Skip to content

Commit f026266

Browse files
committed
fix ff toos issue for mlx5 drivers.
1 parent 1137319 commit f026266

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

dpdk/drivers/net/mlx5/linux/mlx5_os.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/sockios.h>
1515
#include <linux/ethtool.h>
1616
#include <fcntl.h>
17+
#include <dlfcn.h>
1718

1819
#include <rte_malloc.h>
1920
#include <ethdev_driver.h>
@@ -2027,6 +2028,7 @@ mlx5_nl_esw_multiport_get(struct rte_pci_addr *pci_addr, int *enabled)
20272028

20282029
#define SYSFS_MPESW_PARAM_MAX_LEN 16
20292030

2031+
static char *(*real_if_indextoname)(unsigned int, char *) = NULL;
20302032
static int
20312033
mlx5_sysfs_esw_multiport_get(struct ibv_device *ibv, struct rte_pci_addr *pci_addr, int *enabled)
20322034
{
@@ -2056,7 +2058,16 @@ mlx5_sysfs_esw_multiport_get(struct ibv_device *ibv, struct rte_pci_addr *pci_ad
20562058
ifindex = mlx5_nl_ifindex(nl_rdma, ibv->name, i);
20572059
if (!ifindex)
20582060
continue;
2059-
if (!if_indextoname(ifindex, ifname))
2061+
2062+
// for ff tools
2063+
if (!real_if_indextoname) {
2064+
real_if_indextoname = __extension__ (char *(*)(unsigned int, char *))dlsym(RTLD_NEXT, "if_indextoname");
2065+
if (!real_if_indextoname) {
2066+
rte_errno = errno;
2067+
return -rte_errno;
2068+
}
2069+
}
2070+
if (!real_if_indextoname(ifindex, ifname))
20602071
continue;
20612072
MKSTR(sysfs_if_path, "/sys/class/net/%s", ifname);
20622073
if (mlx5_get_pci_addr(sysfs_if_path, &if_pci_addr))

0 commit comments

Comments
 (0)