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