DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/3] fix some bug for hns3
@ 2023-11-27 13:39 Dengdui Huang
  2023-11-27 13:39 ` [PATCH 1/3] net/hns3: fix reset detect be ignored Dengdui Huang
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Dengdui Huang @ 2023-11-27 13:39 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, haijie1, lihuisong, liuyonglong, fengchengwen

Dengdui Huang (3):
  net/hns3: fix reset detect be ignored
  net/hns3: fix VF wrong clear reset status
  net/hns3: fix the VF reset interrupted possibly

 drivers/net/hns3/hns3_ethdev.c    |  5 ++++-
 drivers/net/hns3/hns3_ethdev.h    | 12 ++++++++++++
 drivers/net/hns3/hns3_ethdev_vf.c | 19 +++++++++++++++++--
 drivers/net/hns3/hns3_intr.c      |  4 ++--
 4 files changed, 35 insertions(+), 5 deletions(-)

-- 
2.33.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] net/hns3: fix reset detect be ignored
  2023-11-27 13:39 [PATCH 0/3] fix some bug for hns3 Dengdui Huang
@ 2023-11-27 13:39 ` Dengdui Huang
  2023-11-27 13:39 ` [PATCH 2/3] net/hns3: fix VF wrong clear reset status Dengdui Huang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Dengdui Huang @ 2023-11-27 13:39 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, haijie1, lihuisong, liuyonglong, fengchengwen

The code logic that only new reset whose level is higher than old
reset level will be addressed is added in hns3_detect_reset_event,
see commit 5be38fc6c0fc ("net/hns3: fix multiple reset detected log").
When the new reset is detected and the old reset level is HNS3_NONE_RESET
this reset will be ignored. This patch fix it.

Fixes: 5be38fc6c0fc ("net/hns3: fix multiple reset detected log")
Cc: stable@dpdk.org

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

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 941d047bf1..ae81368f68 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -5560,7 +5560,10 @@ hns3_detect_reset_event(struct hns3_hw *hw)
 		new_req = HNS3_GLOBAL_RESET;
 	}
 
-	if (new_req != HNS3_NONE_RESET && last_req < new_req) {
+	if (new_req == HNS3_NONE_RESET)
+		return HNS3_NONE_RESET;
+
+	if (last_req == HNS3_NONE_RESET || last_req < new_req) {
 		hns3_schedule_delayed_reset(hns);
 		hns3_warn(hw, "High level reset detected, delay do reset");
 	}
-- 
2.33.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/3] net/hns3: fix VF wrong clear reset status
  2023-11-27 13:39 [PATCH 0/3] fix some bug for hns3 Dengdui Huang
  2023-11-27 13:39 ` [PATCH 1/3] net/hns3: fix reset detect be ignored Dengdui Huang
