summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authormsaitoh <msaitoh@NetBSD.org>2023-05-11 07:07:08 +0000
committermsaitoh <msaitoh@NetBSD.org>2023-05-11 07:07:08 +0000
commit00e5fa9c3e0afbb3b8a8b79df44666943bd0b98c (patch)
treeacd102c0abe7d51087f48f68f93b7beb44c7f212 /sys/dev
parent2af328e6b1777d76e4db35b4409556ca47f30946 (diff)
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.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/if_wm.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/sys/dev/pci/if_wm.c b/sys/dev/pci/if_wm.c
index 155c8105517..4dac974edb7 100644
--- a/sys/dev/pci/if_wm.c
+++ b/sys/dev/pci/if_wm.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wm.c,v 1.772 2023/05/11 07:04:06 msaitoh Exp $ */
+/* $NetBSD: if_wm.c,v 1.773 2023/05/11 07:07:08 msaitoh 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.772 2023/05/11 07:04:06 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.773 2023/05/11 07:07:08 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_if_wm.h"
@@ -7688,7 +7688,9 @@ wm_alloc_txrx_queues(struct wm_softc *sc)
WM_Q_MISC_EVCNT_ATTACH(txq, descdrop, txq, i, xname);
WM_Q_MISC_EVCNT_ATTACH(txq, toomanyseg, txq, i, xname);
WM_Q_MISC_EVCNT_ATTACH(txq, defrag, txq, i, xname);
- WM_Q_MISC_EVCNT_ATTACH(txq, underrun, txq, i, xname);
+ /* Only for 82544 (and earlier?) */
+ if (sc->sc_type <= WM_T_82544)
+ WM_Q_MISC_EVCNT_ATTACH(txq, underrun, txq, i, xname);
WM_Q_MISC_EVCNT_ATTACH(txq, skipcontext, txq, i, xname);
#endif /* WM_EVENT_COUNTERS */
@@ -7809,7 +7811,8 @@ wm_free_txrx_queues(struct wm_softc *sc)
WM_Q_EVCNT_DETACH(txq, descdrop, txq, i);
WM_Q_EVCNT_DETACH(txq, toomanyseg, txq, i);
WM_Q_EVCNT_DETACH(txq, defrag, txq, i);
- WM_Q_EVCNT_DETACH(txq, underrun, txq, i);
+ if (sc->sc_type <= WM_T_82544)
+ WM_Q_EVCNT_DETACH(txq, underrun, txq, i);
WM_Q_EVCNT_DETACH(txq, skipcontext, txq, i);
#endif /* WM_EVENT_COUNTERS */
@@ -9431,14 +9434,8 @@ wm_txeof(struct wm_txqueue *txq, u_int limit)
device_xname(sc->sc_dev), i, txs->txs_firstdesc,
txs->txs_lastdesc));
- /*
- * XXX We should probably be using the statistics
- * XXX registers, but I don't know if they exist
- * XXX on chips before the i82544.
- */
-
#ifdef WM_EVENT_COUNTERS
- if (status & WTX_ST_TU)
+ if ((status & WTX_ST_TU) && (sc->sc_type <= WM_T_82544))
WM_Q_EVCNT_INCR(txq, underrun);
#endif /* WM_EVENT_COUNTERS */