summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip/ip_flow_hash.h
diff options
context:
space:
mode:
authorAhmed Abdelsalam <ahabdels@cisco.com>2020-11-20 18:56:09 +0000
committerOle Tr�an <otroan@employees.org>2021-01-21 10:59:46 +0000
commitf2984bbb013acb0d6872e8fbb2f9d57d3e4f49b9 (patch)
tree2b53a21de615e7f6fabcf96e2b15e7070adc1736 /src/vnet/ip/ip_flow_hash.h
parent03fabbd22215d306fb66c51f952480631d67c9dc (diff)
ip: use IPv6 flowlabel in flow hash computation
extends ip6_compute_flow_hash() to include IPv6 flowlabel in flowhash computation Type: improvement Signed-off-by: Ahmed Abdelsalam <ahabdels@cisco.com> Signed-off-by: Neale Ranns <neale.ranns@cisco.com> Change-Id: Id1aaa20c9dac729c22b714eea1cdd6e9e4d1f75e
Diffstat (limited to 'src/vnet/ip/ip_flow_hash.h')
-rw-r--r--src/vnet/ip/ip_flow_hash.h44
1 files changed, 25 insertions, 19 deletions
diff --git a/src/vnet/ip/ip_flow_hash.h b/src/vnet/ip/ip_flow_hash.h
index 04777320f38..82e0efb0d08 100644
--- a/src/vnet/ip/ip_flow_hash.h
+++ b/src/vnet/ip/ip_flow_hash.h
@@ -16,31 +16,37 @@
#ifndef __IP_FLOW_HASH_H__
#define __IP_FLOW_HASH_H__
-/** Flow hash configuration */
-#define IP_FLOW_HASH_SRC_ADDR (1<<0)
-#define IP_FLOW_HASH_DST_ADDR (1<<1)
-#define IP_FLOW_HASH_PROTO (1<<2)
-#define IP_FLOW_HASH_SRC_PORT (1<<3)
-#define IP_FLOW_HASH_DST_PORT (1<<4)
-#define IP_FLOW_HASH_REVERSE_SRC_DST (1<<5)
-#define IP_FLOW_HASH_SYMMETRIC (1<<6)
+/** Default: 5-tuple + flowlabel without the "reverse" bit */
+#define IP_FLOW_HASH_DEFAULT (0x9F)
-/** Default: 5-tuple without the "reverse" bit */
-#define IP_FLOW_HASH_DEFAULT (0x1F)
+#define foreach_flow_hash_bit_v1 \
+ _ (src, IP_FLOW_HASH_SRC_ADDR) \
+ _ (dst, IP_FLOW_HASH_DST_ADDR) \
+ _ (sport, IP_FLOW_HASH_SRC_PORT) \
+ _ (dport, IP_FLOW_HASH_DST_PORT) \
+ _ (proto, IP_FLOW_HASH_PROTO) \
+ _ (reverse, IP_FLOW_HASH_REVERSE_SRC_DST) \
+ _ (symmetric, IP_FLOW_HASH_SYMMETRIC)
-#define foreach_flow_hash_bit \
-_(src, IP_FLOW_HASH_SRC_ADDR) \
-_(dst, IP_FLOW_HASH_DST_ADDR) \
-_(sport, IP_FLOW_HASH_SRC_PORT) \
-_(dport, IP_FLOW_HASH_DST_PORT) \
-_(proto, IP_FLOW_HASH_PROTO) \
-_(reverse, IP_FLOW_HASH_REVERSE_SRC_DST) \
-_(symmetric, IP_FLOW_HASH_SYMMETRIC)
+#define foreach_flow_hash_bit \
+ _ (src, 0, IP_FLOW_HASH_SRC_ADDR) \
+ _ (dst, 1, IP_FLOW_HASH_DST_ADDR) \
+ _ (sport, 2, IP_FLOW_HASH_SRC_PORT) \
+ _ (dport, 3, IP_FLOW_HASH_DST_PORT) \
+ _ (proto, 4, IP_FLOW_HASH_PROTO) \
+ _ (reverse, 5, IP_FLOW_HASH_REVERSE_SRC_DST) \
+ _ (symmetric, 6, IP_FLOW_HASH_SYMMETRIC) \
+ _ (flowlabel, 7, IP_FLOW_HASH_FL)
/**
* A flow hash configuration is a mask of the flow hash options
*/
-typedef u32 flow_hash_config_t;
+typedef enum flow_hash_config_t_
+{
+#define _(a, b, c) c = (1 << b),
+ foreach_flow_hash_bit
+#undef _
+} flow_hash_config_t;
#endif /* __IP_TYPES_H__ */