net/hns3: fix mailbox communication with HW

Message ID 20211028115230.27047-1-humin29@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net/hns3: fix mailbox communication with HW |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot: build success github build: passed
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS

Commit Message

humin (Q) Oct. 28, 2021, 11:52 a.m. UTC
  Mailbox is the communication mechanism between SW and HW. There exist two
approaches for SW to recongnize mailbox message from HW. One way is using
match_id, the other is to compare the message code. The two approaches are
independent and used in different scenarios.

But for the second approache, "next_to_use" should be updated and written
to HW register. If it not done, HW do not know the position SW steps, then,
the communication between SW and HW will turn to be failed.

Fixes: dbbbad23e380 ("net/hns3: fix VF handling LSC event in secondary process")
Cc: stable@dpdk.org

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_mbx.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

humin (Q) Oct. 29, 2021, 3:25 a.m. UTC | #1
Hi, Thomos, Ferruh,
	As this patch is to fix a critical bug for hns3 PMD, we hope this patch 
could be merged into 21.11.
	Please check it out. Thanks.


在 2021/10/28 19:52, Min Hu (Connor) 写道:
> Mailbox is the communication mechanism between SW and HW. There exist two
> approaches for SW to recongnize mailbox message from HW. One way is using
> match_id, the other is to compare the message code. The two approaches are
> independent and used in different scenarios.
> 
> But for the second approache, "next_to_use" should be updated and written
> to HW register. If it not done, HW do not know the position SW steps, then,
> the communication between SW and HW will turn to be failed.
> 
> Fixes: dbbbad23e380 ("net/hns3: fix VF handling LSC event in secondary process")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> ---
>   drivers/net/hns3/hns3_mbx.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c
> index a47622b8a6..245652e2ed 100644
> --- a/drivers/net/hns3/hns3_mbx.c
> +++ b/drivers/net/hns3/hns3_mbx.c
> @@ -435,6 +435,9 @@ hns3_handle_mbx_msg_out_intr(struct hns3_hw *hw)
>   scan_next:
>   		next_to_use = (next_to_use + 1) % hw->cmq.crq.desc_num;
>   	}
> +
> +	crq->next_to_use = next_to_use;
> +	hns3_write_dev(hw, HNS3_CMDQ_RX_HEAD_REG, crq->next_to_use);
>   }
>   
>   void
>
  
Thomas Monjalon Oct. 29, 2021, 9:34 a.m. UTC | #2
29/10/2021 05:25, Min Hu (Connor):
> Hi, Thomos, Ferruh,
> 	As this patch is to fix a critical bug for hns3 PMD, we hope this patch 
> could be merged into 21.11.

No reason to not take a fix.

> 	Please check it out. Thanks.

You sent it yesterday, no need to ping on it.


> 在 2021/10/28 19:52, Min Hu (Connor) 写道:
> > Mailbox is the communication mechanism between SW and HW. There exist two
> > approaches for SW to recongnize mailbox message from HW. One way is using
> > match_id, the other is to compare the message code. The two approaches are
> > independent and used in different scenarios.
> > 
> > But for the second approache, "next_to_use" should be updated and written
> > to HW register. If it not done, HW do not know the position SW steps, then,
> > the communication between SW and HW will turn to be failed.
> > 
> > Fixes: dbbbad23e380 ("net/hns3: fix VF handling LSC event in secondary process")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> > ---
> >   drivers/net/hns3/hns3_mbx.c | 3 +++
> >   1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c
> > index a47622b8a6..245652e2ed 100644
> > --- a/drivers/net/hns3/hns3_mbx.c
> > +++ b/drivers/net/hns3/hns3_mbx.c
> > @@ -435,6 +435,9 @@ hns3_handle_mbx_msg_out_intr(struct hns3_hw *hw)
> >   scan_next:
> >   		next_to_use = (next_to_use + 1) % hw->cmq.crq.desc_num;
> >   	}
> > +
> > +	crq->next_to_use = next_to_use;
> > +	hns3_write_dev(hw, HNS3_CMDQ_RX_HEAD_REG, crq->next_to_use);
> >   }
> >   
> >   void
> > 
>
  
Ferruh Yigit Oct. 29, 2021, 4:29 p.m. UTC | #3
On 10/28/2021 12:52 PM, Min Hu (Connor) wrote:
> Mailbox is the communication mechanism between SW and HW. There exist two
> approaches for SW to recongnize mailbox message from HW. One way is using
> match_id, the other is to compare the message code. The two approaches are
> independent and used in different scenarios.
> 
> But for the second approache, "next_to_use" should be updated and written
> to HW register. If it not done, HW do not know the position SW steps, then,
> the communication between SW and HW will turn to be failed.
> 
> Fixes: dbbbad23e380 ("net/hns3: fix VF handling LSC event in secondary process")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>

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

Patch

diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c
index a47622b8a6..245652e2ed 100644
--- a/drivers/net/hns3/hns3_mbx.c
+++ b/drivers/net/hns3/hns3_mbx.c
@@ -435,6 +435,9 @@  hns3_handle_mbx_msg_out_intr(struct hns3_hw *hw)
 scan_next:
 		next_to_use = (next_to_use + 1) % hw->cmq.crq.desc_num;
 	}
+
+	crq->next_to_use = next_to_use;
+	hns3_write_dev(hw, HNS3_CMDQ_RX_HEAD_REG, crq->next_to_use);
 }
 
 void