From: Andi Kleen <andi@firstfloor•org>
To: davem@davemloft•net
Cc: netdev@vger•kernel.org
Subject: [PATCH] Make simple TX hash little endian safe.
Date: Mon, 21 Jul 2008 10:48:07 +0200 [thread overview]
Message-ID: <1216630088-10328-1-git-send-email-andi@firstfloor.org> (raw)
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
next reply other threads:[~2008-07-21 8:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-21 8:48 Andi Kleen [this message]
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
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=1216630088-10328-1-git-send-email-andi@firstfloor.org \
--to=andi@firstfloor$(echo .)org \
--cc=davem@davemloft$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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