Skip to content

Commit 16f94e1

Browse files
committed
MLX5: modify if_indextoname syscall to support F-Stack tools.
1 parent 908bfc2 commit 16f94e1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

dpdk/drivers/net/mlx5/mlx5_ethdev.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <stdalign.h>
2525
#include <sys/un.h>
2626
#include <time.h>
27+
#include <dlfcn.h>
2728

2829
#include <rte_atomic.h>
2930
#include <rte_ethdev_driver.h>
@@ -1640,6 +1641,7 @@ mlx5_dev_to_eswitch_info(struct rte_eth_dev *dev)
16401641
* @return
16411642
* 0 on success, a negative errno value otherwise and rte_errno is set.
16421643
*/
1644+
static int (*real_if_indextoname)(unsigned int, char *);
16431645
int
16441646
mlx5_sysfs_switch_info(unsigned int ifindex, struct mlx5_switch_info *info)
16451647
{
@@ -1659,7 +1661,16 @@ mlx5_sysfs_switch_info(unsigned int ifindex, struct mlx5_switch_info *info)
16591661
char c;
16601662
int ret;
16611663

1662-
if (!if_indextoname(ifindex, ifname)) {
1664+
// for ff tools
1665+
if (!real_if_indextoname) {
1666+
real_if_indextoname = dlsym(RTLD_NEXT, "if_indextoname");
1667+
if (!real_if_indextoname) {
1668+
rte_errno = errno;
1669+
return -rte_errno;
1670+
}
1671+
}
1672+
1673+
if (!real_if_indextoname(ifindex, ifname)) {
16631674
rte_errno = errno;
16641675
return -rte_errno;
16651676
}

0 commit comments

Comments
 (0)