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
This commit is contained in:
shurd 2017-10-30 21:08:12 +00:00
parent 22fab237c9
commit b8ebc4c70f

View File

@ -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;