aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/interface_funcs.h
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-03-16 01:25:27 +0100
committerDamjan Marion <dmarion.lists@gmail.com>2018-05-10 15:45:03 +0000
commita35cc14d37466f0737fa928d25697fbfe6e7d657 (patch)
tree7242bb0bc9feebc35a2b1ab56986bc2a7ddb0ceb /src/vnet/interface_funcs.h
parentcd330c878dfdb9f52b372007a5086138b12d89f7 (diff)
vnet: device flow offload infra
Change-Id: Ibea4a96bdec5e368301a03d8b11a0712fa0265e0 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/interface_funcs.h')
-rw-r--r--src/vnet/interface_funcs.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/vnet/interface_funcs.h b/src/vnet/interface_funcs.h
index 6e188f7f543..3f910f9d13f 100644
--- a/src/vnet/interface_funcs.h
+++ b/src/vnet/interface_funcs.h
@@ -46,6 +46,14 @@ vnet_get_hw_interface (vnet_main_t * vnm, u32 hw_if_index)
return pool_elt_at_index (vnm->interface_main.hw_interfaces, hw_if_index);
}
+always_inline vnet_hw_interface_t *
+vnet_get_hw_interface_safe (vnet_main_t * vnm, u32 hw_if_index)
+{
+ if (!pool_is_free_index (vnm->interface_main.hw_interfaces, hw_if_index))
+ return pool_elt_at_index (vnm->interface_main.hw_interfaces, hw_if_index);
+ return (NULL);
+}
+
always_inline vnet_sw_interface_t *
vnet_get_sw_interface (vnet_main_t * vnm, u32 sw_if_index)
{
@@ -185,6 +193,19 @@ vnet_sw_interface_get_flags (vnet_main_t * vnm, u32 sw_if_index)
}
always_inline uword
+vnet_sw_interface_is_valid (vnet_main_t * vnm, u32 sw_if_index)
+{
+ return !pool_is_free_index (vnm->interface_main.sw_interfaces, sw_if_index);
+}
+
+always_inline uword
+vnet_hw_interface_is_valid (vnet_main_t * vnm, u32 hw_if_index)
+{
+ return !pool_is_free_index (vnm->interface_main.hw_interfaces, hw_if_index);
+}
+
+
+always_inline uword
vnet_sw_interface_is_admin_up (vnet_main_t * vnm, u32 sw_if_index)
{
return (vnet_sw_interface_get_flags (vnm, sw_if_index) &
@@ -305,6 +326,7 @@ int vnet_sw_interface_stats_collect_enable_disable (u32 sw_if_index,
/* Formats sw/hw interface. */
format_function_t format_vnet_hw_interface;
format_function_t format_vnet_hw_interface_rx_mode;
+format_function_t format_vnet_hw_if_index_name;
format_function_t format_vnet_sw_interface;
format_function_t format_vnet_sw_interface_name;
format_function_t format_vnet_sw_interface_name_override;