Skip to content

Commit c82c4a8

Browse files
committed
mac80211: split aggregation stop by reason
The initiator/tx doesn't really identify why an aggregation session is stopped, give a reason for stopping that more clearly identifies what's going on. This will help tell the driver clearly what is expected of it. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent d582cff commit c82c4a8

8 files changed

Lines changed: 33 additions & 25 deletions

File tree

‎net/mac80211/agg-tx.c‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,7 @@ void ieee80211_assign_tid_tx(struct sta_info *sta, int tid,
150150
}
151151

152152
int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
153-
enum ieee80211_back_parties initiator,
154-
bool tx)
153+
enum ieee80211_agg_stop_reason reason)
155154
{
156155
struct ieee80211_local *local = sta->local;
157156
struct tid_ampdu_tx *tid_tx;
@@ -212,8 +211,10 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
212211
*/
213212
synchronize_net();
214213

215-
tid_tx->stop_initiator = initiator;
216-
tid_tx->tx_stop = tx;
214+
tid_tx->stop_initiator = reason == AGG_STOP_PEER_REQUEST ?
215+
WLAN_BACK_RECIPIENT :
216+
WLAN_BACK_INITIATOR;
217+
tid_tx->tx_stop = reason == AGG_STOP_LOCAL_REQUEST;
217218

218219
ret = drv_ampdu_action(local, sta->sdata,
219220
IEEE80211_AMPDU_TX_STOP,
@@ -660,14 +661,13 @@ void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif,
660661
EXPORT_SYMBOL(ieee80211_start_tx_ba_cb_irqsafe);
661662

662663
int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
663-
enum ieee80211_back_parties initiator,
664-
bool tx)
664+
enum ieee80211_agg_stop_reason reason)
665665
{
666666
int ret;
667667

668668
mutex_lock(&sta->ampdu_mlme.mtx);
669669

670-
ret = ___ieee80211_stop_tx_ba_session(sta, tid, initiator, tx);
670+
ret = ___ieee80211_stop_tx_ba_session(sta, tid, reason);
671671

672672
mutex_unlock(&sta->ampdu_mlme.mtx);
673673

@@ -868,8 +868,7 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local,
868868
}
869869

870870
} else {
871-
___ieee80211_stop_tx_ba_session(sta, tid, WLAN_BACK_INITIATOR,
872-
false);
871+
___ieee80211_stop_tx_ba_session(sta, tid, AGG_STOP_DECLINED);
873872
}
874873

875874
out:

‎net/mac80211/ht.c‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,19 @@ void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data *sdata,
182182
ieee80211_apply_htcap_overrides(sdata, ht_cap);
183183
}
184184

185-
void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta, bool tx)
185+
void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta,
186+
enum ieee80211_agg_stop_reason reason)
186187
{
187188
int i;
188189

189190
cancel_work_sync(&sta->ampdu_mlme.work);
190191

191192
for (i = 0; i < IEEE80211_NUM_TIDS; i++) {
192-
__ieee80211_stop_tx_ba_session(sta, i, WLAN_BACK_INITIATOR, tx);
193+
__ieee80211_stop_tx_ba_session(sta, i, reason);
193194
__ieee80211_stop_rx_ba_session(sta, i, WLAN_BACK_RECIPIENT,
194-
WLAN_REASON_QSTA_LEAVE_QBSS, tx);
195+
WLAN_REASON_QSTA_LEAVE_QBSS,
196+
reason != AGG_STOP_DESTROY_STA &&
197+
reason != AGG_STOP_PEER_REQUEST);
195198
}
196199
}
197200

@@ -248,8 +251,7 @@ void ieee80211_ba_session_work(struct work_struct *work)
248251
if (tid_tx && test_and_clear_bit(HT_AGG_STATE_WANT_STOP,
249252
&tid_tx->state))
250253
___ieee80211_stop_tx_ba_session(sta, tid,
251-
WLAN_BACK_INITIATOR,
252-
true);
254+
AGG_STOP_LOCAL_REQUEST);
253255
}
254256
mutex_unlock(&sta->ampdu_mlme.mtx);
255257
}
@@ -317,8 +319,7 @@ void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
317319
__ieee80211_stop_rx_ba_session(sta, tid, WLAN_BACK_INITIATOR, 0,
318320
true);
319321
else
320-
__ieee80211_stop_tx_ba_session(sta, tid, WLAN_BACK_RECIPIENT,
321-
true);
322+
__ieee80211_stop_tx_ba_session(sta, tid, AGG_STOP_PEER_REQUEST);
322323
}
323324

