mac80211: sync driver before TX

In P2P client mode, the GO (AP) to connect to might
have periods of time where it is not available due
to powersave. To allow the driver to sync with it
and send frames to the GO only when it is available
add a new callback tx_sync (and the corresponding
finish_tx_sync). These callbacks can sleep unlike
the actual TX.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Johannes Berg
2011-07-19 10:39:53 +02:00
committed by John W. Linville
parent e0d687bd9d
commit b2abb6e2bc
6 changed files with 164 additions and 3 deletions

View File

@ -25,6 +25,7 @@
#include "ieee80211_i.h"
#include "rate.h"
#include "driver-ops.h"
#define IEEE80211_AUTH_TIMEOUT (HZ / 5)
#define IEEE80211_AUTH_MAX_TRIES 3
@ -427,6 +428,14 @@ ieee80211_direct_probe(struct ieee80211_work *wk)
struct ieee80211_sub_if_data *sdata = wk->sdata;
struct ieee80211_local *local = sdata->local;
if (!wk->probe_auth.synced) {
int ret = drv_tx_sync(local, sdata, wk->filter_ta,
IEEE80211_TX_SYNC_AUTH);
if (ret)
return WORK_ACT_TIMEOUT;
}
wk->probe_auth.synced = true;
wk->probe_auth.tries++;
if (wk->probe_auth.tries > IEEE80211_AUTH_MAX_TRIES) {
printk(KERN_DEBUG "%s: direct probe to %pM timed out\n",
@ -466,6 +475,14 @@ ieee80211_authenticate(struct ieee80211_work *wk)
struct ieee80211_sub_if_data *sdata = wk->sdata;
struct ieee80211_local *local = sdata->local;
if (!wk->probe_auth.synced) {
int ret = drv_tx_sync(local, sdata, wk->filter_ta,
IEEE80211_TX_SYNC_AUTH);
if (ret)
return WORK_ACT_TIMEOUT;
}
wk->probe_auth.synced = true;
wk->probe_auth.tries++;
if (wk->probe_auth.tries > IEEE80211_AUTH_MAX_TRIES) {
printk(KERN_DEBUG "%s: authentication with %pM"
@ -499,6 +516,14 @@ ieee80211_associate(struct ieee80211_work *wk)
struct ieee80211_sub_if_data *sdata = wk->sdata;
struct ieee80211_local *local = sdata->local;
if (!wk->assoc.synced) {
int ret = drv_tx_sync(local, sdata, wk->filter_ta,
IEEE80211_TX_SYNC_ASSOC);
if (ret)
return WORK_ACT_TIMEOUT;
}
wk->assoc.synced = true;
wk->assoc.tries++;
if (wk->assoc.tries > IEEE80211_ASSOC_MAX_TRIES) {
printk(KERN_DEBUG "%s: association with %pM"