From 4c1aa1b90d6261f14cac0fb250d7e8c46c3ca2b2 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Thu, 27 Nov 2014 14:52:05 +0000 Subject: Fix a long standing bug in MAC statistics register access. One additional register was erroneously added in the MAC register set such that 7 TX statistics counters were wrong. From FreeBSD ok mikeb@ --- sys/dev/pci/if_alc.c | 16 ++++------------ sys/dev/pci/if_alcreg.h | 4 +--- sys/dev/pci/if_ale.c | 16 ++++------------ sys/dev/pci/if_alereg.h | 4 +--- 4 files changed, 10 insertions(+), 30 deletions(-) diff --git a/sys/dev/pci/if_alc.c b/sys/dev/pci/if_alc.c index 4667d5040d2..a38a3192c71 100644 --- a/sys/dev/pci/if_alc.c +++ b/sys/dev/pci/if_alc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_alc.c,v 1.28 2014/11/18 02:37:30 tedu Exp $ */ +/* $OpenBSD: if_alc.c,v 1.29 2014/11/27 14:52:04 brad Exp $ */ /*- * Copyright (c) 2009, Pyun YongHyeon * All rights reserved. @@ -1643,7 +1643,6 @@ alc_stats_update(struct alc_softc *sc) stat->tx_multi_colls += smb->tx_multi_colls; stat->tx_late_colls += smb->tx_late_colls; stat->tx_excess_colls += smb->tx_excess_colls; - stat->tx_abort += smb->tx_abort; stat->tx_underrun += smb->tx_underrun; stat->tx_desc_underrun += smb->tx_desc_underrun; stat->tx_lenerrs += smb->tx_lenerrs; @@ -1656,17 +1655,10 @@ alc_stats_update(struct alc_softc *sc) ifp->if_collisions += smb->tx_single_colls + smb->tx_multi_colls * 2 + smb->tx_late_colls + - smb->tx_abort * HDPX_CFG_RETRY_DEFAULT; + smb->tx_excess_colls * HDPX_CFG_RETRY_DEFAULT; - /* - * XXX - * tx_pkts_truncated counter looks suspicious. It constantly - * increments with no sign of Tx errors. This may indicate - * the counter name is not correct one so I've removed the - * counter in output errors. - */ - ifp->if_oerrors += smb->tx_abort + smb->tx_late_colls + - smb->tx_underrun; + ifp->if_oerrors += smb->tx_late_colls + smb->tx_excess_colls + + smb->tx_underrun + smb->tx_pkts_truncated; ifp->if_ipackets += smb->rx_frames; diff --git a/sys/dev/pci/if_alcreg.h b/sys/dev/pci/if_alcreg.h index 60d603ea9f1..1e5703dc9c5 100644 --- a/sys/dev/pci/if_alcreg.h +++ b/sys/dev/pci/if_alcreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_alcreg.h,v 1.4 2011/05/25 02:22:20 kevlo Exp $ */ +/* $OpenBSD: if_alcreg.h,v 1.5 2014/11/27 14:52:04 brad Exp $ */ /*- * Copyright (c) 2009, Pyun YongHyeon * All rights reserved. @@ -848,7 +848,6 @@ struct smb { uint32_t tx_multi_colls; uint32_t tx_late_colls; uint32_t tx_excess_colls; - uint32_t tx_abort; uint32_t tx_underrun; uint32_t tx_desc_underrun; uint32_t tx_lenerrs; @@ -1118,7 +1117,6 @@ struct alc_hw_stats { uint32_t tx_multi_colls; uint32_t tx_late_colls; uint32_t tx_excess_colls; - uint32_t tx_abort; uint32_t tx_underrun; uint32_t tx_desc_underrun; uint32_t tx_lenerrs; diff --git a/sys/dev/pci/if_ale.c b/sys/dev/pci/if_ale.c index 8034fa18bc5..5bf134058e9 100644 --- a/sys/dev/pci/if_ale.c +++ b/sys/dev/pci/if_ale.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ale.c,v 1.33 2014/11/24 02:03:37 brad Exp $ */ +/* $OpenBSD: if_ale.c,v 1.34 2014/11/27 14:52:04 brad Exp $ */ /*- * Copyright (c) 2008, Pyun YongHyeon * All rights reserved. @@ -1239,7 +1239,6 @@ ale_stats_update(struct ale_softc *sc) stat->tx_multi_colls += smb->tx_multi_colls; stat->tx_late_colls += smb->tx_late_colls; stat->tx_excess_colls += smb->tx_excess_colls; - stat->tx_abort += smb->tx_abort; stat->tx_underrun += smb->tx_underrun; stat->tx_desc_underrun += smb->tx_desc_underrun; stat->tx_lenerrs += smb->tx_lenerrs; @@ -1252,17 +1251,10 @@ ale_stats_update(struct ale_softc *sc) ifp->if_collisions += smb->tx_single_colls + smb->tx_multi_colls * 2 + smb->tx_late_colls + - smb->tx_abort * HDPX_CFG_RETRY_DEFAULT; + smb->tx_excess_colls * HDPX_CFG_RETRY_DEFAULT; - /* - * XXX - * tx_pkts_truncated counter looks suspicious. It constantly - * increments with no sign of Tx errors. This may indicate - * the counter name is not correct one so I've removed the - * counter in output errors. - */ - ifp->if_oerrors += smb->tx_abort + smb->tx_late_colls + - smb->tx_underrun; + ifp->if_oerrors += smb->tx_late_colls + smb->tx_excess_colls + + smb->tx_underrun + smb->tx_pkts_truncated; ifp->if_ipackets += smb->rx_frames; diff --git a/sys/dev/pci/if_alereg.h b/sys/dev/pci/if_alereg.h index 73be8b1111d..27c424f0119 100644 --- a/sys/dev/pci/if_alereg.h +++ b/sys/dev/pci/if_alereg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_alereg.h,v 1.2 2011/05/20 08:36:55 kevlo Exp $ */ +/* $OpenBSD: if_alereg.h,v 1.3 2014/11/27 14:52:04 brad Exp $ */ /*- * Copyright (c) 2008, Pyun YongHyeon * All rights reserved. @@ -598,7 +598,6 @@ struct smb { uint32_t tx_multi_colls; uint32_t tx_late_colls; uint32_t tx_excess_colls; - uint32_t tx_abort; uint32_t tx_underrun; uint32_t tx_desc_underrun; uint32_t tx_lenerrs; @@ -886,7 +885,6 @@ struct ale_hw_stats { uint32_t tx_multi_colls; uint32_t tx_late_colls; uint32_t tx_excess_colls; - uint32_t tx_abort; uint32_t tx_underrun; uint32_t tx_desc_underrun; uint32_t tx_lenerrs; -- cgit v1.2.3