From 5b55526da489def814a239a3ae6599fcb30dbb6e Mon Sep 17 00:00:00 2001 From: Xiaoming Jiang Date: Wed, 8 Mar 2023 06:49:19 +0000 Subject: dpdk: fix format rx/tx burst function name failed Type: fix Signed-off-by: Xiaoming Jiang Change-Id: I9971e69135e0652a36e4b4754774a43ea1d92e8b --- src/plugins/dpdk/device/format.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/dpdk/device/format.c b/src/plugins/dpdk/device/format.c index d3234d16f00..11435343cc8 100644 --- a/src/plugins/dpdk/device/format.c +++ b/src/plugins/dpdk/device/format.c @@ -17,9 +17,6 @@ #include #include -#define __USE_GNU -#include - #include #include #include @@ -347,7 +344,7 @@ 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 }; + clib_elf_symbol_t sym; #if RTE_VERSION < RTE_VERSION_NUM(21, 11, 0, 0) #define rte_eth_fp_ops rte_eth_devices @@ -356,10 +353,14 @@ format_dpdk_burst_fn (u8 *s, va_list *args) 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 || info.dli_sname == 0) - return format (s, "(not available)"); - - return format (s, "%s", info.dli_sname); + if (clib_elf_symbol_by_address (pointer_to_uword (p), &sym)) + { + return format (s, "%s", clib_elf_symbol_name (&sym)); + } + else + { + return format (s, "(not available)"); + } } static u8 * -- cgit 1.2.3-korg