Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp643019ybi; Wed, 19 Jun 2019 05:35:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqxIg+A3NU7yZCXiE6prGAbgVAxi8nbkR8/vVK79ojq5mHK60lUK/V9eLdbQcbWv8/Lv4Kyo X-Received: by 2002:a63:5d61:: with SMTP id o33mr7628119pgm.114.1560947724243; Wed, 19 Jun 2019 05:35:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560947724; cv=none; d=google.com; s=arc-20160816; b=XB6Tk7nydL6TJLoqRjQlowkK5nxe4aJBT1yNmPP9/iGX1q52+mebNAl8YsXLvXxhEC jwNNKnfkA496RoaRBCtGofHT+RABLedebXC5jpU+o8Rdzo7oxqSYdy8EQXiWgqwLT4cJ liCqrArcouLKFXZP1p25odoMu4yFEiw7aEGm2T8q/ex7FdPFhoOOyoBrULEePCmaELeD RUMehdg0kWlemNxiacz8aPLfN3j6M2F1FlsIGAG0ajKJ6w4AXduQ6MrxcV76xCLTwckp 8KdzsEp+fQz4mug5uHZuVNhsaF2V/0DdRu2yVSQIdSucfixFgWTmAmjJxHNXn181FwM1 1duQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=TPyizgQpaIn2NJdqqfd5AcvuET9DGyvIdonmH5gS8lE=; b=JGHhGbiJRIAUpccBtgW0pIgMXZd3/SLHn/BwjdLlRKmzetj73dIgN90MZlzEaA7iEa 9w1Ol/wJsVwpQyjvmCU6M52faPHHjfb4A2Ll6fDWsAjQCNYiDJBgMnDMzhLDQUJgNcp+ viQYPNRjtRwvHMbGDaBb60qWqLOpccLrcxLTCc18kPINxn5K+W3up/QsL4fOZ6jmmlXB vUnrlk6QkFTUZRx2E7JfnQ9jYHG2nCQAZdOAqMTbAzHO11ZmpIlxl6eWwjHD6xZJ6MU1 eSIU58SoHZZ+1DIQ9DA6Ff1yf/IDfF65vBrRwSw4rsg3SLIkiMvI8pOPqiJEjku0eSll pUMw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z197si3010950pgz.267.2019.06.19.05.35.08; Wed, 19 Jun 2019 05:35:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731789AbfFSMds (ORCPT + 99 others); Wed, 19 Jun 2019 08:33:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36958 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727085AbfFSMds (ORCPT ); Wed, 19 Jun 2019 08:33:48 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 634F181E09; Wed, 19 Jun 2019 12:33:41 +0000 (UTC) Received: from cera.brq.redhat.com (unknown [10.43.2.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA0372C8DC; Wed, 19 Jun 2019 12:33:37 +0000 (UTC) Date: Wed, 19 Jun 2019 14:33:37 +0200 From: Ivan Vecera To: Petr Oros Cc: netdev@vger.kernel.org, sathya.perla@broadcom.com, ajit.khaparde@broadcom.com, sriharsha.basavapatna@broadcom.com, somnath.kotur@broadcom.com, davem@davemloft.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 net] be2net: fix link failure after ethtool offline test Message-ID: <20190619143337.424f81ed@cera.brq.redhat.com> In-Reply-To: <20190619122942.15497-1-poros@redhat.com> References: <20190619122942.15497-1-poros@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 19 Jun 2019 12:33:48 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 19 Jun 2019 14:29:42 +0200 Petr Oros wrote: > Certain cards in conjunction with certain switches need a little more > time for link setup that results in ethtool link test failure after > offline test. Patch adds a loop that waits for a link setup finish. > > Changes in v2: > - added fixes header > > Fixes: 4276e47e2d1c ("be2net: Add link test to list of ethtool self > tests.") Signed-off-by: Petr Oros > --- > .../net/ethernet/emulex/benet/be_ethtool.c | 28 > +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c > b/drivers/net/ethernet/emulex/benet/be_ethtool.c index > 8a6785173228f3..492f8769ac12c2 100644 --- > a/drivers/net/ethernet/emulex/benet/be_ethtool.c +++ > b/drivers/net/ethernet/emulex/benet/be_ethtool.c @@ -891,7 +891,7 @@ > static void be_self_test(struct net_device *netdev, struct > ethtool_test *test, u64 *data) { > struct be_adapter *adapter = netdev_priv(netdev); > - int status; > + int status, cnt; > u8 link_status = 0; > > if (adapter->function_caps & BE_FUNCTION_CAPS_SUPER_NIC) { > @@ -902,6 +902,9 @@ static void be_self_test(struct net_device > *netdev, struct ethtool_test *test, > memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM); > > + /* check link status before offline tests */ > + link_status = netif_carrier_ok(netdev); > + > if (test->flags & ETH_TEST_FL_OFFLINE) { > if (be_loopback_test(adapter, BE_MAC_LOOPBACK, > &data[0]) != 0) test->flags |= ETH_TEST_FL_FAILED; > @@ -922,13 +925,26 @@ static void be_self_test(struct net_device > *netdev, struct ethtool_test *test, test->flags |= ETH_TEST_FL_FAILED; > } > > - status = be_cmd_link_status_query(adapter, NULL, > &link_status, 0); > - if (status) { > - test->flags |= ETH_TEST_FL_FAILED; > - data[4] = -1; > - } else if (!link_status) { > + /* link status was down prior to test */ > + if (!link_status) { > test->flags |= ETH_TEST_FL_FAILED; > data[4] = 1; > + return; > + } > + > + for (cnt = 10; cnt; cnt--) { > + status = be_cmd_link_status_query(adapter, NULL, > &link_status, > + 0); > + if (status) { > + test->flags |= ETH_TEST_FL_FAILED; > + data[4] = -1; > + break; > + } > + > + if (link_status) > + break; > + > + msleep_interruptible(500); > } > } > LGTM Reviewed-by: Ivan Vecera