From: David Ahern Date: Tue, 2 Feb 2021 02:45:49 +0000 (+0000) Subject: Merge branch 'devlink-port-mgmt' into next X-Git-Tag: v5.12.0~26^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d10f2a4bd8f82fd009c059d40844095593f5b014;p=thirdparty%2Fiproute2.git Merge branch 'devlink-port-mgmt' into next Parav Pandit says: ==================== This patchset implements devlink port add, delete and function state management commands. An example sequence for a PCI SF: Set the device in switchdev mode: $ devlink dev eswitch set pci/0000:06:00.0 mode switchdev View ports in switchdev mode: $ devlink port show pci/0000:06:00.0/65535: type eth netdev ens2f0np0 flavour physical port 0 s= plittable false Add a subfunction port for PCI PF 0 with sfnumber 88: $ devlink port add pci/0000:06:00.0 flavour pcisf pfnum 0 sfnum 88 pci/0000:08:00.0/32768: type eth netdev eth6 flavour pcisf controller 0 pfn= um 0 sfnum 88 splittable false function: hw_addr 00:00:00:00:00:00 state inactive opstate detached Show a newly added port: $ devlink port show pci/0000:06:00.0/32768 pci/0000:06:00.0/32768: type eth netdev ens2f0npf0sf88 flavour pcisf contro= ller 0 pfnum 0 sfnum 88 splittable false function: hw_addr 00:00:00:00:00:00 state inactive opstate detached Set the function state to active: $ devlink port function set pci/0000:06:00.0/32768 hw_addr 00:00:00:00:88:8= 8 state active Show the port in JSON format: $ devlink port show pci/0000:06:00.0/32768 -jp { "port": { "pci/0000:06:00.0/32768": { "type": "eth", "netdev": "ens2f0npf0sf88", "flavour": "pcisf", "controller": 0, "pfnum": 0, "sfnum": 88, "splittable": false, "function": { "hw_addr": "00:00:00:00:88:88", "state": "active", "opstate": "attached" } } } } Set the function state to active: $ devlink port function set pci/0000:06:00.0/32768 state inactive Delete the port after use: $ devlink port del pci/0000:06:00.0/32768 ==================== Signed-off-by: David Ahern --- d10f2a4bd8f82fd009c059d40844095593f5b014