Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-10]: src/sys/dev/pci Pull up following revision(s) (requested by ...
details: https://anonhg.NetBSD.org/src/rev/5a099ff30e2e
branches: netbsd-10
changeset: 376570:5a099ff30e2e
user: martin <martin%NetBSD.org@localhost>
date: Thu Jun 22 08:14:35 2023 +0000
description:
Pull up following revision(s) (requested by msaitoh in ticket #213):
sys/dev/pci/if_wm.c: revision 1.770
sys/dev/pci/if_wm.c: revision 1.771
sys/dev/pci/if_wm.c: revision 1.772
sys/dev/pci/if_wm.c: revision 1.773
sys/dev/pci/if_wm.c: revision 1.774
sys/dev/pci/if_wm.c: revision 1.775
sys/dev/pci/if_wm.c: revision 1.776
sys/dev/pci/if_wmreg.h: revision 1.129
sys/dev/pci/if_wm.c: revision 1.777
sys/dev/pci/if_wm.c: revision 1.778
sys/dev/pci/if_wmvar.h: revision 1.49
sys/dev/pci/if_wm.c: revision 1.779
sys/dev/pci/if_wm.c: revision 1.768
sys/dev/pci/if_wm.c: revision 1.769
sys/dev/pci/if_wmreg.h: revision 1.130
sys/dev/pci/if_wm.c: revision 1.780
sys/dev/pci/if_wm.c: revision 1.781
Count some 64bit counters correctly.
- Fix calculation of GORC, GOTC, TOR and TOT counters correctly.
- Found by knakahara.
Add note for the TORL register.
The TOR register includes error, flow control and broadcast rejected.
Sort lines. No functional change.
Rearrange the order of the registers so that they are roughly in ascending
order.
Sort lines. No functional change.
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.
The transmit underrun bit in the transmit status filed is only for 82544
(and older?), so don't use the counter for newer chips. The bit is reserved
for newer chips, but the bit sometimes set on 82575 at least.
Don't add "Count" for event counter's description.
Some statistics registers were replaced with new counters.
- 0x403c was CEXTERR(Carrier Extension Error). 82575 and newer except 80003,
ICHs and PCHs have HTDPMC(Host Tx Discarded Packets by MAC). I don't really
know for 82575. The 82575 datasheet say nothing about it.
- The following two are changed for circuit breaker. Only 82576's datasheet
describes abut it, so the registers might be only for 82576.
Use those registers for 82575 and newer except 80003, ICHs and PCHs just in
case.
- 0x40fc was TSCTFC(TCP Segmentation Context Tx Fail). It was replaced by
the CBRMPC(Circuit Breaker Rx Manageability Packet) register.
- 0x4124 was ICRXOC(Interrupt Cause Receiver Overrun). It was replaced by
the HTCBDPC(Host Tx Circuit Breaker Dropped Packet) register.
- From 0x4104 to 0x4124:
- For 0x4124, 82575's datasheet says it's not changed(ICRXOC).
I don't know if it's correct. We use new HTCBDPC register for 82575.
- 82576 and newer changed the meaning.
- I don't know for 80003, ICHs and PCHs. Don't count those registers.
At least, those registers in PCH2 and PCH_CNP are all zero.
Add some new event counters.
Add the following counters for 82575 and newer except 80003, ICHs and PCHs:
- Only 82576 document describes about the circuit breaker,
so the following two might be only for 82575:
- Circuit Breaker TX Manageability Packet
- Circuit Breaker RX Dropped Packet
- 82575's document doesn't describe the following two, but we can see
the same value as GO{T,R}C have:
- Host Good Octets RX
- Host Good Octets TX
- 82575's document doesn't describe the LENERRS (Length Errors) counter.
I don't know if it has.
- Perhaps Non-SerDes/SGMII devices don't have SCVPC
(SerDes/SGMII Code Violation Packet) register. We don't care if
it's SerDes/SGMII or not for now.
- HRMPC (Header Redirection Missed Packet) appears only once
in 8257[56]'s datasheet. FreeBSD's igb counts it, so we do, too.
- Count the following two for I350 and newer. I don't know if PCHs have:
- EEE TX LPI
- EEE RX LPI
Move statistics updating code from wm_tick() to new wm_update_stats().
- To reuse.
- No functional change.
Add SOICZIFDATA (ifconfig -z) support for evcnt(9).
First update the statistics data, then clear the event counters,
and finally copy and clear if_data via ether_ioctl().
Fix prc511's comment and description.
Use WM_IS_ICHPCH(). No functional change.
Fix typo. s/ictxact/ictxatc/. No functional change.
diffstat:
sys/dev/pci/if_wm.c | 907 ++++++++++++++++++++++++++++++++++--------------
sys/dev/pci/if_wmreg.h | 34 +-
sys/dev/pci/if_wmvar.h | 5 +-
3 files changed, 683 insertions(+), 263 deletions(-)
diffs (truncated from 1254 to 300 lines):
diff -r 5b9d434b8532 -r 5a099ff30e2e sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c Wed Jun 21 22:39:15 2023 +0000
+++ b/sys/dev/pci/if_wm.c Thu Jun 22 08:14:35 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wm.c,v 1.767 2022/12/08 08:14:28 knakahara Exp $ */
+/* $NetBSD: if_wm.c,v 1.767.2.1 2023/06/22 08:14:35 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.767 2022/12/08 08:14:28 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.767.2.1 2023/06/22 08:14:35 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_if_wm.h"
@@ -585,10 +585,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 */
@@ -596,15 +596,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 */
@@ -616,44 +630,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;
@@ -725,25 +757,33 @@ do { \
#define WM_EVCNT_INCR(ev) \
atomic_store_relaxed(&((ev)->ev_count), \
atomic_load_relaxed(&(ev)->ev_count) + 1)
+#define WM_EVCNT_STORE(ev, val) \
+ atomic_store_relaxed(&((ev)->ev_count), (val))
#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_STORE(ev, val) \
+ ((ev)->ev_count = (val))
#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)
+#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 */
@@ -852,6 +892,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);
@@ -3199,6 +3241,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");
@@ -3212,28 +3301,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,
@@ -3242,8 +3309,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,
@@ -3266,6 +3350,14 @@ alloc_retry:
NULL, xname, "Rx Oversize");
evcnt_attach_dynamic(&sc->sc_ev_rjc, EVCNT_TYPE_MISC,
Home |
Main Index |
Thread Index |
Old Index