nl80211: Use driver-based off-channel TX if available
If the underlying driver supports off-channel TX, it will now be used by the nl80211 driver wrapper, setting WPA_DRIVER_FLAGS_OFFCHANNEL_TX accordingly. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
190b9062b2
commit
5dfca53fc0
1 changed files with 51 additions and 8 deletions
|
@ -195,8 +195,8 @@ static int wpa_driver_nl80211_mlme(struct wpa_driver_nl80211_data *drv,
|
||||||
static void nl80211_remove_monitor_interface(
|
static void nl80211_remove_monitor_interface(
|
||||||
struct wpa_driver_nl80211_data *drv);
|
struct wpa_driver_nl80211_data *drv);
|
||||||
static int nl80211_send_frame_cmd(struct wpa_driver_nl80211_data *drv,
|
static int nl80211_send_frame_cmd(struct wpa_driver_nl80211_data *drv,
|
||||||
unsigned int freq, const u8 *buf,
|
unsigned int freq, unsigned int wait,
|
||||||
size_t buf_len, u64 *cookie);
|
const u8 *buf, size_t buf_len, u64 *cookie);
|
||||||
static int wpa_driver_nl80211_probe_req_report(void *priv, int report);
|
static int wpa_driver_nl80211_probe_req_report(void *priv, int report);
|
||||||
|
|
||||||
#ifdef HOSTAPD
|
#ifdef HOSTAPD
|
||||||
|
@ -1474,6 +1474,7 @@ struct wiphy_info_data {
|
||||||
int ap_supported;
|
int ap_supported;
|
||||||
int auth_supported;
|
int auth_supported;
|
||||||
int connect_supported;
|
int connect_supported;
|
||||||
|
int offchan_tx_supported;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1516,6 +1517,9 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tb[NL80211_ATTR_OFFCHANNEL_TX_OK])
|
||||||
|
info->offchan_tx_supported = 1;
|
||||||
|
|
||||||
return NL_SKIP;
|
return NL_SKIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1575,6 +1579,12 @@ static int wpa_driver_nl80211_capa(struct wpa_driver_nl80211_data *drv)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (info.offchan_tx_supported) {
|
||||||
|
wpa_printf(MSG_DEBUG, "nl80211: Using driver-based "
|
||||||
|
"off-channel TX");
|
||||||
|
drv->capa.flags |= WPA_DRIVER_FLAGS_OFFCHANNEL_TX;
|
||||||
|
}
|
||||||
|
|
||||||
drv->capa.flags |= WPA_DRIVER_FLAGS_SANE_ERROR_CODES;
|
drv->capa.flags |= WPA_DRIVER_FLAGS_SANE_ERROR_CODES;
|
||||||
drv->capa.flags |= WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE;
|
drv->capa.flags |= WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE;
|
||||||
drv->capa.flags |= WPA_DRIVER_FLAGS_P2P_CAPABLE;
|
drv->capa.flags |= WPA_DRIVER_FLAGS_P2P_CAPABLE;
|
||||||
|
@ -3491,7 +3501,7 @@ static int wpa_driver_nl80211_send_mlme(void *priv, const u8 *data,
|
||||||
* but it works due to the single-threaded nature
|
* but it works due to the single-threaded nature
|
||||||
* of wpa_supplicant.
|
* of wpa_supplicant.
|
||||||
*/
|
*/
|
||||||
return nl80211_send_frame_cmd(drv, drv->last_mgmt_freq,
|
return nl80211_send_frame_cmd(drv, drv->last_mgmt_freq, 0,
|
||||||
data, data_len, NULL);
|
data, data_len, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5796,8 +5806,9 @@ static int cookie_handler(struct nl_msg *msg, void *arg)
|
||||||
|
|
||||||
|
|
||||||
static int nl80211_send_frame_cmd(struct wpa_driver_nl80211_data *drv,
|
static int nl80211_send_frame_cmd(struct wpa_driver_nl80211_data *drv,
|
||||||
unsigned int freq, const u8 *buf,
|
unsigned int freq, unsigned int wait,
|
||||||
size_t buf_len, u64 *cookie_out)
|
const u8 *buf, size_t buf_len,
|
||||||
|
u64 *cookie_out)
|
||||||
{
|
{
|
||||||
struct nl_msg *msg;
|
struct nl_msg *msg;
|
||||||
u64 cookie;
|
u64 cookie;
|
||||||
|
@ -5812,6 +5823,8 @@ static int nl80211_send_frame_cmd(struct wpa_driver_nl80211_data *drv,
|
||||||
|
|
||||||
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
|
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
|
||||||
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq);
|
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq);
|
||||||
|
NLA_PUT_U32(msg, NL80211_ATTR_DURATION, wait);
|
||||||
|
NLA_PUT_FLAG(msg, NL80211_ATTR_OFFCHANNEL_TX_OK);
|
||||||
NLA_PUT(msg, NL80211_ATTR_FRAME, buf_len, buf);
|
NLA_PUT(msg, NL80211_ATTR_FRAME, buf_len, buf);
|
||||||
|
|
||||||
cookie = 0;
|
cookie = 0;
|
||||||
|
@ -5846,8 +5859,8 @@ static int wpa_driver_nl80211_send_action(void *priv, unsigned int freq,
|
||||||
u8 *buf;
|
u8 *buf;
|
||||||
struct ieee80211_hdr *hdr;
|
struct ieee80211_hdr *hdr;
|
||||||
|
|
||||||
wpa_printf(MSG_DEBUG, "nl80211: Send Action frame (ifindex=%d)",
|
wpa_printf(MSG_DEBUG, "nl80211: Send Action frame (ifindex=%d, "
|
||||||
drv->ifindex);
|
"wait=%d ms)", drv->ifindex, wait_time);
|
||||||
|
|
||||||
buf = os_zalloc(24 + data_len);
|
buf = os_zalloc(24 + data_len);
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
|
@ -5863,7 +5876,8 @@ static int wpa_driver_nl80211_send_action(void *priv, unsigned int freq,
|
||||||
if (drv->nlmode == NL80211_IFTYPE_AP)
|
if (drv->nlmode == NL80211_IFTYPE_AP)
|
||||||
ret = wpa_driver_nl80211_send_mlme(priv, buf, 24 + data_len);
|
ret = wpa_driver_nl80211_send_mlme(priv, buf, 24 + data_len);
|
||||||
else
|
else
|
||||||
ret = nl80211_send_frame_cmd(drv, freq, buf, 24 + data_len,
|
ret = nl80211_send_frame_cmd(drv, freq, wait_time, buf,
|
||||||
|
24 + data_len,
|
||||||
&drv->send_action_cookie);
|
&drv->send_action_cookie);
|
||||||
|
|
||||||
os_free(buf);
|
os_free(buf);
|
||||||
|
@ -5871,6 +5885,34 @@ static int wpa_driver_nl80211_send_action(void *priv, unsigned int freq,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void wpa_driver_nl80211_send_action_cancel_wait(void *priv)
|
||||||
|
{
|
||||||
|
struct i802_bss *bss = priv;
|
||||||
|
struct wpa_driver_nl80211_data *drv = bss->drv;
|
||||||
|
struct nl_msg *msg;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
msg = nlmsg_alloc();
|
||||||
|
if (!msg)
|
||||||
|
return;
|
||||||
|
|
||||||
|
genlmsg_put(msg, 0, 0, genl_family_get_id(drv->nl80211), 0, 0,
|
||||||
|
NL80211_CMD_FRAME_WAIT_CANCEL, 0);
|
||||||
|
|
||||||
|
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
|
||||||
|
NLA_PUT_U64(msg, NL80211_ATTR_COOKIE, drv->send_action_cookie);
|
||||||
|
|
||||||
|
ret = send_and_recv_msgs(drv, msg, NULL, NULL);
|
||||||
|
msg = NULL;
|
||||||
|
if (ret)
|
||||||
|
wpa_printf(MSG_DEBUG, "nl80211: wait cancel failed: ret=%d "
|
||||||
|
"(%s)", ret, strerror(-ret));
|
||||||
|
|
||||||
|
nla_put_failure:
|
||||||
|
nlmsg_free(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int wpa_driver_nl80211_remain_on_channel(void *priv, unsigned int freq,
|
static int wpa_driver_nl80211_remain_on_channel(void *priv, unsigned int freq,
|
||||||
unsigned int duration)
|
unsigned int duration)
|
||||||
{
|
{
|
||||||
|
@ -6331,6 +6373,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
|
||||||
#endif /* HOSTAPD */
|
#endif /* HOSTAPD */
|
||||||
.set_freq = i802_set_freq,
|
.set_freq = i802_set_freq,
|
||||||
.send_action = wpa_driver_nl80211_send_action,
|
.send_action = wpa_driver_nl80211_send_action,
|
||||||
|
.send_action_cancel_wait = wpa_driver_nl80211_send_action_cancel_wait,
|
||||||
.remain_on_channel = wpa_driver_nl80211_remain_on_channel,
|
.remain_on_channel = wpa_driver_nl80211_remain_on_channel,
|
||||||
.cancel_remain_on_channel =
|
.cancel_remain_on_channel =
|
||||||
wpa_driver_nl80211_cancel_remain_on_channel,
|
wpa_driver_nl80211_cancel_remain_on_channel,
|
||||||
|
|
Loading…
Reference in a new issue