aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip/ip_api.c
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_api.c
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_api.c')
-rw-r--r--src/vnet/ip/ip_api.c37
1 files changed, 13 insertions, 24 deletions
diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c
index 228d252534c..37656f3232f 100644
--- a/src/vnet/ip/ip_api.c
+++ b/src/vnet/ip/ip_api.c
@@ -87,6 +87,7 @@
_ (IP_PUNT_POLICE, ip_punt_police) \
_ (IP_PUNT_REDIRECT, ip_punt_redirect) \
_ (SET_IP_FLOW_HASH, set_ip_flow_hash) \
+ _ (SET_IP_FLOW_HASH_V2, set_ip_flow_hash_v2) \
_ (IP_CONTAINER_PROXY_ADD_DEL, ip_container_proxy_add_del) \
_ (IP_CONTAINER_PROXY_DUMP, ip_container_proxy_dump) \
_ (IOAM_ENABLE, ioam_enable) \
@@ -1010,7 +1011,7 @@ vl_api_ip_dump_t_handler (vl_api_ip_dump_t * mp)
}
static void
-set_ip6_flow_hash (vl_api_set_ip_flow_hash_t * mp)
+vl_api_set_ip_flow_hash_t_handler (vl_api_set_ip_flow_hash_t *mp)
{
vl_api_set_ip_flow_hash_reply_t *rmp;
int rv;
@@ -1020,41 +1021,29 @@ set_ip6_flow_hash (vl_api_set_ip_flow_hash_t * mp)
table_id = ntohl (mp->vrf_id);
#define _(a,b) if (mp->a) flow_hash_config |= b;
- foreach_flow_hash_bit;
+ foreach_flow_hash_bit_v1;
#undef _
- rv = vnet_set_ip6_flow_hash (table_id, flow_hash_config);
+ rv = ip_flow_hash_set ((mp->is_ipv6 ? AF_IP6 : AF_IP4), table_id,
+ flow_hash_config);
REPLY_MACRO (VL_API_SET_IP_FLOW_HASH_REPLY);
}
static void
-set_ip4_flow_hash (vl_api_set_ip_flow_hash_t * mp)
+vl_api_set_ip_flow_hash_v2_t_handler (vl_api_set_ip_flow_hash_v2_t *mp)
{
- vl_api_set_ip_flow_hash_reply_t *rmp;
+ vl_api_set_ip_flow_hash_v2_reply_t *rmp;
+ ip_address_family_t af;
int rv;
- u32 table_id;
- flow_hash_config_t flow_hash_config = 0;
-
- table_id = ntohl (mp->vrf_id);
-
-#define _(a,b) if (mp->a) flow_hash_config |= b;
- foreach_flow_hash_bit;
-#undef _
-
- rv = vnet_set_ip4_flow_hash (table_id, flow_hash_config);
- REPLY_MACRO (VL_API_SET_IP_FLOW_HASH_REPLY);
-}
+ rv = ip_address_family_decode (mp->af, &af);
+ if (!rv)
+ rv = ip_flow_hash_set (af, htonl (mp->table_id),
+ htonl (mp->flow_hash_config));
-static void
-vl_api_set_ip_flow_hash_t_handler (vl_api_set_ip_flow_hash_t * mp)
-{
- if (mp->is_ipv6 == 0)
- set_ip4_flow_hash (mp);
- else
- set_ip6_flow_hash (mp);
+ REPLY_MACRO (VL_API_SET_IP_FLOW_HASH_V2_REPLY);
}
void