mirror_iproute2/man/man8/devlink-port.8
Parav Pandit bdfb9f1bd6 devlink: Support set of port function state
Support set operation of the devlink port function state.

Example of a PCI SF port function which supports the state:

$ devlink dev eswitch set pci/0000:06:00.0 mode switchdev

$ devlink port show
pci/0000:06:00.0/65535: type eth netdev ens2f0np0 flavour physical port 0 splittable false

$ 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 pfnum 0 sfnum 88 splittable false
  function:
    hw_addr 00:00:00:00:00:00 state inactive opstate detached

$ devlink port show pci/0000:06:00.0/32768
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:00:00 state inactive opstate detached

$ devlink port function set pci/0000:06:00.0/32768 hw_addr 00:00:00:00:88:88 state active

$ 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"
            }
        }
    }
}

Signed-off-by: Parav Pandit <parav@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
2021-02-02 02:06:48 +00:00

276 lines
5.9 KiB
Groff

.TH DEVLINK\-PORT 8 "14 Mar 2016" "iproute2" "Linux"
.SH NAME
devlink-port \- devlink port configuration
.SH SYNOPSIS
.sp
.ad l
.in +8
.ti -8
.B devlink
.RI "[ " OPTIONS " ]"
.B port
.RI " { " COMMAND " | "
.BR help " }"
.sp
.ti -8
.IR OPTIONS " := { "
\fB\-V\fR[\fIersion\fR] |
\fB\-n\fR[\fIno-nice-names\fR] }
.ti -8
.BR "devlink port set "
.IR DEV/PORT_INDEX
.RI "[ "
.BR type " { " eth " | " ib " | " auto " }"
.RI "]"
.ti -8
.BR "devlink port split "
.IR DEV/PORT_INDEX
.BR count
.IR COUNT
.ti -8
.BR "devlink port unsplit "
.IR DEV/PORT_INDEX
.ti -8
.B devlink port show
.RI "[ " DEV/PORT_INDEX " ]"
.ti -8
.B devlink port health
.RI "{ " show " | " recover " | " diagnose " | " dump " | " set " }"
.ti -8
.BI "devlink port add"
.RB "["
.IR "DEV | DEV/PORT_INDEX"
.RB "] "
.RB "[ " flavour
.IR FLAVOUR " ]"
.RB "[ " pcipf
.IR PFNUMBER " ]"
.RB "{ " pcisf
.IR SFNUMBER " }"
.br
.ti -8
.B devlink port del
.IR DEV/PORT_INDEX
.ti -8
.BR "devlink port function set "
.IR DEV/PORT_INDEX
.RI "{ "
.BR "hw_addr "
.RI "ADDR }"
.RI "{ "
.BR "state"
.RI "STATE }"
.ti -8
.B devlink port help
.SH "DESCRIPTION"
.SS devlink port set - change devlink port attributes
.PP
.B "DEV/PORT_INDEX"
- specifies the devlink port to operate on.
.in +4
Format is:
.in +2
BUS_NAME/BUS_ADDRESS/PORT_INDEX
.TP
.BR type " { " eth " | " ib " | " auto " } "
set port type
.I eth
- Ethernet
.I ib
- Infiniband
.I auto
- autoselect
.SS devlink port split - split devlink port into more
.PP
.B "DEV/PORT_INDEX"
- specifies the devlink port to operate on.
.TP
.BI count " COUNT"
number of ports to split to.
.SS devlink port unsplit - unsplit previously split devlink port
Could be performed on any split port of the same split group.
.PP
.B "DEV/PORT_INDEX"
- specifies the devlink port to operate on.
.SS devlink port show - display devlink port attributes
.PP
.I "DEV/PORT_INDEX"
- specifies the devlink port to show.
If this argument is omitted all ports are listed.
.SS devlink port health - devlink health reporting and recovery
Is an alias for
.BR devlink-health (8).
.ti -8
.SS devlink port add - add a devlink port
.PP
.B "DEV"
- specifies the devlink device to operate on. or
.PP
.B "DEV/PORT_INDEX"
- specifies the devlink port index to use for the requested new port.
This is optional. When ommited, driver allocates unique port index.
.TP
.BR flavour " { " pcipf " | " pcisf " } "
set port flavour
.I pcipf
- PCI PF port
.I pcisf
- PCI SF port
.TP
.BR pfnum " { " pfnumber " } "
Specifies PCI pfnumber to use on which a SF device to create
.TP
.BR sfnum " { " sfnumber " } "
Specifies sfnumber to assign to the device of the SF.
This field is optional for those devices which supports auto assignment of the
SF number.
.ti -8
.SS devlink port function set - Set the port function attribute(s).
.PP
.B "DEV/PORT_INDEX"
- specifies the devlink port to operate on.
.TP
.BR hw_addr " ADDR"
- hardware address of the function to set. This is a Ethernet MAC address when
port type is Ethernet.
.TP
.BR state " { " active " | " inactive " } "
- new state of the function to change to.
.I active
- Once configuration of the function is done, activate the function.
.I inactive
- To inactivate the function and its device(s), set to inactive.
.ti -8
.SS devlink port del - delete a devlink port
.PP
.B "DEV/PORT_INDEX"
- specifies the devlink port to delete.
.SH "EXAMPLES"
.PP
devlink port show
.RS 4
Shows the state of all devlink ports on the system.
.RE
.PP
devlink port show pci/0000:01:00.0/1
.RS 4
Shows the state of specified devlink port.
.RE
.PP
devlink port set pci/0000:01:00.0/1 type eth
.RS 4
Set type of specified devlink port to Ethernet.
.RE
.PP
devlink port split pci/0000:01:00.0/1 count 4
.RS 4
Split the specified devlink port into four ports.
.RE
.PP
devlink port unsplit pci/0000:01:00.0/1
.RS 4
Unplit the specified previously split devlink port.
.RE
.PP
devlink port health show
.RS 4
Shows status and configuration of all supported reporters registered on all devlink ports.
.RE
.PP
devlink port health show pci/0000:01:00.0/1 reporter tx
.RS 4
Shows status and configuration of tx reporter registered on pci/0000:01:00.0/1 devlink port.
.RE
.PP
devlink port add pci/0000:06:00.0 flavour pcisf pfnum 0 sfnum 88
.RS 4
Add a devlink port of flavour PCI SF on PCI PF having number 0 with SF number 88.
To make use of the function an example sequence is to add a port, configure the
function attribute and activate the function. Once function usage is completed,
inactivate the function and finally delete the port. When there is desire to
reuse the port without deletion, it can be reconfigured and activated again when
function is in inactive state and function's operational state is detached.
.RE
.PP
devlink port del pci/0000:06:00.0/1
.RS 4
Delete previously created devlink port. It is recommended to first deactivate
the function if the function supports state management.
.RE
.PP
devlink port function set pci/0000:01:00.0/1 hw_addr 00:00:00:11:22:33
.RS 4
Configure hardware address of the PCI function represented by devlink port.
If the port supports change in function state, hardware address must be configured
before activating the function.
.RE
.PP
devlink port function set pci/0000:01:00.0/1 state active
.RS 4
Activate the function. This will initiate the function enumeration and driver loading.
.RE
.PP
devlink port function set pci/0000:01:00.0/1 state inactive
.RS 4
Deactivate the function. This will initiate the function teardown which results
in driver unload and device removal.
.RE
.PP
devlink port function set pci/0000:01:00.0/1 hw_addr 00:00:00:11:22:33 state active
.RS 4
Configure hardware address and also active the function. When a function is
activated together with other configuration in a single command, all the
configuration is applied first before changing the state to active.
.RE
.SH SEE ALSO
.BR devlink (8),
.BR devlink-dev (8),
.BR devlink-sb (8),
.BR devlink-monitor (8),
.BR devlink-health (8),
.br
.SH AUTHOR
Jiri Pirko <jiri@mellanox.com>