1

I can get vendor and device IDs for the device providing a network interface using /sys/class/net/:

$ cat /sys/class/net/p4p2/device/vendor /sys/class/net/p4p2/device/device
0x15b3
0x1013

Then I can get lspci to show me info about that device:

$ lspci -d 0x15b3:0x1013
82:00.0 Infiniband controller: Mellanox Technologies MT27700 Family [ConnectX-4]
82:00.1 Ethernet controller: Mellanox Technologies MT27700 Family [ConnectX-4]

So it's dual-port. In this case I happen to know that device p4p2 is the ethernet side, but is there info in /sys/class/net/<dev> which links it to the 82:00.1 entry? Or some other way which doesn't require sudo?

lost
  • 214

2 Answers2

0

Try realpath /sys/class/net/<dev> or realpath /sys/class/net/<dev>/device.

Those should be symbolic links pointing to /sys/devices/..., and the target path should include the PCI ID.

If you need just the PCI ID part, try:

basename $(realpath /sys/class/net/<dev>/device)
telcoM
  • 96,466
0

Regarding Mellanox HCAs

There is not much information you can dig from lspci without sudo
Using your pci address: sudo lspci -s 82:00.0 -vvv will provide you HCA part number, serial number, PCI bus width and much more

Most of driver related information resides under /sys/bus/pci/devices/<pci_addr>/infiniband>

You also can use lshca utility. It shows you lot's of useful information

Example from Wiki:

#lshca
---------------------------------------------------------------------------------------------------
Dev #1
 Desc: Mellanox Technologies MT27800 Family [ConnectX-5]
 PN: MCX556A-ECAT  rev. A3
 PSID: MT_0000000008
 SN: MT.............
 FW: 16.28.2006
 Tempr: 45
---------------------------------------------------------------------------------------------------
  PCI_addr   |  RDMA  | Net  | Numa | IpStat  | Link | Rate | LnkCapWidth | LnkStaWidth | HCA_Type
---------------------------------------------------------------------------------------------------
0000:81:00.0 | mlx5_2 | ib2  |  1   | up_ip4  |  IB  | 100  |   x16 G3    |   x8 >!<    |  MT4119
0000:81:00.1 | mlx5_3 | p2p2 |  1   | up_ip46 | Eth  | 100  |   x16 G3    |   x8 >!<    |  MT4119
---------------------------------------------------------------------------------------------------

Disclaimer, I'm the lshca author

MrBr
  • 181