Home / Alt manpages / devlink-lc(8)

  • devlink-lc(8)
  • Admin command
  • linux

Provision Devlink Line Cards Without Losing Track of Slot State

You will use devlink lc to inspect line-card slots, identify the type a driver supports, and provision one slot with an explicit type. The guide also shows how to clear that provisioning. The examples use the devlink utility from Ubuntu's iproute2 package, version 6.1.0-1ubuntu6.4 on this machine.

Allow about fifteen minutes for the command work, plus whatever change window your hardware requires. You need a shell, the iproute2 package, and a devlink device whose driver implements line-card management. Reading state is normally unprivileged only where the system permits it. Changing a line-card type is a privileged hardware operation: use the account and change process required by your network platform.

Checkpoint

The read-only workflow ends after step 3. Steps 4 and 5 change slot configuration and need a confirmed device, slot index and supported type.

1. Confirm the utility and syntax

Check which executable is being used, then ask the installed binary for its line-card syntax:

$ command -v devlink
/usr/sbin/devlink
$ devlink -V
devlink utility, iproute2-6.1.0
$ devlink lc help
Usage: devlink lc show [ DEV [ lc LC_INDEX ] ]
       devlink lc set DEV lc LC_INDEX [ { type LC_TYPE | notype } ]

The package version and the utility's reported iproute2 version are related but not identical labels. The package here is 6.1.0-1ubuntu6.4, while the utility reports the upstream release line 6.1.0. Record both when comparing a result with another host.

There is no separate devlink-lc executable in this interface. lc is a subcommand of devlink, so do not try to run devlink-lc as a command.

2. List every line-card slot

Start with the broadest read-only query:

$ devlink lc show

This asks the utility to display line-card attributes for all line cards on all devices. A useful response identifies the devlink device, the slot index and the attributes the driver exposes. The exact output is driver-specific, so do not build a script around a fixed column layout copied from another machine.

A blank result means this query did not present a line card to you. Check that the expected hardware driver is loaded and that the device is visible to devlink before attempting a set operation. Do not invent a PCI address from a diagram: obtain the actual device name from the output of another devlink query or from your platform's inventory.

Checkpoint

Write down the complete device identifier and the slot index you intend to inspect. The device format used by this command is BUS_NAME/BUS_ADDRESS, for example pci/0000:01:00.0.

3. Inspect one slot and its supported types

Once you have a device and slot index, narrow the query:

$ devlink lc show pci/0000:01:00.0 lc 1

Replace both values with the identifiers from your own system. The lc 1 part selects slot index 1; it is not a line-card name. The result includes the list of line-card types supplied by that driver. Treat that list as authoritative for the device. A type shown in documentation for a different adapter, firmware release or slot is not safe to substitute.

Before changing anything, save the current output in your change record. This is your recovery reference, but it is not a full hardware backup and it does not undo a change by itself.

4. Provision a supported type

Warning

Setting a line-card type changes hardware provisioning. It may affect the interfaces or ports presented by the device, and a platform may need a further reload or service change. Confirm maintenance impact, console access and the rollback plan before running the command. The operation requires the appropriate elevated privilege.

Use the exact type string reported for the selected slot:

$ sudo devlink lc set pci/0000:01:00.0 lc 1 type 16x100G

The example type 16x100G is the form documented by the man page, not a universal capability. Replace it with a value your device actually reported. The command does not take a width and speed that devlink calculates for you, and the man page does not define a generic default type.

Verify the resulting state with the same narrow query:

$ sudo devlink lc show pci/0000:01:00.0 lc 1

Confirm that the slot reports the requested provisioning and that any expected platform-specific interfaces are present. If the command fails, keep the error and exit status in the change record. Do not retry repeatedly while guessing at type names.

5. Clear the provisioning when you need to undo it

The documented way to remove a line-card type is notype:

$ sudo devlink lc set pci/0000:01:00.0 lc 1 notype
$ sudo devlink lc show pci/0000:01:00.0 lc 1

This clears provisioning on the selected slot. It is a state-changing operation, not a harmless display option. Use it only when your hardware procedure says the slot can be unprovisioned. Check the result before closing the change, and keep the original show output if you may need to restore the previous type later.

There is no separate undo command in this interface. To restore a previous configuration, run set again with the previously recorded, currently supported type, subject to the device's own change procedure. If the hardware is already in a failed or partially applied state, stop and follow the vendor recovery process rather than cycling types from a script.

Common traps

  • Wrong device syntax: use BUS_NAME/BUS_ADDRESS, such as pci/0000:01:00.0, not a friendly device label.
  • Wrong slot: indexes are supplied explicitly after lc. Inspect all slots first and check the index twice.
  • Unsupported type: line-card types come from the driver. Copy the exact spelling from devlink lc show.
  • Assuming output is identical everywhere: supported types and displayed attributes are device and driver dependent.
  • Confusing display with change: show reads state; set changes it. Only the latter belongs in a maintenance window.

Done means

  • devlink -V and devlink lc help identify the installed interface.
  • You recorded the real devlink device name, slot index and pre-change output.
  • The requested type came from that slot's reported supported types.
  • A privileged set was run only after its service impact and rollback were understood.
  • A follow-up show confirms the intended state, or the failed result is preserved for recovery.