@ 2023-11-27 13:39 ` Dengdui Huang
  2023-11-27 13:39 ` [PATCH 3/3] net/hns3: fix the VF reset interrupted possibly Dengdui Huang
  2023-11-27 13:55 ` [PATCH 0/3] fix some bug for hns3 Jie Hai
  3 siblings, 0 replies; 8+ messages in thread
From: Dengdui Huang @ 2023-11-27 13:39 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, haijie1, lihuisong, liuyonglong, fengchengwen

The function hns3_clear_reset_event is used to clear PF
reset status, The VF shouldn't use it.

This patch fix it.

Fixes: 1eee1ea75c0e ("net/hns3: fix IMP or global reset")
Cc: stable@dpdk.org

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

diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c
index c5a3e3797c..52b5435a23 100644
--- a/drivers/net/hns3/hns3_intr.c
+++ b/drivers/net/hns3/hns3_intr.c
@@ -2749,7 +2749,8 @@ hns3_reset_post(struct hns3_adapter *hns)
 		/* IMP will wait ready flag before reset */
 		hns3_notify_reset_ready(hw, false);
 		hns3_clear_reset_level(hw, &hw->reset.pending);
-		hns3_clear_reset_event(hw);
+		if (!hns->is_vf)
+			hns3_clear_reset_event(hw);
 		__atomic_store_n(&hns->hw.reset.resetting, 0, __ATOMIC_RELAXED);
 		hw->reset.attempts = 0;
 		hw->reset.stats.success_cnt++;
@@ -2799,7 +2800,8 @@ hns3_reset_fail_handle(struct hns3_adapter *hns)
 	struct timeval tv;
 
 	hns3_clear_reset_level(hw, &hw->reset.pending);
-	hns3_clear_reset_event(hw);
+	if (!hns->is_vf)
+		hns3_clear_reset_event(hw);
 	if (hns3_reset_err_handle(hns)) {
 		hw->reset.stage = RESET_STAGE_PREWAIT;
 		hns3_schedule_reset(hns);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/3] net/hns3: fix the VF reset interrupted possibly
  2023-11-27 13:39 [PATCH 0/3] fix some bug for hns3 Dengdui Huang
  2023-11-27 13:39 ` [PATCH 1/3] net/hns3: fix reset detect be ignored Dengdui Huang
  2023-11-27 13:39 ` [PATCH 2/3] net/hns3: fix VF wrong clear reset status Dengdui Huang
@ 2023-11-27 13:39 ` Dengdui Huang
  2023-11-27 13:55 ` [PATCH 0/3] fix some bug for hns3 Jie Hai
  3 siblings, 0 replies; 8+ messages in thread
From: Dengdui Huang @ 2023-11-27 13:39 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stephen, haijie1, lihuisong, liuyonglong, fengchengwen

Currently, the VF reset interrupt is enabled before the reset
process is completed. If the VF reset is triggered by an IMP
reset, the initialization of IMP is may not completed, and the
VF reset interrupt may continue to be reported. In this scenario,
the VF reset being performed by the driver does not need to be
interrupted. Therefore, for VF reset, the driver has to enable
the interrupt after the end of reset.

Fixes: a5475d61fa3 ("net/hns3: support VF")
Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.h    | 12 ++++++++++++
 drivers/net/hns3/hns3_ethdev_vf.c | 19 +++++++++++++++++--
 drivers/net/hns3/hns3_intr.c      |  6 ++----
 3 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index 668f141e32..12d8299def 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -1035,6 +1035,7 @@ void hns3vf_update_link_status(struct hns3_hw *hw, uint8_t link_status,
 			  uint32_t link_speed, uint8_t link_duplex);
 void hns3vf_update_push_lsc_cap(struct hns3_hw *hw, bool supported);
 void hns3_clear_reset_event(struct hns3_hw *hw);
+void hns3vf_clear_reset_event(struct hns3_hw *hw);
 
 const char *hns3_get_media_type_name(uint8_t media_type);
 
@@ -1049,4 +1050,15 @@ is_reset_pending(struct hns3_adapter *hns)
 	return ret;
 }
 
+static inline void
+hns3_clear_reset_status(struct hns3_hw *hw)
+{
+	struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw);
+
+	if (hns->is_vf)
+		hns3vf_clear_reset_event(hw);
+	else
+		hns3_clear_reset_event(hw);
+}
+
 #endif /* HNS3_ETHDEV_H */
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 156fb905f9..53bcc44161 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -531,6 +531,19 @@ hns3vf_enable_irq0(struct hns3_hw *hw)
 	hns3_write_dev(hw, HNS3_MISC_VECTOR_REG_BASE, 1);
 }
 
+void
+hns3vf_clear_reset_event(struct hns3_hw *hw)
+{
+	uint32_t clearval;
+	uint32_t cmdq_stat_reg;
+
+	cmdq_stat_reg = hns3_read_dev(hw, HNS3_VECTOR0_CMDQ_STAT_REG);
+	clearval = cmdq_stat_reg & ~BIT(HNS3_VECTOR0_RST_INT_B);
+	hns3_write_dev(hw, HNS3_VECTOR0_CMDQ_SRC_REG, clearval);
+
+	hns3vf_enable_irq0(hw);
+}
+
 static enum hns3vf_evt_cause
 hns3vf_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval)
 {
@@ -605,8 +618,10 @@ hns3vf_interrupt_handler(void *param)
 		break;
 	}
 
-	/* Enable interrupt */
-	hns3vf_enable_irq0(hw);
+	/* Enable interrupt if it is not cause by reset */
+	if (event_cause == HNS3VF_VECTOR0_EVENT_MBX ||
+	    event_cause == HNS3VF_VECTOR0_EVENT_OTHER)
+		hns3vf_enable_irq0(hw);
 }
 
 void
diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c
index 52b5435a23..916bf30dcb 100644
--- a/drivers/net/hns3/hns3_intr.c
+++ b/drivers/net/hns3/hns3_intr.c
@@ -2749,8 +2749,7 @@ hns3_reset_post(struct hns3_adapter *hns)
 		/* IMP will wait ready flag before reset */
 		hns3_notify_reset_ready(hw, false);
 		hns3_clear_reset_level(hw, &hw->reset.pending);
-		if (!hns->is_vf)
-			hns3_clear_reset_event(hw);
+		hns3_clear_reset_status(hw);
 		__atomic_store_n(&hns->hw.reset.resetting, 0, __ATOMIC_RELAXED);
 		hw->reset.attempts = 0;
 		hw->reset.stats.success_cnt++;
@@ -2800,8 +2799,7 @@ hns3_reset_fail_handle(struct hns3_adapter *hns)
 	struct timeval tv;
 
 	hns3_clear_reset_level(hw, &hw->reset.pending);
-	if (!hns->is_vf)
-		hns3_clear_reset_event(hw);
+	hns3_clear_reset_status(hw);
 	if (hns3_reset_err_handle(hns)) {
 		hw->reset.stage = RESET_STAGE_PREWAIT;
 		hns3_schedule_reset(hns);
-- 
2.33.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] fix some bug for hns3
  2023-11-27 13:39 [PATCH 0/3] fix some bug for hns3 Dengdui Huang
                   ` (2 preceding siblings ...)
  2023-11-27 13:39 ` [PATCH 3/3] net/hns3: fix the VF reset interrupted possibly Dengdui Huang
@ 2023-11-27 13:55 ` Jie Hai
  2023-11-27 18:33   ` Ferruh Yigit
  3 siblings, 1 reply; 8+ messages in thread
From: Jie Hai @ 2023-11-27 13:55 UTC (permalink / raw)
  To: Dengdui Huang, dev
  Cc: ferruh.yigit, stephen, lihuisong, liuyonglong, fengchengwen

On 2023/11/27 21:39, Dengdui Huang wrote:
> Dengdui Huang (3):
>    net/hns3: fix reset detect be ignored
>    net/hns3: fix VF wrong clear reset status
>    net/hns3: fix the VF reset interrupted possibly
Hi, Dengdui,

Good fix.
For the patchset,
Acked-by: Jie Hai <haijie1@huawei.com>

Thank,
Jie Hai
> 
>   drivers/net/hns3/hns3_ethdev.c    |  5 ++++-
>   drivers/net/hns3/hns3_ethdev.h    | 12 ++++++++++++
>   drivers/net/hns3/hns3_ethdev_vf.c | 19 +++++++++++++++++--
>   drivers/net/hns3/hns3_intr.c      |  4 ++--
>   4 files changed, 35 insertions(+), 5 deletions(-)
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] fix some bug for hns3
  2023-11-27 13:55 ` [PATCH 0/3] fix some bug for hns3 Jie Hai
