Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Don't use MSI-X if we can use only one queue to ...



details:   https://anonhg.NetBSD.org/src/rev/244db33d51a0
branches:  trunk
changeset: 828705:244db33d51a0
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Dec 28 06:13:50 2017 +0000

description:
Don't use MSI-X if we can use only one queue to save interrupt resource.
Written by knakahara and tested by me.

diffstat:

 sys/dev/pci/if_wm.c |  29 +++++++++++++++++++----------
 1 files changed, 19 insertions(+), 10 deletions(-)

diffs (52 lines):

diff -r 1bcd51cfdfbc -r 244db33d51a0 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Thu Dec 28 06:10:01 2017 +0000
+++ b/sys/dev/pci/if_wm.c       Thu Dec 28 06:13:50 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.549 2017/12/08 05:22:23 ozaki-r Exp $      */
+/*     $NetBSD: if_wm.c,v 1.550 2017/12/28 06:13:50 msaitoh Exp $      */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.549 2017/12/08 05:22:23 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.550 2017/12/28 06:13:50 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1850,16 +1850,25 @@
        }
 
        wm_adjust_qnum(sc, pci_msix_count(pa->pa_pc, pa->pa_tag));
+       /*
+        *  Don't use MSI-X if we can use only one queue to save interrupt
+        * resource.
+        */
+       if (sc->sc_nqueues > 1) {
+               max_type = PCI_INTR_TYPE_MSIX;
+               /*
+                *  82583 has a MSI-X capability in the PCI configuration space
+                * but it doesn't support it. At least the document doesn't
+                * say anything about MSI-X.
+                */
+               counts[PCI_INTR_TYPE_MSIX]
+                   = (sc->sc_type == WM_T_82583) ? 0 : sc->sc_nqueues + 1;
+       } else {
+               max_type = PCI_INTR_TYPE_MSI;
+               counts[PCI_INTR_TYPE_MSIX] = 0;
+       }
 
        /* Allocation settings */
-       max_type = PCI_INTR_TYPE_MSIX;
-       /*
-        * 82583 has a MSI-X capability in the PCI configuration space but
-        * it doesn't support it. At least the document doesn't say anything
-        * about MSI-X.
-        */
-       counts[PCI_INTR_TYPE_MSIX]
-           = (sc->sc_type == WM_T_82583) ? 0 : sc->sc_nqueues + 1;
        counts[PCI_INTR_TYPE_MSI] = 1;
        counts[PCI_INTR_TYPE_INTX] = 1;
        /* overridden by disable flags */



Home | Main Index | Thread Index | Old Index