]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-6.6/net-hns3-mark-unexcuted-loopback-test-result-as-unex.patch
bb00c276a26c945b8735c324a0a2c07f6846bfc2
[thirdparty/kernel/stable-queue.git] / queue-6.6 / net-hns3-mark-unexcuted-loopback-test-result-as-unex.patch
1 From 0b057fd6cb931f5702010dedb517ae6847a9551a Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Mon, 25 Mar 2024 20:43:11 +0800
4 Subject: net: hns3: mark unexcuted loopback test result as UNEXECUTED
5
6 From: Jian Shen <shenjian15@huawei.com>
7
8 [ Upstream commit 5bd088d6c21a45ee70e6116879310e54174d75eb ]
9
10 Currently, loopback test may be skipped when resetting, but the test
11 result will still show as 'PASS', because the driver doesn't set
12 ETH_TEST_FL_FAILED flag. Fix it by setting the flag and
13 initializating the value to UNEXECUTED.
14
15 Fixes: 4c8dab1c709c ("net: hns3: reconstruct function hns3_self_test")
16 Signed-off-by: Jian Shen <shenjian15@huawei.com>
17 Signed-off-by: Jijie Shao <shaojijie@huawei.com>
18 Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>
19 Reviewed-by: Simon Horman <horms@kernel.org>
20 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
21 Signed-off-by: Sasha Levin <sashal@kernel.org>
22 ---
23 .../ethernet/hisilicon/hns3/hns3_ethtool.c | 19 +++++++++++++++++--
24 1 file changed, 17 insertions(+), 2 deletions(-)
25
26 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
27 index 682239f33082b..78181eea93c1c 100644
28 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
29 +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
30 @@ -78,6 +78,9 @@ static const struct hns3_stats hns3_rxq_stats[] = {
31 #define HNS3_NIC_LB_TEST_NO_MEM_ERR 1
32 #define HNS3_NIC_LB_TEST_TX_CNT_ERR 2
33 #define HNS3_NIC_LB_TEST_RX_CNT_ERR 3
34 +#define HNS3_NIC_LB_TEST_UNEXECUTED 4
35 +
36 +static int hns3_get_sset_count(struct net_device *netdev, int stringset);
37
38 static int hns3_lp_setup(struct net_device *ndev, enum hnae3_loop loop, bool en)
39 {
40 @@ -418,18 +421,26 @@ static void hns3_do_external_lb(struct net_device *ndev,
41 static void hns3_self_test(struct net_device *ndev,
42 struct ethtool_test *eth_test, u64 *data)
43 {
44 + int cnt = hns3_get_sset_count(ndev, ETH_SS_TEST);
45 struct hns3_nic_priv *priv = netdev_priv(ndev);
46 struct hnae3_handle *h = priv->ae_handle;
47 int st_param[HNAE3_LOOP_NONE][2];
48 bool if_running = netif_running(ndev);
49 + int i;
50 +
51 + /* initialize the loopback test result, avoid marking an unexcuted
52 + * loopback test as PASS.
53 + */
54 + for (i = 0; i < cnt; i++)
55 + data[i] = HNS3_NIC_LB_TEST_UNEXECUTED;
56
57 if (hns3_nic_resetting(ndev)) {
58 netdev_err(ndev, "dev resetting!");
59 - return;
60 + goto failure;
61 }
62
63 if (!(eth_test->flags & ETH_TEST_FL_OFFLINE))
64 - return;
65 + goto failure;
66
67 if (netif_msg_ifdown(h))
68 netdev_info(ndev, "self test start\n");
69 @@ -451,6 +462,10 @@ static void hns3_self_test(struct net_device *ndev,
70
71 if (netif_msg_ifdown(h))
72 netdev_info(ndev, "self test end\n");
73 + return;
74 +
75 +failure:
76 + eth_test->flags |= ETH_TEST_FL_FAILED;
77 }
78
79 static void hns3_update_limit_promisc_mode(struct net_device *netdev,
80 --
81 2.43.0
82