All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] flow_dissector: remove __flow_hash_consistentify
@ 2015-07-29 20:49 Tom Herbert
  2015-07-29 21:19 ` Eric Dumazet
  2015-07-30 22:57 ` David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Tom Herbert @ 2015-07-29 20:49 UTC (permalink / raw)
  To: davem, netdev; +Cc: kernel-team

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@herbertland.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

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

end of thread, other threads:[~2015-07-30 22:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-29 20:49 [PATCH net-next] flow_dissector: remove __flow_hash_consistentify Tom Herbert
2015-07-29 21:19 ` Eric Dumazet
2015-07-29 21:47   ` Tom Herbert
2015-07-29 22:15     ` Eric Dumazet
2015-07-29 22:26       ` Tom Herbert
2015-07-30 22:57 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.