Module Name: src Committed By: martin Date: Wed Jun 21 19:20:51 UTC 2023
Modified Files: src/sys/dev/pci/ixgbe [netbsd-9]: ixgbe.c ixgbe_common.c ixgbe_type.h Log Message: Pull up the following revisions, requested by msaitoh in ticket #1647: 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.199.2.25 -r1.199.2.26 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.25.2.6 -r1.25.2.7 src/sys/dev/pci/ixgbe/ixgbe_common.c cvs rdiff -u -r1.41.2.7 -r1.41.2.8 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.199.2.25 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.26 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.25 Mon Jan 23 14:04:42 2023 +++ src/sys/dev/pci/ixgbe/ixgbe.c Wed Jun 21 19:20:50 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.c,v 1.199.2.25 2023/01/23 14:04:42 martin Exp $ */ +/* $NetBSD: ixgbe.c,v 1.199.2.26 2023/06/21 19:20:50 martin Exp $ */ /****************************************************************************** @@ -64,7 +64,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.199.2.25 2023/01/23 14:04:42 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.199.2.26 2023/06/21 19:20:50 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1635,6 +1635,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 */ @@ -1985,6 +1987,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, @@ -2153,6 +2158,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); @@ -3471,7 +3478,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, @@ -3767,6 +3775,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); @@ -5813,7 +5823,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); @@ -5856,7 +5867,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.25.2.6 src/sys/dev/pci/ixgbe/ixgbe_common.c:1.25.2.7 --- src/sys/dev/pci/ixgbe/ixgbe_common.c:1.25.2.6 Mon Jan 23 14:04:42 2023 +++ src/sys/dev/pci/ixgbe/ixgbe_common.c Wed Jun 21 19:20:51 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_common.c,v 1.25.2.6 2023/01/23 14:04:42 martin Exp $ */ +/* $NetBSD: ixgbe_common.c,v 1.25.2.7 2023/06/21 19:20:51 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.25.2.6 2023/01/23 14:04:42 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixgbe_common.c,v 1.25.2.7 2023/06/21 19:20:51 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.41.2.7 src/sys/dev/pci/ixgbe/ixgbe_type.h:1.41.2.8 --- src/sys/dev/pci/ixgbe/ixgbe_type.h:1.41.2.7 Thu Jun 2 10:45:12 2022 +++ src/sys/dev/pci/ixgbe/ixgbe_type.h Wed Jun 21 19:20:51 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_type.h,v 1.41.2.7 2022/06/02 10:45:12 martin Exp $ */ +/* $NetBSD: ixgbe_type.h,v 1.41.2.8 2023/06/21 19:20:51 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;