Skip to content

Commit f438ceb

Browse files
egrumbachjmberg-intel
authored andcommitted
mac80211: uapsd_queues is in QoS IE order
The uapsd_queue field is in QoS IE order and not in IEEE80211_AC_*'s order. This means that mac80211 would get confused between BK and BE which is certainly not such a big deal but needs to be fixed. Signed-off-by: Emmanuel Grumbach <[email protected]> Signed-off-by: Luca Coelho <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
1 parent f3fe4e9 commit f438ceb

File tree

7 files changed

+24
-9
lines changed

7 files changed

+24
-9
lines changed

include/net/cfg80211.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4574,7 +4574,8 @@ void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
45744574
* moves to cfg80211 in this call
45754575
* @buf: authentication frame (header + body)
45764576
* @len: length of the frame data
4577-
* @uapsd_queues: bitmap of ACs configured to uapsd. -1 if n/a.
4577+
* @uapsd_queues: bitmap of queues configured for uapsd. Same format
4578+
* as the AC bitmap in the QoS info field
45784579
*
45794580
* After being asked to associate via cfg80211_ops::assoc() the driver must
45804581
* call either this function or cfg80211_auth_timeout().

include/net/mac80211.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1745,7 +1745,8 @@ struct ieee80211_sta_rates {
17451745
* @drv_priv: data area for driver use, will always be aligned to
17461746
* sizeof(void *), size is determined in hw information.
17471747
* @uapsd_queues: bitmap of queues configured for uapsd. Only valid
1748-
* if wme is supported.
1748+
* if wme is supported. The bits order is like in
1749+
* IEEE80211_WMM_IE_STA_QOSINFO_AC_*.
17491750
* @max_sp: max Service Period. Only valid if wme is supported.
17501751
* @bandwidth: current bandwidth the station can receive with
17511752
* @rx_nss: in HT/VHT, the maximum number of spatial streams the

net/mac80211/ieee80211_i.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ struct ieee80211_local;
8484
#define IEEE80211_DEFAULT_MAX_SP_LEN \
8585
IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL
8686

87+
extern const u8 ieee80211_ac_to_qos_mask[IEEE80211_NUM_ACS];
88+
8789
#define IEEE80211_DEAUTH_FRAME_LEN (24 /* hdr */ + 2 /* reason */)
8890

8991
#define IEEE80211_MAX_NAN_INSTANCE_ID 255

net/mac80211/mlme.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3193,7 +3193,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
31933193
uapsd_queues = 0;
31943194
for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)
31953195
if (sdata->tx_conf[ac].uapsd)
3196-
uapsd_queues |= BIT(ac);
3196+
uapsd_queues |= ieee80211_ac_to_qos_mask[ac];
31973197
}
31983198

31993199
cfg80211_rx_assoc_resp(sdata->dev, bss, (u8 *)mgmt, len, uapsd_queues);

net/mac80211/rx.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1401,7 +1401,8 @@ void ieee80211_sta_uapsd_trigger(struct ieee80211_sta *pubsta, u8 tid)
14011401
* enabled queues, but for now we only implement uAPSD w/o
14021402
* TSPEC changes to the ACs, so they're always the same.
14031403
*/
1404-
if (!(sta->sta.uapsd_queues & BIT(ac)) && tid != IEEE80211_NUM_TIDS)
1404+
if (!(sta->sta.uapsd_queues & ieee80211_ac_to_qos_mask[ac]) &&
1405+
tid != IEEE80211_NUM_TIDS)
14051406
return;
14061407

14071408
/* if we are in a service period, do nothing */

net/mac80211/sta_info.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ static void __sta_info_recalc_tim(struct sta_info *sta, bool ignore_pending)
709709
for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
710710
unsigned long tids;
711711

712-
if (ignore_for_tim & BIT(ac))
712+
if (ignore_for_tim & ieee80211_ac_to_qos_mask[ac])
713713
continue;
714714

715715
indicate_tim |= !skb_queue_empty(&sta->tx_filtered[ac]) ||
@@ -1389,7 +1389,7 @@ ieee80211_sta_ps_more_data(struct sta_info *sta, u8 ignored_acs,
13891389
return true;
13901390

13911391
for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
1392-
if (ignored_acs & BIT(ac))
1392+
if (ignored_acs & ieee80211_ac_to_qos_mask[ac])
13931393
continue;
13941394

13951395
if (!skb_queue_empty(&sta->tx_filtered[ac]) ||
@@ -1414,7 +1414,7 @@ ieee80211_sta_ps_get_frames(struct sta_info *sta, int n_frames, u8 ignored_acs,
14141414
for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
14151415
unsigned long tids;
14161416

1417-
if (ignored_acs & BIT(ac))
1417+
if (ignored_acs & ieee80211_ac_to_qos_mask[ac])
14181418
continue;
14191419

14201420
tids = ieee80211_tids_for_ac(ac);
@@ -1482,7 +1482,7 @@ ieee80211_sta_ps_deliver_response(struct sta_info *sta,
14821482
BIT(find_highest_prio_tid(driver_release_tids));
14831483

14841484
if (skb_queue_empty(&frames) && !driver_release_tids) {
1485-
int tid;
1485+
int tid, ac;
14861486

14871487
/*
14881488
* For PS-Poll, this can only happen due to a race condition
@@ -1500,7 +1500,10 @@ ieee80211_sta_ps_deliver_response(struct sta_info *sta,
15001500
*/
15011501

15021502
/* This will evaluate to 1, 3, 5 or 7. */
1503-
tid = 7 - ((ffs(~ignored_acs) - 1) << 1);
1503+
for (ac = IEEE80211_AC_VO; ac < IEEE80211_NUM_ACS; ac++)
1504+
if (ignored_acs & BIT(ac))
1505+
continue;
1506+
tid = 7 - 2 * ac;
15041507

15051508
ieee80211_send_null_response(sta, tid, reason, true, false);
15061509
} else if (!driver_release_tids) {

net/mac80211/util.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3452,3 +3452,10 @@ void ieee80211_txq_get_depth(struct ieee80211_txq *txq,
34523452
*byte_cnt = txqi->tin.backlog_bytes + frag_bytes;
34533453
}
34543454
EXPORT_SYMBOL(ieee80211_txq_get_depth);
3455+
3456+
const u8 ieee80211_ac_to_qos_mask[IEEE80211_NUM_ACS] = {
3457+
IEEE80211_WMM_IE_STA_QOSINFO_AC_VO,
3458+
IEEE80211_WMM_IE_STA_QOSINFO_AC_VI,
3459+
IEEE80211_WMM_IE_STA_QOSINFO_AC_BE,
3460+
IEEE80211_WMM_IE_STA_QOSINFO_AC_BK
3461+
};

0 commit comments

Comments
 (0)