@ 2023-11-27 18:33   ` Ferruh Yigit
  2023-11-28  3:33     ` Jie Hai
  0 siblings, 1 reply; 8+ messages in thread
From: Ferruh Yigit @ 2023-11-27 18:33 UTC (permalink / raw)
  To: Jie Hai, Dengdui Huang, dev, Thomas Monjalon, David Marchand
  Cc: stephen, lihuisong, liuyonglong, fengchengwen

On 11/27/2023 1:55 PM, Jie Hai wrote:
> On 2023/11/27 21:39, Dengdui Huang wrote:
>> Dengdui Huang (3):
>>    net/hns3: fix reset detect be ignored
>>    net/hns3: fix VF wrong clear reset status
>>    net/hns3: fix the VF reset interrupted possibly
> Hi, Dengdui,
> 
> Good fix.
> For the patchset,
> Acked-by: Jie Hai <haijie1@huawei.com>
> 


Hi Jie, Dengdui, is this set for this release, which is a few days away?
My suggestion is to wait next version as issues doesn't look critical.


I applied set to next-net, but leaving decision to pull it for the
release or not to Thomas/David.

Applied to dpdk-next-net/main, thanks.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] fix some bug for hns3
  2023-11-27 18:33   ` Ferruh Yigit
@ 2023-11-28  3:33     ` Jie Hai
  2023-11-28 10:31       ` Thomas Monjalon
  0 siblings, 1 reply; 8+ messages in thread
From: Jie Hai @ 2023-11-28  3:33 UTC (permalink / raw)
  To: Ferruh Yigit, Dengdui Huang, dev, Thomas Monjalon, David Marchand
  Cc: stephen, lihuisong, liuyonglong, fengchengwen

On 2023/11/28 2:33, Ferruh Yigit wrote:
> On 11/27/2023 1:55 PM, Jie Hai wrote:
>> On 2023/11/27 21:39, Dengdui Huang wrote:
>>> Dengdui Huang (3):
>>>     net/hns3: fix reset detect be ignored
>>>     net/hns3: fix VF wrong clear reset status
>>>     net/hns3: fix the VF reset interrupted possibly
>> Hi, Dengdui,
>>
>> Good fix.
>> For the patchset,
>> Acked-by: Jie Hai <haijie1@huawei.com>
>>
> 
> 
> Hi Jie, Dengdui, is this set for this release, which is a few days away?
> My suggestion is to wait next version as issues doesn't look critical.
> 
> 
> I applied set to next-net, but leaving decision to pull it for the
> release or not to Thomas/David.
> 
> Applied to dpdk-next-net/main, thanks.
> 
Hi, Ferruh, Thomas and David,

I'm sorry that this problem is a little serious.

a) Without [PATCH 2/3], when the VF executes the 
hns3_clear_reset_event(), unexpected memory is written.
As a result, unexpected errors occur in the program or even the app may 
crash.
b) Without [PATCH 3/3], there is a low probability that the app is 
unavailable after the FLR reset is done.
c) In addition, some LTS versions have the same problem.

Therefore, we hope that the problem can be solved in the current version.

Thanks,
Jie Hai
> .

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] fix some bug for hns3
  2023-11-28  3:33     ` Jie Hai
