Source-Changes-HG archive

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

[src/netbsd-9]: src Pull up the following, requested by msaitoh in ticket #1363:



details:   https://anonhg.NetBSD.org/src/rev/1fe31b8be0a4
branches:  netbsd-9
changeset: 989960:1fe31b8be0a4
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Oct 21 14:30:10 2021 +0000

description:
Pull up the following, requested by msaitoh in ticket #1363:

        share/man/man4/wm.4                     1.42
        sys/dev/pci/files.pci                   1.434
        sys/dev/pci/if_wm.c                     1.690,1.692-1.693,1.697-1.704,
                                                1.706-1.715 via patch

- Add missing drain for pcq in wm_stop_locked().
- Add support for I219V 15-19 and I219LM 16-19.
- Fix Tx stall.
- Use wm_flush_desc_rings() workaround more on I219.
- Change DMA physical address in wm_flush_desc_rings() to match other
  OSes.
- Check return value correctly in wm_lv_jumbo_workaround_ich8lan().
- Add new sysctl hw.wmN.debug_flags. This sysctl can be used if
  WM_DEBUG is set.
- Add some sysctl values for debugging TX/RX queues.
- Use atomic_{load,store}_relaxed for evcnt 64 bit counter.
- WM_EVENT_COUNTER is enabled by default on 64 bit architectures.
- Remove extra unlock/lock processing around if_percpuq_enqueue().
- Refactor rxq->rxq_ptr updating.
- Stop legacy interrupts before calling softint.
- Disable printf()s in wm_flush_desc_rings() because the code is
  verified.
- Print I219's version number.
- Uniform INTx/MSI handler's Tx/Rx behavior to MSI-X's one.
- Fix return value of interrupt handler.
- Only print an error about missing I/O BARs for chips that need it.
- Do not return a void value from a void function.
- Fix comment.
- Whitespace fixes. No functional change.

diffstat:

 share/man/man4/wm.4   |    7 +-
 sys/dev/pci/files.pci |    4 +-
 sys/dev/pci/if_wm.c   |  860 ++++++++++++++++++++++++++++++-------------------
 3 files changed, 533 insertions(+), 338 deletions(-)

diffs (truncated from 2413 to 300 lines):

diff -r 76570148d057 -r 1fe31b8be0a4 share/man/man4/wm.4
--- a/share/man/man4/wm.4       Thu Oct 21 14:24:27 2021 +0000
+++ b/share/man/man4/wm.4       Thu Oct 21 14:30:10 2021 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: wm.4,v 1.40 2018/04/13 06:04:12 msaitoh Exp $
+.\"    $NetBSD: wm.4,v 1.40.4.1 2021/10/21 14:30:10 martin Exp $
 .\"
 .\" Copyright 2002, 2003 Wasabi Systems, Inc.
 .\" All rights reserved.
@@ -33,7 +33,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April 13, 2018
+.Dd February 17, 2021
 .Dt WM 4
 .Os
 .Sh NAME
@@ -211,8 +211,11 @@
 .It Dv WM_EVENT_COUNTERS
 Enable many event counters such as each Tx drop counter and Rx interrupt
 counter.
+In 64 bit architectures, this is enabled by default.
 Caution: If this flag is enabled, the number of evcnt entries increase
 very much.
+.It Dv WM_DISABLE_EVENT_COUNTERS
+Disable event counters for 64 bit architectures.
 .It Dv WM_DISABLE_MSI
 If this option is set non-zero value, this driver does not use msi.
 The default value is 0.
diff -r 76570148d057 -r 1fe31b8be0a4 sys/dev/pci/files.pci
--- a/sys/dev/pci/files.pci     Thu Oct 21 14:24:27 2021 +0000
+++ b/sys/dev/pci/files.pci     Thu Oct 21 14:30:10 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.pci,v 1.413.2.4 2021/09/15 16:30:50 martin Exp $
+#      $NetBSD: files.pci,v 1.413.2.5 2021/10/21 14:30:10 martin Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -701,7 +701,7 @@
 device wm: ether, ifnet, arp, mii, mii_bitbang
 attach wm at pci
 file   dev/pci/if_wm.c                 wm
-defflag        opt_if_wm.h     WM_EVENT_COUNTERS
+defflag        opt_if_wm.h     WM_EVENT_COUNTERS WM_DISABLE_EVENT_COUNTERS
 defparam opt_if_wm.h   WM_RX_PROCESS_LIMIT_DEFAULT
                        WM_RX_INTR_PROCESS_LIMIT_DEFAULT
                        WM_DISABLE_MSI
diff -r 76570148d057 -r 1fe31b8be0a4 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Thu Oct 21 14:24:27 2021 +0000
+++ b/sys/dev/pci/if_wm.c       Thu Oct 21 14:30:10 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.645.2.10 2020/11/16 18:21:45 martin Exp $  */
+/*     $NetBSD: if_wm.c,v 1.645.2.11 2021/10/21 14:30:10 martin Exp $  */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.10 2020/11/16 18:21:45 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.11 2021/10/21 14:30:10 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -107,6 +107,7 @@
 #include <sys/pcq.h>
 #include <sys/sysctl.h>
 #include <sys/workqueue.h>
