aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-08-10 22:39:11 +0200
committerDamjan Marion <dmarion@me.com>2018-08-13 14:33:54 +0000
commit6e36351faf5b69a0bfb8235b3b06f8b2c24e5547 (patch)
tree512c92bda1a48604fbfbc7bbbb1e4b613cdba614 /src/plugins
parent3bf6c2bfe59be62169a1245340722481b0b53870 (diff)
Multiarch handling in different constructor macros
This significantly reduces need for ... in multiarch code. Simply constructor macros will jost create static unused entry if CLIB_MARCH_VARIANT is defined and that will be optimized out by compiler. Change-Id: I17d1c4ac0c903adcfadaa4a07de1b854c7ab14ac Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/acl/dataplane_node.c7
-rw-r--r--src/plugins/avf/input.c2
-rw-r--r--src/plugins/dpdk/device/device.c11
-rw-r--r--src/plugins/dpdk/device/dpdk.h5
-rw-r--r--src/plugins/dpdk/device/node.c4
-rw-r--r--src/plugins/dpdk/main.c3
-rw-r--r--src/plugins/memif/device.c19
-rw-r--r--src/plugins/memif/node.c2
8 files changed, 16 insertions, 37 deletions
diff --git a/src/plugins/acl/dataplane_node.c b/src/plugins/acl/dataplane_node.c
index 00cad47fb23..79ee5010c26 100644
--- a/src/plugins/acl/dataplane_node.c
+++ b/src/plugins/acl/dataplane_node.c
@@ -415,7 +415,6 @@ VLIB_NODE_FN (acl_out_fa_ip4_node) (vlib_main_t * vm,
return acl_fa_node_fn (vm, node, frame, 0, 0, 0, 0, &acl_out_fa_ip4_node);
}
-#ifndef CLIB_MARCH_VARIANT
static u8 *
format_fa_5tuple (u8 * s, va_list * args)
{
@@ -447,14 +446,16 @@ format_fa_5tuple (u8 * s, va_list * args)
p5t->pkt.tcp_flags, p5t->pkt.flags_reserved);
}
+#ifndef CLIB_MARCH_VARIANT
u8 *
format_acl_plugin_5tuple (u8 * s, va_list * args)
{
return format_fa_5tuple (s, args);
}
+#endif
/* packet trace format function */
-u8 *
+static u8 *
format_acl_plugin_trace (u8 * s, va_list * args)
{
CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
@@ -475,7 +476,6 @@ format_acl_plugin_trace (u8 * s, va_list * args)
return s;
}
-
/* *INDENT-OFF* */
static char *acl_fa_error_strings[] = {
@@ -634,7 +634,6 @@ VNET_FEATURE_INIT (acl_out_ip4_fa_feature, static) =
.node_name = "acl-plugin-out-ip4-fa",
.runs_before = VNET_FEATURES ("interface-output"),
};
-#endif
/* *INDENT-ON* */
diff --git a/src/plugins/avf/input.c b/src/plugins/avf/input.c
index d11c3cfef64..27c3683f57c 100644
--- a/src/plugins/avf/input.c
+++ b/src/plugins/avf/input.c
@@ -530,7 +530,6 @@ VLIB_NODE_FN (avf_input_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
return n_rx;
}
-#ifndef CLIB_MARCH_VARIANT
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (avf_input_node) = {
.name = "avf-input",
@@ -541,7 +540,6 @@ VLIB_REGISTER_NODE (avf_input_node) = {
.n_errors = AVF_INPUT_N_ERROR,
.error_strings = avf_input_error_strings,
};
-#endif
/* *INDENT-ON* */
diff --git a/src/plugins/dpdk/device/device.c b/src/plugins/dpdk/device/device.c
index 8776e09ed05..b2c87c7930d 100644
--- a/src/plugins/dpdk/device/device.c
+++ b/src/plugins/dpdk/device/device.c
@@ -37,7 +37,6 @@ typedef enum
DPDK_TX_FUNC_N_ERROR,
} dpdk_tx_func_error_t;
-#ifndef CLIB_MARCH_VARIANT
static char *dpdk_tx_func_error_strings[] = {
#define _(n,s) s,
foreach_dpdk_tx_func_error
@@ -65,7 +64,6 @@ dpdk_set_mac_address (vnet_hw_interface_t * hi, char *address)
return NULL;
}
}
-#endif
static struct rte_mbuf *
dpdk_replicate_packet_mb (vlib_buffer_t * b)
@@ -516,7 +514,6 @@ VNET_DEVICE_CLASS_TX_FN (dpdk_device_class) (vlib_main_t * vm,
return tx_pkts;
}
-#ifndef CLIB_MARCH_VARIANT
static void
dpdk_clear_hw_interface_counters (u32 instance)
{
@@ -677,12 +674,9 @@ VNET_DEVICE_CLASS (dpdk_device_class) = {
};
/* *INDENT-ON* */
-#endif
-
#define UP_DOWN_FLAG_EVENT 1
-#ifndef CLIB_MARCH_VARIANT
-uword
+static uword
admin_up_down_process (vlib_main_t * vm,
vlib_node_runtime_t * rt, vlib_frame_t * f)
{
@@ -726,14 +720,13 @@ admin_up_down_process (vlib_main_t * vm,
}
/* *INDENT-OFF* */
-VLIB_REGISTER_NODE (admin_up_down_process_node,static) = {
+VLIB_REGISTER_NODE (admin_up_down_process_node) = {
.function = admin_up_down_process,
.type = VLIB_NODE_TYPE_PROCESS,
.name = "admin-up-down-process",
.process_log2_n_stack_bytes = 17, // 256KB
};
/* *INDENT-ON* */
-#endif
/*
* fd.io coding-style-patch-verification: ON
diff --git a/src/plugins/dpdk/device/dpdk.h b/src/plugins/dpdk/device/dpdk.h
index 2a3794735d2..c39f1f950c6 100644
--- a/src/plugins/dpdk/device/dpdk.h
+++ b/src/plugins/dpdk/device/dpdk.h
@@ -60,6 +60,7 @@
extern vnet_device_class_t dpdk_device_class;
extern vlib_node_registration_t dpdk_input_node;
+extern vlib_node_registration_t admin_up_down_process_node;
#define foreach_dpdk_pmd \
_ ("net_thunderx", THUNDERX) \
@@ -521,10 +522,6 @@ clib_error_t *unformat_rss_fn (unformat_input_t * input, uword * rss_fn);
clib_error_t *unformat_hqos (unformat_input_t * input,
dpdk_device_config_hqos_t * hqos);
-uword
-admin_up_down_process (vlib_main_t * vm,
- vlib_node_runtime_t * rt, vlib_frame_t * f);
-
clib_error_t *dpdk_pool_create (vlib_main_t * vm, u8 * pool_name,
u32 elt_size, u32 num_elts,
u32 pool_priv_size, u16 cache_size, u8 numa,
diff --git a/src/plugins/dpdk/device/node.c b/src/plugins/dpdk/device/node.c
index 8fc8f410ee3..3a7e2789151 100644
--- a/src/plugins/dpdk/device/node.c
+++ b/src/plugins/dpdk/device/node.c
@@ -28,13 +28,11 @@
#include <dpdk/device/dpdk_priv.h>
-#ifndef CLIB_MARCH_VARIANT
static char *dpdk_error_strings[] = {
#define _(n,s) s,
foreach_dpdk_error
#undef _
};
-#endif
STATIC_ASSERT (VNET_DEVICE_INPUT_NEXT_IP4_INPUT - 1 ==
VNET_DEVICE_INPUT_NEXT_IP4_NCS_INPUT,
@@ -644,7 +642,6 @@ VLIB_NODE_FN (dpdk_input_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
return n_rx_packets;
}
-#ifndef CLIB_MARCH_VARIANT
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (dpdk_input_node) = {
.type = VLIB_NODE_TYPE_INPUT,
@@ -661,7 +658,6 @@ VLIB_REGISTER_NODE (dpdk_input_node) = {
.error_strings = dpdk_error_strings,
};
/* *INDENT-ON* */
-#endif
/*
* fd.io coding-style-patch-verification: ON
diff --git a/src/plugins/dpdk/main.c b/src/plugins/dpdk/main.c
index 2c80ff57c26..72dffca7c4d 100644
--- a/src/plugins/dpdk/main.c
+++ b/src/plugins/dpdk/main.c
@@ -58,7 +58,8 @@ rte_delay_us_override (unsigned us)
/* Only suspend for the admin_down_process */
vlib_process_t *proc = vlib_get_current_process (vm);
if (!(proc->flags & VLIB_PROCESS_IS_RUNNING) ||
- (proc->node_runtime.function != admin_up_down_process))
+ (proc->node_runtime.node_index !=
+ admin_up_down_process_node.index))
return 0;
f64 delay = 1e-6 * us;
diff --git a/src/plugins/memif/device.c b/src/plugins/memif/device.c
index f86d692a103..a05ab87a864 100644
--- a/src/plugins/memif/device.c
+++ b/src/plugins/memif/device.c
@@ -40,7 +40,7 @@ typedef enum
MEMIF_TX_N_ERROR,
} memif_tx_func_error_t;
-static __clib_unused char *memif_tx_func_error_strings[] = {
+static char *memif_tx_func_error_strings[] = {
#define _(n,s) s,
foreach_memif_tx_func_error
#undef _
@@ -61,7 +61,7 @@ format_memif_device_name (u8 * s, va_list * args)
}
#endif
-static __clib_unused u8 *
+static u8 *
format_memif_device (u8 * s, va_list * args)
{
u32 dev_instance = va_arg (*args, u32);
@@ -77,7 +77,7 @@ format_memif_device (u8 * s, va_list * args)
return s;
}
-static __clib_unused u8 *
+static u8 *
format_memif_tx_trace (u8 * s, va_list * args)
{
s = format (s, "Unimplemented...");
@@ -432,7 +432,7 @@ VNET_DEVICE_CLASS_TX_FN (memif_device_class) (vlib_main_t * vm,
mq, ptd);
}
-static __clib_unused void
+static void
memif_set_interface_next_node (vnet_main_t * vnm, u32 hw_if_index,
u32 node_index)
{
@@ -451,13 +451,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 __clib_unused void
+static void
memif_clear_hw_interface_counters (u32 instance)
{
/* Nothing for now */
}
-static __clib_unused clib_error_t *
+static clib_error_t *
memif_interface_rx_mode_change (vnet_main_t * vnm, u32 hw_if_index, u32 qid,
vnet_hw_interface_rx_mode mode)
{
@@ -474,7 +474,7 @@ memif_interface_rx_mode_change (vnet_main_t * vnm, u32 hw_if_index, u32 qid,
return 0;
}
-static __clib_unused clib_error_t *
+static clib_error_t *
memif_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
{
memif_main_t *mm = &memif_main;
@@ -490,7 +490,7 @@ memif_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
return error;
}
-static __clib_unused clib_error_t *
+static 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)
@@ -499,7 +499,6 @@ memif_subif_add_del_function (vnet_main_t * vnm,
return 0;
}
-#ifndef CLIB_MARCH_VARIANT
/* *INDENT-OFF* */
VNET_DEVICE_CLASS (memif_device_class) = {
.name = "memif",
@@ -515,8 +514,6 @@ VNET_DEVICE_CLASS (memif_device_class) = {
.rx_mode_change_function = memif_interface_rx_mode_change,
};
-#endif
-
/* *INDENT-ON* */
/*
diff --git a/src/plugins/memif/node.c b/src/plugins/memif/node.c
index 726adb886a5..53a355361a6 100644
--- a/src/plugins/memif/node.c
+++ b/src/plugins/memif/node.c
@@ -885,7 +885,6 @@ VLIB_NODE_FN (memif_input_node) (vlib_main_t * vm,
return n_rx;
}
-#ifndef CLIB_MARCH_VARIANT
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (memif_input_node) = {
.name = "memif-input",
@@ -896,7 +895,6 @@ VLIB_REGISTER_NODE (memif_input_node) = {
.n_errors = MEMIF_INPUT_N_ERROR,
.error_strings = memif_input_error_strings,
};
-#endif
/* *INDENT-ON* */