mirror of https://github.com/F-Stack/f-stack.git
MLX5: modify `if_indextoname` syscall to support F-Stack tools.
This commit is contained in:
parent
823b1d7cf4
commit
a3702d0636
|
@ -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>
|
||||
|
@ -1070,6 +1071,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)
|
||||
{
|
||||
|
@ -1088,7 +1090,16 @@ mlx5_sysfs_switch_info(unsigned int ifindex, struct mlx5_switch_info *info)
|
|||
bool device_dir = false;
|
||||
char c;
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue