[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1425093109-1077-3-git-send-email-therbert@google.com>
Date: Fri, 27 Feb 2015 19:11:45 -0800
From: Tom Herbert <therbert@...gle.com>
To: davem@...emloft.net, netdev@...r.kernel.org
Subject: [PATCH net-next 2/6] flow_dissector: Include ip_proto in hash computation
Fold ip_proto into dst when computing hash. This provides a more
standard 5-tuple hash.
Signed-off-by: Tom Herbert <therbert@...gle.com>
---
net/core/flow_dissector.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 2c35c02..f73a248 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -276,6 +276,7 @@ static __always_inline u32 __flow_hash_3words(u32 a, u32 b, u32 c)
static inline u32 __flow_hash_from_keys(struct flow_keys *keys)
{
u32 hash;
+ u32 extra;
/* get a consistent hash (same value on both flow directions) */
if (((__force u32)keys->dst < (__force u32)keys->src) ||
@@ -285,7 +286,8 @@ static inline u32 __flow_hash_from_keys(struct flow_keys *keys)
swap(keys->port16[0], keys->port16[1]);
}
- hash = __flow_hash_3words((__force u32)keys->dst,
+ extra = keys->ip_proto;
+ hash = __flow_hash_3words((__force u32)keys->dst ^ extra,
(__force u32)keys->src,
(__force u32)keys->ports);
if (!hash)
--
2.2.0.rc0.207.ga3a616c
--
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