From 6a581e93981e8838c85e407303186faf937830d3 Mon Sep 17 00:00:00 2001 From: Dhananjay Phadke Date: Sat, 5 Sep 2009 17:43:08 +0000 Subject: netxen: firmware hang detection Implement state machine to detect firmware hung state and recover. Since firmware will be shared by all PCI functions that have different class drivers (NIC or FCOE or iSCSI), explicit hardware based serialization is required for initializing firmware. o Used global scratchpad register to maintain device reference count. Every probed pci function adds to ref count. o Implement timer (delayed work) for each pci func that checks firmware heartbit every 5 sec and detaches itself if firmware is dead. Last detaching function reloads firmware. Other functions wait for firmware init, and re-attach themselves. Heartbit is not supported by NX2031 firmware. Signed-off-by: Amit Kumar Salecha Signed-off-by: Dhananjay Phadke Signed-off-by: David S. Miller --- drivers/net/netxen/netxen_nic.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'drivers/net/netxen/netxen_nic.h') diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index ede2fa7477ac..30a38163b23b 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h @@ -229,6 +229,8 @@ #define MPORT_SINGLE_FUNCTION_MODE 0x1111 #define MPORT_MULTI_FUNCTION_MODE 0x2222 +#define NX_MAX_PCI_FUNC 8 + /* * NetXen host-peg signal message structure * @@ -1101,6 +1103,10 @@ typedef struct { #define NETXEN_ADAPTER_UP_MAGIC 777 #define NETXEN_NIC_PEG_TUNE 0 +#define __NX_FW_ATTACHED 0 +#define __NX_DEV_UP 1 +#define __NX_RESETTING 2 + struct netxen_dummy_dma { void *addr; dma_addr_t phys_addr; @@ -1137,7 +1143,9 @@ struct netxen_adapter { u8 max_mc_count; u8 rss_supported; u8 link_changed; - u32 resv3; + u8 fw_wait_cnt; + u8 fw_fail_cnt; + u16 resv4; u8 has_link_events; u8 fw_type; @@ -1156,7 +1164,7 @@ struct netxen_adapter { u32 temp; u32 msi_tgt_status; - u32 resv4; + u32 heartbit; struct netxen_adapter_stats stats; @@ -1187,14 +1195,15 @@ struct netxen_adapter { struct netxen_dummy_dma dummy_dma; - struct work_struct watchdog_task; - struct timer_list watchdog_timer; + struct delayed_work fw_work; + struct work_struct tx_timeout_task; struct net_device_stats net_stats; nx_nic_intr_coalesce_t coal; + unsigned long state; u32 resv5; u32 fw_version; const struct firmware *fw; -- cgit v1.2.1