Skip to content

Commit ac92c0a

Browse files
liuyonglong86davem330
authored andcommitted
net: hns3: add barrier in vf mailbox reply process
In hclgevf_mbx_handler() and hclgevf_get_mbx_resp() functions, there is a typical store-store and load-load scenario between received_resp and additional_info. This patch adds barrier to fix the problem. Fixes: 4671042 ("net: hns3: add match_id to check mailbox response from PF to VF") Signed-off-by: Yonglong Liu <liuyonglong@huawei.com> Signed-off-by: Jijie Shao <shaojijie@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 472a2ff commit ac92c0a

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ static int hclgevf_get_mbx_resp(struct hclgevf_dev *hdev, u16 code0, u16 code1,
6363
i++;
6464
}
6565

66+
/* ensure additional_info will be seen after received_resp */
67+
smp_rmb();
68+
6669
if (i >= HCLGEVF_MAX_TRY_TIMES) {
6770
dev_err(&hdev->pdev->dev,
6871
"VF could not get mbx(%u,%u) resp(=%d) from PF in %d tries\n",
@@ -178,6 +181,10 @@ static void hclgevf_handle_mbx_response(struct hclgevf_dev *hdev,
178181
resp->resp_status = hclgevf_resp_to_errno(resp_status);
179182
memcpy(resp->additional_info, req->msg.resp_data,
180183
HCLGE_MBX_MAX_RESP_DATA_SIZE * sizeof(u8));
184+
185+
/* ensure additional_info will be seen before setting received_resp */
186+
smp_wmb();
187+
181188
if (match_id) {
182189
/* If match_id is not zero, it means PF support match_id.
183190
* if the match_id is right, VF get the right response, or

0 commit comments

Comments
 (0)