summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2017-05-22 15:32:04 +0200
committerDave Barach <openvpp@barachs.net>2017-05-22 16:10:07 +0000
commit10980465ce97eceff05ac94a69a13d63d3cfa70a (patch)
tree0db3f8553c920e445c6283c2c78b3947f1632d1e /src/plugins
parent0eb874e7fd34d74edd0619674561995ddf3b20ae (diff)
dpdk: make dpdk global debug level configurable
Adds startup.conf knob: dpdk { log-level debug } Change-Id: I80dfbc00559528d7b0970958fba9f08d97aa7118 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/dpdk/device/dpdk.h2
-rw-r--r--src/plugins/dpdk/device/format.c54
-rwxr-xr-xsrc/plugins/dpdk/device/init.c7
3 files changed, 30 insertions, 33 deletions
diff --git a/src/plugins/dpdk/device/dpdk.h b/src/plugins/dpdk/device/dpdk.h
index 6364d163632..ab5da5672ec 100644
--- a/src/plugins/dpdk/device/dpdk.h
+++ b/src/plugins/dpdk/device/dpdk.h
@@ -432,7 +432,7 @@ format_function_t format_dpdk_tx_dma_trace;
format_function_t format_dpdk_rx_dma_trace;
format_function_t format_dpdk_rte_mbuf;
format_function_t format_dpdk_rx_rte_mbuf;
-unformat_function_t unformat_socket_mem;
+unformat_function_t unformat_dpdk_log_level;
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);
diff --git a/src/plugins/dpdk/device/format.c b/src/plugins/dpdk/device/format.c
index 0b67eae3c45..8fe668918e7 100644
--- a/src/plugins/dpdk/device/format.c
+++ b/src/plugins/dpdk/device/format.c
@@ -143,6 +143,16 @@
foreach_dpdk_pkt_rx_offload_flag \
foreach_dpdk_pkt_tx_offload_flag
+#define foreach_dpdk_log_level \
+ _ (EMERG, "emergency") \
+ _ (ALERT, "alert") \
+ _ (CRIT, "critical") \
+ _ (ERR, "error") \
+ _ (WARNING, "warning") \
+ _ (NOTICE, "notice") \
+ _ (INFO, "info") \
+ _ (DEBUG, "debug")
+
u8 *
format_dpdk_device_name (u8 * s, va_list * args)
{
@@ -704,36 +714,6 @@ format_dpdk_rte_mbuf (u8 * s, va_list * va)
return s;
}
-/* FIXME is this function used? */
-#if 0
-uword
-unformat_socket_mem (unformat_input_t * input, va_list * va)
-{
- uword **r = va_arg (*va, uword **);
- int i = 0;
- u32 mem;
-
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, ","))
- hash_set (*r, i, 1024);
- else if (unformat (input, "%u,", &mem))
- hash_set (*r, i, mem);
- else if (unformat (input, "%u", &mem))
- hash_set (*r, i, mem);
- else
- {
- unformat_put_input (input);
- goto done;
- }
- i++;
- }
-
-done:
- return 1;
-}
-#endif
-
clib_error_t *
unformat_rss_fn (unformat_input_t * input, uword * rss_fn)
{
@@ -757,6 +737,20 @@ unformat_rss_fn (unformat_input_t * input, uword * rss_fn)
return 0;
}
+uword
+unformat_dpdk_log_level (unformat_input_t * input, va_list * args)
+{
+ u32 *r = va_arg (*args, u32 *);
+
+ if (0);
+#define _(v,s) else if (unformat (input, s)) *r = RTE_LOG_##v;
+ foreach_dpdk_log_level
+#undef _
+ else
+ return 0;
+ return 1;
+}
+
clib_error_t *
unformat_hqos (unformat_input_t * input, dpdk_device_config_hqos_t * hqos)
{
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index 545a15e802c..a972394c374 100755
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -810,6 +810,7 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
dpdk_device_config_t *devconf;
vlib_pci_addr_t pci_addr;
unformat_input_t sub_input;
+ uword x;
u8 *s, *tmp = 0;
u8 *rte_cmd = 0, *ethname = 0;
u32 log_level;
@@ -822,6 +823,7 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
u8 *socket_mem = 0;
conf->device_config_index_by_pci_addr = hash_create (0, sizeof (uword));
+ log_level = RTE_LOG_NOTICE;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
@@ -838,6 +840,9 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
else if (unformat (input, "decimal-interface-names"))
conf->interface_name_format_decimal = 1;
+ else if (unformat (input, "log-level %U", unformat_dpdk_log_level, &x))
+ log_level = x;
+
else if (unformat (input, "no-multi-seg"))
conf->no_multi_seg = 1;
@@ -1175,8 +1180,6 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
/* Set up DPDK eal and packet mbuf pool early. */
- log_level = (CLIB_DEBUG > 0) ? RTE_LOG_DEBUG : RTE_LOG_NOTICE;
-
#if RTE_VERSION >= RTE_VERSION_NUM(17, 5, 0, 0)
rte_log_set_global_level (log_level);
#else