netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, vishal@chelsio.com, dt@chelsio.com
Subject: [PATCH net-next] cxgb4: fix check for running offline ethtool selftest
Date: Sat,  1 Aug 2020 02:20:52 +0530	[thread overview]
Message-ID: <1596228652-25525-1-git-send-email-rahul.lakkireddy@chelsio.com> (raw)

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>
---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c | 7 ++++---
 1 file 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])
-- 
2.24.0


             reply	other threads:[~2020-07-31 21:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-31 20:50 Rahul Lakkireddy [this message]
2020-08-03 22:34 ` [PATCH net-next] cxgb4: fix check for running offline ethtool selftest David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1596228652-25525-1-git-send-email-rahul.lakkireddy@chelsio.com \
    --to=rahul.lakkireddy@chelsio.com \
    --cc=davem@davemloft.net \
    --cc=dt@chelsio.com \
    --cc=netdev@vger.kernel.org \
    --cc=vishal@chelsio.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).