From b8ebc4c70f31c1708fe9efcd7817f14eb1150e69 Mon Sep 17 00:00:00 2001 From: shurd Date: Mon, 30 Oct 2017 21:08:12 +0000 Subject: [PATCH] Avoid enabling MSI-X if MSI-X is disabled globally It was reported on the community call that with hw.pci.enable_msix=0, iflib would enable MSI-X on the device and attempt to use it, which caused issues. Test the sysctl explicitly and do not enable MSI-X if it's disabled globally. Reviewed by: sbruno Approved by: sbruno (mentor) Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D12805 --- sys/net/iflib.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 67efbb279f4..b60c43c76a8 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -5260,6 +5260,19 @@ iflib_msix_init(if_ctx_t ctx) bar = ctx->ifc_softc_ctx.isc_msix_bar; admincnt = sctx->isc_admin_intrcnt; + /* Override by global tuneable */ + { + int i; + size_t len = sizeof(i); + err = kernel_sysctlbyname(curthread, "hw.pci.enable_msix", &i, &len, NULL, 0, NULL, 0); + if (err == 0) { + if (i == 0) + goto msi; + } + else { + device_printf(dev, "unable to read hw.pci.enable_msix."); + } + } /* Override by tuneable */ if (scctx->isc_disable_msix) goto msi; -- 2.45.0