* [PATCH] mac80211: simplify code in util.c
@ 2008-04-21 2:36 Harvey Harrison
2008-04-21 5:24 ` Zhu Yi
2008-04-21 8:19 ` Johannes Berg
0 siblings, 2 replies; 4+ messages in thread
From: Harvey Harrison @ 2008-04-21 2:36 UTC (permalink / raw)
To: Johannes Berg; +Cc: John Linville, linux-wireless
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
net/mac80211/util.c | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index cc9f715..9960372 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -101,16 +101,13 @@ int ieee80211_get_hdrlen(u16 fc)
switch (fc & IEEE80211_FCTL_FTYPE) {
case IEEE80211_FTYPE_DATA:
if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS))
- hdrlen = 30; /* Addr4 */
+ hdrlen += ETH_ALEN; /* Addr4 */
/*
* The QoS Control field is two bytes and its presence is
- * indicated by the IEEE80211_STYPE_QOS_DATA bit. Add 2 to
- * hdrlen if that bit is set.
- * This works by masking out the bit and shifting it to
- * bit position 1 so the result has the value 0 or 2.
+ * indicated by the IEEE80211_STYPE_QOS_DATA bit.
*/
- hdrlen += (fc & IEEE80211_STYPE_QOS_DATA)
- >> (ilog2(IEEE80211_STYPE_QOS_DATA)-1);
+ if (fc & IEEE80211_STYPE_QOS_DATA)
+ hdrlen += 2;
break;
case IEEE80211_FTYPE_CTL:
/*
--
1.5.5.144.g3e42
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mac80211: simplify code in util.c
2008-04-21 2:36 [PATCH] mac80211: simplify code in util.c Harvey Harrison
@ 2008-04-21 5:24 ` Zhu Yi
2008-04-21 5:50 ` Harvey Harrison
2008-04-21 8:19 ` Johannes Berg
1 sibling, 1 reply; 4+ messages in thread
From: Zhu Yi @ 2008-04-21 5:24 UTC (permalink / raw)
To: Harvey Harrison; +Cc: Johannes Berg, John Linville, linux-wireless
On Sun, 2008-04-20 at 19:36 -0700, Harvey Harrison wrote:
> - hdrlen += (fc & IEEE80211_STYPE_QOS_DATA)
> - >> (ilog2(IEEE80211_STYPE_QOS_DATA)-1);
> + if (fc & IEEE80211_STYPE_QOS_DATA)
> + hdrlen += 2;
You need also take other QoS types (i.e QOS_NULLFUNC) into
consideration. Please take a look at WLAN_FC_IS_QOS_DATA macro.
Thanks,
-yi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mac80211: simplify code in util.c
2008-04-21 5:24 ` Zhu Yi
@ 2008-04-21 5:50 ` Harvey Harrison
0 siblings, 0 replies; 4+ messages in thread
From: Harvey Harrison @ 2008-04-21 5:50 UTC (permalink / raw)
To: Zhu Yi; +Cc: Johannes Berg, John Linville, linux-wireless
On Mon, 2008-04-21 at 13:24 +0800, Zhu Yi wrote:
> On Sun, 2008-04-20 at 19:36 -0700, Harvey Harrison wrote:
> > - hdrlen += (fc & IEEE80211_STYPE_QOS_DATA)
> > - >> (ilog2(IEEE80211_STYPE_QOS_DATA)-1);
> > + if (fc & IEEE80211_STYPE_QOS_DATA)
> > + hdrlen += 2;
>
> You need also take other QoS types (i.e QOS_NULLFUNC) into
> consideration. Please take a look at WLAN_FC_IS_QOS_DATA macro.
>
Well, that would be a change from what's there now, I've just got a
few pure cleanup patches I've done while making some changes in wpa.c
I'm going to submit the cleanup patches on their own first, then
patches with more substance.
Cheers,
Harvey
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mac80211: simplify code in util.c
2008-04-21 2:36 [PATCH] mac80211: simplify code in util.c Harvey Harrison
2008-04-21 5:24 ` Zhu Yi
@ 2008-04-21 8:19 ` Johannes Berg
1 sibling, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2008-04-21 8:19 UTC (permalink / raw)
To: Harvey Harrison; +Cc: John Linville, linux-wireless
[-- Attachment #1: Type: text/plain, Size: 894 bytes --]
On Sun, 2008-04-20 at 19:36 -0700, Harvey Harrison wrote:
> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
> if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS))
> - hdrlen = 30; /* Addr4 */
> + hdrlen += ETH_ALEN; /* Addr4 */
> /*
> * The QoS Control field is two bytes and its presence is
> - * indicated by the IEEE80211_STYPE_QOS_DATA bit. Add 2 to
> - * hdrlen if that bit is set.
> - * This works by masking out the bit and shifting it to
> - * bit position 1 so the result has the value 0 or 2.
> + * indicated by the IEEE80211_STYPE_QOS_DATA bit.
> */
> - hdrlen += (fc & IEEE80211_STYPE_QOS_DATA)
> - >> (ilog2(IEEE80211_STYPE_QOS_DATA)-1);
> + if (fc & IEEE80211_STYPE_QOS_DATA)
> + hdrlen += 2;
Have you checked the generated code? Last time I checked it was better
with what we had there.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-04-21 8:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-21 2:36 [PATCH] mac80211: simplify code in util.c Harvey Harrison
2008-04-21 5:24 ` Zhu Yi
2008-04-21 5:50 ` Harvey Harrison
2008-04-21 8:19 ` Johannes Berg
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.