From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9B06C42409; Wed, 18 Jan 2023 07:04:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 011F142D61; Wed, 18 Jan 2023 07:04:26 +0100 (CET) Received: from smtpbguseast3.qq.com (smtpbguseast3.qq.com [54.243.244.52]) by mails.dpdk.org (Postfix) with ESMTP id A86CE410EE for ; Wed, 18 Jan 2023 07:04:23 +0100 (CET) X-QQ-mid: bizesmtp69t1674021860tuy4n9ip Received: from wxdbg.localdomain.com ( [183.129.236.74]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 18 Jan 2023 14:04:19 +0800 (CST) X-QQ-SSF: 01400000000000H0X000B00A0000000 X-QQ-FEAT: LE7C6P2vL8TajNKXovkCZOvmcKTJY7kR5zlPxlsNR2CKtQoQqMPbzQigqUrNj LOpzLg1Is9OyJT9hPJ/7OhV1NhfVTPaS4Qbmk7DlQWB8t8ZQ9lb99fV9srsOUDUJzVkVc/j EDBROiHFaQX7dD0v1570vGEgEQ0hvLa0adNnGAMtHXofZrlSU7pScDJO6e5Skr5K4RdHT2M 0PhfksCWidnglIx+E0DqhhJGTJePDPJwoZA5P/BdvsK5LKv5K1kDmr4OYjEPbjazgqDG7Mo 8JoYPmEZMEMLqMwDKtTWTn2AQZiowByE/8NoSDQDBxdC4xxR29fzRpIowQ+lF2e4ejSQE2W uqqhz4j10FmI+nVwxQC274HQ9nmJyq104OeAR56by/M811mfzldY6yN/roOCEphsOJI+72N X-QQ-GoodBg: 2 From: Jiawen Wu To: dev@dpdk.org Cc: Jiawen Wu Subject: [PATCH 6/8] net/ngbe: add chip overheat support Date: Wed, 18 Jan 2023 14:00:37 +0800 Message-Id: <20230118060039.3074016-7-jiawenwu@trustnetic.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230118060039.3074016-1-jiawenwu@trustnetic.com> References: <20230118060039.3074016-1-jiawenwu@trustnetic.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:trustnetic.com:qybglogicsvr:qybglogicsvr5 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Support to handle overheat interrupt. Signed-off-by: Jiawen Wu --- doc/guides/rel_notes/release_23_03.rst | 4 ++++ drivers/net/ngbe/ngbe_ethdev.c | 32 +++++++++++++++++++++++++- drivers/net/ngbe/ngbe_ethdev.h | 1 + 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/doc/guides/rel_notes/release_23_03.rst b/doc/guides/rel_notes/release_23_03.rst index b8c5b68d6c..9c61bdbdcb 100644 --- a/doc/guides/rel_notes/release_23_03.rst +++ b/doc/guides/rel_notes/release_23_03.rst @@ -55,6 +55,10 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Updated Wangxun ngbe driver.** + + * Added chip overheat detection support. + Removed Items ------------- diff --git a/drivers/net/ngbe/ngbe_ethdev.c b/drivers/net/ngbe/ngbe_ethdev.c index afdb3ad41f..c32d954769 100644 --- a/drivers/net/ngbe/ngbe_ethdev.c +++ b/drivers/net/ngbe/ngbe_ethdev.c @@ -947,7 +947,7 @@ ngbe_dev_phy_intr_setup(struct rte_eth_dev *dev) else wr32(hw, NGBE_GPIOINTPOL, NGBE_GPIOINTPOL_ACT(3)); - intr->mask_misc |= NGBE_ICRMISC_GPIO; + intr->mask_misc |= NGBE_ICRMISC_GPIO | NGBE_ICRMISC_HEAT; } /* @@ -1869,6 +1869,28 @@ ngbe_dev_supported_ptypes_get(struct rte_eth_dev *dev) return NULL; } +static void +ngbe_dev_overheat(struct rte_eth_dev *dev) +{ + struct ngbe_hw *hw = ngbe_dev_hw(dev); + s32 temp_state; + + temp_state = hw->mac.check_overtemp(hw); + if (!temp_state) + return; + + if (temp_state == NGBE_ERR_UNDERTEMP) { + PMD_DRV_LOG(CRIT, "Network adapter has been started again, " + "since the temperature has been back to normal state."); + wr32m(hw, NGBE_PBRXCTL, NGBE_PBRXCTL_ENA, NGBE_PBRXCTL_ENA); + ngbe_dev_set_link_up(dev); + } else if (temp_state == NGBE_ERR_OVERTEMP) { + PMD_DRV_LOG(CRIT, "Network adapter has been stopped because it has over heated."); + wr32m(hw, NGBE_PBRXCTL, NGBE_PBRXCTL_ENA, 0); + ngbe_dev_set_link_down(dev); + } +} + void ngbe_dev_setup_link_alarm_handler(void *param) { @@ -2167,6 +2189,9 @@ ngbe_dev_interrupt_get_status(struct rte_eth_dev *dev) if (eicr & NGBE_ICRMISC_GPIO) intr->flags |= NGBE_FLAG_NEED_LINK_UPDATE; + if (eicr & NGBE_ICRMISC_HEAT) + intr->flags |= NGBE_FLAG_OVERHEAT; + ((u32 *)hw->isb_mem)[NGBE_ISB_MISC] = 0; return 0; @@ -2243,6 +2268,11 @@ ngbe_dev_interrupt_action(struct rte_eth_dev *dev) RTE_ETH_EVENT_INTR_LSC, NULL); } + if (intr->flags & NGBE_FLAG_OVERHEAT) { + ngbe_dev_overheat(dev); + intr->flags &= ~NGBE_FLAG_OVERHEAT; + } + PMD_DRV_LOG(DEBUG, "enable intr immediately"); ngbe_enable_intr(dev); diff --git a/drivers/net/ngbe/ngbe_ethdev.h b/drivers/net/ngbe/ngbe_ethdev.h index 8d500fd38c..330f476f6f 100644 --- a/drivers/net/ngbe/ngbe_ethdev.h +++ b/drivers/net/ngbe/ngbe_ethdev.h @@ -17,6 +17,7 @@ #define NGBE_FLAG_PHY_INTERRUPT ((uint32_t)(1 << 2)) #define NGBE_FLAG_MACSEC ((uint32_t)(1 << 3)) #define NGBE_FLAG_NEED_LINK_CONFIG ((uint32_t)(1 << 4)) +#define NGBE_FLAG_OVERHEAT ((uint32_t)(1 << 5)) #define NGBE_VFTA_SIZE 128 #define NGBE_HKEY_MAX_INDEX 10 -- 2.27.0