netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Yuval Mintz" <yuvalmin@broadcom.com>
To: davem@davemloft.net, netdev@vger.kernel.org
Cc: eilong@broadcom.com, ariele@broadcom.com,
	"Yaniv Rosner" <yanivr@broadcom.com>,
	"Yuval Mintz" <yuvalmin@broadcom.com>
Subject: [PATCH net-next 04/10] bnx2x: Fix rare self-test failures
Date: Mon, 14 Jan 2013 17:11:44 +0200	[thread overview]
Message-ID: <1358176310-31504-5-git-send-email-yuvalmin@broadcom.com> (raw)
In-Reply-To: <1358176310-31504-1-git-send-email-yuvalmin@broadcom.com>

From: Yaniv Rosner <yanivr@broadcom.com>

On rare occasions, self test link may fail since the link is
being sampled while it's still being stabilized.
To correct this behaviour, try to sample the link for 2 seconds
prior to declaring a failure.

Signed-off-by: Yaniv Rosner <yanivr@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
index 292634f..23480da 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
@@ -2379,8 +2379,8 @@ static void bnx2x_self_test(struct net_device *dev,
 			    struct ethtool_test *etest, u64 *buf)
 {
 	struct bnx2x *bp = netdev_priv(dev);
-	u8 is_serdes;
-	int rc;
+	u8 is_serdes, link_up;
+	int rc, cnt = 0;
 
 	if (bp->recovery_state != BNX2X_RECOVERY_DONE) {
 		netdev_err(bp->dev,
@@ -2402,20 +2402,17 @@ static void bnx2x_self_test(struct net_device *dev,
 	}
 
 	is_serdes = (bp->link_vars.link_status & LINK_STATUS_SERDES_LINK) > 0;
-
+	link_up = bp->link_vars.link_up;
 	/* offline tests are not supported in MF mode */
 	if ((etest->flags & ETH_TEST_FL_OFFLINE) && !IS_MF(bp)) {
 		int port = BP_PORT(bp);
 		u32 val;
-		u8 link_up;
 
 		/* save current value of input enable for TX port IF */
 		val = REG_RD(bp, NIG_REG_EGRESS_UMP0_IN_EN + port*4);
 		/* disable input for TX port IF */
 		REG_WR(bp, NIG_REG_EGRESS_UMP0_IN_EN + port*4, 0);
 
-		link_up = bp->link_vars.link_up;
-
 		bnx2x_nic_unload(bp, UNLOAD_NORMAL, false);
 		rc = bnx2x_nic_load(bp, LOAD_DIAG);
 		if (rc) {
@@ -2477,7 +2474,13 @@ static void bnx2x_self_test(struct net_device *dev,
 		etest->flags |= ETH_TEST_FL_FAILED;
 	}
 
-	if (bnx2x_link_test(bp, is_serdes) != 0) {
+	if (link_up) {
+		cnt = 100;
+		while (bnx2x_link_test(bp, is_serdes) && --cnt)
+			msleep(20);
+	}
+
+	if (!cnt) {
 		if (!IS_MF(bp))
 			buf[6] = 1;
 		else
-- 
1.8.1.227.g44fe835

  parent reply	other threads:[~2013-01-14 16:10 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-14 15:11 [PATCH net-next 0/10] bnx2x: patch series Yuval Mintz
2013-01-14 15:11 ` [PATCH net-next 01/10] bnx2x: Clear dirty status when booting after UNDI Yuval Mintz
2013-01-14 15:11 ` [PATCH net-next 02/10] bnx2x: Add an additional fatal hw assertion - BRB_HW_INTERRUPT Yuval Mintz
2013-01-14 15:11 ` [PATCH net-next 03/10] bnx2x: use SAN Mac for FCoE Yuval Mintz
2013-01-14 15:11 ` Yuval Mintz [this message]
2013-01-14 15:11 ` [PATCH net-next 05/10] bnx2x: Added nvram personalities support Yuval Mintz
2013-01-14 15:11 ` [PATCH net-next 06/10] bnx2x: add `ethtool -w' support Yuval Mintz
2013-01-14 15:11 ` [PATCH net-next 07/10] bnx2x: improve stop-on-error Yuval Mintz
2013-01-14 15:11 ` [PATCH net-next 08/10] bnx2x: Clean previous IGU status before ack Yuval Mintz
2013-01-14 15:11 ` [PATCH net-next 09/10] bnx2x: Added FW GRO bridging support Yuval Mintz
2013-01-14 17:22   ` Eric Dumazet
2013-01-14 18:44     ` Eric Dumazet
2013-01-15  7:28       ` Yuval Mintz
2013-01-15 14:39         ` Eric Dumazet
2013-01-15 14:02           ` Yuval Mintz
2013-01-15 15:07             ` Eric Dumazet
2013-01-15 20:09             ` David Miller
2013-01-16  4:56               ` Eric Dumazet
2013-01-16  5:37                 ` [PATCH net-next] bnx2x: fix GRO parameters Eric Dumazet
2013-01-16  7:01                   ` Yuval Mintz
2013-01-16 15:29                     ` Eric Dumazet
2013-01-16 14:38                       ` Yuval Mintz
2013-01-16 16:50                         ` Eric Dumazet
2013-01-17  7:16                           ` Yuval Mintz
2013-01-14 15:11 ` [PATCH net-next 10/10] bnx2x: Introduce 2013 and advance version to 1.78.02 Yuval Mintz

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=1358176310-31504-5-git-send-email-yuvalmin@broadcom.com \
    --to=yuvalmin@broadcom.com \
    --cc=ariele@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=eilong@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=yanivr@broadcom.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).