Module Name: src Committed By: martin Date: Wed Jun 21 19:28:12 UTC 2023
Modified Files: src/sys/dev/pci/ixgbe [netbsd-8]: ixgbe.c ixgbe_common.c ixgbe_type.h Log Message: Pullup the following revisions, requested by msaitoh in ticket #1828: sys/dev/pci/ixgbe/ixgbe.c 1.325-1.326 via patch sys/dev/pci/ixgbe/ixgbe_common.c 1.44 sys/dev/pci/ixgbe/ixgbe_type.h 1.56 - PCI device ID 0x15c8 also uses X557-AT PHY, so create the thermal sensor sysctl for it, too. - Count the number of link down events in the MAC using with LINK_DN_CNT register. To generate a diff of this commit: cvs rdiff -u -r1.88.2.54 -r1.88.2.55 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.13.2.13 -r1.13.2.14 src/sys/dev/pci/ixgbe/ixgbe_common.c cvs rdiff -u -r1.22.2.17 -r1.22.2.18 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.88.2.54 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.55 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.54 Mon Jan 23 14:07:24 2023 +++ src/sys/dev/pci/ixgbe/ixgbe.c Wed Jun 21 19:28:12 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.c,v 1.88.2.54 2023/01/23 14:07:24 martin Exp $ */ +/* $NetBSD: ixgbe.c,v 1.88.2.55 2023/06/21 19:28:12 martin Exp $ */ /****************************************************************************** @@ -64,7 +64,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.54 2023/01/23 14:07:24 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.55 2023/06/21 19:28:12 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1643,6 +1643,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 */ @@ -1993,6 +1995,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, @@ -2161,6 +2166,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); @@ -3433,7 +3440,8 @@ ixgbe_add_device_sysctls(struct adapter } /* for X552/X557-AT devices */ - if (hw->device_id == IXGBE_DEV_ID_X550EM_X_10G_T) { + if ((hw->device_id == IXGBE_DEV_ID_X550EM_X_10G_T) || + (hw->device_id == IXGBE_DEV_ID_X550EM_A_10G_T)) { const struct sysctlnode *phy_node; if (sysctl_createv(log, 0, &rnode, &phy_node, 0, CTLTYPE_NODE, @@ -3729,6 +3737,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); @@ -5772,7 +5782,8 @@ ixgbe_sysctl_phy_temp(SYSCTLFN_ARGS) if (ixgbe_fw_recovery_mode_swflag(adapter)) return (EPERM); - if (hw->device_id != IXGBE_DEV_ID_X550EM_X_10G_T) { + if ((hw->device_id != IXGBE_DEV_ID_X550EM_X_10G_T) && + (hw->device_id != IXGBE_DEV_ID_X550EM_A_10G_T)) { device_printf(adapter->dev, "Device has no supported external thermal sensor.\n"); return (ENODEV); @@ -5815,7 +5826,8 @@ ixgbe_sysctl_phy_overtemp_occurred(SYSCT if (ixgbe_fw_recovery_mode_swflag(adapter)) return (EPERM); - if (hw->device_id != IXGBE_DEV_ID_X550EM_X_10G_T) { + if ((hw->device_id != IXGBE_DEV_ID_X550EM_X_10G_T) && + (hw->device_id != IXGBE_DEV_ID_X550EM_A_10G_T)) { device_printf(adapter->dev, "Device has no supported external thermal sensor.\n"); return (ENODEV); Index: src/sys/dev/pci/ixgbe/ixgbe_common.c diff -u src/sys/dev/pci/ixgbe/ixgbe_common.c:1.13.2.13 src/sys/dev/pci/ixgbe/ixgbe_common.c:1.13.2.14 --- src/sys/dev/pci/ixgbe/ixgbe_common.c:1.13.2.13 Mon Jan 23 14:07:24 2023 +++ src/sys/dev/pci/ixgbe/ixgbe_common.c Wed Jun 21 19:28:12 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_common.c,v 1.13.2.13 2023/01/23 14:07:24 martin Exp $ */ +/* $NetBSD: ixgbe_common.c,v 1.13.2.14 2023/06/21 19:28:12 martin 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.13.2.13 2023/01/23 14:07:24 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixgbe_common.c,v 1.13.2.14 2023/06/21 19:28:12 martin 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.22.2.17 src/sys/dev/pci/ixgbe/ixgbe_type.h:1.22.2.18 --- src/sys/dev/pci/ixgbe/ixgbe_type.h:1.22.2.17 Fri Jun 3 12:31:10 2022 +++ src/sys/dev/pci/ixgbe/ixgbe_type.h Wed Jun 21 19:28:12 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_type.h,v 1.22.2.17 2022/06/03 12:31:10 martin Exp $ */ +/* $NetBSD: ixgbe_type.h,v 1.22.2.18 2023/06/21 19:28:12 martin 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;