Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/sys/dev/pci Pull up the following revisions, requested by...
details: https://anonhg.NetBSD.org/src/rev/36d9e1a6fa0c
branches: netbsd-8
changeset: 376669:36d9e1a6fa0c
user: martin <martin%NetBSD.org@localhost>
date: Tue Jun 27 18:36:53 2023 +0000
description:
Pull up the following revisions, requested by msaitoh in #1847:
sys/dev/pci/if_wm.c 1.768-1.782 via patch
sys/dev/pci/if_wmreg.h 1.129-1.130
sys/dev/pci/if_wmvar.h 1.49
wm(4):
- Rework for event counters:
- Fix calculation of GORC, GOTC, TOR and TOT counters correctly.
- Rearrange the order of the registers so that they are roughly
in ascending order.
- Reorder evcnt_attach_dynamic(), WM_EVCNT_ADD() and evcnt_detach()
to match.
- IC{TX,RX}*C registers are for older than 82575.
- Fix a bug that the transmit underrun counter is incorrectly
counted.
- Don't add "Count" for event counter's description.
- Some statistics registers were replaced with new counters on newer
chips. Treat 0x403c(CEXTERR->HTDPMC), 0x40fc(TSCTFC->CBRMPC),
0x4124(ICRXOC->HTCBDPC) and from 0x4104 to 0x4124.
- Add some new counters:
- Circuit Breaker TX Manageability Packet
- Circuit Breaker RX Dropped Packet
- Host Good Octets RX
- Host Good Octets TX
- Length Errors
- SerDes/SGMII Code Violation Packet
- Header Redirection Missed Packet
- EEE TX LPI
- EEE RX LPI
- Fix prc511's comment and description.
- Add SOICZIFDATA (ifconfig -z) support for evcnt(9).
- Use WM_IS_ICHPCH(). No functional change.
- Fix typo. s/ictxact/ictxatc/. No functional change.
- Add comment.
diffstat:
sys/dev/pci/if_wm.c | 906 ++++++++++++++++++++++++++++++++++--------------
sys/dev/pci/if_wmreg.h | 34 +-
sys/dev/pci/if_wmvar.h | 5 +-
3 files changed, 682 insertions(+), 263 deletions(-)
diffs (truncated from 1245 to 300 lines):
diff -r 6be8d6a9b410 -r 36d9e1a6fa0c sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c Thu Jun 22 06:32:31 2023 +0000
+++ b/sys/dev/pci/if_wm.c Tue Jun 27 18:36:53 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wm.c,v 1.508.4.49 2023/06/21 21:29:57 martin Exp $ */
+/* $NetBSD: if_wm.c,v 1.508.4.50 2023/06/27 18:36:53 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.508.4.49 2023/06/21 21:29:57 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.508.4.50 2023/06/27 18:36:53 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_net_mpsafe.h"
@@ -593,10 +593,10 @@ struct wm_softc {
struct evcnt sc_ev_linkintr; /* Link interrupts */
/* >= WM_T_82542_2_1 */
- struct evcnt sc_ev_tx_xoff; /* Tx PAUSE(!0) frames */
+ struct evcnt sc_ev_rx_xon; /* Rx 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_tx_xoff; /* Tx PAUSE(!0) frames */
struct evcnt sc_ev_rx_macctl; /* Rx Unsupported */
struct evcnt sc_ev_crcerrs; /* CRC Error */
@@ -604,15 +604,29 @@ struct wm_softc {
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_colc; /* Collision */
+ struct evcnt sc_ev_cbtmpc; /* Circuit Breaker Tx Mng. Packet */
struct evcnt sc_ev_dc; /* Defer */
+ struct evcnt sc_ev_tncrs; /* Tx-No CRS */
+ struct evcnt sc_ev_sec; /* Sequence Error */
+
+ /* Old */
+ struct evcnt sc_ev_cexterr; /* Carrier Extension Error */
+ /* New */
+ struct evcnt sc_ev_htdpmc; /* Host Tx Discarded Pkts by MAC */
+
+ struct evcnt sc_ev_rlec; /* Receive Length Error */
+ struct evcnt sc_ev_cbrdpc; /* Circuit Breaker Rx Dropped Packet */
+ 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 (256-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_gprc; /* Good Packets Rx */
struct evcnt sc_ev_bprc; /* Broadcast Packets Rx */
struct evcnt sc_ev_mprc; /* Multicast Packets Rx */
@@ -624,44 +638,62 @@ struct wm_softc {
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_mgtprc; /* Management Packets RX */
+ struct evcnt sc_ev_mgtpdc; /* Management Packets Dropped */
+ struct evcnt sc_ev_mgtptc; /* Management Packets TX */
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_mptc; /* Multicast Packets Tx */
+ struct evcnt sc_ev_bptc; /* Broadcast Packets Tx */
+ struct evcnt sc_ev_tsctc; /* TCP Segmentation Context Tx */
+
+ /* Old */
+ struct evcnt sc_ev_tsctfc; /* TCP Segmentation Context Tx Fail */
+ /* New */
+ struct evcnt sc_ev_cbrmpc; /* Circuit Breaker Rx Mng. Packet */
+
struct evcnt sc_ev_iac; /* Interrupt Assertion */
+
+ /* Old */
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_ictxatc; /* 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 */
+ /*
+ * sc_ev_rxdmtc is shared with both "Intr. cause" and
+ * non "Intr. cause" register.
+ */
+ struct evcnt sc_ev_rxdmtc; /* (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 */
+ /* New */
+ struct evcnt sc_ev_rpthc; /* Rx Packets To Host */
+ struct evcnt sc_ev_debug1; /* Debug Counter 1 */
+ struct evcnt sc_ev_debug2; /* Debug Counter 2 */
+ struct evcnt sc_ev_debug3; /* Debug Counter 3 */
+ struct evcnt sc_ev_hgptc; /* Host Good Packets TX */
+ struct evcnt sc_ev_debug4; /* Debug Counter 4 */
+ struct evcnt sc_ev_htcbdpc; /* Host Tx Circuit Breaker Drp. Pkts */
+ struct evcnt sc_ev_hgorc; /* Host Good Octets Rx */
+ struct evcnt sc_ev_hgotc; /* Host Good Octets Tx */
+ struct evcnt sc_ev_lenerrs; /* Length Error */
+ struct evcnt sc_ev_tlpic; /* EEE Tx LPI */
+ struct evcnt sc_ev_rlpic; /* EEE Rx LPI */
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 */
-
+ struct evcnt sc_ev_scvpc; /* SerDes/SGMII Code Violation Pkt. */
+ struct evcnt sc_ev_hrmpc; /* Header Redirection Missed Packet */
#endif /* WM_EVENT_COUNTERS */
struct sysctllog *sc_sysctllog;
@@ -727,17 +759,22 @@ do { \
#ifdef WM_EVENT_COUNTERS
#define WM_EVCNT_INCR(ev) (ev)->ev_count++
+#define WM_EVCNT_STORE(ev, val) (ev)->ev_count = (val)
#define WM_EVCNT_ADD(ev, val) (ev)->ev_count += (val)
#define WM_Q_EVCNT_INCR(qname, evname) \
WM_EVCNT_INCR(&(qname)->qname##_ev_##evname)
+#define WM_Q_EVCNT_STORE(qname, evname, val) \
+ WM_EVCNT_STORE(&(qname)->qname##_ev_##evname, (val))
#define WM_Q_EVCNT_ADD(qname, evname, val) \
WM_EVCNT_ADD(&(qname)->qname##_ev_##evname, (val))
#else /* !WM_EVENT_COUNTERS */
#define WM_EVCNT_INCR(ev) /* nothing */
+#define WM_EVCNT_STORE(ev, val) /* nothing */
#define WM_EVCNT_ADD(ev, val) /* nothing */
#define WM_Q_EVCNT_INCR(qname, evname) /* nothing */
+#define WM_Q_EVCNT_STORE(qname, evname, val) /* nothing */
#define WM_Q_EVCNT_ADD(qname, evname, val) /* nothing */
#endif /* !WM_EVENT_COUNTERS */
@@ -846,6 +883,8 @@ static int wm_setup_msix(struct wm_softc
static int wm_init(struct ifnet *);
static int wm_init_locked(struct ifnet *);
static void wm_init_sysctls(struct wm_softc *);
+static void wm_update_stats(struct wm_softc *);
+static void wm_clear_evcnt(struct wm_softc *);
static void wm_unset_stopping_flags(struct wm_softc *);
static void wm_set_stopping_flags(struct wm_softc *);
static void wm_stop(struct ifnet *, int);
@@ -3168,6 +3207,53 @@ alloc_retry:
evcnt_attach_dynamic(&sc->sc_ev_linkintr, EVCNT_TYPE_INTR,
NULL, xname, "linkintr");
+ 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");
+ 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");
+
+ 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");
+ /* XXX Does 82575 have HTDPMC? */
+ if ((sc->sc_type < WM_T_82575) || WM_IS_ICHPCH(sc))
+ evcnt_attach_dynamic(&sc->sc_ev_cexterr,
+ EVCNT_TYPE_MISC, NULL, xname,
+ "Carrier Extension Error");
+ else
+ evcnt_attach_dynamic(&sc->sc_ev_htdpmc,
+ EVCNT_TYPE_MISC, NULL, xname,
+ "Host Transmit Discarded Packets by MAC");
+
+ evcnt_attach_dynamic(&sc->sc_ev_tncrs, EVCNT_TYPE_MISC,
+ NULL, xname, "Tx with No CRS");
+ evcnt_attach_dynamic(&sc->sc_ev_tsctc, EVCNT_TYPE_MISC,
+ NULL, xname, "TCP Segmentation Context Tx");
+ if ((sc->sc_type < WM_T_82575) || WM_IS_ICHPCH(sc))
+ evcnt_attach_dynamic(&sc->sc_ev_tsctfc,
+ EVCNT_TYPE_MISC, NULL, xname,
+ "TCP Segmentation Context Tx Fail");
+ else {
+ /* XXX Is the circuit breaker only for 82576? */
+ evcnt_attach_dynamic(&sc->sc_ev_cbrdpc,
+ EVCNT_TYPE_MISC, NULL, xname,
+ "Circuit Breaker Rx Dropped Packet");
+ evcnt_attach_dynamic(&sc->sc_ev_cbrmpc,
+ EVCNT_TYPE_MISC, NULL, xname,
+ "Circuit Breaker Rx Manageability Packet");
+ }
+ }
+
if (sc->sc_type >= WM_T_82542_2_1) {
evcnt_attach_dynamic(&sc->sc_ev_tx_xoff, EVCNT_TYPE_MISC,
NULL, xname, "tx_xoff");
@@ -3181,28 +3267,6 @@ alloc_retry:
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,
@@ -3211,8 +3275,25 @@ alloc_retry:
NULL, xname, "Multiple Collision");
evcnt_attach_dynamic(&sc->sc_ev_latecol, EVCNT_TYPE_MISC,
NULL, xname, "Late Collisions");
+
+ if ((sc->sc_type >= WM_T_I350) && !WM_IS_ICHPCH(sc))
+ evcnt_attach_dynamic(&sc->sc_ev_cbtmpc, EVCNT_TYPE_MISC,
+ NULL, xname, "Circuit Breaker Tx Manageability Packet");
+
evcnt_attach_dynamic(&sc->sc_ev_dc, EVCNT_TYPE_MISC,
NULL, xname, "Defer");
+ 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 (256-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_gprc, EVCNT_TYPE_MISC,
NULL, xname, "Good Packets Rx");
evcnt_attach_dynamic(&sc->sc_ev_bprc, EVCNT_TYPE_MISC,
@@ -3235,6 +3316,14 @@ alloc_retry:
NULL, xname, "Rx Oversize");
evcnt_attach_dynamic(&sc->sc_ev_rjc, EVCNT_TYPE_MISC,
NULL, xname, "Rx Jabber");
+ if (sc->sc_type >= WM_T_82540) {
+ evcnt_attach_dynamic(&sc->sc_ev_mgtprc, EVCNT_TYPE_MISC,
+ NULL, xname, "Management Packets RX");
+ evcnt_attach_dynamic(&sc->sc_ev_mgtpdc, EVCNT_TYPE_MISC,
+ NULL, xname, "Management Packets Dropped");
+ evcnt_attach_dynamic(&sc->sc_ev_mgtptc, EVCNT_TYPE_MISC,
+ NULL, xname, "Management Packets TX");
+ }
evcnt_attach_dynamic(&sc->sc_ev_tor, EVCNT_TYPE_MISC,
NULL, xname, "Total Octets Rx");
Home |
Main Index |
Thread Index |
Old Index