netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Make simple TX hash little endian safe.
@ 2008-07-21  8:48 Andi Kleen
  2008-07-21  8:48 ` [PATCH] Add a statistics counter for tx hash miss Andi Kleen
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Andi Kleen @ 2008-07-21  8:48 UTC (permalink / raw)
  To: davem; +Cc: netdev

From: Andi Kleen <andi@basil.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@linux.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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-07-21 17:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-21  8:48 [PATCH] Make simple TX hash little endian safe Andi Kleen
2008-07-21  8:48 ` [PATCH] Add a statistics counter for tx hash miss Andi Kleen
2008-07-21 16:33   ` David Miller
2008-07-21 16:44     ` Andi Kleen
2008-07-21 16:51       ` David Miller
2008-07-21 12:32 ` [PATCH] Make simple TX hash little endian safe Jarek Poplawski
2008-07-21 15:17   ` Andi Kleen
2008-07-21 16:44 ` David Miller
2008-07-21 17:20   ` Andi Kleen

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).