From: Jon Loeliger Date: Thu, 1 Feb 2018 17:19:29 +0000 (-0600) Subject: FIB: Consolidate several copies of fib_ip_proto() into one. X-Git-Tag: v18.04-rc1~397 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=735f8793bf3e8ad37c7e608663283b7d89b7101d;hp=5c42f50d2da0c1f32440d149abe246ad6498d273;p=vpp.git FIB: Consolidate several copies of fib_ip_proto() into one. Rather than having multiple copies of the same function scattered around, promote the function into the FIB PROTOCOL definitions in fib_types.h. Change-Id: I11c4d85931167d3a5f3dc1278afecc8845b23cd7 Signed-off-by: Jon Loeliger --- diff --git a/src/plugins/gtpu/gtpu.c b/src/plugins/gtpu/gtpu.c old mode 100755 new mode 100644 index eba0fa073b1..e5032b45271 --- a/src/plugins/gtpu/gtpu.c +++ b/src/plugins/gtpu/gtpu.c @@ -356,12 +356,6 @@ mcast_shared_remove (ip46_address_t * dst) hash_unset_mem_free (>pu_main.mcast_shared, dst); } -static inline fib_protocol_t -fib_ip_proto (bool is_ip6) -{ - return (is_ip6) ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4; -} - int vnet_gtpu_add_del_tunnel (vnet_gtpu_add_del_tunnel_args_t * a, u32 * sw_if_indexp) { diff --git a/src/vnet/fib/fib_types.h b/src/vnet/fib/fib_types.h index e3aef7a58df..75ed7799f12 100644 --- a/src/vnet/fib/fib_types.h +++ b/src/vnet/fib/fib_types.h @@ -16,6 +16,7 @@ #ifndef __FIB_TYPES_H__ #define __FIB_TYPES_H__ +#include #include #include #include @@ -71,6 +72,16 @@ typedef enum fib_protocol_t_ { _item <= FIB_PROTOCOL_IP6; \ _item++) +/** + * @brief Convert from boolean is_ip6 to FIB protocol. + * Drop MPLS on the floor in favor of IPv4. + */ +static inline fib_protocol_t +fib_ip_proto(bool is_ip6) +{ + return (is_ip6) ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4; +} + /** * @brief Convert from a protocol to a link type */ diff --git a/src/vnet/geneve/geneve.c b/src/vnet/geneve/geneve.c index 1fe73e44cdd..2cc43eda71d 100644 --- a/src/vnet/geneve/geneve.c +++ b/src/vnet/geneve/geneve.c @@ -351,12 +351,6 @@ mcast_shared_remove (ip46_address_t * remote) hash_unset_mem_free (&geneve_main.mcast_shared, remote); } -static inline fib_protocol_t -fib_ip_proto (bool is_ip6) -{ - return (is_ip6) ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4; -} - int vnet_geneve_add_del_tunnel (vnet_geneve_add_del_tunnel_args_t * a, u32 * sw_if_indexp) { diff --git a/src/vnet/vxlan-gpe/vxlan_gpe.c b/src/vnet/vxlan-gpe/vxlan_gpe.c index af5dd190693..ceec2529063 100644 --- a/src/vnet/vxlan-gpe/vxlan_gpe.c +++ b/src/vnet/vxlan-gpe/vxlan_gpe.c @@ -456,12 +456,6 @@ mcast_shared_remove (ip46_address_t * remote) hash_unset_mem_free (&vxlan_gpe_main.mcast_shared, remote); } -static inline fib_protocol_t -fib_ip_proto (bool is_ip6) -{ - return (is_ip6) ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4; -} - /** * @brief Add or Del a VXLAN GPE tunnel * diff --git a/src/vnet/vxlan/vxlan.c b/src/vnet/vxlan/vxlan.c index b0a186e2c05..64936c0e310 100644 --- a/src/vnet/vxlan/vxlan.c +++ b/src/vnet/vxlan/vxlan.c @@ -322,12 +322,6 @@ mcast_shared_remove(ip46_address_t *dst) hash_unset_mem_free (&vxlan_main.mcast_shared, dst); } -static inline fib_protocol_t -fib_ip_proto(bool is_ip6) -{ - return (is_ip6) ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4; -} - int vnet_vxlan_add_del_tunnel (vnet_vxlan_add_del_tunnel_args_t *a, u32 * sw_if_indexp) {