aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarvey Harrison <harvey.harrison@gmail.com>2008-07-02 14:05:34 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-07-08 14:15:59 -0400
commit238f74a227fd7de8ea1bc66dcbbd36cf9920d1cb (patch)
tree2174b8920ae81c82e7e382d1fc66e1609df11828
parent994d31f7430c3639b73c6ee038bd437c926b1227 (diff)
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>
-rw-r--r--include/linux/ieee80211.h2
-rw-r--r--net/mac80211/rx.c28
-rw-r--r--net/mac80211/wme.c4
-rw-r--r--net/mac80211/wme.h8
4 files changed, 18 insertions, 24 deletions
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index aa603c3d76d1..a1630ba0b87c 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -99,6 +99,8 @@
99#define IEEE80211_MAX_SSID_LEN 32 99#define IEEE80211_MAX_SSID_LEN 32
100#define IEEE80211_MAX_MESH_ID_LEN 32 100#define IEEE80211_MAX_MESH_ID_LEN 32
101#define IEEE80211_QOS_CTL_LEN 2 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
103struct ieee80211_hdr { 105struct ieee80211_hdr {
104 __le16 frame_control; 106 __le16 frame_control;
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 6a88e8f9bff0..a3a26e557274 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -321,20 +321,20 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
321 321
322static void ieee80211_parse_qos(struct ieee80211_rx_data *rx) 322static 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 int tid; 325 int tid;
326 326
327 /* does the frame have a qos control field? */ 327 /* does the frame have a qos control field? */
328 if (WLAN_FC_IS_QOS_DATA(rx->fc)) { 328 if (ieee80211_is_data_qos(hdr->frame_control)) {
329 u8 *qc = data + ieee80211_get_hdrlen(rx->fc) - QOS_CONTROL_LEN; 329 u8 *qc = ieee80211_get_qos_ctl(hdr);
330 /* frame has qos control */ 330 /* frame has qos control */
331 tid = qc[0] & QOS_CONTROL_TID_MASK; 331 tid = *qc & IEEE80211_QOS_CTL_TID_MASK;
332 if (qc[0] & IEEE80211_QOS_CONTROL_A_MSDU_PRESENT) 332 if (*qc & IEEE80211_QOS_CONTROL_A_MSDU_PRESENT)
333 rx->flags |= IEEE80211_RX_AMSDU; 333 rx->flags |= IEEE80211_RX_AMSDU;
334 else 334 else
335 rx->flags &= ~IEEE80211_RX_AMSDU; 335 rx->flags &= ~IEEE80211_RX_AMSDU;
336 } else { 336 } else {
337 if (unlikely((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT)) { 337 if (unlikely(ieee80211_is_mgmt(hdr->frame_control))) {
338 /* Separate TID for management frames */ 338 /* Separate TID for management frames */
339 tid = NUM_RX_DATA_QUEUES - 1; 339 tid = NUM_RX_DATA_QUEUES - 1;
340 } else { 340 } else {
@@ -1037,19 +1037,19 @@ ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx)
1037static ieee80211_rx_result debug_noinline 1037static ieee80211_rx_result debug_noinline
1038ieee80211_rx_h_remove_qos_control(struct ieee80211_rx_data *rx) 1038ieee80211_rx_h_remove_qos_control(struct ieee80211_rx_data *rx)
1039{ 1039{
1040 u16 fc = rx->fc;
1041 u8 *data = rx->skb->data; 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 return RX_CONTINUE; 1044 return RX_CONTINUE;
1046 1045
1047 /* remove the qos control field, update frame type and meta-data */ 1046 /* remove the qos control field, update frame type and meta-data */
1048 memmove(data + 2, data, ieee80211_get_hdrlen(fc) - 2); 1047 memmove(data + IEEE80211_QOS_CTL_LEN, data,
1049 hdr = (struct ieee80211_hdr *) skb_pull(rx->skb, 2); 1048 ieee80211_hdrlen(hdr->frame_control) - IEEE80211_QOS_CTL_LEN);
1049 hdr = (struct ieee80211_hdr *)skb_pull(rx->skb, IEEE80211_QOS_CTL_LEN);
1050 /* change frame type to non QOS */ 1050 /* change frame type to non QOS */
1051 rx->fc = fc &= ~IEEE80211_STYPE_QOS_DATA; 1051 rx->fc &= ~IEEE80211_STYPE_QOS_DATA;
1052 hdr->frame_control = cpu_to_le16(fc); 1052 hdr->frame_control &= ~cpu_to_le16(IEEE80211_STYPE_QOS_DATA);
1053 1053
1054 return RX_CONTINUE; 1054 return RX_CONTINUE;
1055} 1055}
@@ -2044,7 +2044,7 @@ static u8 ieee80211_rx_reorder_ampdu(struct ieee80211_local *local,
2044 if (!ieee80211_is_data_qos(hdr->frame_control)) 2044 if (!ieee80211_is_data_qos(hdr->frame_control))
2045 goto end_reorder; 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 if (sta->ampdu_mlme.tid_state_rx[tid] != HT_AGG_STATE_OPERATIONAL) 2049 if (sta->ampdu_mlme.tid_state_rx[tid] != HT_AGG_STATE_OPERATIONAL)
2050 goto end_reorder; 2050 goto end_reorder;
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
index a1a53a4f2b99..5c666f7eda8f 100644
--- a/net/mac80211/wme.c
+++ b/net/mac80211/wme.c
@@ -154,7 +154,7 @@ static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd)
154 queue = skb_get_queue_mapping(skb); 154 queue = skb_get_queue_mapping(skb);
155 rcu_read_lock(); 155 rcu_read_lock();
156 sta = sta_info_get(local, hdr->addr1); 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 if (sta) { 158 if (sta) {
159 int ampdu_queue = sta->tid_to_tx_q[tid]; 159 int ampdu_queue = sta->tid_to_tx_q[tid];
160 if ((ampdu_queue < QD_NUM(hw)) && 160 if ((ampdu_queue < QD_NUM(hw)) &&
@@ -181,7 +181,7 @@ static int wme_qdiscop_enqueue(struct sk_buff *skb, struct Qdisc* qd)
181 if (ieee80211_is_data_qos(hdr->frame_control)) { 181 if (ieee80211_is_data_qos(hdr->frame_control)) {
182 u8 *p = ieee80211_get_qos_ctl(hdr); 182 u8 *p = ieee80211_get_qos_ctl(hdr);
183 u8 ack_policy = 0; 183 u8 ack_policy = 0;
184 tid = skb->priority & QOS_CONTROL_TAG1D_MASK; 184 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
185 if (local->wifi_wme_noack_test) 185 if (local->wifi_wme_noack_test)
186 ack_policy |= QOS_CONTROL_ACK_POLICY_NOACK << 186 ack_policy |= QOS_CONTROL_ACK_POLICY_NOACK <<
187 QOS_CONTROL_ACK_POLICY_SHIFT; 187 QOS_CONTROL_ACK_POLICY_SHIFT;
diff --git a/net/mac80211/wme.h b/net/mac80211/wme.h
index bbdb53344817..1aca609eccfc 100644
--- a/net/mac80211/wme.h
+++ b/net/mac80211/wme.h
@@ -19,18 +19,10 @@
19#define QOS_CONTROL_ACK_POLICY_NORMAL 0 19#define QOS_CONTROL_ACK_POLICY_NORMAL 0
20#define QOS_CONTROL_ACK_POLICY_NOACK 1 20#define QOS_CONTROL_ACK_POLICY_NOACK 1
21 21
22#define QOS_CONTROL_TID_MASK 0x0f
23#define QOS_CONTROL_ACK_POLICY_SHIFT 5 22#define QOS_CONTROL_ACK_POLICY_SHIFT 5
24 23
25#define QOS_CONTROL_TAG1D_MASK 0x07
26
27extern const int ieee802_1d_to_ac[8]; 24extern const int ieee802_1d_to_ac[8];
28 25
29static inline int WLAN_FC_IS_QOS_DATA(u16 fc)
30{
31 return (fc & 0x8C) == 0x88;
32}
33
34#ifdef CONFIG_MAC80211_QOS 26#ifdef CONFIG_MAC80211_QOS
35void ieee80211_install_qdisc(struct net_device *dev); 27void ieee80211_install_qdisc(struct net_device *dev);
36int ieee80211_qdisc_installed(struct net_device *dev); 28int ieee80211_qdisc_installed(struct net_device *dev);