Page MenuHomeFreeBSD

pci: Cosmetic cleanups to MSI/MSI-X routines
ClosedPublic

Authored by jhb on Feb 7 2025, 5:28 PM.
Tags
None
Referenced Files
F114886203: D48889.diff
Fri, Apr 18, 3:24 AM
Unknown Object (File)
Sat, Apr 12, 6:49 PM
Unknown Object (File)
Fri, Mar 28, 4:47 AM
Unknown Object (File)
Feb 27 2025, 12:47 PM
Unknown Object (File)
Feb 19 2025, 10:25 PM
Unknown Object (File)
Feb 18 2025, 1:29 PM
Unknown Object (File)
Feb 17 2025, 1:09 AM
Unknown Object (File)
Feb 13 2025, 3:34 PM
Subscribers
None

Details

Summary
  • Use unsigned integers for various variables. The count argument to the alloc method as well as the IRQ values used with the pcib_if.m methods should also be unsigned eventually.
  • Use mallocarray to allocate arrays
  • Use bool in a few places

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/dev/pci/pci.c
2023

Have you considered using bitstring instead?

sys/dev/pci/pci.c
2023

I did think about it. This routine is also I think never used (and possibly something I should just remove entirely). I had added it because some language in the PCI spec implied that drivers may wish to shuffle MSI-X assignments, but I have yet to see a driver that does. The one thing I think drivers would like to do is allocate additional MSI-X IRQs on the fly which would be a different API than this. But due to the fact that this isn't used, I didn't pursue a bigger change than just switching to bool.

The one thing I think drivers would like to do is allocate additional MSI-X IRQs on the fly

I think that would be pretty useful for things like RDMA or sub-interfaces in ICE.

But due to the fact that this isn't used, I didn't pursue a bigger change than just switching to bool.

Fair point.

This revision is now accepted and ready to land.Feb 10 2025, 3:56 PM

The one thing I think drivers would like to do is allocate additional MSI-X IRQs on the fly

I think that would be pretty useful for things like RDMA or sub-interfaces in ICE.

We definitely have use cases in cxgbe(4) for this, I just haven't implemented it. :(

This revision was automatically updated to reflect the committed changes.