Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mac80211: move QOS control helpers into ieee80211.h

Also remove the WLAN_IS_QOS_DATA inline after removing the last
two users. This starts moving away from using rx->fc to using
the header frame_control directly.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Harvey Harrison and committed by
John W. Linville
238f74a2 994d31f7

+18 -24
+2
include/linux/ieee80211.h
··· 99 99 #define IEEE80211_MAX_SSID_LEN 32 100 100 #define IEEE80211_MAX_MESH_ID_LEN 32 101 101 #define IEEE80211_QOS_CTL_LEN 2 102 + #define IEEE80211_QOS_CTL_TID_MASK 0x000F 103 + #define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007 102 104 103 105 struct ieee80211_hdr { 104 106 __le16 frame_control;
+14 -14
net/mac80211/rx.c
··· 321 321 322 322 static void ieee80211_parse_qos(struct ieee80211_rx_data *rx) 323 323 { 324 - u8 *data = rx->skb->data; 324 + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; 325 325 int tid; 326 326 327 327 /* does the frame have a qos control field? */ 328 - if (WLAN_FC_IS_QOS_DATA(rx->fc)) { 329 - u8 *qc = data + ieee80211_get_hdrlen(rx->fc) - QOS_CONTROL_LEN; 328 + if (ieee80211_is_data_qos(hdr->frame_control)) { 329 + u8 *qc = ieee80211_get_qos_ctl(hdr); 330 330 /* frame has qos control */ 331 - tid = qc[0] & QOS_CONTROL_TID_MASK; 332 - if (qc[0] & IEEE80211_QOS_CONTROL_A_MSDU_PRESENT) 331 + tid = *qc & IEEE80211_QOS_CTL_TID_MASK; 332 + if (*qc & IEEE80211_QOS_CONTROL_A_MSDU_PRESENT) 333 333 rx->flags |= IEEE80211_RX_AMSDU; 334 334 else 335 335 rx->flags &= ~IEEE80211_RX_AMSDU; 336 336 } else { 337 - if (unlikely((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT)) { 337 + if (unlikely(ieee80211_is_mgmt(hdr->frame_control))) { 338 338 /* Separate TID for management frames */ 339 339 tid = NUM_RX_DATA_QUEUES - 1; 340 340 } else { ··· 1037 1037 static ieee80211_rx_result debug_noinline 1038 1038 ieee80211_rx_h_remove_qos_control(struct ieee80211_rx_data *rx) 1039 1039 { 1040 - u16 fc = rx->fc; 1041 1040 u8 *data = rx->skb->data; 1042 - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) data; 1041 + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)data; 1043 1042 1044 - if (!WLAN_FC_IS_QOS_DATA(fc)) 1043 + if (!ieee80211_is_data_qos(hdr->frame_control)) 1045 1044 return RX_CONTINUE; 1046 1045 1047 1046 /* remove the qos control field, update frame type and meta-data */ 1048 - memmove(data + 2, data, ieee80211_get_hdrlen(fc) - 2); 1049 - hdr = (struct ieee80211_hdr *) skb_pull(rx->skb, 2); 1047 + memmove(data + IEEE80211_QOS_CTL_LEN, data, 1048 + ieee80211_hdrlen(hdr->frame_control) - IEEE80211_QOS_CTL_LEN); 1049 + hdr = (struct ieee80211_hdr *)skb_pull(rx->skb, IEEE80211_QOS_CTL_LEN); 1050 1050 /* change frame type to non QOS */ 1051 - rx->fc = fc &= ~IEEE80211_STYPE_QOS_DATA; 1052 - hdr->frame_control = cpu_to_le16(fc); 1051 + rx->fc &= ~IEEE80211_STYPE_QOS_DATA; 1052 + hdr->frame_control &= ~cpu_to_le16(IEEE80211_STYPE_QOS_DATA); 1053 1053 1054 1054 return RX_CONTINUE; 1055 1055 } ··· 2044 2044 if (!ieee80211_is_data_qos(hdr->frame_control)) 2045 2045 goto end_reorder; 2046 2046 2047 - tid = *ieee80211_get_qos_ctl(hdr) & QOS_CONTROL_TID_MASK; 2047 + tid = *ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK; 2048 2048 2049 2049 if (sta->ampdu_mlme.tid_state_rx[tid] != HT_AGG_STATE_OPERATIONAL) 2050 2050 goto end_reorder;
+2 -2
net/mac80211/wme.c
··· 154 154 queue = skb_get_queue_mapping(skb); 155 155 rcu_read_lock(); 156 156 sta = sta_info_get(local, hdr->addr1); 157 - tid = skb->priority & QOS_CONTROL_TAG1D_MASK; 157 + tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; 158 158 if (sta) { 159 159 int ampdu_queue = sta->tid_to_tx_q[tid]; 160 160 if ((ampdu_queue < QD_NUM(hw)) && ··· 181 181 if (ieee80211_is_data_qos(hdr->frame_control)) { 182 182 u8 *p = ieee80211_get_qos_ctl(hdr); 183 183 u8 ack_policy = 0; 184 - tid = skb->priority & QOS_CONTROL_TAG1D_MASK; 184 + tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; 185 185 if (local->wifi_wme_noack_test) 186 186 ack_policy |= QOS_CONTROL_ACK_POLICY_NOACK << 187 187 QOS_CONTROL_ACK_POLICY_SHIFT;
-8
net/mac80211/wme.h
··· 19 19 #define QOS_CONTROL_ACK_POLICY_NORMAL 0 20 20 #define QOS_CONTROL_ACK_POLICY_NOACK 1 21 21 22 - #define QOS_CONTROL_TID_MASK 0x0f 23 22 #define QOS_CONTROL_ACK_POLICY_SHIFT 5 24 23 25 - #define QOS_CONTROL_TAG1D_MASK 0x07 26 - 27 24 extern const int ieee802_1d_to_ac[8]; 28 - 29 - static inline int WLAN_FC_IS_QOS_DATA(u16 fc) 30 - { 31 - return (fc & 0x8C) == 0x88; 32 - } 33 25 34 26 #ifdef CONFIG_MAC80211_QOS 35 27 void ieee80211_install_qdisc(struct net_device *dev);