324325
int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata,

‎net/mac80211/ieee80211_i.h‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,7 +1432,8 @@ void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
14321432
u16 initiator, u16 reason, bool stop);
14331433
void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
14341434
u16 initiator, u16 reason, bool stop);
1435-
void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta, bool tx);
1435+
void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta,
1436+
enum ieee80211_agg_stop_reason reason);
14361437
void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
14371438
struct sta_info *sta,
14381439
struct ieee80211_mgmt *mgmt, size_t len);
@@ -1446,11 +1447,9 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
14461447
size_t len);
14471448

14481449
int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
1449-
enum ieee80211_back_parties initiator,
1450-
bool tx);
1450+
enum ieee80211_agg_stop_reason reason);
14511451
int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
1452-
enum ieee80211_back_parties initiator,
1453-
bool tx);
1452+
enum ieee80211_agg_stop_reason reason);
14541453
void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid);
14551454
void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid);
14561455
void ieee80211_ba_session_work(struct work_struct *work);

‎net/mac80211/mlme.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1525,7 +1525,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
15251525
sta = sta_info_get(sdata, ifmgd->bssid);
15261526
if (sta) {
15271527
set_sta_flag(sta, WLAN_STA_BLOCK_BA);
1528-
ieee80211_sta_tear_down_BA_sessions(sta, false);
1528+
ieee80211_sta_tear_down_BA_sessions(sta, AGG_STOP_DESTROY_STA);
15291529
}
15301530
mutex_unlock(&local->sta_mtx);
15311531

‎net/mac80211/pm.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
4242
mutex_lock(&local->sta_mtx);
4343
list_for_each_entry(sta, &local->sta_list, list) {
4444
set_sta_flag(sta, WLAN_STA_BLOCK_BA);
45-
ieee80211_sta_tear_down_BA_sessions(sta, true);
45+
ieee80211_sta_tear_down_BA_sessions(
46+
sta, AGG_STOP_LOCAL_REQUEST);
4647
}
4748
mutex_unlock(&local->sta_mtx);
4849
}

‎net/mac80211/sta_info.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ int __must_check __sta_info_destroy(struct sta_info *sta)
784784
* will be sufficient.
785785
*/
786786
set_sta_flag(sta, WLAN_STA_BLOCK_BA);
787-
ieee80211_sta_tear_down_BA_sessions(sta, false);
787+
ieee80211_sta_tear_down_BA_sessions(sta, AGG_STOP_DESTROY_STA);
788788

789789
ret = sta_info_hash_del(local, sta);
790790
if (ret)

‎net/mac80211/sta_info.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ enum ieee80211_sta_info_flags {
9292
#define HT_AGG_STATE_WANT_START 4
9393
#define HT_AGG_STATE_WANT_STOP 5
9494

95+
enum ieee80211_agg_stop_reason {
96+
AGG_STOP_DECLINED,
97+
AGG_STOP_LOCAL_REQUEST,
98+
AGG_STOP_PEER_REQUEST,
99+
AGG_STOP_DESTROY_STA,
100+
};
101+
95102
/**
96103
* struct tid_ampdu_tx - TID aggregation information (Tx).
97104
*

‎net/mac80211/util.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1639,7 +1639,8 @@ int ieee80211_reconfig(struct ieee80211_local *local)
16391639
mutex_lock(&local->sta_mtx);
16401640

16411641
list_for_each_entry(sta, &local->sta_list, list) {
1642-
ieee80211_sta_tear_down_BA_sessions(sta, true);
1642+
ieee80211_sta_tear_down_BA_sessions(
1643+
sta, AGG_STOP_LOCAL_REQUEST);
16431644
clear_sta_flag(sta, WLAN_STA_BLOCK_BA);
16441645
}
16451646

0 commit comments

Comments
 (0)