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