DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jiawen Wu <jiawenwu@trustnetic.com>
To: dev@dpdk.org
Cc: Jiawen Wu <jiawenwu@trustnetic.com>
Subject: [PATCH 6/8] net/ngbe: add chip overheat support
Date: Wed, 18 Jan 2023 14:00:37 +0800	[thread overview]
Message-ID: <20230118060039.3074016-7-jiawenwu@trustnetic.com> (raw)
In-Reply-To: <20230118060039.3074016-1-jiawenwu@trustnetic.com>

Support to handle overheat interrupt.

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
 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


  parent reply	other threads:[~2023-01-18  6:04 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-18  6:00 [PATCH 0/8] Wangxun fixes and new supports Jiawen Wu
2023-01-18  6:00 ` [PATCH 1/8] net/txgbe: fix Rx buffer size in configure register Jiawen Wu
2023-01-27 15:36   ` Ferruh Yigit
2023-02-01  2:34     ` Jiawen Wu
2023-02-01 10:40       ` Ferruh Yigit
2023-01-18  6:00 ` [PATCH 2/8] net/txgbe: fix default signal quality value for KX/KX4 Jiawen Wu
2023-01-18  6:00 ` [PATCH 3/8] net/txgbe: fix packet type to parse from offload flags Jiawen Wu
2023-01-27 15:36   ` Ferruh Yigit
2023-02-01  3:14     ` Jiawen Wu
2023-02-01 10:41       ` Ferruh Yigit
2023-01-18  6:00 ` [PATCH 4/8] net/ngbe: " Jiawen Wu
2023-01-27 15:37   ` Ferruh Yigit
2023-01-18  6:00 ` [PATCH 5/8] net/ngbe: add spinlock protection on YT PHY Jiawen Wu
2023-01-18  6:00 ` Jiawen Wu [this message]
2023-01-18  6:00 ` [PATCH 7/8] net/txgbe: add chip overheat support Jiawen Wu
2023-01-18  6:00 ` [PATCH 8/8] net/txgbe: add SFP hot-plug identification support Jiawen Wu
2023-01-27 15:38   ` Ferruh Yigit
2023-02-02  9:21 ` [PATCH v2 00/10] Wangxun fixes and new supports Jiawen Wu
2023-02-02  9:21   ` [PATCH v2 01/10] net/ngbe: fix Rx buffer size in configure register Jiawen Wu
2023-02-08 10:28     ` Ferruh Yigit
2023-02-09  9:00       ` Jiawen Wu
2023-02-14  8:15         ` Jiawen Wu
2023-02-14  9:55           ` Ferruh Yigit
2023-02-15  9:35             ` Ferruh Yigit
2023-02-15 10:09               ` Jiawen Wu
2023-02-02  9:21   ` [PATCH v2 02/10] net/txgbe: " Jiawen Wu
2023-02-02  9:21   ` [PATCH v2 03/10] net/txgbe: fix default signal quality value for KX/KX4 Jiawen Wu
2023-02-02  9:21   ` [PATCH v2 04/10] net/txgbe: fix packet type to parse from offload flags Jiawen Wu
2023-02-02  9:21   ` [PATCH v2 05/10] net/ngbe: " Jiawen Wu
2023-02-02  9:21   ` [PATCH v2 06/10] net/ngbe: add spinlock protection on YT PHY Jiawen Wu
2023-02-02  9:21   ` [PATCH v2 07/10] net/ngbe: add chip overheat support Jiawen Wu
2023-02-02  9:21   ` [PATCH v2 08/10] net/txgbe: " Jiawen Wu
2023-02-02  9:21   ` [PATCH v2 09/10] net/txgbe: fix interrupt loss Jiawen Wu
2023-02-02  9:21   ` [PATCH v2 10/10] net/txgbe: add SFP hot-plug identification support Jiawen Wu
2023-02-08 12:23   ` [PATCH v2 00/10] Wangxun fixes and new supports Ferruh Yigit
2023-02-15  2:00 ` [PATCH v3] net/txgbe: fix Rx buffer size in configure register Jiawen Wu
2023-02-15 10:24   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230118060039.3074016-7-jiawenwu@trustnetic.com \
    --to=jiawenwu@trustnetic.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).