Thread (13 messages) 13 messages, 1 author, 2007-01-03
STALE7107d
Revisions (7)
  1. v1 [diff vs current]
  2. v1 [diff vs current]
  3. v1 [diff vs current]
  4. v1 [diff vs current]
  5. v1 [diff vs current]
  6. v1 current
  7. v1 [diff vs current]

[PATCH 4/12] d80211: simplify classify_1d

From: Jiri Benc <hidden>
Date: 2007-01-03 18:05:12
Subsystem: networking [general], the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

The switch in classify_1d can be simplified to a bit operation.

Signed-off-by: Jiri Benc <redacted>

---

 net/d80211/wme.c |   19 ++-----------------
 1 files changed, 2 insertions(+), 17 deletions(-)

e874890656210a235fbcfe0935717f86e5d179d9
diff --git a/net/d80211/wme.c b/net/d80211/wme.c
index f26fe6c..0624ad8 100644
--- a/net/d80211/wme.c
+++ b/net/d80211/wme.c
@@ -129,24 +129,9 @@ #endif /* CONFIG_NET_SCHED */
 	ip = (struct iphdr *) (skb->data + offset);
 
 	dscp = ip->tos & 0xfc;
-	switch (dscp) {
-	case 0x20:
-		return 1;
-	case 0x40:
-		return 2;
-	case 0x60:
-		return 3;
-	case 0x80:
-		return 4;
-	case 0xa0:
-		return 5;
-	case 0xc0:
-		return 6;
-	case 0xe0:
-		return 7;
-	default:
+	if (dscp & 0x1c)
 		return 0;
-	}
+	return dscp >> 5;
 }
 
 
-- 
1.3.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help