Commit a710b9ff authored by Jiaran Zhang's avatar Jiaran Zhang Committed by David S. Miller

net: hns3: fix incorrect resp_msg issue

In hclge_mbx_handler(), if there are two consecutive mailbox
messages that requires resp_msg, the resp_msg is not cleared
after processing the first message, which will cause the resp_msg
data of second message incorrect.

Fix it by clearing the resp_msg before processing every mailbox
message.

Fixes: bb5790b7 ("net: hns3: refactor mailbox response scheme between PF and VF")
Signed-off-by: default avatarJiaran Zhang <zhangjiaran@huawei.com>
Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 33e6b167
...@@ -710,7 +710,6 @@ void hclge_mbx_handler(struct hclge_dev *hdev) ...@@ -710,7 +710,6 @@ void hclge_mbx_handler(struct hclge_dev *hdev)
unsigned int flag; unsigned int flag;
int ret = 0; int ret = 0;
memset(&resp_msg, 0, sizeof(resp_msg));
/* handle all the mailbox requests in the queue */ /* handle all the mailbox requests in the queue */
while (!hclge_cmd_crq_empty(&hdev->hw)) { while (!hclge_cmd_crq_empty(&hdev->hw)) {
if (test_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state)) { if (test_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state)) {
...@@ -738,6 +737,9 @@ void hclge_mbx_handler(struct hclge_dev *hdev) ...@@ -738,6 +737,9 @@ void hclge_mbx_handler(struct hclge_dev *hdev)
trace_hclge_pf_mbx_get(hdev, req); trace_hclge_pf_mbx_get(hdev, req);
/* clear the resp_msg before processing every mailbox message */
memset(&resp_msg, 0, sizeof(resp_msg));
switch (req->msg.code) { switch (req->msg.code) {
case HCLGE_MBX_MAP_RING_TO_VECTOR: case HCLGE_MBX_MAP_RING_TO_VECTOR:
ret = hclge_map_unmap_ring_to_vf_vector(vport, true, ret = hclge_map_unmap_ring_to_vf_vector(vport, true,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment