devlink-linecard.rst 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. .. SPDX-License-Identifier: GPL-2.0
  2. =================
  3. Devlink Line card
  4. =================
  5. Background
  6. ==========
  7. The ``devlink-linecard`` mechanism is targeted for manipulation of
  8. line cards that serve as a detachable PHY modules for modular switch
  9. system. Following operations are provided:
  10. * Get a list of supported line card types.
  11. * Provision of a slot with specific line card type.
  12. * Get and monitor of line card state and its change.
  13. Line card according to the type may contain one or more gearboxes
  14. to mux the lanes with certain speed to multiple ports with lanes
  15. of different speed. Line card ensures N:M mapping between
  16. the switch ASIC modules and physical front panel ports.
  17. Overview
  18. ========
  19. Each line card devlink object is created by device driver,
  20. according to the physical line card slots available on the device.
  21. Similar to splitter cable, where the device might have no way
  22. of detection of the splitter cable geometry, the device
  23. might not have a way to detect line card type. For that devices,
  24. concept of provisioning is introduced. It allows the user to:
  25. * Provision a line card slot with certain line card type
  26. - Device driver would instruct the ASIC to prepare all
  27. resources accordingly. The device driver would
  28. create all instances, namely devlink port and netdevices
  29. that reside on the line card, according to the line card type
  30. * Manipulate of line card entities even without line card
  31. being physically connected or powered-up
  32. * Setup splitter cable on line card ports
  33. - As on the ordinary ports, user may provision a splitter
  34. cable of a certain type, without the need to
  35. be physically connected to the port
  36. * Configure devlink ports and netdevices
  37. Netdevice carrier is decided as follows:
  38. * Line card is not inserted or powered-down
  39. - The carrier is always down
  40. * Line card is inserted and powered up
  41. - The carrier is decided as for ordinary port netdevice
  42. Line card state
  43. ===============
  44. The ``devlink-linecard`` mechanism supports the following line card states:
  45. * ``unprovisioned``: Line card is not provisioned on the slot.
  46. * ``unprovisioning``: Line card slot is currently being unprovisioned.
  47. * ``provisioning``: Line card slot is currently in a process of being provisioned
  48. with a line card type.
  49. * ``provisioning_failed``: Provisioning was not successful.
  50. * ``provisioned``: Line card slot is provisioned with a type.
  51. * ``active``: Line card is powered-up and active.
  52. The following diagram provides a general overview of ``devlink-linecard``
  53. state transitions::
  54. +-------------------------+
  55. | |
  56. +----------------------------------> unprovisioned |
  57. | | |
  58. | +--------|-------^--------+
  59. | | |
  60. | | |
  61. | +--------v-------|--------+
  62. | | |
  63. | | provisioning |
  64. | | |
  65. | +------------|------------+
  66. | |
  67. | +-----------------------------+
  68. | | |
  69. | +------------v------------+ +------------v------------+ +-------------------------+
  70. | | | | ----> |
  71. +----- provisioning_failed | | provisioned | | active |
  72. | | | | <---- |
  73. | +------------^------------+ +------------|------------+ +-------------------------+
  74. | | |
  75. | | |
  76. | | +------------v------------+
  77. | | | |
  78. | | | unprovisioning |
  79. | | | |
  80. | | +------------|------------+
  81. | | |
  82. | +-----------------------------+
  83. | |
  84. +-----------------------------------------------+
  85. Example usage
  86. =============
  87. .. code:: shell
  88. $ devlink lc show [ DEV [ lc LC_INDEX ] ]
  89. $ devlink lc set DEV lc LC_INDEX [ { type LC_TYPE | notype } ]
  90. # Show current line card configuration and status for all slots:
  91. $ devlink lc
  92. # Set slot 8 to be provisioned with type "16x100G":
  93. $ devlink lc set pci/0000:01:00.0 lc 8 type 16x100G
  94. # Set slot 8 to be unprovisioned:
  95. $ devlink lc set pci/0000:01:00.0 lc 8 notype