Change the default interrupt-affinity of iavf(4)

This commit is contained in:
yamaguchi 2020-12-08 07:53:20 +00:00
parent a21a9cd665
commit 2ed09c7e02
1 changed files with 18 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_iavf.c,v 1.7 2020/12/01 04:39:03 yamaguchi Exp $ */ /* $NetBSD: if_iavf.c,v 1.8 2020/12/08 07:53:20 yamaguchi Exp $ */
/* /*
* Copyright (c) 2013-2015, Intel Corporation * Copyright (c) 2013-2015, Intel Corporation
@ -75,7 +75,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_iavf.c,v 1.7 2020/12/01 04:39:03 yamaguchi Exp $"); __KERNEL_RCSID(0, "$NetBSD: if_iavf.c,v 1.8 2020/12/08 07:53:20 yamaguchi Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/types.h> #include <sys/types.h>
@ -1813,7 +1813,7 @@ iavf_setup_interrupts(struct iavf_softc *sc)
} }
kcpuset_create(&affinity, false); kcpuset_create(&affinity, false);
affinity_to = ((int)num <= ncpu) ? 1 : 0; affinity_to = 0;
qid = 0; qid = 0;
for (vector = 1; vector < num; vector++) { for (vector = 1; vector < num; vector++) {
pci_intr_setattr(pa->pa_pc, &sc->sc_ihp[vector], pci_intr_setattr(pa->pa_pc, &sc->sc_ihp[vector],
@ -1851,6 +1851,21 @@ iavf_setup_interrupts(struct iavf_softc *sc)
affinity_to = (affinity_to + 1) % ncpu; affinity_to = (affinity_to + 1) % ncpu;
} }
vector = 0;
kcpuset_zero(affinity);
kcpuset_set(affinity, affinity_to);
intrstr = pci_intr_string(pa->pa_pc, sc->sc_ihp[vector],
intrbuf, sizeof(intrbuf));
error = interrupt_distribute(sc->sc_ihs[vector], affinity, NULL);
if (error == 0) {
IAVF_LOG(sc, LOG_INFO,
"for Misc interrupt at %s, affinity to %d\n",
intrstr, affinity_to);
} else {
IAVF_LOG(sc, LOG_INFO,
"for MISC interrupt at %s\n", intrstr);
}
kcpuset_destroy(affinity); kcpuset_destroy(affinity);
sc->sc_nintrs = num; sc->sc_nintrs = num;