From f2984bbb013acb0d6872e8fbb2f9d57d3e4f49b9 Mon Sep 17 00:00:00 2001 From: Ahmed Abdelsalam Date: Fri, 20 Nov 2020 18:56:09 +0000 Subject: 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 Signed-off-by: Neale Ranns Change-Id: Id1aaa20c9dac729c22b714eea1cdd6e9e4d1f75e --- src/vnet/ip/ip_flow_hash.h | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) (limited to 'src/vnet/ip/ip_flow_hash.h') 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__ */ -- cgit 1.2.3-korg