| 1 | |
| 2 |
|
| 3 | ==========================
|
| 4 | Devlink E-Switch Attribute
|
| 5 | ==========================
|
| 6 |
|
| 7 | Devlink E-Switch supports two modes of operation: legacy and switchdev.
|
| 8 | Legacy mode operates based on traditional MAC/VLAN steering rules. Switching
|
| 9 | decisions are made based on MAC addresses, VLANs, etc. There is limited ability
|
| 10 | to offload switching rules to hardware.
|
| 11 |
|
| 12 | On the other hand, switchdev mode allows for more advanced offloading
|
| 13 | capabilities of the E-Switch to hardware. In switchdev mode, more switching
|
| 14 | rules and logic can be offloaded to the hardware switch ASIC. It enables
|
| 15 | representor netdevices that represent the slow path of virtual functions (VFs)
|
| 16 | or scalable-functions (SFs) of the device. See more information about
|
| 17 | :ref:`Documentation/networking/switchdev.rst <switchdev>` and
|
| 18 | :ref:`Documentation/networking/representors.rst <representors>`.
|
| 19 |
|
| 20 | In addition, the devlink E-Switch also comes with other attributes listed
|
| 21 | in the following section.
|
| 22 |
|
| 23 | Attributes Description
|
| 24 | ======================
|
| 25 |
|
| 26 | The following is a list of E-Switch attributes.
|
| 27 |
|
| 28 | .. list-table:: E-Switch attributes
|
| 29 | :widths: 8 5 45
|
| 30 |
|
| 31 | * - Name
|
| 32 | - Type
|
| 33 | - Description
|
| 34 | * - ``mode``
|
| 35 | - enum
|
| 36 | - The mode of the device. The mode can be one of the following:
|
| 37 |
|
| 38 | * ``legacy`` operates based on traditional MAC/VLAN steering
|
| 39 | rules.
|
| 40 | * ``switchdev`` allows for more advanced offloading capabilities of
|
| 41 | the E-Switch to hardware.
|
| 42 | * ``switchdev_inactive`` switchdev mode but starts inactive, doesn't allow traffic
|
| 43 | until explicitly activated. This mode is useful for orchestrators that
|
| 44 | want to prepare the device in switchdev mode but only activate it when
|
| 45 | all configurations are done.
|
| 46 | * - ``inline-mode``
|
| 47 | - enum
|
| 48 | - Some HWs need the VF driver to put part of the packet
|
| 49 | headers on the TX descriptor so the e-switch can do proper
|
| 50 | matching and steering. Support for both switchdev mode and legacy mode.
|
| 51 |
|
| 52 | * ``none`` none.
|
| 53 | * ``link`` L2 mode.
|
| 54 | * ``network`` L3 mode.
|
| 55 | * ``transport`` L4 mode.
|
| 56 | * - ``encap-mode``
|
| 57 | - enum
|
| 58 | - The encapsulation mode of the device. Support for both switchdev mode
|
| 59 | and legacy mode. The mode can be one of the following:
|
| 60 |
|
| 61 | * ``none`` Disable encapsulation support.
|
| 62 | * ``basic`` Enable encapsulation support.
|
| 63 |
|
| 64 | Example Usage
|
| 65 | =============
|
| 66 |
|
| 67 | .. code:: shell
|
| 68 |
|
| 69 | # enable switchdev mode
|
| 70 | $ devlink dev eswitch set pci/0000:08:00.0 mode switchdev
|
| 71 |
|
| 72 | # set inline-mode and encap-mode
|
| 73 | $ devlink dev eswitch set pci/0000:08:00.0 inline-mode none encap-mode basic
|
| 74 |
|
| 75 | # display devlink device eswitch attributes
|
| 76 | $ devlink dev eswitch show pci/0000:08:00.0
|
| 77 | pci/0000:08:00.0: mode switchdev inline-mode none encap-mode basic
|
| 78 |
|
| 79 | # enable encap-mode with legacy mode
|
| 80 | $ devlink dev eswitch set pci/0000:08:00.0 mode legacy inline-mode none encap-mode basic
|
| 81 |
|
| 82 | # start switchdev mode in inactive state
|
| 83 | $ devlink dev eswitch set pci/0000:08:00.0 mode switchdev_inactive
|
| 84 |
|
| 85 | # setup switchdev configurations, representors, FDB entries, etc..
|
| 86 | ...
|
| 87 |
|
| 88 | # activate switchdev mode to allow traffic
|
| 89 | $ devlink dev eswitch set pci/0000:08:00.0 mode switchdev
|