git: 70133cdf2d93 - main - iflib: return one vector when falling back to a legacy interrupt

From: Nick Price <nprice_at_FreeBSD.org>
Date: Tue, 24 Nov 2026 15:57:55 UTC
The branch main has been updated by nprice:

URL: https://cgit.FreeBSD.org/src/commit/?id=70133cdf2d935fba24353ca2be24297dda4868c4

commit 70133cdf2d935fba24353ca2be24297dda4868c4
Author:     Nick Price <nprice@FreeBSD.org>
AuthorDate: 2026-11-24 15:57:33 +0000
Commit:     Nick Price <nprice@FreeBSD.org>
CommitDate: 2026-11-24 15:57:38 +0000

    iflib: return one vector when falling back to a legacy interrupt
    
    iflib_msix_init() is documented to "return us the number of supported
    vectors (will be 1 for a legacy interrupt and MSI)", and
    iflib_device_register() relies on that: it treats a return greater than
    one as "MSI-X was set up" and calls IFDI_MSIX_INTR_ASSIGN().
    
    On the legacy fallback the function sets scctx->isc_vectors to 1 but
    returns the raw pci_msi_count() it fetched at the msi: label.
    
    Set vectors to 1 alongside isc_vectors so the return value matches both
    the documented contract and the interrupt mode that was chosen.
    
    Reported by: llm-postcr
    Signed-off-by: Nick Price <nprice@FreeBSD.org>
    Reviewed by:    gallatin
    Differential Revision:  https://reviews.freebsd.org/D61974
---
 sys/net/iflib.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index bae5271d38c2..205d2ff0d63f 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -7382,7 +7382,8 @@ msi:
 		device_printf(dev, "Using an MSI interrupt\n");
 		scctx->isc_intr = IFLIB_INTR_MSI;
 	} else {
-		scctx->isc_vectors = 1;
+		vectors = 1;
+		scctx->isc_vectors = vectors;
 		device_printf(dev, "Using a Legacy interrupt\n");
 		scctx->isc_intr = IFLIB_INTR_LEGACY;
 	}