PCIe: lanes, generations and slots

Video 048 of 140 in Virtualization Foundations, in the unit “Storage devices, buses and network cards”. 3:21, with English and Hindi audio.

Network cards, NVMe drives and graphics cards all plug into the server's main bus, called PCI Express or PCIe. The speed a card gets depends on two things: how many lanes it uses, and which generation of the standard the slot follows. A slot can quietly hold back a fast card. This article explains lanes and generations, and shows how to read the link status that Linux reports.

What you will learn

What a lane and a link are

A lane is one pair of wires for sending data, and another pair for receiving it. So each lane carries data both ways at once.

A device joins several lanes into a link. The width is written x1, x4, x8 or x16. More lanes means more data moving at the same time.

A network card with two ports often uses eight lanes, and an NVMe drive usually uses four.

How generations set the speed of each lane

A generation is one version of the standard. Each generation roughly doubles the speed of a lane, so the version of the slot matters as much as its width.

The slower of the card and the slot sets the speed. A fast card in a slot of an older generation, or a narrow slot, runs only as fast as that slot allows.

How a slow slot caps a fast card

Take a card with two 25 GbE network ports as an example. Its ports can carry more data than a narrow or old slot can feed them.

A slower slot quietly caps the card below its ports. The ports still look fine, and nothing shows as an error, so you have to check the link itself.

Check the link with lspci

The verbose form of lspci shows the link lines for each PCI device. The command below keeps only the two lines that matter.

Show what each link can do, and what it runs at now
sudo lspci -vvv | grep -E 'LnkCap|LnkSta'

Note: If LnkSta is lower than LnkCap, something is holding the link back. A card that is not fully seated can train at fewer lanes than it was built for. Some server firmware can also force a slot to an older generation, so check the settings there too.

Terms

Lane
One pair of wires for sending data, and another pair for receiving it.
Link
The group of lanes that a device uses together, such as eight lanes written x8.
Generation
One version of the PCI Express standard. Each one roughly doubles the speed of a lane.
LnkCap
The speed and width that the card and slot can do, as lspci reports them.
LnkSta
The speed and width that the link runs at now, as lspci reports them.

Check yourself

What does x8 mean for a PCIe device?

The device uses eight lanes together as one link.

What does it mean if LnkSta is lower than LnkCap?

The link runs slower or narrower than the card can do, so something is holding it back.

Why can a fast card run slowly in an old slot?

The slower of the card and the slot sets the speed, so an older generation or a narrow width caps the card.

Previous: SATA, SAS and NVMe compared. Next: Listing devices with lspci and lsblk.