P2P: Add option for offloading off-channel TX to the driver

With the new kernel functionality coming to Linux to allow off-channel
TX, we can take advantage of that in the P2P code that currently uses
remain-on-channel. If a driver advertises support for it, it will be
asked to handle off-channel TX by itself.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg 2010-12-29 13:59:17 +02:00 committed by Jouni Malinen
parent 0d7e5a3a29
commit 190b9062b2
8 changed files with 61 additions and 13 deletions

View file

@ -559,6 +559,8 @@ struct wpa_driver_capa {
* operation does not end up getting completed successfully later.
*/
#define WPA_DRIVER_FLAGS_SANE_ERROR_CODES 0x00004000
/* Driver supports off-channel TX */
#define WPA_DRIVER_FLAGS_OFFCHANNEL_TX 0x00008000
unsigned int flags;
int max_scan_ssids;
@ -1724,6 +1726,7 @@ struct wpa_driver_ops {
* send_action - Transmit an Action frame
* @priv: Private driver interface data
* @freq: Frequency (in MHz) of the channel
* @wait: Time to wait off-channel for a response (in ms), or zero
* @dst: Destination MAC address (Address 1)
* @src: Source MAC address (Address 2)
* @bssid: BSSID (Address 3)
@ -1732,16 +1735,32 @@ struct wpa_driver_ops {
* Returns: 0 on success, -1 on failure
*
* This command can be used to request the driver to transmit an action
* frame to the specified destination. If a remain-on-channel duration
* is in progress, the frame is transmitted on that channel. Otherwise,
* the frame is transmitted on the current operational channel if in
* associated state in station mode or if operating as an AP. If none
* of these conditions is in effect, send_action() cannot be used.
* frame to the specified destination.
*
* If the %WPA_DRIVER_FLAGS_OFFCHANNEL_TX flag is set, the frame will
* be transmitted on the given channel and the device will wait for a
* response on that channel for the given wait time.
*
* If the flag is not set, the wait time will be ignored. In this case,
* if a remain-on-channel duration is in progress, the frame must be
* transmitted on that channel; alternatively the frame may be sent on
* the current operational channel (if in associated state in station
* mode or while operating as an AP.)
*/
int (*send_action)(void *priv, unsigned int freq,
int (*send_action)(void *priv, unsigned int freq, unsigned int wait,
const u8 *dst, const u8 *src, const u8 *bssid,
const u8 *data, size_t data_len);
/**
* send_action_cancel_wait - Cancel action frame TX wait
* @priv: Private driver interface data
*
* This command cancels the wait time associated with sending an action
* frame. It is only available when %WPA_DRIVER_FLAGS_OFFCHANNEL_TX is
* set in the driver flags.
*/
void (*send_action_cancel_wait)(void *priv);
/**
* remain_on_channel - Remain awake on a channel
* @priv: Private driver interface data

View file

@ -3295,6 +3295,7 @@ const struct wpa_driver_ops wpa_driver_ndis_ops = {
NULL /* set_supp_port */,
NULL /* set_wds_sta */,
NULL /* send_action */,
NULL /* send_action_cancel_wait */,
NULL /* remain_on_channel */,
NULL /* cancel_remain_on_channel */,
NULL /* probe_req_report */,

View file

@ -5835,6 +5835,7 @@ nla_put_failure:
static int wpa_driver_nl80211_send_action(void *priv, unsigned int freq,
unsigned int wait_time,
const u8 *dst, const u8 *src,
const u8 *bssid,
const u8 *data, size_t data_len)
@ -6146,8 +6147,8 @@ static int nl80211_send_ft_action(void *priv, u8 action, const u8 *target_ap,
pos += ETH_ALEN;
os_memcpy(pos, ies, ies_len);
ret = wpa_driver_nl80211_send_action(bss, drv->assoc_freq, drv->bssid,
own_addr, drv->bssid,
ret = wpa_driver_nl80211_send_action(bss, drv->assoc_freq, 0,
drv->bssid, own_addr, drv->bssid,
data, data_len);
os_free(data);

View file

@ -2598,6 +2598,7 @@ static int wpa_driver_test_set_freq(void *priv,
static int wpa_driver_test_send_action(void *priv, unsigned int freq,
unsigned int wait,
const u8 *dst, const u8 *src,
const u8 *bssid,
const u8 *data, size_t data_len)