Skip to content

Commit 65105c9

Browse files
committed
dpdk: improve logging
Type: improvement Change-Id: If61d7409ff14b9f771c1dc8ec9f35e179cea7a28 Signed-off-by: Damjan Marion <[email protected]>
1 parent 7e9c778 commit 65105c9

File tree

3 files changed

+49
-10
lines changed

3 files changed

+49
-10
lines changed

src/plugins/dpdk/device/common.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ dpdk_device_setup (dpdk_device_t * xd)
8282

8383
rte_eth_dev_info_get (xd->port_id, &dev_info);
8484

85+
dpdk_log_debug ("[%u] configuring device %U", xd->port_id,
86+
format_dpdk_rte_device, dev_info.device);
87+
8588
/* create rx and tx offload wishlist */
8689
rxo = DEV_RX_OFFLOAD_IPV4_CKSUM;
8790
txo = 0;
@@ -118,8 +121,12 @@ dpdk_device_setup (dpdk_device_t * xd)
118121
rxo &= dev_info.rx_offload_capa;
119122
txo &= dev_info.tx_offload_capa;
120123

124+
dpdk_log_debug ("[%u] Supported RX offloads: %U", xd->port_id,
125+
format_dpdk_rx_offload_caps, dev_info.rx_offload_capa);
121126
dpdk_log_debug ("[%u] Configured RX offloads: %U", xd->port_id,
122127
format_dpdk_rx_offload_caps, rxo);
128+
dpdk_log_debug ("[%u] Supported TX offloads: %U", xd->port_id,
129+
format_dpdk_tx_offload_caps, dev_info.tx_offload_capa);
123130
dpdk_log_debug ("[%u] Configured TX offloads: %U", xd->port_id,
124131
format_dpdk_tx_offload_caps, txo);
125132

@@ -374,6 +381,11 @@ dpdk_device_start (dpdk_device_t * xd)
374381
return;
375382
}
376383

384+
dpdk_log_debug ("[%u] RX burst function: %U", xd->port_id,
385+
format_dpdk_burst_fn, xd, VLIB_RX);
386+
dpdk_log_debug ("[%u] TX burst function: %U", xd->port_id,
387+
format_dpdk_burst_fn, xd, VLIB_TX);
388+
377389
dpdk_setup_interrupts (xd);
378390

379391
if (xd->default_mac_address)

src/plugins/dpdk/device/dpdk.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,8 @@ format_function_t format_dpdk_flow;
473473
format_function_t format_dpdk_rss_hf_name;
474474
format_function_t format_dpdk_rx_offload_caps;
475475
format_function_t format_dpdk_tx_offload_caps;
476+
format_function_t format_dpdk_burst_fn;
477+
format_function_t format_dpdk_rte_device;
476478
vnet_flow_dev_ops_function_t dpdk_flow_ops_fn;
477479

478480
clib_error_t *unformat_rss_fn (unformat_input_t * input, uword * rss_fn);

src/plugins/dpdk/device/format.c

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -491,15 +491,25 @@ format_dpdk_device_module_info (u8 * s, va_list * args)
491491
return s;
492492
}
493493

494-
static const char *
495-
ptr2sname (void *p)
494+
u8 *
495+
format_dpdk_burst_fn (u8 *s, va_list *args)
496496
{
497+
dpdk_device_t *xd = va_arg (*args, dpdk_device_t *);
498+
vlib_rx_or_tx_t dir = va_arg (*args, vlib_rx_or_tx_t);
499+
void *p;
497500
Dl_info info = { 0 };
498501

502+
#if RTE_VERSION < RTE_VERSION_NUM(21, 11, 0, 0)
503+
#define rte_eth_fp_ops rte_eth_devices
504+
#endif
505+
506+
p = (dir == VLIB_TX) ? rte_eth_fp_ops[xd->port_id].tx_pkt_burst :
507+
rte_eth_fp_ops[xd->port_id].rx_pkt_burst;
508+
499509
if (dladdr (p, &info) == 0)
500510
return 0;
501511

502-
return info.dli_sname;
512+
return format (s, "%s", info.dli_sname);
503513
}
504514

505515
static u8 *
@@ -516,6 +526,25 @@ format_switch_info (u8 * s, va_list * args)
516526
return s;
517527
}
518528

529+
u8 *
530+
format_dpdk_rte_device (u8 *s, va_list *args)
531+
{
532+
struct rte_device *d = va_arg (*args, struct rte_device *);
533+
534+
if (!d)
535+
return format (s, "not available");
536+
537+
s = format (s, "name: %s, numa: %d", d->name, d->numa_node);
538+
539+
if (d->driver)
540+
s = format (s, ", driver: %s", d->driver->name);
541+
542+
if (d->bus)
543+
s = format (s, ", bus: %s", d->bus->name);
544+
545+
return s;
546+
}
547+
519548
u8 *
520549
format_dpdk_device (u8 * s, va_list * args)
521550
{
@@ -630,12 +659,8 @@ format_dpdk_device (u8 * s, va_list * args)
630659
"");
631660
}
632661

633-
#if RTE_VERSION < RTE_VERSION_NUM(21, 11, 0, 0)
634-
#define rte_eth_fp_ops rte_eth_devices
635-
#endif
636-
637-
s = format (s, "%Utx burst function: %s\n", format_white_space, indent + 2,
638-
ptr2sname (rte_eth_fp_ops[xd->port_id].tx_pkt_burst));
662+
s = format (s, "%Utx burst function: %U\n", format_white_space, indent + 2,
663+
format_dpdk_burst_fn, xd, VLIB_RX);
639664

640665
if (rte_eth_rx_burst_mode_get (xd->port_id, 0, &mode) == 0)
641666
{
@@ -646,7 +671,7 @@ format_dpdk_device (u8 * s, va_list * args)
646671
}
647672

648673
s = format (s, "%Urx burst function: %s\n", format_white_space, indent + 2,
649-
ptr2sname (rte_eth_devices[xd->port_id].rx_pkt_burst));
674+
format_dpdk_burst_fn, xd, VLIB_TX);
650675

651676
/* $$$ MIB counters */
652677
{

0 commit comments

Comments
 (0)