Commit fd4ec076 authored by Rahul Lakkireddy's avatar Rahul Lakkireddy Committed by David S. Miller

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: 7235ffae ("cxgb4: add loopback ethtool self-test")
Signed-off-by: default avatarRahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 38bd9d9f
......@@ -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])
......
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