diff options
author | Johannes Berg <johannes.berg@intel.com> | 2010-12-18 17:20:48 +0100 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-01-05 16:07:12 -0500 |
commit | 90fc4b3a5ba24f09af2a8c4a723651a328949460 (patch) | |
tree | 0ec7031f451f8a7eb38259b6fe80ec52cf780b43 /net/mac80211/cfg.c | |
parent | 21f83589644bb2ed98079bf1e2154c8e70ca6a6c (diff) | |
download | blackbird-op-linux-90fc4b3a5ba24f09af2a8c4a723651a328949460.tar.gz blackbird-op-linux-90fc4b3a5ba24f09af2a8c4a723651a328949460.zip |
mac80211: implement off-channel TX using hw r-o-c offload
When the driver has remain-on-channel offload,
implement off-channel transmission using that
primitive.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r-- | net/mac80211/cfg.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 168a6ba8fc28..4bc8a9250cfd 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1641,6 +1641,7 @@ static int ieee80211_remain_on_channel(struct wiphy *wiphy, ret = ieee80211_remain_on_channel_hw(local, dev, chan, channel_type, duration, cookie); + local->hw_roc_for_tx = false; mutex_unlock(&local->mtx); return ret; @@ -1783,6 +1784,49 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct net_device *dev, *cookie = (unsigned long) skb; + if (is_offchan && local->ops->remain_on_channel) { + unsigned int duration; + int ret; + + mutex_lock(&local->mtx); + /* + * If the duration is zero, then the driver + * wouldn't actually do anything. Set it to + * 100 for now. + * + * TODO: cancel the off-channel operation + * when we get the SKB's TX status and + * the wait time was zero before. + */ + duration = 100; + if (wait) + duration = wait; + ret = ieee80211_remain_on_channel_hw(local, dev, chan, + channel_type, + duration, cookie); + if (ret) { + kfree_skb(skb); + mutex_unlock(&local->mtx); + return ret; + } + + local->hw_roc_for_tx = true; + local->hw_roc_duration = wait; + + /* + * queue up frame for transmission after + * ieee80211_ready_on_channel call + */ + + /* modify cookie to prevent API mismatches */ + *cookie ^= 2; + IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_TX_OFFCHAN; + local->hw_roc_skb = skb; + mutex_unlock(&local->mtx); + + return 0; + } + /* * Can transmit right away if the channel was the * right one and there's no wait involved... If a @@ -1823,6 +1867,21 @@ static int ieee80211_mgmt_tx_cancel_wait(struct wiphy *wiphy, int ret = -ENOENT; mutex_lock(&local->mtx); + + if (local->ops->cancel_remain_on_channel) { + cookie ^= 2; + ret = ieee80211_cancel_remain_on_channel_hw(local, cookie); + + if (ret == 0) { + kfree_skb(local->hw_roc_skb); + local->hw_roc_skb = NULL; + } + + mutex_unlock(&local->mtx); + + return ret; + } + list_for_each_entry(wk, &local->work_list, list) { if (wk->sdata != sdata) continue; |