From e87593ae2112848ab1d46fc5cc96e00e0386b0f9 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Mon, 10 Mar 2025 22:27:53 -0400 Subject: [PATCH] atheros813x: Merge changes from upstream FreeBSD. Up through upstream commit 05a95d19cb248203acdd4e069d3eedfe597c3b49. May fix #19471. --- .../ether/atheros813x/dev/alc/if_alc.c | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/add-ons/kernel/drivers/network/ether/atheros813x/dev/alc/if_alc.c b/src/add-ons/kernel/drivers/network/ether/atheros813x/dev/alc/if_alc.c index be52822e1c..86ae705667 100644 --- a/src/add-ons/kernel/drivers/network/ether/atheros813x/dev/alc/if_alc.c +++ b/src/add-ons/kernel/drivers/network/ether/atheros813x/dev/alc/if_alc.c @@ -29,7 +29,6 @@ /* Driver for Atheros AR813x/AR815x PCIe Ethernet. */ -#include #include #include #include @@ -92,8 +91,14 @@ MODULE_DEPEND(alc, miibus, 1, 1, 1); /* Tunables. */ static int msi_disable = 0; -static int msix_disable = 0; TUNABLE_INT("hw.alc.msi_disable", &msi_disable); + +/* + * The default value of msix_disable is 2, which means to decide whether to + * enable MSI-X in alc_attach() depending on the card type. The operator can + * set this to 0 or 1 to override the default. + */ +static int msix_disable = 2; TUNABLE_INT("hw.alc.msix_disable", &msix_disable); /* @@ -1411,6 +1416,14 @@ alc_attach(device_t dev) case DEVICEID_ATHEROS_E2400: case DEVICEID_ATHEROS_E2500: sc->alc_flags |= ALC_FLAG_E2X00; + + /* + * Disable MSI-X by default on Killer devices, since this is + * reported by several users to not work well. + */ + if (msix_disable == 2) + msix_disable = 1; + /* FALLTHROUGH */ case DEVICEID_ATHEROS_AR8161: if (pci_get_subvendor(dev) == VENDORID_ATHEROS && @@ -1440,6 +1453,14 @@ alc_attach(device_t dev) default: break; } + + /* + * The default value of msix_disable is 2, which means auto-detect. If + * we didn't auto-detect it, default to enabling it. + */ + if (msix_disable == 2) + msix_disable = 0; + sc->alc_flags |= ALC_FLAG_JUMBO; /*