HowTo Find the Logical-to-Physical Port Mapping (Linux)

Version 5

    This post presents several ways to map the physical port and card to logical port name (e.g. eth1).






    If MLNX_OFED is installed, use the following command:

    # ibdev2netdev

    mlx4_0 port 1 ==> eth2 (Up)

    mlx4_0 port 2 ==> ib0 (Down)      


    Another nice option is to use MST (Mellanox Software Tools) to get the PCI as well:

    # mst start

    Starting MST (Mellanox Software Tools) driver set

    Loading MST PCI module - Success

    Loading MST PCI configuration module - Success

    Create devices

    # mst status -v

    MST modules:


        MST PCI module loaded

        MST PCI configuration module loaded

    PCI devices:


    DEVICE_TYPE             MST                           PCI       RDMA    NET                       NUMA

    ConnectX3(rev:1)        /dev/mst/mt4099_pciconf0

    ConnectX3(rev:1)        /dev/mst/mt4099_pci_cr0       0a:00.0   mlx4_0  net-ib0,net-eth2          0


    Inbox Driver

    If the Inbox driver is used, run the following command:

    cat /sys/class/net/MLNX_DEVICE/device/infiniband_verbs/uverbs0/ibdev


    MLNX_DEVICE may be eth2, eth3, ib0, ib1, etc.


    For example:

    # cat /sys/class/net/eth2/device/infiniband_verbs/uverbs0/ibdev


    Note: In this instance mlx4_0 is the adapter card number of the server. If there is more than one card it will have added numbering (e.g. mlx4_1, mlx4_2, etc).


    To get the post number run the following command and add 1 to the result.


    cat /sys/class/net/DEVICE/dev_id


    For example:

    # cat /sys/class/net/eth2/dev_id

    0x0 --> Port 1

    # cat /sys/class/net/ib0/dev_id

    0x1 --> Port 2