Skip to content

Commit 5a306f5

Browse files
committed
mac80211: introduce IEEE80211_NUM_TIDS and use it
Introduce IEEE80211_NUM_TIDS in the generic 802.11 header file and use it in place of STA_TID_NUM and NUM_RX_DATA_QUEUES which are both really the number of TIDs. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 0f92732 commit 5a306f5

11 files changed

Lines changed: 43 additions & 44 deletions

File tree

‎include/linux/ieee80211.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@
131131

132132
#define IEEE80211_MAX_MESH_ID_LEN 32
133133

134+
#define IEEE80211_NUM_TIDS 16
135+
134136
#define IEEE80211_QOS_CTL_LEN 2
135137
/* 1d tag mask */
136138
#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007

‎net/mac80211/agg-rx.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ void ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, u16 ba_rx_bitmap,
118118
return;
119119
}
120120

121-
for (i = 0; i < STA_TID_NUM; i++)
121+
for (i = 0; i < IEEE80211_NUM_TIDS; i++)
122122
if (ba_rx_bitmap & BIT(i))
123123
set_bit(i, sta->ampdu_mlme.tid_rx_stop_requested);
124124

‎net/mac80211/agg-tx.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
448448
if (WARN_ON(!local->ops->ampdu_action))
449449
return -EINVAL;
450450

451-
if ((tid >= STA_TID_NUM) ||
451+
if ((tid >= IEEE80211_NUM_TIDS) ||
452452
!(local->hw.flags & IEEE80211_HW_AMPDU_AGGREGATION) ||
453453
(local->hw.flags & IEEE80211_HW_TX_AMPDU_SETUP_IN_HW))
454454
return -EINVAL;
@@ -605,9 +605,9 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
605605

606606
trace_api_start_tx_ba_cb(sdata, ra, tid);
607607

608-
if (tid >= STA_TID_NUM) {
608+
if (tid >= IEEE80211_NUM_TIDS) {
609609
ht_dbg(sdata, "Bad TID value: tid = %d (>= %d)\n",
610-
tid, STA_TID_NUM);
610+
tid, IEEE80211_NUM_TIDS);
611611
return;
612612
}
613613

@@ -687,7 +687,7 @@ int ieee80211_stop_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid)
687687
if (!local->ops->ampdu_action)
688688
return -EINVAL;
689689

690-
if (tid >= STA_TID_NUM)
690+
if (tid >= IEEE80211_NUM_TIDS)
691691
return -EINVAL;
692692

693693
spin_lock_bh(&sta->lock);
@@ -722,9 +722,9 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid)
722722

723723
trace_api_stop_tx_ba_cb(sdata, ra, tid);
724724

725-
if (tid >= STA_TID_NUM) {
725+
if (tid >= IEEE80211_NUM_TIDS) {
726726
ht_dbg(sdata, "Bad TID value: tid = %d (>= %d)\n",
727-
tid, STA_TID_NUM);
727+
tid, IEEE80211_NUM_TIDS);
728728
return;
729729
}
730730

