bnx2x: add fan failure event handling
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> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
					parent
					
						
							
								46fa1309fe
							
						
					
				
			
			
				commit
				
					
						8304859adc
					
				
			
		
					 2 changed files with 26 additions and 1 deletions
				
			
		|  | @ -1141,6 +1141,7 @@ struct bnx2x_fw_stats_data { | ||||||
| enum { | enum { | ||||||
| 	BNX2X_SP_RTNL_SETUP_TC, | 	BNX2X_SP_RTNL_SETUP_TC, | ||||||
| 	BNX2X_SP_RTNL_TX_TIMEOUT, | 	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 BNX2X_VPD_LEN			128 | ||||||
| #define VENDOR_ID_LEN			4 | #define VENDOR_ID_LEN			4 | ||||||
| 
 | 
 | ||||||
|  | int bnx2x_close(struct net_device *dev); | ||||||
|  | 
 | ||||||
| /* Congestion management fairness mode */ | /* Congestion management fairness mode */ | ||||||
| #define CMNG_FNS_NONE		0 | #define CMNG_FNS_NONE		0 | ||||||
| #define CMNG_FNS_MINMAX		1 | #define CMNG_FNS_MINMAX		1 | ||||||
|  |  | ||||||
|  | @ -3299,6 +3299,17 @@ static inline void bnx2x_fan_failure(struct bnx2x *bp) | ||||||
| 	netdev_err(bp->dev, "Fan Failure on Network Controller has caused" | 	netdev_err(bp->dev, "Fan Failure on Network Controller has caused" | ||||||
| 	       " the driver to shutdown the card to prevent permanent" | 	       " the driver to shutdown the card to prevent permanent" | ||||||
| 	       " damage.  Please contact OEM Support for assistance\n"); | 	       " 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) | 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)) | 	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); | 		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: | sp_rtnl_exit: | ||||||
| 	rtnl_unlock(); | 	rtnl_unlock(); | ||||||
| } | } | ||||||
|  | @ -9969,7 +9991,7 @@ static int bnx2x_open(struct net_device *dev) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /* called with rtnl_lock */ | /* 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); | 	struct bnx2x *bp = netdev_priv(dev); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Ariel Elior
				Ariel Elior