Back to home page

OSCL-LXR

 
 

    


0001 .. SPDX-License-Identifier: GPL-2.0
0002 
0003 =================
0004 Devlink Line card
0005 =================
0006 
0007 Background
0008 ==========
0009 
0010 The ``devlink-linecard`` mechanism is targeted for manipulation of
0011 line cards that serve as a detachable PHY modules for modular switch
0012 system. Following operations are provided:
0013 
0014   * Get a list of supported line card types.
0015   * Provision of a slot with specific line card type.
0016   * Get and monitor of line card state and its change.
0017 
0018 Line card according to the type may contain one or more gearboxes
0019 to mux the lanes with certain speed to multiple ports with lanes
0020 of different speed. Line card ensures N:M mapping between
0021 the switch ASIC modules and physical front panel ports.
0022 
0023 Overview
0024 ========
0025 
0026 Each line card devlink object is created by device driver,
0027 according to the physical line card slots available on the device.
0028 
0029 Similar to splitter cable, where the device might have no way
0030 of detection of the splitter cable geometry, the device
0031 might not have a way to detect line card type. For that devices,
0032 concept of provisioning is introduced. It allows the user to:
0033 
0034   * Provision a line card slot with certain line card type
0035 
0036     - Device driver would instruct the ASIC to prepare all
0037       resources accordingly. The device driver would
0038       create all instances, namely devlink port and netdevices
0039       that reside on the line card, according to the line card type
0040   * Manipulate of line card entities even without line card
0041     being physically connected or powered-up
0042   * Setup splitter cable on line card ports
0043 
0044     - As on the ordinary ports, user may provision a splitter
0045       cable of a certain type, without the need to
0046       be physically connected to the port
0047   * Configure devlink ports and netdevices
0048 
0049 Netdevice carrier is decided as follows:
0050 
0051   * Line card is not inserted or powered-down
0052 
0053     - The carrier is always down
0054   * Line card is inserted and powered up
0055 
0056     - The carrier is decided as for ordinary port netdevice
0057 
0058 Line card state
0059 ===============
0060 
0061 The ``devlink-linecard`` mechanism supports the following line card states:
0062 
0063   * ``unprovisioned``: Line card is not provisioned on the slot.
0064   * ``unprovisioning``: Line card slot is currently being unprovisioned.
0065   * ``provisioning``: Line card slot is currently in a process of being provisioned
0066     with a line card type.
0067   * ``provisioning_failed``: Provisioning was not successful.
0068   * ``provisioned``: Line card slot is provisioned with a type.
0069   * ``active``: Line card is powered-up and active.
0070 
0071 The following diagram provides a general overview of ``devlink-linecard``
0072 state transitions::
0073 
0074                                           +-------------------------+
0075                                           |                         |
0076        +---------------------------------->      unprovisioned      |
0077        |                                  |                         |
0078        |                                  +--------|-------^--------+
0079        |                                           |       |
0080        |                                           |       |
0081        |                                  +--------v-------|--------+
0082        |                                  |                         |
0083        |                                  |       provisioning      |
0084        |                                  |                         |
0085        |                                  +------------|------------+
0086        |                                               |
0087        |                 +-----------------------------+
0088        |                 |                             |
0089        |    +------------v------------+   +------------v------------+   +-------------------------+
0090        |    |                         |   |                         ---->                         |
0091        +-----   provisioning_failed   |   |       provisioned       |   |         active          |
0092        |    |                         |   |                         <----                         |
0093        |    +------------^------------+   +------------|------------+   +-------------------------+
0094        |                 |                             |
0095        |                 |                             |
0096        |                 |                +------------v------------+
0097        |                 |                |                         |
0098        |                 |                |     unprovisioning      |
0099        |                 |                |                         |
0100        |                 |                +------------|------------+
0101        |                 |                             |
0102        |                 +-----------------------------+
0103        |                                               |
0104        +-----------------------------------------------+
0105 
0106 
0107 Example usage
0108 =============
0109 
0110 .. code:: shell
0111 
0112     $ devlink lc show [ DEV [ lc LC_INDEX ] ]
0113     $ devlink lc set DEV lc LC_INDEX [ { type LC_TYPE | notype } ]
0114 
0115     # Show current line card configuration and status for all slots:
0116     $ devlink lc
0117 
0118     # Set slot 8 to be provisioned with type "16x100G":
0119     $ devlink lc set pci/0000:01:00.0 lc 8 type 16x100G
0120 
0121     # Set slot 8 to be unprovisioned:
0122     $ devlink lc set pci/0000:01:00.0 lc 8 notype