‎net/mac80211/debugfs_key.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ static ssize_t key_rx_spec_read(struct file *file, char __user *userbuf,
116116
size_t count, loff_t *ppos)
117117
{
118118
struct ieee80211_key *key = file->private_data;
119-
char buf[14*NUM_RX_DATA_QUEUES+1], *p = buf;
119+
char buf[14*IEEE80211_NUM_TIDS+1], *p = buf;
120120
int i, len;
121121
const u8 *rpn;
122122

@@ -126,15 +126,15 @@ static ssize_t key_rx_spec_read(struct file *file, char __user *userbuf,
126126
len = scnprintf(buf, sizeof(buf), "\n");
127127
break;
128128
case WLAN_CIPHER_SUITE_TKIP:
129-
for (i = 0; i < NUM_RX_DATA_QUEUES; i++)
129+
for (i = 0; i < IEEE80211_NUM_TIDS; i++)
130130
p += scnprintf(p, sizeof(buf)+buf-p,
131131
"%08x %04x\n",
132132
key->u.tkip.rx[i].iv32,
133133
key->u.tkip.rx[i].iv16);
134134
len = p - buf;
135135
break;
136136
case WLAN_CIPHER_SUITE_CCMP:
137-
for (i = 0; i < NUM_RX_DATA_QUEUES + 1; i++) {
137+
for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++) {
138138
rpn = key->u.ccmp.rx_pn[i];
139139
p += scnprintf(p, sizeof(buf)+buf-p,
140140
"%02x%02x%02x%02x%02x%02x\n",

‎net/mac80211/debugfs_sta.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ STA_OPS(connected_time);
131131
static ssize_t sta_last_seq_ctrl_read(struct file *file, char __user *userbuf,
132132
size_t count, loff_t *ppos)
133133
{
134-
char buf[15*NUM_RX_DATA_QUEUES], *p = buf;
134+
char buf[15*IEEE80211_NUM_TIDS], *p = buf;
135135
int i;
136136
struct sta_info *sta = file->private_data;
137-
for (i = 0; i < NUM_RX_DATA_QUEUES; i++)
137+
for (i = 0; i < IEEE80211_NUM_TIDS; i++)
138138
p += scnprintf(p, sizeof(buf)+buf-p, "%x ",
139139
le16_to_cpu(sta->last_seq_ctrl[i]));
140140
p += scnprintf(p, sizeof(buf)+buf-p, "\n");
@@ -145,7 +145,7 @@ STA_OPS(last_seq_ctrl);
145145
static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf,
146146
size_t count, loff_t *ppos)
147147
{
148-
char buf[71 + STA_TID_NUM * 40], *p = buf;
148+
char buf[71 + IEEE80211_NUM_TIDS * 40], *p = buf;
149149
int i;
150150
struct sta_info *sta = file->private_data;
151151
struct tid_ampdu_rx *tid_rx;
@@ -158,7 +158,7 @@ static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf,
158158
p += scnprintf(p, sizeof(buf) + buf - p,
159159
"TID\t\tRX active\tDTKN\tSSN\t\tTX\tDTKN\tpending\n");
160160

161-
for (i = 0; i < STA_TID_NUM; i++) {
161+
for (i = 0; i < IEEE80211_NUM_TIDS; i++) {
162162
tid_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[i]);
163163
tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[i]);
164164

@@ -220,7 +220,7 @@ static ssize_t sta_agg_status_write(struct file *file, const char __user *userbu
220220

221221
tid = simple_strtoul(buf, NULL, 0);
222222

223-
if (tid >= STA_TID_NUM)
223+
if (tid >= IEEE80211_NUM_TIDS)
224224
return -EINVAL;
225225

226226
if (tx) {

‎net/mac80211/ht.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta, bool tx)
185185

186186
cancel_work_sync(&sta->ampdu_mlme.work);
187187

188-
for (i = 0; i < STA_TID_NUM; i++) {
188+
for (i = 0; i < IEEE80211_NUM_TIDS; i++) {
189189
__ieee80211_stop_tx_ba_session(sta, i, WLAN_BACK_INITIATOR, tx);
190190
__ieee80211_stop_rx_ba_session(sta, i, WLAN_BACK_RECIPIENT,
191191
WLAN_REASON_QSTA_LEAVE_QBSS, tx);
@@ -209,7 +209,7 @@ void ieee80211_ba_session_work(struct work_struct *work)
209209
return;
210210

211211
mutex_lock(&sta->ampdu_mlme.mtx);
212-
for (tid = 0; tid < STA_TID_NUM; tid++) {
212+
for (tid = 0; tid < IEEE80211_NUM_TIDS; tid++) {
213213
if (test_and_clear_bit(tid, sta->ampdu_mlme.tid_rx_timer_expired))
214214
___ieee80211_stop_rx_ba_session(
215215
sta, tid, WLAN_BACK_RECIPIENT,

‎net/mac80211/key.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ struct ieee80211_key *ieee80211_key_alloc(u32 cipher, int idx, size_t key_len,
339339
key->conf.iv_len = TKIP_IV_LEN;
340340
key->conf.icv_len = TKIP_ICV_LEN;
341341
if (seq) {
342-
for (i = 0; i < NUM_RX_DATA_QUEUES; i++) {
342+
for (i = 0; i < IEEE80211_NUM_TIDS; i++) {
343343
key->u.tkip.rx[i].iv32 =
344344
get_unaligned_le32(&seq[2]);
345345
key->u.tkip.rx[i].iv16 =
@@ -352,7 +352,7 @@ struct ieee80211_key *ieee80211_key_alloc(u32 cipher, int idx, size_t key_len,
352352
key->conf.iv_len = CCMP_HDR_LEN;
353353
key->conf.icv_len = CCMP_MIC_LEN;
354354
if (seq) {
355-
for (i = 0; i < NUM_RX_DATA_QUEUES + 1; i++)
355+
for (i = 0; i < IEEE80211_NUM_TIDS + 1; i++)
356356
for (j = 0; j < CCMP_PN_LEN; j++)
357357
key->u.ccmp.rx_pn[i][j] =
358358
seq[CCMP_PN_LEN - j - 1];
@@ -655,16 +655,16 @@ void ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf,
655655

656656
switch (key->conf.cipher) {
657657
case WLAN_CIPHER_SUITE_TKIP:
658-
if (WARN_ON(tid < 0 || tid >= NUM_RX_DATA_QUEUES))
658+
if (WARN_ON(tid < 0 || tid >= IEEE80211_NUM_TIDS))
659659
return;
660660
seq->tkip.iv32 = key->u.tkip.rx[tid].iv32;
661661
seq->tkip.iv16 = key->u.tkip.rx[tid].iv16;
662662
break;
663663
case WLAN_CIPHER_SUITE_CCMP:
664-
if (WARN_ON(tid < -1 || tid >= NUM_RX_DATA_QUEUES))
664+
if (WARN_ON(tid < -1 || tid >= IEEE80211_NUM_TIDS))
665665
return;
666666
if (tid < 0)
667-
pn = key->u.ccmp.rx_pn[NUM_RX_DATA_QUEUES];
667+
pn = key->u.ccmp.rx_pn[IEEE80211_NUM_TIDS];
668668
else
669669
pn = key->u.ccmp.rx_pn[tid];
670670
memcpy(seq->ccmp.pn, pn, CCMP_PN_LEN);

‎net/mac80211/key.h‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
#define TKIP_ICV_LEN 4
3131
#define CMAC_PN_LEN 6
3232

33-
#define NUM_RX_DATA_QUEUES 16
34-
3533
struct ieee80211_local;
3634
struct ieee80211_sub_if_data;
3735
struct sta_info;
@@ -82,17 +80,17 @@ struct ieee80211_key {
8280
struct tkip_ctx tx;
8381

8482
/* last received RSC */
85-
struct tkip_ctx rx[NUM_RX_DATA_QUEUES];
83+
struct tkip_ctx rx[IEEE80211_NUM_TIDS];
8684
} tkip;
8785
struct {
8886
atomic64_t tx_pn;
8987
/*
9088
* Last received packet number. The first
91-
* NUM_RX_DATA_QUEUES counters are used with Data
89+
* IEEE80211_NUM_TIDS counters are used with Data
9290
* frames and the last counter is used with Robust
9391
* Management frames.
9492
*/
95-
u8 rx_pn[NUM_RX_DATA_QUEUES + 1][CCMP_PN_LEN];
93+
u8 rx_pn[IEEE80211_NUM_TIDS + 1][CCMP_PN_LEN];
9694
struct crypto_cipher *tfm;
9795
u32 replays; /* dot11RSNAStatsCCMPReplays */
9896
} ccmp;

‎net/mac80211/rx.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,10 +408,10 @@ static void ieee80211_parse_qos(struct ieee80211_rx_data *rx)
408408
*
409409
* We also use that counter for non-QoS STAs.
410410
*/
411-
seqno_idx = NUM_RX_DATA_QUEUES;
411+
seqno_idx = IEEE80211_NUM_TIDS;
412412
security_idx = 0;
413413
if (ieee80211_is_mgmt(hdr->frame_control))
414-
security_idx = NUM_RX_DATA_QUEUES;
414+
security_idx = IEEE80211_NUM_TIDS;
415415
tid = 0;
416416
}
417417

‎net/mac80211/sta_info.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static void free_sta_work(struct work_struct *wk)
142142
* drivers have to handle aggregation stop being requested, followed
143143
* directly by station destruction.
144144
*/
145-
for (i = 0; i < STA_TID_NUM; i++) {
145+
for (i = 0; i < IEEE80211_NUM_TIDS; i++) {
146146
tid_tx = rcu_dereference_raw(sta->ampdu_mlme.tid_tx[i]);
147147
if (!tid_tx)
148148
continue;
@@ -330,7 +330,7 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
330330
return NULL;
331331
}
332332

333-
for (i = 0; i < STA_TID_NUM; i++) {
333+
for (i = 0; i < IEEE80211_NUM_TIDS; i++) {
334334
/*
335335
* timer_to_tid must be initialized with identity mapping
336336
* to enable session_timer's data differentiation. See
@@ -343,7 +343,7 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
343343
skb_queue_head_init(&sta->tx_filtered[i]);
344344
}
345345

346-
for (i = 0; i < NUM_RX_DATA_QUEUES; i++)
346+
for (i = 0; i < IEEE80211_NUM_TIDS; i++)
347347
sta->last_seq_ctrl[i] = cpu_to_le16(USHRT_MAX);
348348

349349
sta_dbg(sdata, "Allocated STA %pM\n", sta->sta.addr);
@@ -985,7 +985,7 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta)
985985

986986
clear_sta_flag(sta, WLAN_STA_SP);
987987

988-
BUILD_BUG_ON(BITS_TO_LONGS(STA_TID_NUM) > 1);
988+
BUILD_BUG_ON(BITS_TO_LONGS(IEEE80211_NUM_TIDS) > 1);
989989
sta->driver_buffered_tids = 0;
990990

991991
if (!(local->hw.flags & IEEE80211_HW_AP_LINK_PS))
@@ -1369,7 +1369,7 @@ void ieee80211_sta_set_buffered(struct ieee80211_sta *pubsta,
13691369
{
13701370
struct sta_info *sta = container_of(pubsta, struct sta_info, sta);
13711371

1372-
if (WARN_ON(tid >= STA_TID_NUM))
1372+
if (WARN_ON(tid >= IEEE80211_NUM_TIDS))
13731373
return;
13741374

13751375
if (buffered)

0 commit comments

Comments
 (0)