Skip to content

Commit

Permalink
MLX5: modify if_indextoname syscall to support F-Stack tools.
Browse files Browse the repository at this point in the history
  • Loading branch information
jfb8856606 committed Jun 15, 2021
1 parent b0e0328 commit 9eb89b0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
3 changes: 1 addition & 2 deletions doc/Launch_F-Stack_on_AWS_EC2_in_one_minute.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion dpdk/drivers/net/mlx5/linux/mlx5_ethdev_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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)
{
Expand All @@ -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;
}
Expand Down

0 comments on commit 9eb89b0

Please sign in to comment.