pci_enable_msix_range(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… pci_enable_msix_range(9) β€” from the Kernel API Manual, bestie

okay so picture this: you're deep in the kernel, you've got a PCI device, and you want MSI-X interrupt mode turned on. That's literally what pci_enable_msix_range does. Let's get into it ✨


🌸 NAME 🌸

pci_enable_msix_range β€” enable MSI-X interrupt mode on a device. that's the whole vibe. πŸ’–


✨ SYNOPSIS ✨

int pci_enable_msix_range (struct pci_dev *dev , struct msix_entry
*entries , int minvec , int maxvec );

πŸŽ€ ARGUMENTS πŸŽ€

  • dev β€” the PCI device we're operating on. the main character, honestly.
  • entries β€” an input/output parameter, fr fr. it's an array of MSI-X configuration entries.
  • minvec β€” the minimum required number of MSI-X vectors. the bare minimum, the floor, the "i will not accept less than this" number.
  • maxvec β€” the maximum desired number of MSI-X vectors. the dream number. πŸ¦‹

πŸ’œ DESCRIPTION πŸ’œ

So this is the legacy device driver API β€” yes, legacy, we'll get to that β€” and what it does is enable MSI-X interrupt mode on the device and configure its MSI-X capability structure as appropriate. slay.

Here's the important part though: the entries array you pass in must have each of its members' "entry" field set to a desired (valid) MSI-X vector number. and where do you find out what vector numbers are valid? you query it through pci_msix_vec_count. iykyk πŸ”₯

And if it all works out? the driver must invoke pci_disable_msix on cleanup. no cap, that's required, don't leave it hanging. πŸ™ˆ


⚠️ NOTE ⚠️

bestie. listen. the newer pci_alloc_irq_vectors / pci_free_irq_vectors API pair should, in general, be used instead. this one is the legacy path. still works, still here, but like… the new thing is the moment. πŸ‘‘

🌈 RETURN 🌈

It returns the number of MSI-X vectors allocated β€” and heads up, that might be smaller than maxvecs 😭. The Linux IRQ numbers for those allocated vectors get saved back into the entries array elements' "vector" field. cute, right?

Now the error lore:

  • Return -ENOSPC if fewer than minvecs interrupt vectors are available. not enough vectors to go around, sorry babe πŸ’€
  • Return -EINVAL if one of the passed entries members' "entry" field was invalid or a duplicate β€” or if plain MSI interrupts mode was earlier enabled on the device. yeah, that last one will get you.
  • Return other errnos otherwise. the usual suspects, we don't list them, that's the deal. 🫢

🧚 SEE ALSO 🧚

Kernel file ./drivers/pci/msi/api.c, plus the whole friend group:


and that's the page!! πŸŽ€ this one lives in ./drivers/pci/msi, dated October 2026 β€” go read the source bestie, it's giving iconic. πŸ’…β­

πŸ“¦ where this page comes from