Commit 47ef6dec authored by Jian Shen's avatar Jian Shen Committed by David S. Miller

net: hns3: fix return value handle issue for hclge_set_loopback()

In current code, it always return 0, even loopback mode setting failed.
It's incorrect. This patch fixes return value handle for loopback test.

Fixes: 0f29fc23 ("net: hns3: Fix for loopback selftest failed problem")
Signed-off-by: default avatarJian Shen <shenjian15@huawei.com>
Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1821dce9
...@@ -117,7 +117,7 @@ static int hns3_lp_up(struct net_device *ndev, enum hnae3_loop loop_mode) ...@@ -117,7 +117,7 @@ static int hns3_lp_up(struct net_device *ndev, enum hnae3_loop loop_mode)
ret = hns3_lp_setup(ndev, loop_mode, true); ret = hns3_lp_setup(ndev, loop_mode, true);
usleep_range(10000, 20000); usleep_range(10000, 20000);
return 0; return ret;
} }
static int hns3_lp_down(struct net_device *ndev, enum hnae3_loop loop_mode) static int hns3_lp_down(struct net_device *ndev, enum hnae3_loop loop_mode)
...@@ -334,10 +334,10 @@ static void hns3_self_test(struct net_device *ndev, ...@@ -334,10 +334,10 @@ static void hns3_self_test(struct net_device *ndev,
continue; continue;
data[test_index] = hns3_lp_up(ndev, loop_type); data[test_index] = hns3_lp_up(ndev, loop_type);
if (!data[test_index]) { if (!data[test_index])
data[test_index] = hns3_lp_run_test(ndev, loop_type); data[test_index] = hns3_lp_run_test(ndev, loop_type);
hns3_lp_down(ndev, loop_type);
} hns3_lp_down(ndev, loop_type);
if (data[test_index]) if (data[test_index])
eth_test->flags |= ETH_TEST_FL_FAILED; eth_test->flags |= ETH_TEST_FL_FAILED;
......
...@@ -5332,6 +5332,9 @@ static int hclge_set_loopback(struct hnae3_handle *handle, ...@@ -5332,6 +5332,9 @@ static int hclge_set_loopback(struct hnae3_handle *handle,
break; break;
} }
if (ret)
return ret;
kinfo = &vport->nic.kinfo; kinfo = &vport->nic.kinfo;
for (i = 0; i < kinfo->num_tqps; i++) { for (i = 0; i < kinfo->num_tqps; i++) {
ret = hclge_tqp_enable(hdev, i, 0, en); ret = hclge_tqp_enable(hdev, i, 0, en);
......
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