Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/dev/pci Pull up the following revisions, requested by...



details:   https://anonhg.NetBSD.org/src/rev/5244767b2459
branches:  netbsd-9
changeset: 369912:5244767b2459
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Sep 07 10:05:42 2022 +0000

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

        sys/dev/pci/if_wm.c                             1.741-1.749,
                                                        1.753-1.757,
                                                        1.762 via patch
        sys/dev/pci/if_wmreg.h                          1.126-1.127

- Fix I219 workaround in wm_flush_desc_rings().
- Add more statistics counters.
- To avoid releasing mutex temporally, use new
  wm_set_mdio_slow_mode_hv_locked().
- No functional changes:
  - Turn a locking botch (shouldn't drop lock on error) into a KASSERT
    in wm_deferred_start_locked().
  - Remove unneeded header inclusion.
  - Use __BIT() a little.
  - Modify comment and debug messages.
  - Consistency use -1 instead of 1 for some error code.
  - KNF.

diffstat:

 sys/dev/pci/if_wm.c    |  690 +++++++++++++++++++++++++++++++++++++++---------
 sys/dev/pci/if_wmreg.h |   82 ++++-
 2 files changed, 622 insertions(+), 150 deletions(-)

diffs (truncated from 1323 to 300 lines):

diff -r 9e63dd1084cb -r 5244767b2459 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Tue Aug 30 18:36:21 2022 +0000
+++ b/sys/dev/pci/if_wm.c       Wed Sep 07 10:05:42 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.645.2.13 2022/07/11 14:10:18 martin Exp $  */
+/*     $NetBSD: if_wm.c,v 1.645.2.14 2022/09/07 10:05:42 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.13 2022/07/11 14:10:18 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.14 2022/09/07 10:05:42 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -90,26 +90,25 @@
 #endif
 
 #include <sys/param.h>
-#include <sys/systm.h>
+
+#include <sys/atomic.h>
 #include <sys/callout.h>
-#include <sys/mbuf.h>
-#include <sys/malloc.h>
-#include <sys/kmem.h>
-#include <sys/kernel.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/errno.h>
+#include <sys/cpu.h>
 #include <sys/device.h>
-#include <sys/queue.h>
-#include <sys/syslog.h>
+#include <sys/errno.h>
 #include <sys/interrupt.h>
-#include <sys/cpu.h>
+#include <sys/ioctl.h>
+#include <sys/kernel.h>
+#include <sys/kmem.h>
+#include <sys/mbuf.h>
 #include <sys/pcq.h>
+#include <sys/queue.h>
+#include <sys/rndsource.h>
+#include <sys/socket.h>
 #include <sys/sysctl.h>
+#include <sys/syslog.h>
+#include <sys/systm.h>
 #include <sys/workqueue.h>
-#include <sys/atomic.h>
-
-#include <sys/rndsource.h>
 
 #include <net/if.h>
 #include <net/if_dl.h>
@@ -497,7 +496,7 @@
 };
 
 struct wm_phyop {
-       int (*acquire)(struct wm_softc *);
+       int (*acquire)(struct wm_softc *) __attribute__((warn_unused_result));
        void (*release)(struct wm_softc *);
        int (*readreg_locked)(device_t, int, int, uint16_t *);
        int (*writereg_locked)(device_t, int, int, uint16_t);
@@ -506,7 +505,7 @@
 };
 
 struct wm_nvmop {
-       int (*acquire)(struct wm_softc *);
+       int (*acquire)(struct wm_softc *) __attribute__((warn_unused_result));
        void (*release)(struct wm_softc *);
        int (*read)(struct wm_softc *, int, int, uint16_t *);
 };
@@ -597,12 +596,76 @@
        /* Event counters. */
        struct evcnt sc_ev_linkintr;    /* Link interrupts */
 
-       /* WM_T_82542_2_1 only */
+       /* >= WM_T_82542_2_1 */
        struct evcnt sc_ev_tx_xoff;     /* Tx PAUSE(!0) frames */
        struct evcnt sc_ev_tx_xon;      /* Tx PAUSE(0) frames */
        struct evcnt sc_ev_rx_xoff;     /* Rx PAUSE(!0) frames */
        struct evcnt sc_ev_rx_xon;      /* Rx PAUSE(0) frames */
        struct evcnt sc_ev_rx_macctl;   /* Rx Unsupported */
+
+       struct evcnt sc_ev_crcerrs;     /* CRC Error */
+       struct evcnt sc_ev_algnerrc;    /* Alignment Error */
+       struct evcnt sc_ev_symerrc;     /* Symbol Error */
+       struct evcnt sc_ev_rxerrc;      /* Receive Error */
+       struct evcnt sc_ev_mpc;         /* Missed Packets */
+       struct evcnt sc_ev_colc;        /* Collision */
+       struct evcnt sc_ev_sec;         /* Sequence Error */
+       struct evcnt sc_ev_cexterr;     /* Carrier Extension Error */
+       struct evcnt sc_ev_rlec;        /* Receive Length Error */
+       struct evcnt sc_ev_scc;         /* Single Collision */
+       struct evcnt sc_ev_ecol;        /* Excessive Collision */
+       struct evcnt sc_ev_mcc;         /* Multiple Collision */
+       struct evcnt sc_ev_latecol;     /* Late Collision */
+       struct evcnt sc_ev_dc;          /* Defer */
+       struct evcnt sc_ev_gprc;        /* Good Packets Rx */
+       struct evcnt sc_ev_bprc;        /* Broadcast Packets Rx */
+       struct evcnt sc_ev_mprc;        /* Multicast Packets Rx */
+       struct evcnt sc_ev_gptc;        /* Good Packets Tx */
+       struct evcnt sc_ev_gorc;        /* Good Octets Rx */
+       struct evcnt sc_ev_gotc;        /* Good Octets Tx */
+       struct evcnt sc_ev_rnbc;        /* Rx No Buffers */
+       struct evcnt sc_ev_ruc;         /* Rx Undersize */
+       struct evcnt sc_ev_rfc;         /* Rx Fragment */
+       struct evcnt sc_ev_roc;         /* Rx Oversize */
+       struct evcnt sc_ev_rjc;         /* Rx Jabber */
+       struct evcnt sc_ev_tor;         /* Total Octets Rx */
+       struct evcnt sc_ev_tot;         /* Total Octets Tx */
+       struct evcnt sc_ev_tpr;         /* Total Packets Rx */
+       struct evcnt sc_ev_tpt;         /* Total Packets Tx */
+       struct evcnt sc_ev_mptc;        /* Multicast Packets Tx */
+       struct evcnt sc_ev_bptc;        /* Broadcast Packets Tx Count */
+       struct evcnt sc_ev_prc64;       /* Packets Rx (64 bytes) */
+       struct evcnt sc_ev_prc127;      /* Packets Rx (65-127 bytes) */
+       struct evcnt sc_ev_prc255;      /* Packets Rx (128-255 bytes) */
+       struct evcnt sc_ev_prc511;      /* Packets Rx (255-511 bytes) */
+       struct evcnt sc_ev_prc1023;     /* Packets Rx (512-1023 bytes) */
+       struct evcnt sc_ev_prc1522;     /* Packets Rx (1024-1522 bytes) */
+       struct evcnt sc_ev_ptc64;       /* Packets Tx (64 bytes) */
+       struct evcnt sc_ev_ptc127;      /* Packets Tx (65-127 bytes) */
+       struct evcnt sc_ev_ptc255;      /* Packets Tx (128-255 bytes) */
+       struct evcnt sc_ev_ptc511;      /* Packets Tx (256-511 bytes) */
+       struct evcnt sc_ev_ptc1023;     /* Packets Tx (512-1023 bytes) */
+       struct evcnt sc_ev_ptc1522;     /* Packets Tx (1024-1522 Bytes) */
+       struct evcnt sc_ev_iac;         /* Interrupt Assertion */
+       struct evcnt sc_ev_icrxptc;     /* Intr. Cause Rx Pkt Timer Expire */
+       struct evcnt sc_ev_icrxatc;     /* Intr. Cause Rx Abs Timer Expire */
+       struct evcnt sc_ev_ictxptc;     /* Intr. Cause Tx Pkt Timer Expire */
+       struct evcnt sc_ev_ictxact;     /* Intr. Cause Tx Abs Timer Expire */
+       struct evcnt sc_ev_ictxqec;     /* Intr. Cause Tx Queue Empty */
+       struct evcnt sc_ev_ictxqmtc;    /* Intr. Cause Tx Queue Min Thresh */
+       struct evcnt sc_ev_icrxdmtc;    /* Intr. Cause Rx Desc Min Thresh */
+       struct evcnt sc_ev_icrxoc;      /* Intr. Cause Receiver Overrun */
+       struct evcnt sc_ev_tncrs;       /* Tx-No CRS */
+       struct evcnt sc_ev_tsctc;       /* TCP Segmentation Context Tx */
+       struct evcnt sc_ev_tsctfc;      /* TCP Segmentation Context Tx Fail */
+       struct evcnt sc_ev_mgtprc;      /* Management Packets RX */
+       struct evcnt sc_ev_mgtpdc;      /* Management Packets Dropped */
+       struct evcnt sc_ev_mgtptc;      /* Management Packets TX */
+       struct evcnt sc_ev_b2ogprc;     /* BMC2OS pkts received by host */
+       struct evcnt sc_ev_o2bspc;      /* OS2BMC pkts transmitted by host */
+       struct evcnt sc_ev_b2ospc;      /* BMC2OS pkts sent by BMC */
+       struct evcnt sc_ev_o2bgptc;     /* OS2BMC pkts received by BMC */
+
 #endif /* WM_EVENT_COUNTERS */
 
        struct sysctllog *sc_sysctllog;
@@ -1055,6 +1118,7 @@
 static int     wm_k1_workaround_lv(struct wm_softc *);
 static int     wm_link_stall_workaround_hv(struct wm_softc *);
 static int     wm_set_mdio_slow_mode_hv(struct wm_softc *);
+static int     wm_set_mdio_slow_mode_hv_locked(struct wm_softc *);
 static void    wm_configure_k1_ich8lan(struct wm_softc *, int);
 static void    wm_reset_init_script_82575(struct wm_softc *);
 static void    wm_reset_mdicnfg_82580(struct wm_softc *);
@@ -3143,16 +3207,153 @@
        evcnt_attach_dynamic(&sc->sc_ev_linkintr, EVCNT_TYPE_INTR,
            NULL, xname, "linkintr");
 
-       evcnt_attach_dynamic(&sc->sc_ev_tx_xoff, EVCNT_TYPE_MISC,
-           NULL, xname, "tx_xoff");
-       evcnt_attach_dynamic(&sc->sc_ev_tx_xon, EVCNT_TYPE_MISC,
-           NULL, xname, "tx_xon");
-       evcnt_attach_dynamic(&sc->sc_ev_rx_xoff, EVCNT_TYPE_MISC,
-           NULL, xname, "rx_xoff");
-       evcnt_attach_dynamic(&sc->sc_ev_rx_xon, EVCNT_TYPE_MISC,
-           NULL, xname, "rx_xon");
-       evcnt_attach_dynamic(&sc->sc_ev_rx_macctl, EVCNT_TYPE_MISC,
-           NULL, xname, "rx_macctl");
+       if (sc->sc_type >= WM_T_82542_2_1) {
+               evcnt_attach_dynamic(&sc->sc_ev_tx_xoff, EVCNT_TYPE_MISC,
+                   NULL, xname, "tx_xoff");
+               evcnt_attach_dynamic(&sc->sc_ev_tx_xon, EVCNT_TYPE_MISC,
+                   NULL, xname, "tx_xon");
+               evcnt_attach_dynamic(&sc->sc_ev_rx_xoff, EVCNT_TYPE_MISC,
+                   NULL, xname, "rx_xoff");
+               evcnt_attach_dynamic(&sc->sc_ev_rx_xon, EVCNT_TYPE_MISC,
+                   NULL, xname, "rx_xon");
+               evcnt_attach_dynamic(&sc->sc_ev_rx_macctl, EVCNT_TYPE_MISC,
+                   NULL, xname, "rx_macctl");
+       }
+
+       evcnt_attach_dynamic(&sc->sc_ev_crcerrs, EVCNT_TYPE_MISC,
+           NULL, xname, "CRC Error");
+       evcnt_attach_dynamic(&sc->sc_ev_symerrc, EVCNT_TYPE_MISC,
+           NULL, xname, "Symbol Error");
+
+       if (sc->sc_type >= WM_T_82543) {
+               evcnt_attach_dynamic(&sc->sc_ev_algnerrc, EVCNT_TYPE_MISC,
+                   NULL, xname, "Alignment Error");
+               evcnt_attach_dynamic(&sc->sc_ev_rxerrc, EVCNT_TYPE_MISC,
+                   NULL, xname, "Receive Error");
+               evcnt_attach_dynamic(&sc->sc_ev_cexterr, EVCNT_TYPE_MISC,
+                   NULL, xname, "Carrier Extension Error");
+       }
+
+       evcnt_attach_dynamic(&sc->sc_ev_mpc, EVCNT_TYPE_MISC,
+           NULL, xname, "Missed Packets");
+       evcnt_attach_dynamic(&sc->sc_ev_colc, EVCNT_TYPE_MISC,
+           NULL, xname, "Collision");
+       evcnt_attach_dynamic(&sc->sc_ev_sec, EVCNT_TYPE_MISC,
+           NULL, xname, "Sequence Error");
+       evcnt_attach_dynamic(&sc->sc_ev_rlec, EVCNT_TYPE_MISC,
+           NULL, xname, "Receive Length Error");
+       evcnt_attach_dynamic(&sc->sc_ev_scc, EVCNT_TYPE_MISC,
+           NULL, xname, "Single Collision");
+       evcnt_attach_dynamic(&sc->sc_ev_ecol, EVCNT_TYPE_MISC,
+           NULL, xname, "Excessive Collisions");
+       evcnt_attach_dynamic(&sc->sc_ev_mcc, EVCNT_TYPE_MISC,
+           NULL, xname, "Multiple Collision");
+       evcnt_attach_dynamic(&sc->sc_ev_latecol, EVCNT_TYPE_MISC,
+           NULL, xname, "Late Collisions");
+       evcnt_attach_dynamic(&sc->sc_ev_dc, EVCNT_TYPE_MISC,
+           NULL, xname, "Defer");
+       evcnt_attach_dynamic(&sc->sc_ev_gprc, EVCNT_TYPE_MISC,
+           NULL, xname, "Good Packets Rx");
+       evcnt_attach_dynamic(&sc->sc_ev_bprc, EVCNT_TYPE_MISC,
+           NULL, xname, "Broadcast Packets Rx");
+       evcnt_attach_dynamic(&sc->sc_ev_mprc, EVCNT_TYPE_MISC,
+           NULL, xname, "Multicast Packets Rx");
+       evcnt_attach_dynamic(&sc->sc_ev_gptc, EVCNT_TYPE_MISC,
+           NULL, xname, "Good Packets Tx");
+       evcnt_attach_dynamic(&sc->sc_ev_gorc, EVCNT_TYPE_MISC,
+           NULL, xname, "Good Octets Rx");
+       evcnt_attach_dynamic(&sc->sc_ev_gotc, EVCNT_TYPE_MISC,
+           NULL, xname, "Good Octets Tx");
+       evcnt_attach_dynamic(&sc->sc_ev_rnbc, EVCNT_TYPE_MISC,
+           NULL, xname, "Rx No Buffers");
+       evcnt_attach_dynamic(&sc->sc_ev_ruc, EVCNT_TYPE_MISC,
+           NULL, xname, "Rx Undersize");
+       evcnt_attach_dynamic(&sc->sc_ev_rfc, EVCNT_TYPE_MISC,
+           NULL, xname, "Rx Fragment");
+       evcnt_attach_dynamic(&sc->sc_ev_roc, EVCNT_TYPE_MISC,
+           NULL, xname, "Rx Oversize");
+       evcnt_attach_dynamic(&sc->sc_ev_rjc, EVCNT_TYPE_MISC,
+           NULL, xname, "Rx Jabber");
+       evcnt_attach_dynamic(&sc->sc_ev_tor, EVCNT_TYPE_MISC,
+           NULL, xname, "Total Octets Rx");
+       evcnt_attach_dynamic(&sc->sc_ev_tot, EVCNT_TYPE_MISC,
+           NULL, xname, "Total Octets Tx");
+       evcnt_attach_dynamic(&sc->sc_ev_tpr, EVCNT_TYPE_MISC,
+           NULL, xname, "Total Packets Rx");
+       evcnt_attach_dynamic(&sc->sc_ev_tpt, EVCNT_TYPE_MISC,
+           NULL, xname, "Total Packets Tx");
+       evcnt_attach_dynamic(&sc->sc_ev_mptc, EVCNT_TYPE_MISC,
+           NULL, xname, "Multicast Packets Tx");
+       evcnt_attach_dynamic(&sc->sc_ev_bptc, EVCNT_TYPE_MISC,
+           NULL, xname, "Broadcast Packets Tx Count");
+       evcnt_attach_dynamic(&sc->sc_ev_prc64, EVCNT_TYPE_MISC,
+           NULL, xname, "Packets Rx (64 bytes)");
+       evcnt_attach_dynamic(&sc->sc_ev_prc127, EVCNT_TYPE_MISC,
+           NULL, xname, "Packets Rx (65-127 bytes)");
+       evcnt_attach_dynamic(&sc->sc_ev_prc255, EVCNT_TYPE_MISC,
+           NULL, xname, "Packets Rx (128-255 bytes)");
+       evcnt_attach_dynamic(&sc->sc_ev_prc511, EVCNT_TYPE_MISC,
+           NULL, xname, "Packets Rx (255-511 bytes)");
+       evcnt_attach_dynamic(&sc->sc_ev_prc1023, EVCNT_TYPE_MISC,
+           NULL, xname, "Packets Rx (512-1023 bytes)");
+       evcnt_attach_dynamic(&sc->sc_ev_prc1522, EVCNT_TYPE_MISC,
+           NULL, xname, "Packets Rx (1024-1522 bytes)");
+       evcnt_attach_dynamic(&sc->sc_ev_ptc64, EVCNT_TYPE_MISC,
+           NULL, xname, "Packets Tx (64 bytes)");
+       evcnt_attach_dynamic(&sc->sc_ev_ptc127, EVCNT_TYPE_MISC,
+           NULL, xname, "Packets Tx (65-127 bytes)");
+       evcnt_attach_dynamic(&sc->sc_ev_ptc255, EVCNT_TYPE_MISC,
+           NULL, xname, "Packets Tx (128-255 bytes)");
+       evcnt_attach_dynamic(&sc->sc_ev_ptc511, EVCNT_TYPE_MISC,
+           NULL, xname, "Packets Tx (256-511 bytes)");
+       evcnt_attach_dynamic(&sc->sc_ev_ptc1023, EVCNT_TYPE_MISC,
+           NULL, xname, "Packets Tx (512-1023 bytes)");
+       evcnt_attach_dynamic(&sc->sc_ev_ptc1522, EVCNT_TYPE_MISC,
+           NULL, xname, "Packets Tx (1024-1522 Bytes)");
+       evcnt_attach_dynamic(&sc->sc_ev_iac, EVCNT_TYPE_MISC,
+           NULL, xname, "Interrupt Assertion");
+       evcnt_attach_dynamic(&sc->sc_ev_icrxptc, EVCNT_TYPE_MISC,
+           NULL, xname, "Intr. Cause Rx Pkt Timer Expire");
+       evcnt_attach_dynamic(&sc->sc_ev_icrxatc, EVCNT_TYPE_MISC,
+           NULL, xname, "Intr. Cause Rx Abs Timer Expire");
+       evcnt_attach_dynamic(&sc->sc_ev_ictxptc, EVCNT_TYPE_MISC,
+           NULL, xname, "Intr. Cause Tx Pkt Timer Expire");
+       evcnt_attach_dynamic(&sc->sc_ev_ictxact, EVCNT_TYPE_MISC,
+           NULL, xname, "Intr. Cause Tx Abs Timer Expire");
+       evcnt_attach_dynamic(&sc->sc_ev_ictxqec, EVCNT_TYPE_MISC,
+           NULL, xname, "Intr. Cause Tx Queue Empty");
+       evcnt_attach_dynamic(&sc->sc_ev_ictxqmtc, EVCNT_TYPE_MISC,
+           NULL, xname, "Intr. Cause Tx Queue Min Thresh");
+       evcnt_attach_dynamic(&sc->sc_ev_icrxdmtc, EVCNT_TYPE_MISC,
+           NULL, xname, "Intr. Cause Rx Desc Min Thresh");
+       evcnt_attach_dynamic(&sc->sc_ev_icrxoc, EVCNT_TYPE_MISC,
+           NULL, xname, "Interrupt Cause Receiver Overrun");
+       if (sc->sc_type >= WM_T_82543) {
+               evcnt_attach_dynamic(&sc->sc_ev_tncrs, EVCNT_TYPE_MISC,
+                   NULL, xname, "Tx with No CRS");



Home | Main Index | Thread Index | Old Index