linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: John Linville <linville@tuxdriver.com>
Cc: Jiri Benc <jbenc@suse.cz>, linux-wireless@vger.kernel.org
Subject: [PATCH 02/14] mac80211: move QoS rx handlers into rx.c
Date: Fri, 22 Jun 2007 00:16:05 +0200	[thread overview]
Message-ID: <20070621221756.224604000@sipsolutions.net> (raw)
In-Reply-To: 20070621221603.778432000@sipsolutions.net

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>

---
 net/mac80211/Makefile |    2 -
 net/mac80211/rx.c     |   65 ++++++++++++++++++++++++++++++++++++++++++++
 net/mac80211/wme.c    |   73 --------------------------------------------------
 net/mac80211/wme.h    |    9 ++----
 4 files changed, 70 insertions(+), 79 deletions(-)

--- wireless-dev.orig/net/mac80211/rx.c	2007-06-21 19:29:20.218638003 +0200
+++ wireless-dev/net/mac80211/rx.c	2007-06-21 19:29:25.278638003 +0200
@@ -31,6 +31,50 @@
  */
 
 static ieee80211_txrx_result
+ieee80211_rx_h_parse_qos(struct ieee80211_txrx_data *rx)
+{
+	u8 *data = rx->skb->data;
+	int tid;
+	unsigned int is_agg_frame = 0;
+
+	/* does the frame have a qos control field? */
+	if (WLAN_FC_IS_QOS_DATA(rx->fc)) {
+		u8 *qc = data + ieee80211_get_hdrlen(rx->fc) - QOS_CONTROL_LEN;
+
+		/* frame has qos control */
+		rx->u.rx.qos_control = le16_to_cpu(*((__le16*)qc));
+		tid = rx->u.rx.qos_control & QOS_CONTROL_TID_MASK;
+		if (rx->u.rx.qos_control &
+		    IEEE80211_QOS_CONTROL_A_MSDU_PRESENT)
+			is_agg_frame = 1;
+	} else {
+		if (unlikely((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT)) {
+			/* Separate TID for management frames */
+			tid = NUM_RX_DATA_QUEUES - 1;
+		} else {
+			/* no qos control present */
+			tid = 0; /* 802.1d - Best Effort */
+		}
+		rx->u.rx.qos_control = 0;
+	}
+#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
+	I802_DEBUG_INC(rx->local->wme_rx_queue[tid]);
+	if (rx->sta) {
+		I802_DEBUG_INC(rx->sta->wme_rx_queue[tid]);
+	}
+#endif /* CONFIG_MAC80211_DEBUG_COUNTERS */
+
+	rx->u.rx.queue = tid;
+	rx->u.rx.is_agg_frame = is_agg_frame;
+	/* Set skb->priority to 1d tag if highest order bit of TID is not set.
+	 * For now, set skb->priority to 0 for other cases. */
+	rx->skb->priority = (tid > 7) ? 0 : tid;
+
+	return TXRX_CONTINUE;
+}
+
+
+static ieee80211_txrx_result
 ieee80211_rx_h_load_stats(struct ieee80211_txrx_data *rx)
 {
 	struct ieee80211_local *local = rx->local;
@@ -777,6 +821,27 @@ ieee80211_rx_h_ps_poll(struct ieee80211_
 
 
 static ieee80211_txrx_result
+ieee80211_rx_h_remove_qos_control(struct ieee80211_txrx_data *rx)
+{
+	u16 fc = rx->fc;
+	u8 *data = rx->skb->data;
+	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) data;
+
+	if (!WLAN_FC_IS_QOS_DATA(fc))
+		return TXRX_CONTINUE;
+
+	/* remove the qos control field, update frame type and meta-data */
+	memmove(data + 2, data, ieee80211_get_hdrlen(fc) - 2);
+	hdr = (struct ieee80211_hdr *) skb_pull(rx->skb, 2);
+	/* change frame type to non QOS */
+	rx->fc = fc &= ~IEEE80211_STYPE_QOS_DATA;
+	hdr->frame_control = cpu_to_le16(fc);
+
+	return TXRX_CONTINUE;
+}
+
+
+static ieee80211_txrx_result
 ieee80211_rx_h_802_1x_pae(struct ieee80211_txrx_data *rx)
 {
 	if (rx->sdata->eapol && ieee80211_is_eapol(rx->skb) &&
--- wireless-dev.orig/net/mac80211/wme.c	2007-06-21 19:29:07.088638003 +0200
+++ wireless-dev/net/mac80211/wme.c	2007-06-21 19:29:51.328638003 +0200
@@ -18,78 +18,6 @@
 #include "ieee80211_i.h"
 #include "wme.h"
 
-static inline int WLAN_FC_IS_QOS_DATA(u16 fc)
-{
-	return (fc & 0x8C) == 0x88;
-}
-
-
-ieee80211_txrx_result
-ieee80211_rx_h_parse_qos(struct ieee80211_txrx_data *rx)
-{
-	u8 *data = rx->skb->data;
-	int tid;
-	unsigned int is_agg_frame = 0;
-
-	/* does the frame have a qos control field? */
-	if (WLAN_FC_IS_QOS_DATA(rx->fc)) {
-		u8 *qc = data + ieee80211_get_hdrlen(rx->fc) - QOS_CONTROL_LEN;
-
-		/* frame has qos control */
-		rx->u.rx.qos_control = le16_to_cpu(*((__le16*)qc));
-		tid = rx->u.rx.qos_control & QOS_CONTROL_TID_MASK;
-		if (rx->u.rx.qos_control &
-		    IEEE80211_QOS_CONTROL_A_MSDU_PRESENT)
-			is_agg_frame = 1;
-	} else {
-		if (unlikely((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT)) {
-			/* Separate TID for management frames */
-			tid = NUM_RX_DATA_QUEUES - 1;
-		} else {
-			/* no qos control present */
-			tid = 0; /* 802.1d - Best Effort */
-		}
-		rx->u.rx.qos_control = 0;
-	}
-#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
-	I802_DEBUG_INC(rx->local->wme_rx_queue[tid]);
-	if (rx->sta) {
-		I802_DEBUG_INC(rx->sta->wme_rx_queue[tid]);
-	}
-#endif /* CONFIG_MAC80211_DEBUG_COUNTERS */
-
-	rx->u.rx.queue = tid;
-	rx->u.rx.is_agg_frame = is_agg_frame;
-	/* Set skb->priority to 1d tag if highest order bit of TID is not set.
-	 * For now, set skb->priority to 0 for other cases. */
-	rx->skb->priority = (tid > 7) ? 0 : tid;
-
-	return TXRX_CONTINUE;
-}
-
-
-ieee80211_txrx_result
-ieee80211_rx_h_remove_qos_control(struct ieee80211_txrx_data *rx)
-{
-	u16 fc = rx->fc;
-	u8 *data = rx->skb->data;
-	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) data;
-
-	if (!WLAN_FC_IS_QOS_DATA(fc))
-		return TXRX_CONTINUE;
-
-	/* remove the qos control field, update frame type and meta-data */
-	memmove(data + 2, data, ieee80211_get_hdrlen(fc) - 2);
-	hdr = (struct ieee80211_hdr *) skb_pull(rx->skb, 2);
-	/* change frame type to non QOS */
-	rx->fc = fc &= ~IEEE80211_STYPE_QOS_DATA;
-	hdr->frame_control = cpu_to_le16(fc);
-
-	return TXRX_CONTINUE;
-}
-
-
-#ifdef CONFIG_NET_SCHED
 /* maximum number of hardware queues we support. */
 #define TC_80211_MAX_QUEUES 8
 
@@ -709,4 +637,3 @@ void ieee80211_wme_unregister(void)
 {
 	unregister_qdisc(&wme_qdisc_ops);
 }
-#endif /* CONFIG_NET_SCHED */
--- wireless-dev.orig/net/mac80211/wme.h	2007-06-21 19:29:07.178638003 +0200
+++ wireless-dev/net/mac80211/wme.h	2007-06-21 19:29:25.288638003 +0200
@@ -24,11 +24,10 @@
 
 #define QOS_CONTROL_TAG1D_MASK 0x07
 
-ieee80211_txrx_result
-ieee80211_rx_h_parse_qos(struct ieee80211_txrx_data *rx);
-
-ieee80211_txrx_result
-ieee80211_rx_h_remove_qos_control(struct ieee80211_txrx_data *rx);
+static inline int WLAN_FC_IS_QOS_DATA(u16 fc)
+{
+	return (fc & 0x8C) == 0x88;
+}
 
 #ifdef CONFIG_NET_SCHED
 void ieee80211_install_qdisc(struct net_device *dev);
--- wireless-dev.orig/net/mac80211/Makefile	2007-06-21 19:29:53.828638003 +0200
+++ wireless-dev/net/mac80211/Makefile	2007-06-21 19:30:12.558638003 +0200
@@ -2,6 +2,7 @@ obj-$(CONFIG_MAC80211) += mac80211.o rc8
 
 mac80211-objs-$(CONFIG_MAC80211_LEDS) += ieee80211_led.o
 mac80211-objs-$(CONFIG_MAC80211_DEBUGFS) += debugfs.o debugfs_sta.o debugfs_netdev.o debugfs_key.o
+mac80211-objs-$(CONFIG_NET_SCHED) += wme.o
 
 mac80211-objs := \
 	ieee80211.o \
@@ -16,7 +17,6 @@ mac80211-objs := \
 	regdomain.o \
 	tkip.o \
 	aes_ccm.o \
-	wme.o \
 	ieee80211_cfg.o \
 	rx.o \
 	$(mac80211-objs-y)

-- 


  reply	other threads:[~2007-06-22  8:41 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-21 22:16 [PATCH 00/14] major mac80211 restructuring/cleanups Johannes Berg
2007-06-21 22:16 ` Johannes Berg [this message]
2007-06-21 22:16 ` [PATCH 03/14] mac80211: rx cleanups (1) Johannes Berg
2007-06-21 22:16 ` [PATCH 04/14] mac80211: split ieee80211_rx_h_check handler Johannes Berg
2007-06-21 22:16 ` [PATCH 05/14] mac80211: split up __ieee80211_rx Johannes Berg
2007-06-21 22:16 ` [PATCH 06/14] mac80211: fix bug for per-sta stats Johannes Berg
2007-06-21 22:16 ` [PATCH 07/14] mac80211: rx cleanups (2) Johannes Berg
2007-06-21 22:16 ` [PATCH 09/14] mac80211: remove some unnecessary includes Johannes Berg
2007-06-21 22:16 ` [PATCH 10/14] mac80211: split out some key functions from ieee80211.c Johannes Berg
2007-06-21 22:16 ` [PATCH 11/14] mac80211: regdomain.c needs to include ieee80211_i.h Johannes Berg
2007-06-21 22:16 ` [PATCH 12/14] mac80211: move some rate control functions out of ieee80211.c Johannes Berg
2007-06-21 22:16 ` [PATCH 13/14] mac80211: reorder interface related functions Johannes Berg
2007-06-21 22:16 ` [PATCH 14/14] mac80211: introduce util.c Johannes Berg
2007-06-22  9:09 ` [PATCH 00/14] major mac80211 restructuring/cleanups Johannes Berg
2007-06-28 10:59   ` Johannes Berg
2007-07-10 13:34 ` Jiri Benc
2007-07-10 13:50   ` Johannes Berg
2007-07-10 14:29     ` Jiri Benc
2007-07-10 14:51       ` Johannes Berg
2007-07-10 17:12         ` John W. Linville
2007-07-10 18:35           ` Johannes Berg
2007-07-11 20:20             ` Christoph Hellwig
2007-07-17 13:54               ` Luis R. Rodriguez
2007-07-17 13:57                 ` Luis R. Rodriguez
2007-07-11 16:34         ` jketreno
2007-07-11 20:06           ` Joerg Mayer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070621221756.224604000@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=jbenc@suse.cz \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).