summaryrefslogtreecommitdiffstats
path: root/src/plugins/memif/device.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/memif/device.c')
-rw-r--r--src/plugins/memif/device.c42
1 files changed, 29 insertions, 13 deletions
diff --git a/src/plugins/memif/device.c b/src/plugins/memif/device.c
index 012c75327f1..fa3a4eda40d 100644
--- a/src/plugins/memif/device.c
+++ b/src/plugins/memif/device.c
@@ -42,12 +42,13 @@ typedef enum
MEMIF_TX_N_ERROR,
} memif_tx_func_error_t;
-static char *memif_tx_func_error_strings[] = {
+static __clib_unused char *memif_tx_func_error_strings[] = {
#define _(n,s) s,
foreach_memif_tx_func_error
#undef _
};
+#ifndef CLIB_MULTIARCH_VARIANT
u8 *
format_memif_device_name (u8 * s, va_list * args)
{
@@ -58,8 +59,9 @@ format_memif_device_name (u8 * s, va_list * args)
s = format (s, "memif%lu/%lu", mif->socket_file_index, mif->id);
return s;
}
+#endif
-static u8 *
+static __clib_unused u8 *
format_memif_device (u8 * s, va_list * args)
{
u32 dev_instance = va_arg (*args, u32);
@@ -75,7 +77,7 @@ format_memif_device (u8 * s, va_list * args)
return s;
}
-static u8 *
+static __clib_unused u8 *
format_memif_tx_trace (u8 * s, va_list * args)
{
s = format (s, "Unimplemented...");
@@ -256,9 +258,10 @@ error:
return frame->n_vectors;
}
-static uword
-memif_interface_tx (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * frame)
+uword
+CLIB_MULTIARCH_FN (memif_interface_tx) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
memif_main_t *nm = &memif_main;
vnet_interface_output_runtime_t *rund = (void *) node->runtime_data;
@@ -270,7 +273,7 @@ memif_interface_tx (vlib_main_t * vm,
return memif_interface_tx_inline (vm, node, frame, mif, MEMIF_RING_M2S);
}
-static void
+static __clib_unused void
memif_set_interface_next_node (vnet_main_t * vnm, u32 hw_if_index,
u32 node_index)
{
@@ -289,13 +292,13 @@ memif_set_interface_next_node (vnet_main_t * vnm, u32 hw_if_index,
vlib_node_add_next (vlib_get_main (), memif_input_node.index, node_index);
}
-static void
+static __clib_unused void
memif_clear_hw_interface_counters (u32 instance)
{
/* Nothing for now */
}
-static clib_error_t *
+static __clib_unused clib_error_t *
memif_interface_rx_mode_change (vnet_main_t * vnm, u32 hw_if_index, u32 qid,
vnet_hw_interface_rx_mode mode)
{
@@ -312,7 +315,7 @@ memif_interface_rx_mode_change (vnet_main_t * vnm, u32 hw_if_index, u32 qid,
return 0;
}
-static clib_error_t *
+static __clib_unused clib_error_t *
memif_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
{
memif_main_t *mm = &memif_main;
@@ -328,7 +331,7 @@ memif_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
return error;
}
-static clib_error_t *
+static __clib_unused clib_error_t *
memif_subif_add_del_function (vnet_main_t * vnm,
u32 hw_if_index,
struct vnet_sw_interface_t *st, int is_add)
@@ -337,6 +340,7 @@ memif_subif_add_del_function (vnet_main_t * vnm,
return 0;
}
+#ifndef CLIB_MULTIARCH_VARIANT
/* *INDENT-OFF* */
VNET_DEVICE_CLASS (memif_device_class) = {
.name = "memif",
@@ -353,8 +357,20 @@ VNET_DEVICE_CLASS (memif_device_class) = {
.rx_mode_change_function = memif_interface_rx_mode_change,
};
-VLIB_DEVICE_TX_FUNCTION_MULTIARCH(memif_device_class,
- memif_interface_tx)
+#if __x86_64__
+vlib_node_function_t __clib_weak memif_interface_tx_avx512;
+vlib_node_function_t __clib_weak memif_interface_tx_avx2;
+static void __clib_constructor
+dpdk_interface_tx_multiarch_select (void)
+{
+ if (memif_interface_tx_avx512 && clib_cpu_supports_avx512f ())
+ memif_device_class.tx_function = memif_interface_tx_avx512;
+ else if (memif_interface_tx_avx2 && clib_cpu_supports_avx2 ())
+ memif_device_class.tx_function = memif_interface_tx_avx2;
+}
+#endif
+#endif
+
/* *INDENT-ON* */
/*