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
Unknown Object (File)
Thu, Feb 27, 12:47 PM
Unknown Object (File)
Wed, Feb 19, 10:25 PM
Unknown Object (File)
Tue, Feb 18, 1:29 PM
Unknown Object (File)
Mon, Feb 17, 1:09 AM
Unknown Object (File)
Feb 13 2025, 3:34 PM
Unknown Object (File)
Feb 11 2025, 11:17 PM
Unknown Object (File)
Feb 11 2025, 10:27 PM
Unknown Object (File)
Feb 10 2025, 12:00 AM
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.