HomeFreeBSD

Revert r332735 and fix MSI-X to properly fail allocations when full.

Description

Revert r332735 and fix MSI-X to properly fail allocations when full.

The off-by-one errors in 332735 weren't actual errors and were
preventing the last MSI interrupt source from being used. Instead,
the issue is that when all MSI interrupt sources were allocated, the
loop in msix_alloc() would terminate with 'msi' still set to non-null.
The only check for 'i' overflowing was in the 'msi' == NULL case, so
msix_alloc() would try to reuse the last MSI interrupt source instead
of failing.

Fix by moving the check for all sources being in use to just after the
loop.

Reviewed by: kib, markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D17976

Details

Provenance
jhbAuthored on
Reviewer
kib
Differential Revision
D17976: Revert r332735 and fix MSI-X to properly fail allocations when full.
Parents
rS340440: Fix typo introduced in r340439 - s/ETN/ETC/
Branches
Unknown
Tags
Unknown