162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci
362306a36Sopenharmony_ci===================
462306a36Sopenharmony_ciice devlink support
562306a36Sopenharmony_ci===================
662306a36Sopenharmony_ci
762306a36Sopenharmony_ciThis document describes the devlink features implemented by the ``ice``
862306a36Sopenharmony_cidevice driver.
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ciParameters
1162306a36Sopenharmony_ci==========
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci.. list-table:: Generic parameters implemented
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci   * - Name
1662306a36Sopenharmony_ci     - Mode
1762306a36Sopenharmony_ci     - Notes
1862306a36Sopenharmony_ci   * - ``enable_roce``
1962306a36Sopenharmony_ci     - runtime
2062306a36Sopenharmony_ci     - mutually exclusive with ``enable_iwarp``
2162306a36Sopenharmony_ci   * - ``enable_iwarp``
2262306a36Sopenharmony_ci     - runtime
2362306a36Sopenharmony_ci     - mutually exclusive with ``enable_roce``
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ciInfo versions
2662306a36Sopenharmony_ci=============
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ciThe ``ice`` driver reports the following versions
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci.. list-table:: devlink info versions implemented
3162306a36Sopenharmony_ci    :widths: 5 5 5 90
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci    * - Name
3462306a36Sopenharmony_ci      - Type
3562306a36Sopenharmony_ci      - Example
3662306a36Sopenharmony_ci      - Description
3762306a36Sopenharmony_ci    * - ``board.id``
3862306a36Sopenharmony_ci      - fixed
3962306a36Sopenharmony_ci      - K65390-000
4062306a36Sopenharmony_ci      - The Product Board Assembly (PBA) identifier of the board.
4162306a36Sopenharmony_ci    * - ``fw.mgmt``
4262306a36Sopenharmony_ci      - running
4362306a36Sopenharmony_ci      - 2.1.7
4462306a36Sopenharmony_ci      - 3-digit version number of the management firmware running on the
4562306a36Sopenharmony_ci        Embedded Management Processor of the device. It controls the PHY,
4662306a36Sopenharmony_ci        link, access to device resources, etc. Intel documentation refers to
4762306a36Sopenharmony_ci        this as the EMP firmware.
4862306a36Sopenharmony_ci    * - ``fw.mgmt.api``
4962306a36Sopenharmony_ci      - running
5062306a36Sopenharmony_ci      - 1.5.1
5162306a36Sopenharmony_ci      - 3-digit version number (major.minor.patch) of the API exported over
5262306a36Sopenharmony_ci        the AdminQ by the management firmware. Used by the driver to
5362306a36Sopenharmony_ci        identify what commands are supported. Historical versions of the
5462306a36Sopenharmony_ci        kernel only displayed a 2-digit version number (major.minor).
5562306a36Sopenharmony_ci    * - ``fw.mgmt.build``
5662306a36Sopenharmony_ci      - running
5762306a36Sopenharmony_ci      - 0x305d955f
5862306a36Sopenharmony_ci      - Unique identifier of the source for the management firmware.
5962306a36Sopenharmony_ci    * - ``fw.undi``
6062306a36Sopenharmony_ci      - running
6162306a36Sopenharmony_ci      - 1.2581.0
6262306a36Sopenharmony_ci      - Version of the Option ROM containing the UEFI driver. The version is
6362306a36Sopenharmony_ci        reported in ``major.minor.patch`` format. The major version is
6462306a36Sopenharmony_ci        incremented whenever a major breaking change occurs, or when the
6562306a36Sopenharmony_ci        minor version would overflow. The minor version is incremented for
6662306a36Sopenharmony_ci        non-breaking changes and reset to 1 when the major version is
6762306a36Sopenharmony_ci        incremented. The patch version is normally 0 but is incremented when
6862306a36Sopenharmony_ci        a fix is delivered as a patch against an older base Option ROM.
6962306a36Sopenharmony_ci    * - ``fw.psid.api``
7062306a36Sopenharmony_ci      - running
7162306a36Sopenharmony_ci      - 0.80
7262306a36Sopenharmony_ci      - Version defining the format of the flash contents.
7362306a36Sopenharmony_ci    * - ``fw.bundle_id``
7462306a36Sopenharmony_ci      - running
7562306a36Sopenharmony_ci      - 0x80002ec0
7662306a36Sopenharmony_ci      - Unique identifier of the firmware image file that was loaded onto
7762306a36Sopenharmony_ci        the device. Also referred to as the EETRACK identifier of the NVM.
7862306a36Sopenharmony_ci    * - ``fw.app.name``
7962306a36Sopenharmony_ci      - running
8062306a36Sopenharmony_ci      - ICE OS Default Package
8162306a36Sopenharmony_ci      - The name of the DDP package that is active in the device. The DDP
8262306a36Sopenharmony_ci        package is loaded by the driver during initialization. Each
8362306a36Sopenharmony_ci        variation of the DDP package has a unique name.
8462306a36Sopenharmony_ci    * - ``fw.app``
8562306a36Sopenharmony_ci      - running
8662306a36Sopenharmony_ci      - 1.3.1.0
8762306a36Sopenharmony_ci      - The version of the DDP package that is active in the device. Note
8862306a36Sopenharmony_ci        that both the name (as reported by ``fw.app.name``) and version are
8962306a36Sopenharmony_ci        required to uniquely identify the package.
9062306a36Sopenharmony_ci    * - ``fw.app.bundle_id``
9162306a36Sopenharmony_ci      - running
9262306a36Sopenharmony_ci      - 0xc0000001
9362306a36Sopenharmony_ci      - Unique identifier for the DDP package loaded in the device. Also
9462306a36Sopenharmony_ci        referred to as the DDP Track ID. Can be used to uniquely identify
9562306a36Sopenharmony_ci        the specific DDP package.
9662306a36Sopenharmony_ci    * - ``fw.netlist``
9762306a36Sopenharmony_ci      - running
9862306a36Sopenharmony_ci      - 1.1.2000-6.7.0
9962306a36Sopenharmony_ci      - The version of the netlist module. This module defines the device's
10062306a36Sopenharmony_ci        Ethernet capabilities and default settings, and is used by the
10162306a36Sopenharmony_ci        management firmware as part of managing link and device
10262306a36Sopenharmony_ci        connectivity.
10362306a36Sopenharmony_ci    * - ``fw.netlist.build``
10462306a36Sopenharmony_ci      - running
10562306a36Sopenharmony_ci      - 0xee16ced7
10662306a36Sopenharmony_ci      - The first 4 bytes of the hash of the netlist module contents.
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ciFlash Update
10962306a36Sopenharmony_ci============
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ciThe ``ice`` driver implements support for flash update using the
11262306a36Sopenharmony_ci``devlink-flash`` interface. It supports updating the device flash using a
11362306a36Sopenharmony_cicombined flash image that contains the ``fw.mgmt``, ``fw.undi``, and
11462306a36Sopenharmony_ci``fw.netlist`` components.
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ci.. list-table:: List of supported overwrite modes
11762306a36Sopenharmony_ci   :widths: 5 95
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_ci   * - Bits
12062306a36Sopenharmony_ci     - Behavior
12162306a36Sopenharmony_ci   * - ``DEVLINK_FLASH_OVERWRITE_SETTINGS``
12262306a36Sopenharmony_ci     - Do not preserve settings stored in the flash components being
12362306a36Sopenharmony_ci       updated. This includes overwriting the port configuration that
12462306a36Sopenharmony_ci       determines the number of physical functions the device will
12562306a36Sopenharmony_ci       initialize with.
12662306a36Sopenharmony_ci   * - ``DEVLINK_FLASH_OVERWRITE_SETTINGS`` and ``DEVLINK_FLASH_OVERWRITE_IDENTIFIERS``
12762306a36Sopenharmony_ci     - Do not preserve either settings or identifiers. Overwrite everything
12862306a36Sopenharmony_ci       in the flash with the contents from the provided image, without
12962306a36Sopenharmony_ci       performing any preservation. This includes overwriting device
13062306a36Sopenharmony_ci       identifying fields such as the MAC address, VPD area, and device
13162306a36Sopenharmony_ci       serial number. It is expected that this combination be used with an
13262306a36Sopenharmony_ci       image customized for the specific device.
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ciThe ice hardware does not support overwriting only identifiers while
13562306a36Sopenharmony_cipreserving settings, and thus ``DEVLINK_FLASH_OVERWRITE_IDENTIFIERS`` on its
13662306a36Sopenharmony_ciown will be rejected. If no overwrite mask is provided, the firmware will be
13762306a36Sopenharmony_ciinstructed to preserve all settings and identifying fields when updating.
13862306a36Sopenharmony_ci
13962306a36Sopenharmony_ciReload
14062306a36Sopenharmony_ci======
14162306a36Sopenharmony_ci
14262306a36Sopenharmony_ciThe ``ice`` driver supports activating new firmware after a flash update
14362306a36Sopenharmony_ciusing ``DEVLINK_CMD_RELOAD`` with the ``DEVLINK_RELOAD_ACTION_FW_ACTIVATE``
14462306a36Sopenharmony_ciaction.
14562306a36Sopenharmony_ci
14662306a36Sopenharmony_ci.. code:: shell
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ci    $ devlink dev reload pci/0000:01:00.0 reload action fw_activate
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_ciThe new firmware is activated by issuing a device specific Embedded
15162306a36Sopenharmony_ciManagement Processor reset which requests the device to reset and reload the
15262306a36Sopenharmony_ciEMP firmware image.
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_ciThe driver does not currently support reloading the driver via
15562306a36Sopenharmony_ci``DEVLINK_RELOAD_ACTION_DRIVER_REINIT``.
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_ciPort split
15862306a36Sopenharmony_ci==========
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ciThe ``ice`` driver supports port splitting only for port 0, as the FW has
16162306a36Sopenharmony_cia predefined set of available port split options for the whole device.
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_ciA system reboot is required for port split to be applied.
16462306a36Sopenharmony_ci
16562306a36Sopenharmony_ciThe following command will select the port split option with 4 ports:
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_ci.. code:: shell
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_ci    $ devlink port split pci/0000:16:00.0/0 count 4
17062306a36Sopenharmony_ci
17162306a36Sopenharmony_ciThe list of all available port options will be printed to dynamic debug after
17262306a36Sopenharmony_cieach ``split`` and ``unsplit`` command. The first option is the default.
17362306a36Sopenharmony_ci
17462306a36Sopenharmony_ci.. code:: shell
17562306a36Sopenharmony_ci
17662306a36Sopenharmony_ci    ice 0000:16:00.0: Available port split options and max port speeds (Gbps):
17762306a36Sopenharmony_ci    ice 0000:16:00.0: Status  Split      Quad 0          Quad 1
17862306a36Sopenharmony_ci    ice 0000:16:00.0:         count  L0  L1  L2  L3  L4  L5  L6  L7
17962306a36Sopenharmony_ci    ice 0000:16:00.0: Active  2     100   -   -   - 100   -   -   -
18062306a36Sopenharmony_ci    ice 0000:16:00.0:         2      50   -  50   -   -   -   -   -
18162306a36Sopenharmony_ci    ice 0000:16:00.0: Pending 4      25  25  25  25   -   -   -   -
18262306a36Sopenharmony_ci    ice 0000:16:00.0:         4      25  25   -   -  25  25   -   -
18362306a36Sopenharmony_ci    ice 0000:16:00.0:         8      10  10  10  10  10  10  10  10
18462306a36Sopenharmony_ci    ice 0000:16:00.0:         1     100   -   -   -   -   -   -   -
18562306a36Sopenharmony_ci
18662306a36Sopenharmony_ciThere could be multiple FW port options with the same port split count. When
18762306a36Sopenharmony_cithe same port split count request is issued again, the next FW port option with
18862306a36Sopenharmony_cithe same port split count will be selected.
18962306a36Sopenharmony_ci
19062306a36Sopenharmony_ci``devlink port unsplit`` will select the option with a split count of 1. If
19162306a36Sopenharmony_cithere is no FW option available with split count 1, you will receive an error.
19262306a36Sopenharmony_ci
19362306a36Sopenharmony_ciRegions
19462306a36Sopenharmony_ci=======
19562306a36Sopenharmony_ci
19662306a36Sopenharmony_ciThe ``ice`` driver implements the following regions for accessing internal
19762306a36Sopenharmony_cidevice data.
19862306a36Sopenharmony_ci
19962306a36Sopenharmony_ci.. list-table:: regions implemented
20062306a36Sopenharmony_ci    :widths: 15 85
20162306a36Sopenharmony_ci
20262306a36Sopenharmony_ci    * - Name
20362306a36Sopenharmony_ci      - Description
20462306a36Sopenharmony_ci    * - ``nvm-flash``
20562306a36Sopenharmony_ci      - The contents of the entire flash chip, sometimes referred to as
20662306a36Sopenharmony_ci        the device's Non Volatile Memory.
20762306a36Sopenharmony_ci    * - ``shadow-ram``
20862306a36Sopenharmony_ci      - The contents of the Shadow RAM, which is loaded from the beginning
20962306a36Sopenharmony_ci        of the flash. Although the contents are primarily from the flash,
21062306a36Sopenharmony_ci        this area also contains data generated during device boot which is
21162306a36Sopenharmony_ci        not stored in flash.
21262306a36Sopenharmony_ci    * - ``device-caps``
21362306a36Sopenharmony_ci      - The contents of the device firmware's capabilities buffer. Useful to
21462306a36Sopenharmony_ci        determine the current state and configuration of the device.
21562306a36Sopenharmony_ci
21662306a36Sopenharmony_ciBoth the ``nvm-flash`` and ``shadow-ram`` regions can be accessed without a
21762306a36Sopenharmony_cisnapshot. The ``device-caps`` region requires a snapshot as the contents are
21862306a36Sopenharmony_cisent by firmware and can't be split into separate reads.
21962306a36Sopenharmony_ci
22062306a36Sopenharmony_ciUsers can request an immediate capture of a snapshot for all three regions
22162306a36Sopenharmony_civia the ``DEVLINK_CMD_REGION_NEW`` command.
22262306a36Sopenharmony_ci
22362306a36Sopenharmony_ci.. code:: shell
22462306a36Sopenharmony_ci
22562306a36Sopenharmony_ci    $ devlink region show
22662306a36Sopenharmony_ci    pci/0000:01:00.0/nvm-flash: size 10485760 snapshot [] max 1
22762306a36Sopenharmony_ci    pci/0000:01:00.0/device-caps: size 4096 snapshot [] max 10
22862306a36Sopenharmony_ci
22962306a36Sopenharmony_ci    $ devlink region new pci/0000:01:00.0/nvm-flash snapshot 1
23062306a36Sopenharmony_ci    $ devlink region dump pci/0000:01:00.0/nvm-flash snapshot 1
23162306a36Sopenharmony_ci
23262306a36Sopenharmony_ci    $ devlink region dump pci/0000:01:00.0/nvm-flash snapshot 1
23362306a36Sopenharmony_ci    0000000000000000 0014 95dc 0014 9514 0035 1670 0034 db30
23462306a36Sopenharmony_ci    0000000000000010 0000 0000 ffff ff04 0029 8c00 0028 8cc8
23562306a36Sopenharmony_ci    0000000000000020 0016 0bb8 0016 1720 0000 0000 c00f 3ffc
23662306a36Sopenharmony_ci    0000000000000030 bada cce5 bada cce5 bada cce5 bada cce5
23762306a36Sopenharmony_ci
23862306a36Sopenharmony_ci    $ devlink region read pci/0000:01:00.0/nvm-flash snapshot 1 address 0 length 16
23962306a36Sopenharmony_ci    0000000000000000 0014 95dc 0014 9514 0035 1670 0034 db30
24062306a36Sopenharmony_ci
24162306a36Sopenharmony_ci    $ devlink region delete pci/0000:01:00.0/nvm-flash snapshot 1
24262306a36Sopenharmony_ci
24362306a36Sopenharmony_ci    $ devlink region new pci/0000:01:00.0/device-caps snapshot 1
24462306a36Sopenharmony_ci    $ devlink region dump pci/0000:01:00.0/device-caps snapshot 1
24562306a36Sopenharmony_ci    0000000000000000 01 00 01 00 00 00 00 00 01 00 00 00 00 00 00 00
24662306a36Sopenharmony_ci    0000000000000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
24762306a36Sopenharmony_ci    0000000000000020 02 00 02 01 32 03 00 00 0a 00 00 00 25 00 00 00
24862306a36Sopenharmony_ci    0000000000000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
24962306a36Sopenharmony_ci    0000000000000040 04 00 01 00 01 00 00 00 00 00 00 00 00 00 00 00
25062306a36Sopenharmony_ci    0000000000000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
25162306a36Sopenharmony_ci    0000000000000060 05 00 01 00 03 00 00 00 00 00 00 00 00 00 00 00
25262306a36Sopenharmony_ci    0000000000000070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
25362306a36Sopenharmony_ci    0000000000000080 06 00 01 00 01 00 00 00 00 00 00 00 00 00 00 00
25462306a36Sopenharmony_ci    0000000000000090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
25562306a36Sopenharmony_ci    00000000000000a0 08 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00
25662306a36Sopenharmony_ci    00000000000000b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
25762306a36Sopenharmony_ci    00000000000000c0 12 00 01 00 01 00 00 00 01 00 01 00 00 00 00 00
25862306a36Sopenharmony_ci    00000000000000d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
25962306a36Sopenharmony_ci    00000000000000e0 13 00 01 00 00 01 00 00 00 00 00 00 00 00 00 00
26062306a36Sopenharmony_ci    00000000000000f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
26162306a36Sopenharmony_ci    0000000000000100 14 00 01 00 01 00 00 00 00 00 00 00 00 00 00 00
26262306a36Sopenharmony_ci    0000000000000110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
26362306a36Sopenharmony_ci    0000000000000120 15 00 01 00 01 00 00 00 00 00 00 00 00 00 00 00
26462306a36Sopenharmony_ci    0000000000000130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
26562306a36Sopenharmony_ci    0000000000000140 16 00 01 00 01 00 00 00 00 00 00 00 00 00 00 00
26662306a36Sopenharmony_ci    0000000000000150 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
26762306a36Sopenharmony_ci    0000000000000160 17 00 01 00 06 00 00 00 00 00 00 00 00 00 00 00
26862306a36Sopenharmony_ci    0000000000000170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
26962306a36Sopenharmony_ci    0000000000000180 18 00 01 00 01 00 00 00 01 00 00 00 08 00 00 00
27062306a36Sopenharmony_ci    0000000000000190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
27162306a36Sopenharmony_ci    00000000000001a0 22 00 01 00 01 00 00 00 00 00 00 00 00 00 00 00
27262306a36Sopenharmony_ci    00000000000001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
27362306a36Sopenharmony_ci    00000000000001c0 40 00 01 00 00 08 00 00 08 00 00 00 00 00 00 00
27462306a36Sopenharmony_ci    00000000000001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
27562306a36Sopenharmony_ci    00000000000001e0 41 00 01 00 00 08 00 00 00 00 00 00 00 00 00 00
27662306a36Sopenharmony_ci    00000000000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
27762306a36Sopenharmony_ci    0000000000000200 42 00 01 00 00 08 00 00 00 00 00 00 00 00 00 00
27862306a36Sopenharmony_ci    0000000000000210 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
27962306a36Sopenharmony_ci
28062306a36Sopenharmony_ci    $ devlink region delete pci/0000:01:00.0/device-caps snapshot 1
28162306a36Sopenharmony_ci
28262306a36Sopenharmony_ciDevlink Rate
28362306a36Sopenharmony_ci============
28462306a36Sopenharmony_ci
28562306a36Sopenharmony_ciThe ``ice`` driver implements devlink-rate API. It allows for offload of
28662306a36Sopenharmony_cithe Hierarchical QoS to the hardware. It enables user to group Virtual
28762306a36Sopenharmony_ciFunctions in a tree structure and assign supported parameters: tx_share,
28862306a36Sopenharmony_citx_max, tx_priority and tx_weight to each node in a tree. So effectively
28962306a36Sopenharmony_ciuser gains an ability to control how much bandwidth is allocated for each
29062306a36Sopenharmony_ciVF group. This is later enforced by the HW.
29162306a36Sopenharmony_ci
29262306a36Sopenharmony_ciIt is assumed that this feature is mutually exclusive with DCB performed
29362306a36Sopenharmony_ciin FW and ADQ, or any driver feature that would trigger changes in QoS,
29462306a36Sopenharmony_cifor example creation of the new traffic class. The driver will prevent DCB
29562306a36Sopenharmony_cior ADQ configuration if user started making any changes to the nodes using
29662306a36Sopenharmony_cidevlink-rate API. To configure those features a driver reload is necessary.
29762306a36Sopenharmony_ciCorrespondingly if ADQ or DCB will get configured the driver won't export
29862306a36Sopenharmony_cihierarchy at all, or will remove the untouched hierarchy if those
29962306a36Sopenharmony_cifeatures are enabled after the hierarchy is exported, but before any
30062306a36Sopenharmony_cichanges are made.
30162306a36Sopenharmony_ci
30262306a36Sopenharmony_ciThis feature is also dependent on switchdev being enabled in the system.
30362306a36Sopenharmony_ciIt's required because devlink-rate requires devlink-port objects to be
30462306a36Sopenharmony_cipresent, and those objects are only created in switchdev mode.
30562306a36Sopenharmony_ci
30662306a36Sopenharmony_ciIf the driver is set to the switchdev mode, it will export internal
30762306a36Sopenharmony_cihierarchy the moment VF's are created. Root of the tree is always
30862306a36Sopenharmony_cirepresented by the node_0. This node can't be deleted by the user. Leaf
30962306a36Sopenharmony_cinodes and nodes with children also can't be deleted.
31062306a36Sopenharmony_ci
31162306a36Sopenharmony_ci.. list-table:: Attributes supported
31262306a36Sopenharmony_ci    :widths: 15 85
31362306a36Sopenharmony_ci
31462306a36Sopenharmony_ci    * - Name
31562306a36Sopenharmony_ci      - Description
31662306a36Sopenharmony_ci    * - ``tx_max``
31762306a36Sopenharmony_ci      - maximum bandwidth to be consumed by the tree Node. Rate Limit is
31862306a36Sopenharmony_ci        an absolute number specifying a maximum amount of bytes a Node may
31962306a36Sopenharmony_ci        consume during the course of one second. Rate limit guarantees
32062306a36Sopenharmony_ci        that a link will not oversaturate the receiver on the remote end
32162306a36Sopenharmony_ci        and also enforces an SLA between the subscriber and network
32262306a36Sopenharmony_ci        provider.
32362306a36Sopenharmony_ci    * - ``tx_share``
32462306a36Sopenharmony_ci      - minimum bandwidth allocated to a tree node when it is not blocked.
32562306a36Sopenharmony_ci        It specifies an absolute BW. While tx_max defines the maximum
32662306a36Sopenharmony_ci        bandwidth the node may consume, the tx_share marks committed BW
32762306a36Sopenharmony_ci        for the Node.
32862306a36Sopenharmony_ci    * - ``tx_priority``
32962306a36Sopenharmony_ci      - allows for usage of strict priority arbiter among siblings. This
33062306a36Sopenharmony_ci        arbitration scheme attempts to schedule nodes based on their
33162306a36Sopenharmony_ci        priority as long as the nodes remain within their bandwidth limit.
33262306a36Sopenharmony_ci        Range 0-7. Nodes with priority 7 have the highest priority and are
33362306a36Sopenharmony_ci        selected first, while nodes with priority 0 have the lowest
33462306a36Sopenharmony_ci        priority. Nodes that have the same priority are treated equally.
33562306a36Sopenharmony_ci    * - ``tx_weight``
33662306a36Sopenharmony_ci      - allows for usage of Weighted Fair Queuing arbitration scheme among
33762306a36Sopenharmony_ci        siblings. This arbitration scheme can be used simultaneously with
33862306a36Sopenharmony_ci        the strict priority. Range 1-200. Only relative values matter for
33962306a36Sopenharmony_ci        arbitration.
34062306a36Sopenharmony_ci
34162306a36Sopenharmony_ci``tx_priority`` and ``tx_weight`` can be used simultaneously. In that case
34262306a36Sopenharmony_cinodes with the same priority form a WFQ subgroup in the sibling group
34362306a36Sopenharmony_ciand arbitration among them is based on assigned weights.
34462306a36Sopenharmony_ci
34562306a36Sopenharmony_ci.. code:: shell
34662306a36Sopenharmony_ci
34762306a36Sopenharmony_ci    # enable switchdev
34862306a36Sopenharmony_ci    $ devlink dev eswitch set pci/0000:4b:00.0 mode switchdev
34962306a36Sopenharmony_ci
35062306a36Sopenharmony_ci    # at this point driver should export internal hierarchy
35162306a36Sopenharmony_ci    $ echo 2 > /sys/class/net/ens785np0/device/sriov_numvfs
35262306a36Sopenharmony_ci
35362306a36Sopenharmony_ci    $ devlink port function rate show
35462306a36Sopenharmony_ci    pci/0000:4b:00.0/node_25: type node parent node_24
35562306a36Sopenharmony_ci    pci/0000:4b:00.0/node_24: type node parent node_0
35662306a36Sopenharmony_ci    pci/0000:4b:00.0/node_32: type node parent node_31
35762306a36Sopenharmony_ci    pci/0000:4b:00.0/node_31: type node parent node_30
35862306a36Sopenharmony_ci    pci/0000:4b:00.0/node_30: type node parent node_16
35962306a36Sopenharmony_ci    pci/0000:4b:00.0/node_19: type node parent node_18
36062306a36Sopenharmony_ci    pci/0000:4b:00.0/node_18: type node parent node_17
36162306a36Sopenharmony_ci    pci/0000:4b:00.0/node_17: type node parent node_16
36262306a36Sopenharmony_ci    pci/0000:4b:00.0/node_14: type node parent node_5
36362306a36Sopenharmony_ci    pci/0000:4b:00.0/node_5: type node parent node_3
36462306a36Sopenharmony_ci    pci/0000:4b:00.0/node_13: type node parent node_4
36562306a36Sopenharmony_ci    pci/0000:4b:00.0/node_12: type node parent node_4
36662306a36Sopenharmony_ci    pci/0000:4b:00.0/node_11: type node parent node_4
36762306a36Sopenharmony_ci    pci/0000:4b:00.0/node_10: type node parent node_4
36862306a36Sopenharmony_ci    pci/0000:4b:00.0/node_9: type node parent node_4
36962306a36Sopenharmony_ci    pci/0000:4b:00.0/node_8: type node parent node_4
37062306a36Sopenharmony_ci    pci/0000:4b:00.0/node_7: type node parent node_4
37162306a36Sopenharmony_ci    pci/0000:4b:00.0/node_6: type node parent node_4
37262306a36Sopenharmony_ci    pci/0000:4b:00.0/node_4: type node parent node_3
37362306a36Sopenharmony_ci    pci/0000:4b:00.0/node_3: type node parent node_16
37462306a36Sopenharmony_ci    pci/0000:4b:00.0/node_16: type node parent node_15
37562306a36Sopenharmony_ci    pci/0000:4b:00.0/node_15: type node parent node_0
37662306a36Sopenharmony_ci    pci/0000:4b:00.0/node_2: type node parent node_1
37762306a36Sopenharmony_ci    pci/0000:4b:00.0/node_1: type node parent node_0
37862306a36Sopenharmony_ci    pci/0000:4b:00.0/node_0: type node
37962306a36Sopenharmony_ci    pci/0000:4b:00.0/1: type leaf parent node_25
38062306a36Sopenharmony_ci    pci/0000:4b:00.0/2: type leaf parent node_25
38162306a36Sopenharmony_ci
38262306a36Sopenharmony_ci    # let's create some custom node
38362306a36Sopenharmony_ci    $ devlink port function rate add pci/0000:4b:00.0/node_custom parent node_0
38462306a36Sopenharmony_ci
38562306a36Sopenharmony_ci    # second custom node
38662306a36Sopenharmony_ci    $ devlink port function rate add pci/0000:4b:00.0/node_custom_1 parent node_custom
38762306a36Sopenharmony_ci
38862306a36Sopenharmony_ci    # reassign second VF to newly created branch
38962306a36Sopenharmony_ci    $ devlink port function rate set pci/0000:4b:00.0/2 parent node_custom_1
39062306a36Sopenharmony_ci
39162306a36Sopenharmony_ci    # assign tx_weight to the VF
39262306a36Sopenharmony_ci    $ devlink port function rate set pci/0000:4b:00.0/2 tx_weight 5
39362306a36Sopenharmony_ci
39462306a36Sopenharmony_ci    # assign tx_share to the VF
39562306a36Sopenharmony_ci    $ devlink port function rate set pci/0000:4b:00.0/2 tx_share 500Mbps
396