• Parav Pandit's avatar
    devlink: Use controller while building phys_port_name · 66b17082
    Parav Pandit authored
    Now that controller number attribute is available, use it when
    building phsy_port_name for external controller ports.
    
    An example devlink port and representor netdev name consist of controller
    annotation for external controller with controller number = 1,
    for a VF 1 of PF 0:
    
    $ devlink port show pci/0000:06:00.0/2
    pci/0000:06:00.0/2: type eth netdev ens2f0c1pf0vf1 flavour pcivf controller 1 pfnum 0 vfnum 1 external true splittable false
      function:
        hw_addr 00:00:00:00:00:00
    
    $ devlink port show pci/0000:06:00.0/2 -jp
    {
        "port": {
            "pci/0000:06:00.0/2": {
                "type": "eth",
                "netdev": "ens2f0c1pf0vf1",
                "flavour": "pcivf",
                "controller": 1,
                "pfnum": 0,
                "vfnum": 1,
                "external": true,
                "splittable": false,
                "function": {
                    "hw_addr": "00:00:00:00:00:00"
                }
            }
        }
    }
    
    Controller number annotation is skipped for non external controllers to
    maintain backward compatibility.
    Signed-off-by: default avatarParav Pandit <parav@nvidia.com>
    Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    66b17082
devlink.c 247 KB