From 16a456d6e0d683dbdf778e46e3e5ffe15361619c Mon Sep 17 00:00:00 2001 From: fengbojiang Date: Tue, 15 Jun 2021 17:48:26 +0800 Subject: [PATCH] MLX5: modify `if_indextoname` syscall to support F-Stack tools. --- doc/Launch_F-Stack_on_AWS_EC2_in_one_minute.md | 3 +-- dpdk/drivers/net/mlx5/linux/mlx5_ethdev_os.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/doc/Launch_F-Stack_on_AWS_EC2_in_one_minute.md b/doc/Launch_F-Stack_on_AWS_EC2_in_one_minute.md index 2eb218be9..e7eb261f0 100644 --- a/doc/Launch_F-Stack_on_AWS_EC2_in_one_minute.md +++ b/doc/Launch_F-Stack_on_AWS_EC2_in_one_minute.md @@ -3,14 +3,13 @@ If you have a Redhat7.3 EC2 instanceļ¼Œand 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 diff --git a/dpdk/drivers/net/mlx5/linux/mlx5_ethdev_os.c b/dpdk/drivers/net/mlx5/linux/mlx5_ethdev_os.c index 128845cb5..4d8efda07 100644 --- a/dpdk/drivers/net/mlx5/linux/mlx5_ethdev_os.c +++ b/dpdk/drivers/net/mlx5/linux/mlx5_ethdev_os.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -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; }