DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jie Hai <haijie1@huawei.com>
To: <dev@dpdk.org>, Yisen Zhuang <yisen.zhuang@huawei.com>,
	Chunsong Feng <fengchunsong@huawei.com>,
	Hao Chen <chenh@yusur.tech>, Huisong Li <lihuisong@huawei.com>,
	Ferruh Yigit <ferruh.yigit@intel.com>,
	"Min Hu (Connor)" <humin29@huawei.com>
Cc: <fengchengwen@huawei.com>, <liudongdong3@huawei.com>,
	<huangdengdui@huawei.com>
Subject: [PATCH 4/8] net/hns3: fix double stats for IMP and global reset
Date: Fri, 27 Oct 2023 14:09:42 +0800	[thread overview]
Message-ID: <20231027060947.3183983-5-haijie1@huawei.com> (raw)
In-Reply-To: <20231027060947.3183983-1-haijie1@huawei.com>

From: Dengdui Huang <huangdengdui@huawei.com>

There is a stats counter for IMP and global reset in PF driver.
hns3 driver has two following task to detect reset event:
(1) interrupte handled task(A): triggered by interrupt and detect
    which reset level. And the reset service will be executed
    after 10us.
(2) polling task(B): scan reset source register to detect if
    driver has to do reset. And the reset service will be executed
    after deferred 3s.

They'll both count the number of one reset plus 1.
Task(A) adds it before doing the reset service. And in the reset service,
task(B) adds it if hw->reset.schedule is 'SCHEDULE_REQUESTED'.
Normally, this reset counter is just added by 1 once. Unfortunately,
this counter is added by 2 in the following case:
1. Task(B) detect the reset event, like IMP. hw->reset.schedule is
   set to 'SCHEDULE_REQUESTED'.
2. Task(A) is just triggered before running the reset service of task(B).
   Note: the reset counter is added by 1 at this moment before running
   the reset service of task(A). Additionally, the reset service of
   task(B) is canceled in task(A) because of schedule status being
   'SCHEDULE_REQUESTED'.
3. Then the reset service of task(A) is executed at last.
   Note: The reset counter is added by 1 again in this step because of
   schedule status still being 'SCHEDULE_REQUESTED'.

So this patch fix it by setting the scheduling status to
'SCHEDULE_REQUESTED' in step 2.

Fixes: 2790c6464725 ("net/hns3: support device reset")
Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
---
 drivers/net/hns3/hns3_intr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c
index 44a11194155a..baf5f58e9e2b 100644
--- a/drivers/net/hns3/hns3_intr.c
+++ b/drivers/net/hns3/hns3_intr.c
@@ -2434,8 +2434,8 @@ hns3_schedule_reset(struct hns3_adapter *hns)
 	if (__atomic_load_n(&hw->reset.schedule, __ATOMIC_RELAXED) ==
 			    SCHEDULE_DEFERRED)
 		rte_eal_alarm_cancel(hw->reset.ops->reset_service, hns);
-	else
-		__atomic_store_n(&hw->reset.schedule, SCHEDULE_REQUESTED,
+
+	__atomic_store_n(&hw->reset.schedule, SCHEDULE_REQUESTED,
 				 __ATOMIC_RELAXED);
 
 	rte_eal_alarm_set(SWITCH_CONTEXT_US, hw->reset.ops->reset_service, hns);
-- 
2.30.0


  parent reply	other threads:[~2023-10-27  6:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-27  6:09 [PATCH 0/8] net/hns3: add some bugfix for hns3 Jie Hai
2023-10-27  6:09 ` [PATCH 1/8] net/hns3: fix a typo Jie Hai
2023-10-27  6:09 ` [PATCH 2/8] net/hns3: fix unchecked Rx free threshold Jie Hai
2023-10-27  6:09 ` [PATCH 3/8] net/hns3: fix segmentfault for NEON and SVE Jie Hai
2023-10-27  6:09 ` Jie Hai [this message]
2023-10-27  6:09 ` [PATCH 5/8] net/hns3: remove reset log in secondary Jie Hai
2023-10-27  6:09 ` [PATCH 6/8] net/hns3: fix multiple reset detected log Jie Hai
2023-10-27  6:09 ` [PATCH 7/8] net/hns3: fix the imp/global reset interrupted possibly Jie Hai
2023-10-27  6:09 ` [PATCH 8/8] net/hns3: refactor interrupt state query Jie Hai
2023-10-27  7:11 ` [PATCH 0/8] net/hns3: add some bugfix for hns3 fengchengwen
2023-10-27 19:29 ` Ferruh Yigit
2023-10-28  1:57   ` Jie Hai

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=20231027060947.3183983-5-haijie1@huawei.com \
    --to=haijie1@huawei.com \
    --cc=chenh@yusur.tech \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=fengchunsong@huawei.com \
    --cc=ferruh.yigit@intel.com \
    --cc=huangdengdui@huawei.com \
    --cc=humin29@huawei.com \
    --cc=lihuisong@huawei.com \
    --cc=liudongdong3@huawei.com \
    --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).