pcie_set_target_speed(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… pcie_set_target_speed β€” like, the Kernel API Manual, but make it make sense

okay so bestie, welcome to pcie_set_target_speed(9) β€” yes that (9) means it's a kernel API page, we're in the deep end of the pool today and honestly? we're thriving 🫢

This is the little function that tells a PCIe Port "hey, go faster" (or slower, no judgement) and then actually waits around to see if the link training worked. Very main character energy. Let's get into it ✨


🌸 NAME 🌸

pcie_set_target_speed β€” Set downstream Link Speed for PCIe Port

That's it. That's the whole vibe. It sets the Link Speed. For a port. Downstream. Periodt πŸ’…


⭐ SYNOPSIS ⭐

int pcie_set_target_speed (struct pci_dev *port , enum pci_bus_speed
speed_req , bool use_lt );

Like, three things go in, an int comes out. That's the whole transaction, no cap πŸ’–


πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the tea, bestie: this function attempts to set the PCIe Port Link Speed to speed_req.

And it's giving "I'll try my best" energy, because β€” and this is important, don't miss it β€” speed_req may be adjusted downwards to the best speed supported by both the Port and the PCIe Device underneath it. So you might ask for the speed of light and get a polite compromise instead 😭 The port and the device have to agree, that's the whole point.

ngl β€” the word "attempt" is doing a lot of heavy lifting in that sentence. Read it again. They said attempt. 🫢

πŸ’œ ARGUMENTS πŸ’œ

  • port β€” the PCIe Port. That's the thing you're controlling, the whole reason you're here, the star of the show πŸ‘‘
  • speed_req β€” the Requested PCIe Link Speed. What you want. Whether you get it is another matter entirely (see DESCRIPTION, see also: life).
  • use_lt β€” a bool that says: wait for the LT or DLLLA bit to detect the end of link training. So like, do we actually sit here and monitor the training bits, or do we just fire and forget? That's the question this little boolean is asking πŸŽ€

πŸ’€ RETURN πŸ’€

The return values, ranked, with feelings:

  • 0 β€” on success. Slay. It worked. Iconic behaviour ✨
  • -EINVAL β€” speed_req is not a PCIe Link Speed. Bestie. That's not a speed. Read the enum 😭
  • -ENODEV β€” port is not controllable. The port said "not today" and honestly we respect the boundaries πŸ™ˆ
  • -ETIMEDOUT β€” changing Link Speed took too long. It's giving "the server is thinking…" forever 🌸
  • -EAGAIN β€” Link Speed was changed but speed_req was not achieved. So it moved! Just not to where you asked. A for effort, lowkey πŸ”₯

🧚 SEE ALSO 🧚

  • Kernel file ./drivers/pci/pcie/bwctrl.c β€” go read the source, iykyk
  • struct pcie_bwctrl_data(9) β€” the struct itself, the blueprint, the lore
  • pcie_bwctrl_select_speed(9) β€” the cousin that picks a speed, which is kind of a whole mood too

and that's the page!! πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«Ά

this absolute gem came out of ./drivers/pci/pcie and it's dated October 2026, so like… mark your calendars bestie, the future is calling and it wants a faster link speed 🌈⭐

no notes. 10/10. go set some target speeds, you've got this πŸ’œ

πŸ“¦ where this page comes from