DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dongdong Liu <liudongdong3@huawei.com>
To: <dev@dpdk.org>, <ferruh.yigit@amd.com>, <thomas@monjalon.net>,
	<andrew.rybchenko@oktetlabs.ru>, <fengchengwen@huawei.com>
Cc: <stable@dpdk.org>, <lihuisong@huawei.com>,
	<liudongdong3@huawei.com>, <yisen.zhuang@huawei.com>
Subject: [PATCH 4/5] net/hns3: fix receive multiple firmware reset interrupts
Date: Thu, 18 May 2023 19:29:43 +0800	[thread overview]
Message-ID: <20230518112944.32276-5-liudongdong3@huawei.com> (raw)
In-Reply-To: <20230518112944.32276-1-liudongdong3@huawei.com>

From: Chengwen Feng <fengchengwen@huawei.com>

In the firmware (also known as IMP) reset scenario, driver interrupt
processing and firmware watchdog initialization are asynchronous.

If the driver interrupt processing is faster than firmware watchdog
initialization (that is, the driver clears the firmware reset
interrupt source before the firmware watchdog is initialized), the
driver will receive multiple firmware reset interrupts.

In the Kunpeng 920 platform, the above situation does not exist. But
it does on the newer platforms. So we add 5ms delay before drivers
clears the IMP reset interrupt source.

As for the impact of 5ms, the number of PFs managed by a firmware is
limited. Therefore, even if a DPDK process takes over all the PFs
which managed by the firmware, the delay is controllable.

Cc: stable@dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 5ef66f96c6..664226a6ef 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -286,6 +286,19 @@ hns3_handle_mac_tnl(struct hns3_hw *hw)
 	}
 }
 
+static void
+hns3_delay_before_clear_event_cause(struct hns3_hw *hw, uint32_t event_type, uint32_t regclr)
+{
+#define IMPRESET_WAIT_MS_TIME	5
+
+	if (event_type == HNS3_VECTOR0_EVENT_RST &&
+	    regclr & BIT(HNS3_VECTOR0_IMPRESET_INT_B) &&
+	    hw->revision >= PCI_REVISION_ID_HIP09_A) {
+		rte_delay_ms(IMPRESET_WAIT_MS_TIME);
+		hns3_dbg(hw, "wait firmware watchdog initialization completed.");
+	}
+}
+
 static void
 hns3_interrupt_handler(void *param)
 {
@@ -305,6 +318,7 @@ hns3_interrupt_handler(void *param)
 	vector0_int = hns3_read_dev(hw, HNS3_VECTOR0_OTHER_INT_STS_REG);
 	ras_int = hns3_read_dev(hw, HNS3_RAS_PF_OTHER_INT_STS_REG);
 	cmdq_int = hns3_read_dev(hw, HNS3_VECTOR0_CMDQ_SRC_REG);
+	hns3_delay_before_clear_event_cause(hw, event_cause, clearval);
 	hns3_clear_event_cause(hw, event_cause, clearval);
 	/* vector 0 interrupt is shared with reset and mailbox source events. */
 	if (event_cause == HNS3_VECTOR0_EVENT_ERR) {
-- 
2.22.0


  parent reply	other threads:[~2023-05-18 11:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-18 11:29 [PATCH 0/5] ] net/hns3: add some features and bugfixes Dongdong Liu
2023-05-18 11:29 ` [PATCH 1/5] net/hns3: fix never set MAC flow control Dongdong Liu
2023-05-18 11:29 ` [PATCH 2/5] net/hns3: add flow control autoneg for fiber and backplane port Dongdong Liu
2023-05-18 11:29 ` [PATCH 3/5] net/hns3: fix loop code variable type mismatch Dongdong Liu
2023-05-18 11:29 ` Dongdong Liu [this message]
2023-05-18 11:29 ` [PATCH 5/5] net/hns3: add Tx/Rx descriptor logs Dongdong Liu
2023-05-22 11:57 ` [PATCH 0/5] ] net/hns3: add some features and bugfixes Ferruh Yigit
2023-05-22 12:13   ` Dongdong Liu
2023-05-22 13:17 ` [PATCH v2 0/5] " Dongdong Liu
2023-05-22 13:17   ` [PATCH v2 1/5] net/hns3: fix never set MAC flow control Dongdong Liu
2023-05-22 13:17   ` [PATCH v2 2/5] net/hns3: add flow control autoneg for fiber port Dongdong Liu
2023-05-22 13:17   ` [PATCH v2 3/5] net/hns3: fix loop code variable type mismatch Dongdong Liu
2023-05-22 13:17   ` [PATCH v2 4/5] net/hns3: fix receive multiple firmware reset interrupts Dongdong Liu
2023-05-22 13:17   ` [PATCH v2 5/5] net/hns3: add Tx/Rx descriptor logs Dongdong Liu
2023-05-22 16:15   ` [PATCH v2 0/5] net/hns3: add some features and bugfixes Ferruh Yigit
2023-06-01 10:30     ` Ferruh Yigit
2023-06-01 11:37       ` Dongdong Liu

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=20230518112944.32276-5-liudongdong3@huawei.com \
    --to=liudongdong3@huawei.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=ferruh.yigit@amd.com \
    --cc=lihuisong@huawei.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    --cc=yisen.zhuang@huawei.com \
    /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).