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,
	"Barak Witkowski" <barak@broadcom.com>,
	"Yuval Mintz" <yuvalmin@broadcom.com>
Subject: [PATCH net-next 08/13] bnx2x: IGU parse error cause probe failure
Date: Sun, 2 Dec 2012 16:05:52 +0200	[thread overview]
Message-ID: <1354457157-4730-9-git-send-email-yuvalmin@broadcom.com> (raw)
In-Reply-To: <1354457157-4730-1-git-send-email-yuvalmin@broadcom.com>

From: Barak Witkowski <barak@broadcom.com>

If IGU parse error is encountered during the probing process, the error
propagates and the probe gracefully fails (until now, such errors were ignored,
later causing mischief).

Signed-off-by: Barak Witkowski <barak@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 571508d..5ff0bcb 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -9974,7 +9974,7 @@ static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp)
 #define IGU_FID(val)	GET_FIELD((val), IGU_REG_MAPPING_MEMORY_FID)
 #define IGU_VEC(val)	GET_FIELD((val), IGU_REG_MAPPING_MEMORY_VECTOR)
 
-static void __devinit bnx2x_get_igu_cam_info(struct bnx2x *bp)
+static int __devinit bnx2x_get_igu_cam_info(struct bnx2x *bp)
 {
 	int pfid = BP_FUNC(bp);
 	int igu_sb_id;
@@ -9991,7 +9991,7 @@ static void __devinit bnx2x_get_igu_cam_info(struct bnx2x *bp)
 		bp->igu_dsb_id =  E1HVN_MAX * FP_SB_MAX_E1x +
 			(CHIP_MODE_IS_4_PORT(bp) ? pfid : vn);
 
-		return;
+		return 0;
 	}
 
 	/* IGU in normal mode - read CAM */
@@ -10025,8 +10025,12 @@ static void __devinit bnx2x_get_igu_cam_info(struct bnx2x *bp)
 	bp->igu_sb_cnt = min_t(int, bp->igu_sb_cnt, igu_sb_cnt);
 #endif
 
-	if (igu_sb_cnt == 0)
+	if (igu_sb_cnt == 0) {
 		BNX2X_ERR("CAM configuration error\n");
+		return -EINVAL;
+	}
+
+	return 0;
 }
 
 static void __devinit bnx2x_link_settings_supported(struct bnx2x *bp,
@@ -10706,6 +10710,8 @@ static int __devinit bnx2x_get_hwinfo(struct bnx2x *bp)
 			if (REG_RD(bp, IGU_REG_RESET_MEMORIES)) {
 				dev_err(&bp->pdev->dev,
 					"FORCING Normal Mode failed!!!\n");
+				bnx2x_release_hw_lock(bp,
+						      HW_LOCK_RESOURCE_RESET);
 				return -EPERM;
 			}
 		}
@@ -10716,9 +10722,10 @@ static int __devinit bnx2x_get_hwinfo(struct bnx2x *bp)
 		} else
 			BNX2X_DEV_INFO("IGU Normal Mode\n");
 
-		bnx2x_get_igu_cam_info(bp);
-
+		rc = bnx2x_get_igu_cam_info(bp);
 		bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_RESET);
+		if (rc)
+			return rc;
 	}
 
 	/*
-- 
1.7.1

  parent reply	other threads:[~2012-12-02 14:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-02 14:05 [PATCH net-next 00/13] bnx2x: net-next patch series Yuval Mintz
2012-12-02 14:05 ` [PATCH net-next 01/13] bnx2x: revised and corrected SPIO access Yuval Mintz
2012-12-02 14:05 ` [PATCH net-next 02/13] bnx2x: parity recovery flow enhancement Yuval Mintz
2012-12-02 14:05 ` [PATCH net-next 03/13] bnx2x: Management can control PFC/ETS Yuval Mintz
2012-12-02 14:05 ` [PATCH net-next 04/13] bnx2x: Filter packets on FCoE rings Yuval Mintz
2012-12-02 14:05 ` [PATCH net-next 05/13] bnx2x: Correct advertised speed/duplex Yuval Mintz
2012-12-02 14:05 ` [PATCH net-next 06/13] bnx2x: nvram enables dropless flow control Yuval Mintz
2012-12-02 14:05 ` [PATCH net-next 07/13] bnx2x: Ext. config accessed only on non-E1x Yuval Mintz
2012-12-02 14:05 ` Yuval Mintz [this message]
2012-12-02 14:05 ` [PATCH net-next 09/13] bnx2x: mask CPL_OF interrupt Yuval Mintz
2012-12-02 14:05 ` [PATCH net-next 10/13] bnx2x: Handle a rarely missed interrupt Yuval Mintz
2012-12-02 14:05 ` [PATCH net-next 11/13] bnx2x: prevent DCB if disabled in nvram Yuval Mintz
2012-12-02 14:05 ` [PATCH net-next 12/13] bnx2x: fix 'Ethtool -A' when autoneg Yuval Mintz
2012-12-02 14:05 ` [PATCH net-next 13/13] bnx2x: Correct PFC disablement Yuval Mintz
2012-12-03  1:23 ` [PATCH net-next 00/13] bnx2x: net-next patch series 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=1354457157-4730-9-git-send-email-yuvalmin@broadcom.com \
    --to=yuvalmin@broadcom.com \
    --cc=ariele@broadcom.com \
    --cc=barak@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=eilong@broadcom.com \
    --cc=netdev@vger.kernel.org \
    /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).