Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Change the default interrupt-affinity of iavf(4)



details:   https://anonhg.NetBSD.org/src/rev/22c333019070
branches:  trunk
changeset: 1016978:22c333019070
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Tue Dec 08 07:53:20 2020 +0000

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

diffstat:

 sys/dev/pci/if_iavf.c |  21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diffs (49 lines):

diff -r 24653a3e5c3a -r 22c333019070 sys/dev/pci/if_iavf.c
--- a/sys/dev/pci/if_iavf.c     Tue Dec 08 04:09:38 2020 +0000
+++ b/sys/dev/pci/if_iavf.c     Tue Dec 08 07:53:20 2020 +0000
@@ -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 @@
        }
 
        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 @@
                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;



Home | Main Index | Thread Index | Old Index