nl80211: Add driver_ops for starting radar detection

This patch is based on the original work by Boris Presman and
Victor Goldenshtein. Channel Switch Announcement support has been
removed and event handling as well as channel set handling was
changed, among various other changes.

Cc: Boris Presman <boris.presman@ti.com>
Cc: Victor Goldenshtein <victorg@ti.com>
Signed-hostap: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
This commit is contained in:
Simon Wunderlich 2013-05-09 20:05:01 +03:00 committed by Jouni Malinen
parent fc96522eb9
commit f90e9c1c8b
2 changed files with 43 additions and 0 deletions

View file

@ -2655,6 +2655,14 @@ struct wpa_driver_ops {
* avoid frequency conflict in single channel concurrency. * avoid frequency conflict in single channel concurrency.
*/ */
int (*switch_channel)(void *priv, unsigned int freq); int (*switch_channel)(void *priv, unsigned int freq);
/**
* start_dfs_cac - Listen for radar interference on the channel
* @priv: Private driver interface data
* @freq: Frequency (in MHz) of the channel
* Returns: 0 on success, -1 on failure
*/
int (*start_dfs_cac)(void *priv, int freq);
}; };

View file

@ -9446,6 +9446,40 @@ static int nl80211_set_p2p_powersave(void *priv, int legacy_ps, int opp_ps,
} }
static int nl80211_start_radar_detection(void *priv, int freq)
{
struct i802_bss *bss = priv;
struct wpa_driver_nl80211_data *drv = bss->drv;
struct nl_msg *msg;
int ret;
wpa_printf(MSG_DEBUG, "nl80211: Start radar detection (CAC)");
if (!(drv->capa.flags & WPA_DRIVER_FLAGS_RADAR)) {
wpa_printf(MSG_DEBUG, "nl80211: Driver does not support radar "
"detection");
return -1;
}
msg = nlmsg_alloc();
if (!msg)
return -1;
nl80211_cmd(bss->drv, msg, 0, NL80211_CMD_RADAR_DETECT);
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq);
/* only HT20 is supported at this point */
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, NL80211_CHAN_HT20);
ret = send_and_recv_msgs(drv, msg, NULL, NULL);
if (ret == 0)
return 0;
wpa_printf(MSG_DEBUG, "nl80211: Failed to start radar detection: "
"%d (%s)", ret, strerror(-ret));
nla_put_failure:
return -1;
}
#ifdef CONFIG_TDLS #ifdef CONFIG_TDLS
static int nl80211_send_tdls_mgmt(void *priv, const u8 *dst, u8 action_code, static int nl80211_send_tdls_mgmt(void *priv, const u8 *dst, u8 action_code,
@ -9878,6 +9912,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.set_rekey_info = nl80211_set_rekey_info, .set_rekey_info = nl80211_set_rekey_info,
.poll_client = nl80211_poll_client, .poll_client = nl80211_poll_client,
.set_p2p_powersave = nl80211_set_p2p_powersave, .set_p2p_powersave = nl80211_set_p2p_powersave,
.start_dfs_cac = nl80211_start_radar_detection,
#ifdef CONFIG_TDLS #ifdef CONFIG_TDLS
.send_tdls_mgmt = nl80211_send_tdls_mgmt, .send_tdls_mgmt = nl80211_send_tdls_mgmt,
.tdls_oper = nl80211_tdls_oper, .tdls_oper = nl80211_tdls_oper,