MLX5: modify `if_indextoname` syscall to support F-Stack tools.

This commit is contained in:
fengbojiang 2021-06-15 17:48:26 +08:00
parent cf06e8b0b7
commit 16a456d6e0
2 changed files with 13 additions and 3 deletions

View File

@ -3,14 +3,13 @@
If you have a Redhat7.3 EC2 instanceand then execute the following cmds, you will get the F-Stack server in one minute
sudo -i
yum install -y git gcc openssl-devel kernel-devel-$(uname -r) bc numactl-devel mkdir make net-tools vim pciutils iproute pcre-devel zlib-devel elfutils-libelf-devel vim
yum install -y git gcc openssl-devel kernel-devel-$(uname -r) bc numactl-devel mkdir make net-tools vim pciutils iproute pcre-devel zlib-devel elfutils-libelf-devel meson
mkdir /data/f-stack
git clone https://github.com/F-Stack/f-stack.git /data/f-stack
# Compile DPDK
cd /data/f-stack/dpdk
cd dpdk/
meson -Denable_kmods=true build
ninja -C build
ninja -C build install

View File

@ -23,6 +23,7 @@
#include <stdalign.h>
#include <sys/un.h>
#include <time.h>
#include <dlfcn.h>
#include <rte_ethdev_driver.h>
#include <rte_bus_pci.h>
@ -1027,6 +1028,7 @@ mlx5_sysfs_check_switch_info(bool device_dir,
* @return
* 0 on success, a negative errno value otherwise and rte_errno is set.
*/
static int (*real_if_indextoname)(unsigned int, char *);
int
mlx5_sysfs_switch_info(unsigned int ifindex, struct mlx5_switch_info *info)
{
@ -1046,7 +1048,16 @@ mlx5_sysfs_switch_info(unsigned int ifindex, struct mlx5_switch_info *info)
char c;
int ret;
if (!if_indextoname(ifindex, ifname)) {
// for ff tools
if (!real_if_indextoname) {
real_if_indextoname = dlsym(RTLD_NEXT, "if_indextoname");
if (!real_if_indextoname) {
rte_errno = errno;
return -rte_errno;
}
}
if (!real_if_indextoname(ifindex, ifname)) {
rte_errno = errno;
return -rte_errno;
}