# IBVerbs kernel device name

**URL:** <https://forums.developer.nvidia.com/t/ibverbs-kernel-device-name/268940>\
**Category:** Mellanox OFED\
**Created:** [October 10, 2023, 4:29am UTC](https://forums.developer.nvidia.com/t/ibverbs-kernel-device-name/268940 "2023-10-10T04:29:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harry8](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Harry8](https://forums.developer.nvidia.com/u/Harry8)\
**Post date:** [October 10, 2023, 4:29am UTC](https://forums.developer.nvidia.com/t/ibverbs-kernel-device-name/268940/1 "2023-10-10T04:29:21Z")

</div>

Using ibverbs and ibv\_get\_device\_list() I need to select the device according the name used by linux.

eg enp3s0f1 but what is returened by struct ibv\_device → name is mlx5\_1, -\>dev\_name gives me “uverbs1”

dev\_path and ibdev\_path don’t seem to help much either.

I really do need select the device by enp3s0f1, how do I get it from ibverbs?

It’s a known mapping as mst status -v shows

```auto
$ sudo mst status -v
MST modules:
------------
    MST PCI module is not loaded
    MST PCI configuration module is not loaded
PCI devices:
------------
DEVICE_TYPE MST PCI RDMA NET NUMA  
ConnectX5(rev:0) NA 03:00.0 mlx5_0 net-enp3s0f0 -1    

ConnectX5(rev:0) NA 03:00.1 mlx5_1 net-enp3s0f1 -1

```

The best idea I have now is to attempt:

```auto
char syspath[1024];
snprintf(syspath, sizeof(syspath), "/sys/class/net/%s/device/infiniband/%s", kernel_name, dev_list[i]->name);
DIR* dir = opendir(syspath);
if(dir) { // found it }

```

What am I missing?

---

<div class="post-metadata">

**Author:** ![shim1](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/shim1/32/367020_2.png) [@shim1](https://forums.developer.nvidia.com/u/shim1)\
**Post date:** [October 13, 2023, 6:59am UTC](https://forums.developer.nvidia.com/t/ibverbs-kernel-device-name/268940/2 "2023-10-13T06:59:42Z")

</div>

Hi Harry

You can reference script ibdev2netdev  
It should in your server after you install the OFED

Thank you  
Meng, Shi
