Module Name: src
Committed By: msaitoh
Date: Mon May 15 08:01:22 UTC 2023
Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixgbe_common.c ixgbe_type.h
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.325 -r1.326 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/pci/ixgbe/ixgbe_type.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.325 src/sys/dev/pci/ixgbe/ixgbe.c:1.326
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.325 Fri Feb 3 05:43:55 2023
+++ src/sys/dev/pci/ixgbe/ixgbe.c Mon May 15 08:01:22 2023
@@ -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);
Index: src/sys/dev/pci/ixgbe/ixgbe_common.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_common.c:1.43 src/sys/dev/pci/ixgbe/ixgbe_common.c:1.44
--- src/sys/dev/pci/ixgbe/ixgbe_common.c:1.43 Mon Jun 6 02:16:37 2022
+++ src/sys/dev/pci/ixgbe/ixgbe_common.c Mon May 15 08:01:22 2023
@@ -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);
Index: src/sys/dev/pci/ixgbe/ixgbe_type.h
diff -u src/sys/dev/pci/ixgbe/ixgbe_type.h:1.55 src/sys/dev/pci/ixgbe/ixgbe_type.h:1.56
--- src/sys/dev/pci/ixgbe/ixgbe_type.h:1.55 Fri Dec 24 05:11:04 2021
+++ src/sys/dev/pci/ixgbe/ixgbe_type.h Mon May 15 08:01:22 2023
@@ -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;