Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci/ixgbe Count the number of link down events in th...



details:   https://anonhg.NetBSD.org/src/rev/3fa6a8601ddb
branches:  trunk
changeset: 375328:3fa6a8601ddb
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Mon May 15 08:01:22 2023 +0000

description:
Count the number of link down events in the MAC using with LINK_DN_CNT.

 - Add new event counter "link_dn_cnt" to count the number of link down
   events in the MAC.
 - The LINK_DN_CNT register (at 0x0403c) is described only in the
   Denverton's datasheet, so use it only on ixgbe_mac_X550EM_a.

diffstat:

 sys/dev/pci/ixgbe/ixgbe.c        |  13 +++++++++++--
 sys/dev/pci/ixgbe/ixgbe_common.c |   6 ++++--
 sys/dev/pci/ixgbe/ixgbe_type.h   |   4 +++-
 3 files changed, 18 insertions(+), 5 deletions(-)

diffs (107 lines):

diff -r 585d69643666 -r 3fa6a8601ddb sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Mon May 15 07:57:22 2023 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Mon May 15 08:01:22 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.325 2023/02/03 05:43:55 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.326 2023/05/15 08:01:22 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.325 2023/02/03 05:43:55 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.326 2023/05/15 08:01:22 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1680,6 +1680,8 @@ ixgbe_update_stats_counters(struct adapt
                IXGBE_EVC_REGADD(hw, stats, IXGBE_MLFC, mlfc);
                IXGBE_EVC_REGADD(hw, stats, IXGBE_MRFC, mrfc);
        }
+       if (hw->mac.type == ixgbe_mac_X550EM_a)
+               IXGBE_EVC_REGADD(hw, stats, IXGBE_LINK_DN_CNT, link_dn_cnt);
        IXGBE_EVC_REGADD2(hw, stats, IXGBE_RLEC, rlec);
 
        /* Hardware workaround, gprc counts missed packets */
@@ -2029,6 +2031,9 @@ ixgbe_add_hw_stats(struct adapter *adapt
            stats->namebuf, "MAC Local Faults");
        evcnt_attach_dynamic(&stats->mrfc, EVCNT_TYPE_MISC, NULL,
            stats->namebuf, "MAC Remote Faults");
+       if (hw->mac.type == ixgbe_mac_X550EM_a)
+               evcnt_attach_dynamic(&stats->link_dn_cnt, EVCNT_TYPE_MISC,
+                   NULL, stats->namebuf, "Link down event in the MAC");
        evcnt_attach_dynamic(&stats->rlec, EVCNT_TYPE_MISC, NULL,
            stats->namebuf, "Receive Length Errors");
        evcnt_attach_dynamic(&stats->lxontxc, EVCNT_TYPE_MISC, NULL,
@@ -2197,6 +2202,8 @@ ixgbe_clear_evcnt(struct adapter *adapte
        IXGBE_EVC_STORE(&stats->mpctotal, 0);
        IXGBE_EVC_STORE(&stats->mlfc, 0);
        IXGBE_EVC_STORE(&stats->mrfc, 0);
+       if (hw->mac.type == ixgbe_mac_X550EM_a)
+               IXGBE_EVC_STORE(&stats->link_dn_cnt, 0);
        IXGBE_EVC_STORE(&stats->rlec, 0);
        IXGBE_EVC_STORE(&stats->lxontxc, 0);
        IXGBE_EVC_STORE(&stats->lxonrxc, 0);
@@ -3802,6 +3809,8 @@ ixgbe_detach(device_t dev, int flags)
        evcnt_detach(&stats->mpctotal);
        evcnt_detach(&stats->mlfc);
        evcnt_detach(&stats->mrfc);
+       if (hw->mac.type == ixgbe_mac_X550EM_a)
+               evcnt_detach(&stats->link_dn_cnt);
        evcnt_detach(&stats->rlec);
        evcnt_detach(&stats->lxontxc);
        evcnt_detach(&stats->lxonrxc);
diff -r 585d69643666 -r 3fa6a8601ddb sys/dev/pci/ixgbe/ixgbe_common.c
--- a/sys/dev/pci/ixgbe/ixgbe_common.c  Mon May 15 07:57:22 2023 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_common.c  Mon May 15 08:01:22 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_common.c,v 1.43 2022/06/06 02:16:37 msaitoh Exp $ */
+/* $NetBSD: ixgbe_common.c,v 1.44 2023/05/15 08:01:22 msaitoh Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -36,7 +36,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/ixgbe_common.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixgbe_common.c,v 1.43 2022/06/06 02:16:37 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe_common.c,v 1.44 2023/05/15 08:01:22 msaitoh Exp $");
 
 #include "ixgbe_common.h"
 #include "ixgbe_phy.h"
@@ -544,6 +544,8 @@ s32 ixgbe_clear_hw_cntrs_generic(struct 
 
        IXGBE_READ_REG(hw, IXGBE_MLFC);
        IXGBE_READ_REG(hw, IXGBE_MRFC);
+       if (hw->mac.type == ixgbe_mac_X550EM_a)
+               IXGBE_READ_REG(hw, IXGBE_LINK_DN_CNT);
        IXGBE_READ_REG(hw, IXGBE_RLEC);
        IXGBE_READ_REG(hw, IXGBE_LXONTXC);
        IXGBE_READ_REG(hw, IXGBE_LXOFFTXC);
diff -r 585d69643666 -r 3fa6a8601ddb sys/dev/pci/ixgbe/ixgbe_type.h
--- a/sys/dev/pci/ixgbe/ixgbe_type.h    Mon May 15 07:57:22 2023 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_type.h    Mon May 15 08:01:22 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_type.h,v 1.55 2021/12/24 05:11:04 msaitoh Exp $ */
+/* $NetBSD: ixgbe_type.h,v 1.56 2023/05/15 08:01:22 msaitoh Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -991,6 +991,7 @@ struct ixgbe_dmac_config {
 #define IXGBE_MPC(_i)  (0x03FA0 + ((_i) * 4)) /* 8 of these 3FA0-3FBC*/
 #define IXGBE_MLFC     0x04034
 #define IXGBE_MRFC     0x04038
+#define IXGBE_LINK_DN_CNT 0x0403c      /* LINK Down Counter */
 #define IXGBE_RLEC     0x04040
 #define IXGBE_LXONTXC  0x03F60
 #define IXGBE_LXONRXC  0x0CF60
@@ -3918,6 +3919,7 @@ struct ixgbe_hw_stats {
        struct evcnt mpc[IXGBE_TC_COUNTER_NUM];
        struct evcnt mlfc;
        struct evcnt mrfc;
+       struct evcnt link_dn_cnt;
        struct evcnt rlec;
        struct evcnt lxontxc;
        struct evcnt lxonrxc;



Home | Main Index | Thread Index | Old Index