Skip to content

Commit

Permalink
net: hns3: fix a return value error in hclge_get_reset_status()
Browse files Browse the repository at this point in the history
hclge_get_reset_status() should return the tqp reset status.
However, if the CMDQ fails, the caller will take it as tqp reset
success status by mistake. Therefore, uses a parameters to get
the tqp reset status instead.

Fixes: 46a3df9 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support")
Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Yufeng Mo authored and David S. Miller committed Sep 20, 2021
1 parent ef39d63 commit 5126b9d
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -10726,7 +10726,8 @@ static int hclge_reset_tqp_cmd_send(struct hclge_dev *hdev, u16 queue_id,
return 0;
}

static int hclge_get_reset_status(struct hclge_dev *hdev, u16 queue_id)
static int hclge_get_reset_status(struct hclge_dev *hdev, u16 queue_id,
u8 *reset_status)
{
struct hclge_reset_tqp_queue_cmd *req;
struct hclge_desc desc;
Expand All @@ -10744,7 +10745,9 @@ static int hclge_get_reset_status(struct hclge_dev *hdev, u16 queue_id)
return ret;
}

return hnae3_get_bit(req->ready_to_reset, HCLGE_TQP_RESET_B);
*reset_status = hnae3_get_bit(req->ready_to_reset, HCLGE_TQP_RESET_B);

return 0;
}

u16 hclge_covert_handle_qid_global(struct hnae3_handle *handle, u16 queue_id)
Expand All @@ -10763,7 +10766,7 @@ static int hclge_reset_tqp_cmd(struct hnae3_handle *handle)
struct hclge_vport *vport = hclge_get_vport(handle);
struct hclge_dev *hdev = vport->back;
u16 reset_try_times = 0;
int reset_status;
u8 reset_status;
u16 queue_gid;
int ret;
u16 i;
Expand All @@ -10779,7 +10782,11 @@ static int hclge_reset_tqp_cmd(struct hnae3_handle *handle)
}

while (reset_try_times++ < HCLGE_TQP_RESET_TRY_TIMES) {
reset_status = hclge_get_reset_status(hdev, queue_gid);
ret = hclge_get_reset_status(hdev, queue_gid,
&reset_status);
if (ret)
return ret;

if (reset_status)
break;

Expand Down

0 comments on commit 5126b9d

Please sign in to comment.