devlink-eswitch-attr.rst 3.2 KB

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