Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp609776ybi; Wed, 19 Jun 2019 05:04:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqzTvGJwOOw/vac7E5wjfoTfTGnyU0h2c6m4cR8LN4GGaRuz0KswnvR+5N+Z4N9G4M/mn0nW X-Received: by 2002:a17:902:934a:: with SMTP id g10mr109319440plp.18.1560945868746; Wed, 19 Jun 2019 05:04:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560945868; cv=none; d=google.com; s=arc-20160816; b=BynzNYGpurmgUCxrqCMhVOmedSHU2tyrLOUkSOb4tpngx5VNfPzlsFopxZTN/HXT38 0+G19fxJytQjyjtRIjPeiED3hiq/v0B8LlPUcAxbuEJ9vPkjQSWFNUetY4g/L0/B3Tic 2L3nkUpcvLZTbWXCPnJknDurylkKzGLojj2FZGlb5DiHZeDxl61jtnEoRWT4z2kyDtXx XYdJxfXhgNEYFMB+MZxQJxPTV+OlLHsOw7G89mKkDmJj1Eixe6nKv39IEVTLbMj3n7po hfkvQHHroHMpjGFGm0RW1PEGYjx0yFqCiKGat7mHqPJ1uCUVkWCN8ZTqcuCaTd0OVOea t+aQ== 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=prvs8kySuZ9xMlh0PSaeNyxrK7Y8vgiv4MIJinZMuQM=; b=My0fSaANCM+taJXkqGwq/S9KgXCtNbyRHgjM225KDoJjms0wkhlqpR+PLNjRBLkvPX 7nhxDiRGgudtVw1qtr48H3/WciHNirsnGFUj5/JaG8IrCRBY3UPSDm6DFvOtwobWDnRI vt3w3LLX2Q2PkMPR5OQR7uYcNYjaTi1ixb6ff/wIA7M9RkBtoZApSe6ufPyGeg1v91Oh Y5htAgWu9/UDF8BFelJQ0WRPb2V/vSd7IyOEKuObeKTP8P+tQMr/ZhaO1kmz90i6q3ZI 4t8npWHVVa6shXfJo6AIPMQpmb6oX6GNl/Qfk+T9IvGQhbLotVhEAdwzh8Z9zWNraIVZ lwSg== 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 f10si2956828pgi.236.2019.06.19.05.04.07; Wed, 19 Jun 2019 05:04:28 -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 S1731706AbfFSMDe (ORCPT + 99 others); Wed, 19 Jun 2019 08:03:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56270 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727134AbfFSMDe (ORCPT ); Wed, 19 Jun 2019 08:03:34 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AC15730018D7; Wed, 19 Jun 2019 12:03:28 +0000 (UTC) Received: from cera.brq.redhat.com (unknown [10.43.2.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3139B5C207; Wed, 19 Jun 2019 12:03:26 +0000 (UTC) Date: Wed, 19 Jun 2019 14:03:25 +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 net] be2net: fix link failure after ethtool offline test Message-ID: <20190619140325.64dafd23@cera.brq.redhat.com> In-Reply-To: <20190619115231.6020-1-poros@redhat.com> References: <20190619115231.6020-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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 19 Jun 2019 12:03:33 +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 13:52:31 +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. > > Signed-off-by: Petr Oros Missing Fixes header for net stuff... Otherwise LGTM. Ivan > --- > .../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); > } > } >