aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-02-10 15:25:53 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-13 13:45:46 -0500
commitd75636ef9c1af224f1097941879d5a8db7cd04e5 (patch)
tree504c217da5968aa4b85614bd86ea9eaacf1183b4 /net/mac80211
parent2dace10efb8b761ccbd18d524f3b14d823edf8c0 (diff)
mac80211: RX aggregation: clean up stop session
Clean up the locking by splitting it into two functions, this will also enable further cleanups of stopping all sessions. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/agg-rx.c57
1 files changed, 32 insertions, 25 deletions
diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
index 4b571b211625..bb1f8740cbd5 100644
--- a/net/mac80211/agg-rx.c
+++ b/net/mac80211/agg-rx.c
@@ -17,47 +17,32 @@
17#include <net/mac80211.h> 17#include <net/mac80211.h>
18#include "ieee80211_i.h" 18#include "ieee80211_i.h"
19 19
20void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, 20static void __ieee80211_sta_stop_rx_ba_session(struct sta_info *sta, u16 tid,
21 u16 initiator, u16 reason) 21 u16 initiator, u16 reason)
22{ 22{
23 struct ieee80211_local *local = sdata->local; 23 struct ieee80211_local *local = sta->local;
24 struct ieee80211_hw *hw = &local->hw; 24 struct ieee80211_hw *hw = &local->hw;
25 struct sta_info *sta; 25 int i;
26 int ret, i;
27
28 rcu_read_lock();
29
30 sta = sta_info_get(local, ra);
31 if (!sta) {
32 rcu_read_unlock();
33 return;
34 }
35 26
36 /* check if TID is in operational state */ 27 /* check if TID is in operational state */
37 spin_lock_bh(&sta->lock); 28 spin_lock_bh(&sta->lock);
38 if (sta->ampdu_mlme.tid_state_rx[tid] 29 if (sta->ampdu_mlme.tid_state_rx[tid] != HT_AGG_STATE_OPERATIONAL) {
39 != HT_AGG_STATE_OPERATIONAL) {
40 spin_unlock_bh(&sta->lock); 30 spin_unlock_bh(&sta->lock);
41 rcu_read_unlock();
42 return; 31 return;
43 } 32 }
33
44 sta->ampdu_mlme.tid_state_rx[tid] = 34 sta->ampdu_mlme.tid_state_rx[tid] =
45 HT_AGG_STATE_REQ_STOP_BA_MSK | 35 HT_AGG_STATE_REQ_STOP_BA_MSK |
46 (initiator << HT_AGG_STATE_INITIATOR_SHIFT); 36 (initiator << HT_AGG_STATE_INITIATOR_SHIFT);
47 spin_unlock_bh(&sta->lock); 37 spin_unlock_bh(&sta->lock);
48 38
49 /* stop HW Rx aggregation. ampdu_action existence
50 * already verified in session init so we add the BUG_ON */
51 BUG_ON(!local->ops->ampdu_action);
52
53#ifdef CONFIG_MAC80211_HT_DEBUG 39#ifdef CONFIG_MAC80211_HT_DEBUG
54 printk(KERN_DEBUG "Rx BA session stop requested for %pM tid %u\n", 40 printk(KERN_DEBUG "Rx BA session stop requested for %pM tid %u\n",
55 ra, tid); 41 sta->sta.addr, tid);
56#endif /* CONFIG_MAC80211_HT_DEBUG */ 42#endif /* CONFIG_MAC80211_HT_DEBUG */
57 43
58 ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_RX_STOP, 44 if (local->ops->ampdu_action(hw, IEEE80211_AMPDU_RX_STOP,
59 &sta->sta, tid, NULL); 45 &sta->sta, tid, NULL))
60 if (ret)
61 printk(KERN_DEBUG "HW problem - can not stop rx " 46 printk(KERN_DEBUG "HW problem - can not stop rx "
62 "aggregation for tid %d\n", tid); 47 "aggregation for tid %d\n", tid);
63 48
@@ -67,7 +52,8 @@ void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *r
67 52
68 /* check if this is a self generated aggregation halt */ 53 /* check if this is a self generated aggregation halt */
69 if (initiator == WLAN_BACK_RECIPIENT || initiator == WLAN_BACK_TIMER) 54 if (initiator == WLAN_BACK_RECIPIENT || initiator == WLAN_BACK_TIMER)
70 ieee80211_send_delba(sdata, ra, tid, 0, reason); 55 ieee80211_send_delba(sta->sdata, sta->sta.addr,
56 tid, 0, reason);
71 57
72 /* free the reordering buffer */ 58 /* free the reordering buffer */
73 for (i = 0; i < sta->ampdu_mlme.tid_rx[tid]->buf_size; i++) { 59 for (i = 0; i < sta->ampdu_mlme.tid_rx[tid]->buf_size; i++) {
@@ -90,6 +76,27 @@ void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *r
90 76
91 sta->ampdu_mlme.tid_state_rx[tid] = HT_AGG_STATE_IDLE; 77 sta->ampdu_mlme.tid_state_rx[tid] = HT_AGG_STATE_IDLE;
92 spin_unlock_bh(&sta->lock); 78 spin_unlock_bh(&sta->lock);
79}
80
81void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid,
82 u16 initiator, u16 reason)
83{
84 struct ieee80211_local *local = sdata->local;
85 struct sta_info *sta;
86
87 /* stop HW Rx aggregation. ampdu_action existence
88 * already verified in session init so we add the BUG_ON */
89 BUG_ON(!local->ops->ampdu_action);
90
91 rcu_read_lock();
92
93 sta = sta_info_get(local, ra);
94 if (!sta) {
95 rcu_read_unlock();
96 return;
97 }
98
99 __ieee80211_sta_stop_rx_ba_session(sta, tid, initiator, reason);
93 100
94 rcu_read_unlock(); 101 rcu_read_unlock();
95} 102}