pci_enable_msix_range(9)
π 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 newerpci_alloc_irq_vectors/pci_free_irq_vectorsAPI 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
-ENOSPCif fewer thanminvecsinterrupt vectors are available. not enough vectors to go around, sorry babe π - Return
-EINVALif one of the passedentriesmembers'"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:
pci_enable_msi(9)pci_disable_msi(9)pci_msix_vec_count(9)pci_msix_can_alloc_dyn(9)pci_msix_alloc_irq_at(9)pci_msix_free_irq(9)pci_disable_msix(9)pci_alloc_irq_vectors(9)pci_alloc_irq_vectors_affinity(9)pci_irq_vector(9)pci_irq_get_affinity(9)pci_free_irq_vectors(9)pci_restore_msi_state(9)pci_msi_enabled(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms