Module Name:    src
Committed By:   yamaguchi
Date:           Tue Dec  8 07:53:20 UTC 2020

Modified Files:
        src/sys/dev/pci: if_iavf.c

Log Message:
Change the default interrupt-affinity of iavf(4)


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/if_iavf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_iavf.c
diff -u src/sys/dev/pci/if_iavf.c:1.7 src/sys/dev/pci/if_iavf.c:1.8
--- src/sys/dev/pci/if_iavf.c:1.7	Tue Dec  1 04:39:03 2020
+++ src/sys/dev/pci/if_iavf.c	Tue Dec  8 07:53:20 2020
@@ -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
@@ -75,7 +75,7 @@
  */
 
 #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/types.h>
@@ -1813,7 +1813,7 @@ iavf_setup_interrupts(struct iavf_softc 
 	}
 
 	kcpuset_create(&affinity, false);
-	affinity_to = ((int)num <= ncpu) ? 1 : 0;
+	affinity_to = 0;
 	qid = 0;
 	for (vector = 1; vector < num; vector++) {
 		pci_intr_setattr(pa->pa_pc, &sc->sc_ihp[vector],
@@ -1851,6 +1851,21 @@ iavf_setup_interrupts(struct iavf_softc 
 		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);
 
 	sc->sc_nintrs = num;

Reply via email to