[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1438202943-937619-1-git-send-email-tom@herbertland.com>
Date: Wed, 29 Jul 2015 13:49:03 -0700
From: Tom Herbert <tom@...bertland.com>
To: <davem@...emloft.net>, <netdev@...r.kernel.org>
CC: <kernel-team@...com>
Subject: [PATCH net-next] flow_dissector: remove __flow_hash_consistentify
The intent of this function was to produce a consistent hash for both
directions of a flow. However, since we added more inputs to the flow
hashing (IPv6 flow labels for instance) in a lot of cases we won't get
the same hash computed for each direction anyway. Also, there is no
defined correlation between the hashes computed in each direction of a
flow.
This patch removes the function since it is not providing significant
value and is expensive to be called for every packet. If there are
ever users of the flow_hash_from_keys that did require consistency
they can swap addresses and ports as needed in the flow_keys before
calling flow_hash_from_keys.
Signed-off-by: Tom Herbert <tom@...bertland.com>
---
net/core/flow_dissector.c | 35 -----------------------------------
1 file changed, 35 deletions(-)
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 2a834c6..9c9236b 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -500,45 +500,10 @@ __be32 flow_get_u32_dst(const struct flow_keys *flow)
}
EXPORT_SYMBOL(flow_get_u32_dst);
-static inline void __flow_hash_consistentify(struct flow_keys *keys)
-{
- int addr_diff, i;
-
- switch (keys->control.addr_type) {
- case FLOW_DISSECTOR_KEY_IPV4_ADDRS:
- addr_diff = (__force u32)keys->addrs.v4addrs.dst -
- (__force u32)keys->addrs.v4addrs.src;
- if ((addr_diff < 0) ||
- (addr_diff == 0 &&
- ((__force u16)keys->ports.dst <
- (__force u16)keys->ports.src))) {
- swap(keys->addrs.v4addrs.src, keys->addrs.v4addrs.dst);
- swap(keys->ports.src, keys->ports.dst);
- }
- break;
- case FLOW_DISSECTOR_KEY_IPV6_ADDRS:
- addr_diff = memcmp(&keys->addrs.v6addrs.dst,
- &keys->addrs.v6addrs.src,
- sizeof(keys->addrs.v6addrs.dst));
- if ((addr_diff < 0) ||
- (addr_diff == 0 &&
- ((__force u16)keys->ports.dst <
- (__force u16)keys->ports.src))) {
- for (i = 0; i < 4; i++)
- swap(keys->addrs.v6addrs.src.s6_addr32[i],
- keys->addrs.v6addrs.dst.s6_addr32[i]);
- swap(keys->ports.src, keys->ports.dst);
- }
- break;
- }
-}
-
static inline u32 __flow_hash_from_keys(struct flow_keys *keys, u32 keyval)
{
u32 hash;
- __flow_hash_consistentify(keys);
-
hash = __flow_hash_words((u32 *)flow_keys_hash_start(keys),
flow_keys_hash_length(keys), keyval);
if (!hash)
--
1.8.1
--
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