[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1216630088-10328-1-git-send-email-andi@firstfloor.org>
Date: Mon, 21 Jul 2008 10:48:07 +0200
From: Andi Kleen <andi@...stfloor.org>
To: davem@...emloft.net
Cc: netdev@...r.kernel.org
Subject: [PATCH] Make simple TX hash little endian safe.
From: Andi Kleen <andi@...il.nowhere.org>
Currently it will not use the lower
bits at all on big endian system, mapping e.g. all connections to a single
queue on a local network which only differs in the low bits.
Also fold the upper 16 bits always in the lower 16bits.
Signed-off-by: Andi Kleen <ak@...ux.intel.com>
---
net/core/dev.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 2eed17b..c35fefc 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1694,8 +1694,11 @@ static u16 simple_tx_hash(struct net_device *dev, struct sk_buff *skb)
ports = (u32 *) (skb_network_header(skb) + (ihl * 4));
hash = 0;
- while (alen--)
- hash ^= *addr++;
+ while (alen--) {
+ hash ^= ntohl(*addr);
+ addr++;
+ }
+ hash ^= hash >> 16; /* More folding needed? */
switch (ip_proto) {
case IPPROTO_TCP:
--
1.5.6
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists