netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Dmitry Kravkov" <dmitry@broadcom.com>
To: davem@davemloft.net, netdev@vger.kernel.org
Cc: "Ariel Elior" <ariele@broadcom.com>,
	"Dmitry Kravkov" <dmitry@broadcom.com>,
	"Eilon Greenstein" <eilong@broadcom.com>
Subject: [PATCH v3 net-next 09/12] bnx2x: add fan failure event handling
Date: Sun, 13 Nov 2011 16:34:29 +0200	[thread overview]
Message-ID: <1321194872-8276-10-git-send-email-dmitry@broadcom.com> (raw)
In-Reply-To: <1321194872-8276-1-git-send-email-dmitry@broadcom.com>

From: Ariel Elior <ariele@broadcom.com>

Shut down the device in case of fan failure to prevent HW damage.

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x.h      |    3 ++
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |   24 +++++++++++++++++++++-
 2 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
index 23e91f4..78613ef 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
@@ -1141,6 +1141,7 @@ struct bnx2x_fw_stats_data {
 enum {
 	BNX2X_SP_RTNL_SETUP_TC,
 	BNX2X_SP_RTNL_TX_TIMEOUT,
+	BNX2X_SP_RTNL_FAN_FAILURE,
 };
 
 
@@ -2048,6 +2049,8 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
 #define BNX2X_VPD_LEN			128
 #define VENDOR_ID_LEN			4
 
+int bnx2x_close(struct net_device *dev);
+
 /* Congestion management fairness mode */
 #define CMNG_FNS_NONE		0
 #define CMNG_FNS_MINMAX		1
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 967c41b..33ff60d 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -3299,6 +3299,17 @@ static inline void bnx2x_fan_failure(struct bnx2x *bp)
 	netdev_err(bp->dev, "Fan Failure on Network Controller has caused"
 	       " the driver to shutdown the card to prevent permanent"
 	       " damage.  Please contact OEM Support for assistance\n");
+
+	/*
+	 * Scheudle device reset (unload)
+	 * This is due to some boards consuming sufficient power when driver is
+	 * up to overheat if fan fails.
+	 */
+	smp_mb__before_clear_bit();
+	set_bit(BNX2X_SP_RTNL_FAN_FAILURE, &bp->sp_rtnl_state);
+	smp_mb__after_clear_bit();
+	schedule_delayed_work(&bp->sp_rtnl_task, 0);
+
 }
 
 static inline void bnx2x_attn_int_deasserted0(struct bnx2x *bp, u32 attn)
@@ -8503,6 +8514,17 @@ sp_rtnl_not_reset:
 	if (test_and_clear_bit(BNX2X_SP_RTNL_SETUP_TC, &bp->sp_rtnl_state))
 		bnx2x_setup_tc(bp->dev, bp->dcbx_port_params.ets.num_of_cos);
 
+	/*
+	 * in case of fan failure we need to reset id if the "stop on error"
+	 * debug flag is set, since we trying to prevent permanent overheating
+	 * damage
+	 */
+	if (test_and_clear_bit(BNX2X_SP_RTNL_FAN_FAILURE, &bp->sp_rtnl_state)) {
+		DP(BNX2X_MSG_SP, "fan failure detected. Unloading driver");
+		netif_device_detach(bp->dev);
+		bnx2x_close(bp->dev);
+	}
+
 sp_rtnl_exit:
 	rtnl_unlock();
 }
@@ -9969,7 +9991,7 @@ static int bnx2x_open(struct net_device *dev)
 }
 
 /* called with rtnl_lock */
-static int bnx2x_close(struct net_device *dev)
+int bnx2x_close(struct net_device *dev)
 {
 	struct bnx2x *bp = netdev_priv(dev);
 
-- 
1.7.7.2

  parent reply	other threads:[~2011-11-13 14:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-13 14:34 [PATCH v3 net-next 00/12] bnx2x series Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 01/12] bnx2x: allow FCoE and DCB for 578xx Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 02/12] bnx2x: use rx_queue index for skb_record_rx_queue() Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 03/12] bnx2x: remove unused variable Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 04/12] bnx2x: separate FCoE and iSCSI license initialization Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 05/12] bnx2x: propagate DCBX negotiation Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 06/12] bnx2x: DCBX: use #define instead of magic Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 07/12] bnx2x: simplify definition of RX_SGE_MASK_LEN and use it Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 08/12] bnx2x: remove unused #define Dmitry Kravkov
2011-11-13 14:34 ` Dmitry Kravkov [this message]
2011-11-13 21:11   ` [PATCH v3 net-next 09/12] bnx2x: add fan failure event handling Joe Perches
     [not found]     ` <80A6ED01A151614884EE6C5D6AF0F2E9099806AF42@SJEXCHCCR01.corp.ad.broadcom.com>
2011-11-14  8:28       ` Dmitry Kravkov
2011-11-14  8:37         ` David Miller
2011-11-13 14:34 ` [PATCH v3 net-next 10/12] bnx2x: prevent race in statistics flow Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 11/12] bnx2x: Remove on-stack napi struct variable Dmitry Kravkov
2011-11-13 14:34 ` [PATCH v3 net-next 12/12] bnx2x: update driver version to 1.70.35-0 Dmitry Kravkov
2011-11-13 21:06 ` [PATCH v3 net-next 00/12] bnx2x 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=1321194872-8276-10-git-send-email-dmitry@broadcom.com \
    --to=dmitry@broadcom.com \
    --cc=ariele@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).