This series includes some bugfixes for the HNS3 ethernet driver.
Chengwen Feng (1):
net: hns3: fix possible mismatches resp of mailbox
Jian Shen (2):
net: hns3: disable port VLAN filter when support function level VLAN
filter control
net: hns3: fix rx VLAN offload state inconsistent issue
Peng Li (1):
net: hns3: add match_id to check mailbox response from PF to VF
drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h | 7 +++++--
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 8 ++++++--
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 1 +
.../net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 10 ++++++++++
.../net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c | 19 +++++++++++++++++++
5 files changed, 41 insertions(+), 4 deletions(-)
--
2.8.1
From: Jian Shen <shenjian15@huawei.com>
For hardware limitation, port VLAN filter is port level, and
effective for all the functions of the port. So if not support
port VLAN bypass, it's necessary to disable the port VLAN filter,
in order to support function level VLAN filter control.
Fixes: 2ba306627f59 ("net: hns3: add support for modify VLAN filter state")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Guangbin Huang <redacted>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
From: Jian Shen <shenjian15@huawei.com>
Currently, VF doesn't enable rx VLAN offload when initializating,
and PF does it for VFs. If user disable the rx VLAN offload for
VF with ethtool -K, and reload the VF driver, it may cause the
rx VLAN offload state being inconsistent between hardware and
software.
Fixes it by enabling rx VLAN offload when VF initializing.
Fixes: e2cb1dec9779 ("net: hns3: Add HNS3 VF HCL(Hardware Compatibility Layer) Support")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Guangbin Huang <redacted>
---
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 10 ++++++++++
1 file changed, 10 insertions(+)
From: Peng Li <redacted>
When VF need response from PF, VF will wait (1us - 1s) to receive
the response, or it will wait timeout and the VF action fails.
If VF do not receive response in 1st action because timeout,
the 2nd action may receive response for the 1st action, and get
incorrect response data.VF must reciveve the right response from
PF,or it will cause unexpected error.
This patch adds match_id to check mailbox response from PF to VF,
to make sure VF get the right response:
1. The message sent from VF was labelled with match_id which was a
unique 16-bit non-zero value.
2. The response sent from PF will label with match_id which got from
the request.
3. The VF uses the match_id to match request and response message.
This scheme depends on PF driver supports match_id, if PF driver doesn't
support then VF will uses the original scheme.
Signed-off-by: Peng Li <redacted>
Signed-off-by: Guangbin Huang <redacted>
---
drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h | 1 +
.../net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c | 19 +++++++++++++++++++
2 files changed, 20 insertions(+)
@@ -13,6 +13,7 @@ static int hclgevf_resp_to_errno(u16 resp_code)returnresp_code?-resp_code:0;}+#define HCLGEVF_MBX_MATCH_ID_START 1staticvoidhclgevf_reset_mbx_resp_status(structhclgevf_dev*hdev){/* this function should be called with mbx_resp.mbx_mutex held
@@ -21,6 +22,10 @@ static void hclgevf_reset_mbx_resp_status(struct hclgevf_dev *hdev)hdev->mbx_resp.received_resp=false;hdev->mbx_resp.origin_mbx_msg=0;hdev->mbx_resp.resp_status=0;+hdev->mbx_resp.match_id++;+/* Update match_id and ensure the value of match_id is not zero */+if(hdev->mbx_resp.match_id==0)+hdev->mbx_resp.match_id=HCLGEVF_MBX_MATCH_ID_START;memset(hdev->mbx_resp.additional_info,0,HCLGE_MBX_MAX_RESP_DATA_SIZE);}
@@ -115,6 +120,7 @@ int hclgevf_send_mbx_msg(struct hclgevf_dev *hdev,if(need_resp){mutex_lock(&hdev->mbx_resp.mbx_mutex);hclgevf_reset_mbx_resp_status(hdev);+req->match_id=hdev->mbx_resp.match_id;status=hclgevf_cmd_send(&hdev->hw,&desc,1);if(status){dev_err(&hdev->pdev->dev,
@@ -211,6 +217,19 @@ void hclgevf_mbx_handler(struct hclgevf_dev *hdev)resp->additional_info[i]=*temp;temp++;}++/* If match_id is not zero, it means PF support+*match_id.Ifthematch_idisright,VFgetthe+*rightresponse,otherwiseignoretheresponse.+*Driverwillclearhdev->mbx_respwhensend+*nextmessagewhichneedresponse.+*/+if(req->match_id){+if(req->match_id==resp->match_id)+resp->received_resp=true;+}else{+resp->received_resp=true;+}break;caseHCLGE_MBX_LINK_STAT_CHANGE:caseHCLGE_MBX_ASSERTING_RESET:
From: Chengwen Feng <redacted>
Currently, the mailbox synchronous communication between VF and PF use
the following fields to maintain communication:
1. Origin_mbx_msg which was combined by message code and subcode, used
to match request and response.
2. Received_resp which means whether received response.
There may possible mismatches of the following situation:
1. VF sends message A with code=1 subcode=1.
2. PF was blocked about 500ms when processing the message A.
3. VF will detect message A timeout because it can't get the response
within 500ms.
4. VF sends message B with code=1 subcode=1 which equal message A.
5. PF processes the first message A and send the response message to
VF.
6. VF will identify the response matched the message B because the
code/subcode is the same. This will lead to mismatch of request and
response.
To fix the above bug, we use the following scheme:
1. The message sent from VF was labelled with match_id which was a
unique 16-bit non-zero value.
2. The response sent from PF will label with match_id which got from
the request.
3. The VF uses the match_id to match request and response message.
As for PF driver, it only needs to copy the match_id from request to
response.
Fixes: dde1a86e93ca ("net: hns3: Add mailbox support to PF driver")
Signed-off-by: Chengwen Feng <redacted>
Signed-off-by: Guangbin Huang <redacted>
---
drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h | 6 ++++--
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 1 +
2 files changed, 5 insertions(+), 2 deletions(-)
Hello:
This series was applied to netdev/net.git (refs/heads/master):
On Mon, 19 Jul 2021 17:13:04 +0800 you wrote:
This series includes some bugfixes for the HNS3 ethernet driver.
Chengwen Feng (1):
net: hns3: fix possible mismatches resp of mailbox
Jian Shen (2):
net: hns3: disable port VLAN filter when support function level VLAN
filter control
net: hns3: fix rx VLAN offload state inconsistent issue
[...]