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 862B441BAB; Thu, 2 Feb 2023 10:26:24 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 60F9242D8D; Thu, 2 Feb 2023 10:26:01 +0100 (CET) Received: from smtpbg150.qq.com (smtpbg150.qq.com [18.132.163.193]) by mails.dpdk.org (Postfix) with ESMTP id 5B58A42DAA for ; Thu, 2 Feb 2023 10:25:59 +0100 (CET) X-QQ-mid: bizesmtp85t1675329955thk3yobm Received: from wxdbg.localdomain.com ( [183.129.236.74]) by bizesmtp.qq.com (ESMTP) with id ; Thu, 02 Feb 2023 17:25:54 +0800 (CST) X-QQ-SSF: 01400000002000H0Y000B00A0000000 X-QQ-FEAT: qcKkmz/zJhxd6HG7gtwztGt/owKjp+c4mfu4kvJlLrAY9h9mFBzN9f2+cGhSl /64LVzwUy5IV4jP4zyeZJdPIcBiCvg6eeVLcfMT0AfIPnZNWO7w+949EFC7rywqQyRf3TJh 8a1mr4lA93Z849jQw7TSKqiVIu8+pdPSoCXaaZ297QcN0tF867Se/czwi2rDg3J98MdIE/r PhDYxvfkda8aXoZ6+VPWzbpaRYrXKHqdUfWPz3a0EGLCBzJkzDtCet61rV/DuFS1rC2RIPZ ZWculAYinJmf90k70+W8YiRofDO4QE6AFEjk5nAg4nB7aGKA0pTEZgb6rwv5LWPpkfGp0TU 9mtRaCbJE3XziCCBH1ffaT8QdR+lNSjELAx9X/Z5bGgWw3KXPmfAXeDDDcpyMMHf2/6fPG1 QLQYdqtCR4I= X-QQ-GoodBg: 2 From: Jiawen Wu To: dev@dpdk.org Cc: Jiawen Wu Subject: [PATCH v2 07/10] net/ngbe: add chip overheat support Date: Thu, 2 Feb 2023 17:21:29 +0800 Message-Id: <20230202092132.3271910-8-jiawenwu@trustnetic.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230202092132.3271910-1-jiawenwu@trustnetic.com> References: <20230118060039.3074016-1-jiawenwu@trustnetic.com> <20230202092132.3271910-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