+#include <sys/atomic.h>
 
 #include <sys/rndsource.h>
 
@@ -157,11 +158,20 @@
 #define        WM_DEBUG_NVM            __BIT(5)
 #define        WM_DEBUG_INIT           __BIT(6)
 #define        WM_DEBUG_LOCK           __BIT(7)
-int    wm_debug = WM_DEBUG_TX | WM_DEBUG_RX | WM_DEBUG_LINK | WM_DEBUG_GMII
-    | WM_DEBUG_MANAGE | WM_DEBUG_NVM | WM_DEBUG_INIT | WM_DEBUG_LOCK;
-#define        DPRINTF(x, y)   do { if (wm_debug & (x)) printf y; } while (0)
+
+#if 0
+#define WM_DEBUG_DEFAULT       WM_DEBUG_TX | WM_DEBUG_RX | WM_DEBUG_LINK | \
+       WM_DEBUG_GMII | WM_DEBUG_MANAGE | WM_DEBUG_NVM | WM_DEBUG_INIT |    \
+       WM_DEBUG_LOCK
+#endif
+
+#define        DPRINTF(sc, x, y)                         \
+       do {                                      \
+               if ((sc)->sc_debug & (x))         \
+                       printf y;                 \
+       } while (0)
 #else
-#define        DPRINTF(x, y)   __nothing
+#define        DPRINTF(sc, x, y)       __nothing
 #endif /* WM_DEBUG */
 
 #ifdef NET_MPSAFE
@@ -261,7 +271,7 @@
 
 typedef union rxdescs {
        wiseman_rxdesc_t sctxu_rxdescs[WM_NRXDESC];
-       ext_rxdesc_t      sctxu_ext_rxdescs[WM_NRXDESC]; /* 82574 only */
+       ext_rxdesc_t     sctxu_ext_rxdescs[WM_NRXDESC]; /* 82574 only */
        nq_rxdesc_t      sctxu_nq_rxdescs[WM_NRXDESC]; /* 82575 and newer */
 } rxdescs_t;
 
@@ -304,6 +314,12 @@
 
 struct wm_softc;
 
+#if defined(_LP64) && !defined(WM_DISABLE_EVENT_COUNTERS)
+#if !defined(WM_EVENT_COUNTERS)
+#define WM_EVENT_COUNTERS 1
+#endif
+#endif
+
 #ifdef WM_EVENT_COUNTERS
 #define WM_Q_EVCNT_DEFINE(qname, evname)                               \
        char qname##_##evname##_evcnt_name[sizeof("qname##XX##evname")]; \
@@ -384,8 +400,8 @@
        time_t txq_lastsent;
 
        /* Checksum flags used for previous packet */
-       uint32_t        txq_last_hw_cmd;
-       uint8_t         txq_last_hw_fields;
+       uint32_t        txq_last_hw_cmd;
+       uint8_t         txq_last_hw_fields;
        uint16_t        txq_last_hw_ipcs;
        uint16_t        txq_last_hw_tucs;
 
@@ -472,6 +488,7 @@
 
        struct wm_txqueue wmq_txq;
        struct wm_rxqueue wmq_rxq;
+       char sysctlname[32];            /* Name for sysctl */
 
        bool wmq_txrx_use_workqueue;
        struct work wmq_cookie;
@@ -624,6 +641,9 @@
 
        struct wm_phyop phy;
        struct wm_nvmop nvm;
+#ifdef WM_DEBUG
+       uint32_t sc_debug;
+#endif
 };
 
 #define WM_CORE_LOCK(_sc)                                              \
@@ -647,8 +667,19 @@
 } while (/*CONSTCOND*/0)
 
 #ifdef WM_EVENT_COUNTERS
