diff options
author | Rahul Lakkireddy <rahul.lakkireddy@chelsio.com> | 2020-08-01 02:20:52 +0530 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-08-03 15:32:52 -0700 |
commit | fd4ec07631b13438c148af973ecd461cf440ee2e (patch) | |
tree | 4e3675e3089731dcbdb855067b7b995de7e7d58e /drivers | |
parent | 38bd9d9f6287ae7e39101e7e11a278daf4b56a68 (diff) | |
download | lwn-fd4ec07631b13438c148af973ecd461cf440ee2e.tar.gz lwn-fd4ec07631b13438c148af973ecd461cf440ee2e.zip |
cxgb4: fix check for running offline ethtool selftest
The flag indicating the selftest to run is a bitmask. So, fix the
check. Also, the selftests will fail if adapter initialization has
not been completed yet. So, add appropriate check and bail sooner.
Fixes: 7235ffae3d2c ("cxgb4: add loopback ethtool self-test")
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c index 12ef9ddd1e54..9f3173f86eed 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c @@ -31,7 +31,7 @@ enum cxgb4_ethtool_tests { }; static const char cxgb4_selftest_strings[CXGB4_ETHTOOL_MAX_TEST][ETH_GSTRING_LEN] = { - "Loop back test", + "Loop back test (offline)", }; static const char * const flash_region_strings[] = { @@ -2095,12 +2095,13 @@ static void cxgb4_self_test(struct net_device *netdev, memset(data, 0, sizeof(u64) * CXGB4_ETHTOOL_MAX_TEST); - if (!(adap->flags & CXGB4_FW_OK)) { + if (!(adap->flags & CXGB4_FULL_INIT_DONE) || + !(adap->flags & CXGB4_FW_OK)) { eth_test->flags |= ETH_TEST_FL_FAILED; return; } - if (eth_test->flags == ETH_TEST_FL_OFFLINE) + if (eth_test->flags & ETH_TEST_FL_OFFLINE) cxgb4_lb_test(netdev, &data[CXGB4_ETHTOOL_LB_TEST]); if (data[CXGB4_ETHTOOL_LB_TEST]) |