netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: netdev@vger.kernel.org
Cc: Jouni Malinen <jkm@devicescape.com>, Jiri Benc <jbenc@suse.cz>
Subject: [PATCH] d80211: get rid of the WME bitfield
Date: Mon, 14 Aug 2006 10:15:14 +0200	[thread overview]
Message-ID: <44E03112.9070002@sipsolutions.net> (raw)
In-Reply-To: <44E02F41.2060300@sipsolutions.net>

Somewhere, sometime, someone had to start getting rid of bitfields ;) 
This one seemed an easy target :P

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>

--- wireless-dev.orig/net/d80211/wme.c    2006-08-12 10:43:01.809644280 
+0200
+++ wireless-dev/net/d80211/wme.c    2006-08-12 10:51:35.909644280 +0200
@@ -246,15 +246,13 @@ static int wme_qdiscop_enqueue(struct sk
     /* now we know the 1d priority, fill in the QoS header if there is one
      */
     if (WLAN_FC_IS_QOS_DATA(fc)) {
-        struct qos_control *qc = (struct qos_control *)
-            (skb->data + ieee80211_get_hdrlen(fc) - 2);
-        u8 *p = (u8 *) qc;
-        *p++ = 0; /* do this due to gcc's lack of optimization on
-               * bitfield ops */
-        *p = 0;
-        qc->tag1d = skb->priority;
+        /* hard-coded QOS control header length! */
+        u16 *p = (u16 *) (skb->data + ieee80211_get_hdrlen(fc) - 2);
+        u16 qos_hdr = skb->priority & QOS_CONTROL_TAG1D_MASK;
         if (local->wifi_wme_noack_test)
-            qc->ack_policy = 1;
+            qos_hdr |= QOS_CONTROL_ACK_POLICY_NOACK <<
+                    QOS_CONTROL_ACK_POLICY_SHIFT;
+        *p = cpu_to_le16(qos_hdr);
     }
 
     if (unlikely(queue >= local->hw->queues)) {
--- wireless-dev.orig/net/d80211/wme.h    2006-08-12 10:53:18.899644280 
+0200
+++ wireless-dev/net/d80211/wme.h    2006-08-12 10:53:21.629644280 +0200
@@ -24,26 +24,7 @@
 #define QOS_CONTROL_TID_MASK 0x0f
 #define QOS_CONTROL_ACK_POLICY_SHIFT 5
 
-/* This bit field structure should not be used; it can cause compiler to
- * generate unaligned accesses and inefficient code. */
-struct qos_control {
-#if defined(__LITTLE_ENDIAN_BITFIELD)
-    u8    tag1d:3, /* bits 0-2 */
-          reserved1:1,
-        eosp:1,
-        ack_policy:2,
-          reserved2:1;
-#elif defined (__BIG_ENDIAN_BITFIELD)
-    u8    reserved2:1,
-        ack_policy:2,
-        eosp:1,
-        reserved1:1,
-        tag1d:3; /* bits 0-2 */
-#else
-#error    "Please fix <asm/byteorder.h>"
-#endif
-    u8 reserved;
-} __attribute__ ((packed));
+#define QOS_CONTROL_TAG1D_MASK 0x07
 
 ieee80211_txrx_result
 ieee80211_rx_h_parse_qos(struct ieee80211_txrx_data *rx);


  parent reply	other threads:[~2006-08-14  8:15 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-14  8:07 [wireless] bunch of questions and notes on d80211 Johannes Berg
2006-08-14  8:10 ` bcm43xx for d80211 softirq loop Johannes Berg
     [not found]   ` <44E0300D.1000402-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
2006-08-14  8:21     ` Johannes Berg
2006-08-14 13:27   ` Michael Buesch
2006-08-14  8:12 ` [d80211 rfc] link master interface from wiphy Johannes Berg
2006-08-14 12:01   ` Dan Williams
2006-08-16 17:05   ` Jiri Benc
2006-08-17  7:18     ` Johannes Berg
2006-08-14  8:13 ` [PATCH] d80211: fix some 0 vs. NULL comparisons Johannes Berg
2006-08-14 13:20   ` Johannes Berg
2006-08-14 15:48     ` Jouni Malinen
2006-08-14  8:15 ` Johannes Berg [this message]
2006-08-14 16:12   ` [PATCH] d80211: get rid of the WME bitfield Jouni Malinen
2006-08-15  7:11     ` Johannes Berg
2006-08-14  8:16 ` ieee80211_japan_5ghz / firmware etc.?? Johannes Berg
2006-08-14  8:16 ` ieee80211_set_encryption Johannes Berg
2006-08-14 15:53   ` ieee80211_set_encryption Jouni Malinen
2006-08-14  8:18 ` network manager confused with bcm43xx-d80211? Johannes Berg
2006-08-14 11:46   ` Dan Williams
2006-08-14 12:28     ` Johannes Berg
2006-08-14 12:48       ` Larry Finger
2006-08-14 12:54         ` Johannes Berg
2006-08-14  8:19 ` d80211 and sta_aid for AP functionality Johannes Berg
2006-08-17 18:21   ` Jiri Benc
2006-08-14  8:22 ` wlan#ap seems bogus Johannes Berg
2006-08-14 14:04   ` Johannes Berg
2006-08-14 18:53     ` Simon Barber
2006-08-15  7:22       ` Johannes Berg
2006-08-14 15:58   ` Jouni Malinen
2006-08-14 16:04     ` Johannes Berg

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=44E03112.9070002@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=jbenc@suse.cz \
    --cc=jkm@devicescape.com \
    --cc=netdev@vger.kernel.org \
    /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).