-#define        WM_EVCNT_INCR(ev)       (ev)->ev_count++
-#define        WM_EVCNT_ADD(ev, val)   (ev)->ev_count += (val)
+#ifdef __HAVE_ATOMIC64_LOADSTORE
+#define        WM_EVCNT_INCR(ev)                                               \
+       atomic_store_relaxed(&((ev)->ev_count),                         \
+           atomic_load_relaxed(&(ev)->ev_count) + 1)
+#define        WM_EVCNT_ADD(ev, val)                                           \
+       atomic_store_relaxed(&((ev)->ev_count),                         \
+           atomic_load_relaxed(&(ev)->ev_count) + (val))
+#else
+#define        WM_EVCNT_INCR(ev)                                               \
+       ((ev)->ev_count)++
+#define        WM_EVCNT_ADD(ev, val)                                           \
+       (ev)->ev_count += (val)
+#endif
 
 #define WM_Q_EVCNT_INCR(qname, evname)                 \
        WM_EVCNT_INCR(&(qname)->qname##_ev_##evname)
@@ -1036,6 +1067,10 @@
 static void    wm_set_linkdown_discard(struct wm_softc *);
 static void    wm_clear_linkdown_discard(struct wm_softc *);
 
+#ifdef WM_DEBUG
+static int     wm_sysctl_debug(SYSCTLFN_PROTO);
+#endif
+
 CFATTACH_DECL3_NEW(wm, sizeof(struct wm_softc),
     wm_match, wm_attach, wm_detach, NULL, NULL, NULL, DVF_DETACH_SHUTDOWN);
 
@@ -1563,85 +1598,112 @@
          "I219 LM Ethernet Connection",
          WM_T_PCH_SPT,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_LM2,
-         "I219 LM Ethernet Connection",
+         "I219 LM (2) Ethernet Connection",
          WM_T_PCH_SPT,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_LM3,
-         "I219 LM Ethernet Connection",
+         "I219 LM (3) Ethernet Connection",
          WM_T_PCH_SPT,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_LM4,
-         "I219 LM Ethernet Connection",
+         "I219 LM (4) Ethernet Connection",
          WM_T_PCH_SPT,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_LM5,
-         "I219 LM Ethernet Connection",
+         "I219 LM (5) Ethernet Connection",
          WM_T_PCH_SPT,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_LM6,
-         "I219 LM Ethernet Connection",
+         "I219 LM (6) Ethernet Connection",
          WM_T_PCH_CNP,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_LM7,
-         "I219 LM Ethernet Connection",
+         "I219 LM (7) Ethernet Connection",
          WM_T_PCH_CNP,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_LM8,
-         "I219 LM Ethernet Connection",
+         "I219 LM (8) Ethernet Connection",
          WM_T_PCH_CNP,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_LM9,
-         "I219 LM Ethernet Connection",
+         "I219 LM (9) Ethernet Connection",
          WM_T_PCH_CNP,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_LM10,
-         "I219 LM Ethernet Connection",
+         "I219 LM (10) Ethernet Connection",
          WM_T_PCH_CNP,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_LM11,
-         "I219 LM Ethernet Connection",
+         "I219 LM (11) Ethernet Connection",
          WM_T_PCH_CNP,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_LM12,
-         "I219 LM Ethernet Connection",
+         "I219 LM (12) Ethernet Connection",
          WM_T_PCH_SPT,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_LM13,
-         "I219 LM Ethernet Connection",
+         "I219 LM (13) Ethernet Connection",
          WM_T_PCH_CNP,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_LM14,
-         "I219 LM Ethernet Connection",
+         "I219 LM (14) Ethernet Connection",
          WM_T_PCH_CNP,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_LM15,
-         "I219 LM Ethernet Connection",
+         "I219 LM (15) Ethernet Connection",
+         WM_T_PCH_CNP,         WMP_F_COPPER },
+       { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_LM16,
+         "I219 LM (16) Ethernet Connection",
+         WM_T_PCH_CNP,         WMP_F_COPPER },
+       { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_LM17,
+         "I219 LM (17) Ethernet Connection",
+         WM_T_PCH_CNP,         WMP_F_COPPER },
+       { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_LM18,
+         "I219 LM (18) Ethernet Connection",
+         WM_T_PCH_CNP,         WMP_F_COPPER },
+       { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_LM19,
+         "I219 LM (19) Ethernet Connection",
          WM_T_PCH_CNP,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_V,
          "I219 V Ethernet Connection",
          WM_T_PCH_SPT,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_V2,
-         "I219 V Ethernet Connection",
+         "I219 V (2) Ethernet Connection",
          WM_T_PCH_SPT,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_V4,
-         "I219 V Ethernet Connection",
+         "I219 V (4) Ethernet Connection",
          WM_T_PCH_SPT,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_V5,
-         "I219 V Ethernet Connection",
+         "I219 V (5) Ethernet Connection",
          WM_T_PCH_SPT,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_V6,
-         "I219 V Ethernet Connection",
+         "I219 V (6) Ethernet Connection",
          WM_T_PCH_CNP,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_V7,
-         "I219 V Ethernet Connection",
+         "I219 V (7) Ethernet Connection",
          WM_T_PCH_CNP,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_V8,
-         "I219 V Ethernet Connection",
+         "I219 V (8) Ethernet Connection",
          WM_T_PCH_CNP,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_V9,
-         "I219 V Ethernet Connection",
+         "I219 V (9) Ethernet Connection",
          WM_T_PCH_CNP,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_V10,
-         "I219 V Ethernet Connection",
+         "I219 V (10) Ethernet Connection",
          WM_T_PCH_CNP,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_V11,
-         "I219 V Ethernet Connection",
+         "I219 V (11) Ethernet Connection",
          WM_T_PCH_CNP,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_V12,
-         "I219 V Ethernet Connection",
+         "I219 V (12) Ethernet Connection",
          WM_T_PCH_SPT,         WMP_F_COPPER },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_I219_V13,
-         "I219 V Ethernet Connection",
+         "I219 V (13) Ethernet Connection",



Home | Main Index | Thread Index | Old Index