dpdk: improve logging 94/34894/4
authorDamjan Marion <damarion@cisco.com>
Wed, 12 Jan 2022 17:46:29 +0000 (18:46 +0100)
committerDamjan Marion <damarion@cisco.com>
Wed, 12 Jan 2022 18:49:50 +0000 (19:49 +0100)
Type: improvement
Change-Id: If61d7409ff14b9f771c1dc8ec9f35e179cea7a28
Signed-off-by: Damjan Marion <damarion@cisco.com>
src/plugins/dpdk/device/common.c
src/plugins/dpdk/device/dpdk.h
src/plugins/dpdk/device/format.c

index 15424ac..8396386 100644 (file)
@@ -82,6 +82,9 @@ dpdk_device_setup (dpdk_device_t * xd)
 
   rte_eth_dev_info_get (xd->port_id, &dev_info);
 
+  dpdk_log_debug ("[%u] configuring device %U", xd->port_id,
+                 format_dpdk_rte_device, dev_info.device);
+
   /* create rx and tx offload wishlist */
   rxo = DEV_RX_OFFLOAD_IPV4_CKSUM;
   txo = 0;
@@ -118,8 +121,12 @@ dpdk_device_setup (dpdk_device_t * xd)
   rxo &= dev_info.rx_offload_capa;
   txo &= dev_info.tx_offload_capa;
 
+  dpdk_log_debug ("[%u] Supported RX offloads: %U", xd->port_id,
+                 format_dpdk_rx_offload_caps, dev_info.rx_offload_capa);
   dpdk_log_debug ("[%u] Configured RX offloads: %U", xd->port_id,
                  format_dpdk_rx_offload_caps, rxo);
+  dpdk_log_debug ("[%u] Supported TX offloads: %U", xd->port_id,
+                 format_dpdk_tx_offload_caps, dev_info.tx_offload_capa);
   dpdk_log_debug ("[%u] Configured TX offloads: %U", xd->port_id,
                  format_dpdk_tx_offload_caps, txo);
 
@@ -374,6 +381,11 @@ dpdk_device_start (dpdk_device_t * xd)
       return;
     }
 
+  dpdk_log_debug ("[%u] RX burst function: %U", xd->port_id,
+                 format_dpdk_burst_fn, xd, VLIB_RX);
+  dpdk_log_debug ("[%u] TX burst function: %U", xd->port_id,
+                 format_dpdk_burst_fn, xd, VLIB_TX);
+
   dpdk_setup_interrupts (xd);
 
   if (xd->default_mac_address)
index 7a941e2..1ebda6c 100644 (file)
@@ -473,6 +473,8 @@ format_function_t format_dpdk_flow;
 format_function_t format_dpdk_rss_hf_name;
 format_function_t format_dpdk_rx_offload_caps;
 format_function_t format_dpdk_tx_offload_caps;
+format_function_t format_dpdk_burst_fn;
+format_function_t format_dpdk_rte_device;
 vnet_flow_dev_ops_function_t dpdk_flow_ops_fn;
 
 clib_error_t *unformat_rss_fn (unformat_input_t * input, uword * rss_fn);
index 20f5f74..3ff66ed 100644 (file)
@@ -491,15 +491,25 @@ format_dpdk_device_module_info (u8 * s, va_list * args)
   return s;
 }
 
-static const char *
-ptr2sname (void *p)
+u8 *
+format_dpdk_burst_fn (u8 *s, va_list *args)
 {
+  dpdk_device_t *xd = va_arg (*args, dpdk_device_t *);
+  vlib_rx_or_tx_t dir = va_arg (*args, vlib_rx_or_tx_t);
+  void *p;
   Dl_info info = { 0 };
 
+#if RTE_VERSION < RTE_VERSION_NUM(21, 11, 0, 0)
+#define rte_eth_fp_ops rte_eth_devices
+#endif
+
+  p = (dir == VLIB_TX) ? rte_eth_fp_ops[xd->port_id].tx_pkt_burst :
+                        rte_eth_fp_ops[xd->port_id].rx_pkt_burst;
+
   if (dladdr (p, &info) == 0)
     return 0;
 
-  return info.dli_sname;
+  return format (s, "%s", info.dli_sname);
 }
 
 static u8 *
@@ -516,6 +526,25 @@ format_switch_info (u8 * s, va_list * args)
   return s;
 }
 
+u8 *
+format_dpdk_rte_device (u8 *s, va_list *args)
+{
+  struct rte_device *d = va_arg (*args, struct rte_device *);
+
+  if (!d)
+    return format (s, "not available");
+
+  s = format (s, "name: %s, numa: %d", d->name, d->numa_node);
+
+  if (d->driver)
+    s = format (s, ", driver: %s", d->driver->name);
+
+  if (d->bus)
+    s = format (s, ", bus: %s", d->bus->name);
+
+  return s;
+}
+
 u8 *
 format_dpdk_device (u8 * s, va_list * args)
 {
@@ -630,12 +659,8 @@ format_dpdk_device (u8 * s, va_list * args)
                                                              "");
     }
 
-#if RTE_VERSION < RTE_VERSION_NUM(21, 11, 0, 0)
-#define rte_eth_fp_ops rte_eth_devices
-#endif
-
-  s = format (s, "%Utx burst function: %s\n", format_white_space, indent + 2,
-             ptr2sname (rte_eth_fp_ops[xd->port_id].tx_pkt_burst));
+  s = format (s, "%Utx burst function: %U\n", format_white_space, indent + 2,
+             format_dpdk_burst_fn, xd, VLIB_RX);
 
   if (rte_eth_rx_burst_mode_get (xd->port_id, 0, &mode) == 0)
     {
@@ -646,7 +671,7 @@ format_dpdk_device (u8 * s, va_list * args)
     }
 
   s = format (s, "%Urx burst function: %s\n", format_white_space, indent + 2,
-             ptr2sname (rte_eth_devices[xd->port_id].rx_pkt_burst));
+             format_dpdk_burst_fn, xd, VLIB_TX);
 
   /* $$$ MIB counters  */
   {