Source-Changes-HG archive

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

[src/trunk]: src wm(4) can disable msi/msix by build option and ddb command.



details:   https://anonhg.NetBSD.org/src/rev/8d34f319f176
branches:  trunk
changeset: 823130:8d34f319f176
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Thu Apr 13 10:37:36 2017 +0000

description:
wm(4) can disable msi/msix by build option and ddb command.

suggested by nonaka@n.o.
reviewed by msaitoh@n.o and nonaka@n.o.

diffstat:

 share/man/man4/wm.4   |   8 +++++++-
 sys/dev/pci/files.pci |   4 +++-
 sys/dev/pci/if_wm.c   |  25 +++++++++++++++++++++++--
 3 files changed, 33 insertions(+), 4 deletions(-)

diffs (93 lines):

diff -r 0dd40f637386 -r 8d34f319f176 share/man/man4/wm.4
--- a/share/man/man4/wm.4       Thu Apr 13 09:57:28 2017 +0000
+++ b/share/man/man4/wm.4       Thu Apr 13 10:37:36 2017 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: wm.4,v 1.35 2017/03/22 09:38:10 wiz Exp $
+.\"    $NetBSD: wm.4,v 1.36 2017/04/13 10:37:36 knakahara Exp $
 .\"
 .\" Copyright 2002, 2003 Wasabi Systems, Inc.
 .\" All rights reserved.
@@ -196,6 +196,12 @@
 counter.
 Caution: If this flag is enabled, the number of evcnt entries increase
 very much.
+.It Dv WM_DISABLE_MSI
+If this option is set non-zero value, this driver does not use msi.
+The default value is 0.
+.It Dv WM_DISABLE_MSIX
+If this option is set non-zero value, this driver does not use msix.
+The default value is 0.
 .El
 .Pp
 Setting
diff -r 0dd40f637386 -r 8d34f319f176 sys/dev/pci/files.pci
--- a/sys/dev/pci/files.pci     Thu Apr 13 09:57:28 2017 +0000
+++ b/sys/dev/pci/files.pci     Thu Apr 13 10:37:36 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.pci,v 1.387 2017/03/22 03:32:09 knakahara Exp $
+#      $NetBSD: files.pci,v 1.388 2017/04/13 10:37:36 knakahara Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -693,6 +693,8 @@
 defflag        opt_if_wm.h     WM_EVENT_COUNTERS
 defparam opt_if_wm.h   WM_RX_PROCESS_LIMIT_DEFAULT
                        WM_RX_INTR_PROCESS_LIMIT_DEFAULT
+                       WM_DISABLE_MSI
+                       WM_DISABLE_MSIX
 
 # Broadcom 570x Gigabit Ethernet
 device bge: ether, ifnet, arp, mii, mii_bitbang
diff -r 0dd40f637386 -r 8d34f319f176 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Thu Apr 13 09:57:28 2017 +0000
+++ b/sys/dev/pci/if_wm.c       Thu Apr 13 10:37:36 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.507 2017/04/12 05:08:00 knakahara Exp $    */
+/*     $NetBSD: if_wm.c,v 1.508 2017/04/13 10:37:36 knakahara Exp $    */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.507 2017/04/12 05:08:00 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508 2017/04/13 10:37:36 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -173,6 +173,16 @@
 #define WM_MAX_NQUEUEINTR      16
 #define WM_MAX_NINTR           (WM_MAX_NQUEUEINTR + 1)
 
+#ifndef WM_DISABLE_MSI
+#define        WM_DISABLE_MSI 0
+#endif
+#ifndef WM_DISABLE_MSIX
+#define        WM_DISABLE_MSIX 0
+#endif
+
+int wm_disable_msi = WM_DISABLE_MSI;
+int wm_disable_msix = WM_DISABLE_MSIX;
+
 /*
  * Transmit descriptor list size.  Due to errata, we can only have
  * 256 hardware descriptors in the ring on < 82544, but we use 4096
@@ -1831,6 +1841,17 @@
        counts[PCI_INTR_TYPE_MSIX] = sc->sc_nqueues + 1;
        counts[PCI_INTR_TYPE_MSI] = 1;
        counts[PCI_INTR_TYPE_INTX] = 1;
+       /* overridden by disable flags */
+       if (wm_disable_msi != 0) {
+               counts[PCI_INTR_TYPE_MSI] = 0;
+               if (wm_disable_msix != 0) {
+                       max_type = PCI_INTR_TYPE_INTX;
+                       counts[PCI_INTR_TYPE_MSIX] = 0;
+               }
+       } else if (wm_disable_msix != 0) {
+               max_type = PCI_INTR_TYPE_MSI;
+               counts[PCI_INTR_TYPE_MSIX] = 0;
+       }
 
 alloc_retry:
        if (pci_intr_alloc(pa, &sc->sc_intrs, counts, max_type) != 0) {



Home | Main Index | Thread Index | Old Index