X-Git-Url: https://gerrit.fd.io/r/gitweb?p=vpp.git;a=blobdiff_plain;f=src%2Fvnet%2Fip%2Fip_api.c;h=37656f3232fea4bb4eda31394ff22b6ca48863f4;hp=228d252534cb7297b1b84901f0667c2c2e616650;hb=f2984bbb0;hpb=03fabbd22215d306fb66c51f952480631d67c9dc 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