@ 2023-11-28 10:31       ` Thomas Monjalon
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Monjalon @ 2023-11-28 10:31 UTC (permalink / raw)
  To: Ferruh Yigit, Dengdui Huang, Jie Hai
  Cc: dev, David Marchand, stephen, lihuisong, liuyonglong, fengchengwen

28/11/2023 04:33, Jie Hai:
> On 2023/11/28 2:33, Ferruh Yigit wrote:
> > On 11/27/2023 1:55 PM, Jie Hai wrote:
> >> On 2023/11/27 21:39, Dengdui Huang wrote:
> >>> Dengdui Huang (3):
> >>>     net/hns3: fix reset detect be ignored
> >>>     net/hns3: fix VF wrong clear reset status
> >>>     net/hns3: fix the VF reset interrupted possibly
> >> Hi, Dengdui,
> >>
> >> Good fix.
> >> For the patchset,
> >> Acked-by: Jie Hai <haijie1@huawei.com>
> >>
> > 
> > 
> > Hi Jie, Dengdui, is this set for this release, which is a few days away?
> > My suggestion is to wait next version as issues doesn't look critical.
> > 
> > 
> > I applied set to next-net, but leaving decision to pull it for the
> > release or not to Thomas/David.
> > 
> > Applied to dpdk-next-net/main, thanks.
> > 
> Hi, Ferruh, Thomas and David,
> 
> I'm sorry that this problem is a little serious.
> 
> a) Without [PATCH 2/3], when the VF executes the 
> hns3_clear_reset_event(), unexpected memory is written.
> As a result, unexpected errors occur in the program or even the app may 
> crash.
> b) Without [PATCH 3/3], there is a low probability that the app is 
> unavailable after the FLR reset is done.
> c) In addition, some LTS versions have the same problem.
> 
> Therefore, we hope that the problem can be solved in the current version.

OK applied, thanks.




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-11-28 10:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-27 13:39 [PATCH 0/3] fix some bug for hns3 Dengdui Huang
2023-11-27 13:39 ` [PATCH 1/3] net/hns3: fix reset detect be ignored Dengdui Huang
2023-11-27 13:39 ` [PATCH 2/3] net/hns3: fix VF wrong clear reset status Dengdui Huang
2023-11-27 13:39 ` [PATCH 3/3] net/hns3: fix the VF reset interrupted possibly Dengdui Huang
2023-11-27 13:55 ` [PATCH 0/3] fix some bug for hns3 Jie Hai
2023-11-27 18:33   ` Ferruh Yigit
2023-11-28  3:33     ` Jie Hai
2023-11-28 10:31       ` Thomas Monjalon

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).