aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-07-27 09:43:22 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:47:30 -0400
commit6e0d114d52833449a4e40f6dc8582e88d0742be4 (patch)
treebabc9afb1adfb418bb6853db9701e2df3c580838
parent571ecf676d66735f59be6b950360e4074f02f47d (diff)
[MAC80211]: move QoS rx handlers into rx.c
This patch moves the QoS handlers into rx.c making it possible to compile wme.c only when NET_SCHED is defined. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Jiri Benc <jbenc@suse.cz> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--net/mac80211/Makefile2
-rw-r--r--net/mac80211/rx.c55
-rw-r--r--net/mac80211/wme.c65
-rw-r--r--net/mac80211/wme.h9
4 files changed, 60 insertions, 71 deletions
diff --git a/net/mac80211/Makefile b/net/mac80211/Makefile
index b5853991324b..0353e75ec963 100644
--- a/net/mac80211/Makefile
+++ b/net/mac80211/Makefile
@@ -2,6 +2,7 @@ obj-$(CONFIG_MAC80211) += mac80211.o rc80211_simple.o
2 2
3mac80211-objs-$(CONFIG_MAC80211_LEDS) += ieee80211_led.o 3mac80211-objs-$(CONFIG_MAC80211_LEDS) += ieee80211_led.o
4mac80211-objs-$(CONFIG_MAC80211_DEBUGFS) += debugfs.o debugfs_sta.o debugfs_netdev.o debugfs_key.o 4mac80211-objs-$(CONFIG_MAC80211_DEBUGFS) += debugfs.o debugfs_sta.o debugfs_netdev.o debugfs_key.o
5mac80211-objs-$(CONFIG_NET_SCHED) += wme.o
5 6
6mac80211-objs := \ 7mac80211-objs := \
7 ieee80211.o \ 8 ieee80211.o \
@@ -16,7 +17,6 @@ mac80211-objs := \
16 regdomain.o \ 17 regdomain.o \
17 tkip.o \ 18 tkip.o \
18 aes_ccm.o \ 19 aes_ccm.o \
19 wme.o \
20 ieee80211_cfg.o \ 20 ieee80211_cfg.o \
21 rx.o \ 21 rx.o \
22 $(mac80211-objs-y) 22 $(mac80211-objs-y)
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 8c0d14c5628f..c5a6bb200726 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -31,6 +31,41 @@
31 */ 31 */
32 32
33static ieee80211_txrx_result 33static ieee80211_txrx_result
34ieee80211_rx_h_parse_qos(struct ieee80211_txrx_data *rx)
35{
36 u8 *data = rx->skb->data;
37 int tid;
38
39 /* does the frame have a qos control field? */
40 if (WLAN_FC_IS_QOS_DATA(rx->fc)) {
41 u8 *qc = data + ieee80211_get_hdrlen(rx->fc) - QOS_CONTROL_LEN;
42 /* frame has qos control */
43 tid = qc[0] & QOS_CONTROL_TID_MASK;
44 } else {
45 if (unlikely((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT)) {
46 /* Separate TID for management frames */
47 tid = NUM_RX_DATA_QUEUES - 1;
48 } else {
49 /* no qos control present */
50 tid = 0; /* 802.1d - Best Effort */
51 }
52 }
53#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
54 I802_DEBUG_INC(rx->local->wme_rx_queue[tid]);
55 if (rx->sta) {
56 I802_DEBUG_INC(rx->sta->wme_rx_queue[tid]);
57 }
58#endif /* CONFIG_MAC80211_DEBUG_COUNTERS */
59
60 rx->u.rx.queue = tid;
61 /* Set skb->priority to 1d tag if highest order bit of TID is not set.
62 * For now, set skb->priority to 0 for other cases. */
63 rx->skb->priority = (tid > 7) ? 0 : tid;
64
65 return TXRX_CONTINUE;
66}
67
68static ieee80211_txrx_result
34ieee80211_rx_h_load_stats(struct ieee80211_txrx_data *rx) 69ieee80211_rx_h_load_stats(struct ieee80211_txrx_data *rx)
35{ 70{
36 struct ieee80211_local *local = rx->local; 71 struct ieee80211_local *local = rx->local;
@@ -765,6 +800,26 @@ ieee80211_rx_h_ps_poll(struct ieee80211_txrx_data *rx)
765} 800}
766 801
767static ieee80211_txrx_result 802static ieee80211_txrx_result
803ieee80211_rx_h_remove_qos_control(struct ieee80211_txrx_data *rx)
804{
805 u16 fc = rx->fc;
806 u8 *data = rx->skb->data;
807 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) data;
808
809 if (!WLAN_FC_IS_QOS_DATA(fc))
810 return TXRX_CONTINUE;
811
812 /* remove the qos control field, update frame type and meta-data */
813 memmove(data + 2, data, ieee80211_get_hdrlen(fc) - 2);
814 hdr = (struct ieee80211_hdr *) skb_pull(rx->skb, 2);
815 /* change frame type to non QOS */
816 rx->fc = fc &= ~IEEE80211_STYPE_QOS_DATA;
817 hdr->frame_control = cpu_to_le16(fc);
818
819 return TXRX_CONTINUE;
820}
821
822static ieee80211_txrx_result
768ieee80211_rx_h_802_1x_pae(struct ieee80211_txrx_data *rx) 823ieee80211_rx_h_802_1x_pae(struct ieee80211_txrx_data *rx)
769{ 824{
770 if (rx->sdata->eapol && ieee80211_is_eapol(rx->skb) && 825 if (rx->sdata->eapol && ieee80211_is_eapol(rx->skb) &&
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
index 7ab82b376e1b..0f11ccd30a36 100644
--- a/net/mac80211/wme.c
+++ b/net/mac80211/wme.c
@@ -18,70 +18,6 @@
18#include "ieee80211_i.h" 18#include "ieee80211_i.h"
19#include "wme.h" 19#include "wme.h"
20 20
21static inline int WLAN_FC_IS_QOS_DATA(u16 fc)
22{
23 return (fc & 0x8C) == 0x88;
24}
25
26
27ieee80211_txrx_result
28ieee80211_rx_h_parse_qos(struct ieee80211_txrx_data *rx)
29{
30 u8 *data = rx->skb->data;
31 int tid;
32
33 /* does the frame have a qos control field? */
34 if (WLAN_FC_IS_QOS_DATA(rx->fc)) {
35 u8 *qc = data + ieee80211_get_hdrlen(rx->fc) - QOS_CONTROL_LEN;
36 /* frame has qos control */
37 tid = qc[0] & QOS_CONTROL_TID_MASK;
38 } else {
39 if (unlikely((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT)) {
40 /* Separate TID for management frames */
41 tid = NUM_RX_DATA_QUEUES - 1;
42 } else {
43 /* no qos control present */
44 tid = 0; /* 802.1d - Best Effort */
45 }
46 }
47#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
48 I802_DEBUG_INC(rx->local->wme_rx_queue[tid]);
49 if (rx->sta) {
50 I802_DEBUG_INC(rx->sta->wme_rx_queue[tid]);
51 }
52#endif /* CONFIG_MAC80211_DEBUG_COUNTERS */
53
54 rx->u.rx.queue = tid;
55 /* Set skb->priority to 1d tag if highest order bit of TID is not set.
56 * For now, set skb->priority to 0 for other cases. */
57 rx->skb->priority = (tid > 7) ? 0 : tid;
58
59 return TXRX_CONTINUE;
60}
61
62
63ieee80211_txrx_result
64ieee80211_rx_h_remove_qos_control(struct ieee80211_txrx_data *rx)
65{
66 u16 fc = rx->fc;
67 u8 *data = rx->skb->data;
68 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) data;
69
70 if (!WLAN_FC_IS_QOS_DATA(fc))
71 return TXRX_CONTINUE;
72
73 /* remove the qos control field, update frame type and meta-data */
74 memmove(data + 2, data, ieee80211_get_hdrlen(fc) - 2);
75 hdr = (struct ieee80211_hdr *) skb_pull(rx->skb, 2);
76 /* change frame type to non QOS */
77 rx->fc = fc &= ~IEEE80211_STYPE_QOS_DATA;
78 hdr->frame_control = cpu_to_le16(fc);
79
80 return TXRX_CONTINUE;
81}
82
83
84#ifdef CONFIG_NET_SCHED
85/* maximum number of hardware queues we support. */ 21/* maximum number of hardware queues we support. */
86#define TC_80211_MAX_QUEUES 8 22#define TC_80211_MAX_QUEUES 8
87 23
@@ -675,4 +611,3 @@ void ieee80211_wme_unregister(void)
675{ 611{
676 unregister_qdisc(&wme_qdisc_ops); 612 unregister_qdisc(&wme_qdisc_ops);
677} 613}
678#endif /* CONFIG_NET_SCHED */
diff --git a/net/mac80211/wme.h b/net/mac80211/wme.h
index f0bff10f0e08..76c713a6450c 100644
--- a/net/mac80211/wme.h
+++ b/net/mac80211/wme.h
@@ -24,11 +24,10 @@
24 24
25#define QOS_CONTROL_TAG1D_MASK 0x07 25#define QOS_CONTROL_TAG1D_MASK 0x07
26 26
27ieee80211_txrx_result 27static inline int WLAN_FC_IS_QOS_DATA(u16 fc)
28ieee80211_rx_h_parse_qos(struct ieee80211_txrx_data *rx); 28{
29 29 return (fc & 0x8C) == 0x88;
30ieee80211_txrx_result 30}
31ieee80211_rx_h_remove_qos_control(struct ieee80211_txrx_data *rx);
32 31
33#ifdef CONFIG_NET_SCHED 32#ifdef CONFIG_NET_SCHED
34void ieee80211_install_qdisc(struct net_device *dev); 33void ieee80211_install_qdisc(struct net_device *dev);