Skip to contentSkip to conversation

net/hns3: fix mailbox communication with HW

PATCH Applied Min Hu (Connor) 3 participants 4 messages Oct 28, 2021 – Oct 29, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/hns3: fix mailbox communication with HW

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")
---
 drivers/net/hns3/hns3_mbx.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/hns3/hns3_mbx.c +3 -0
index a47622b8a6..245652e2ed 100644
@@ -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
Signature · 1 line
2.33.0
#1 lore raw

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.

Quoted 32 lines · 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")
---
  drivers/net/hns3/hns3_mbx.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/net/hns3/hns3_mbx.c +3 -0
index a47622b8a6..245652e2ed 100644
@@ -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
#2 lore raw

29/10/2021 05:25, Min Hu (Connor):

Quoted 3 lines

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.

Quoted 1 line

Please check it out. Thanks.

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

Quoted 34 lines · Min Hu (Connor)
Quoted 32 lines

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")
---
  drivers/net/hns3/hns3_mbx.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/net/hns3/hns3_mbx.c +3 -0
index a47622b8a6..245652e2ed 100644
@@ -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
Applied
#3 lore raw
In reply to Min Hu (Connor)
Quoted 5 lines · 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.

Quoted 8 lines

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

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