aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen/netxen_nic.h
diff options
context:
space:
mode:
authorDhananjay Phadke <dhananjay@netxen.com>2007-07-02 00:07:57 -0400
committerJeff Garzik <jeff@garzik.org>2007-07-02 08:24:52 -0400
commit96acb6eb8effe7c2549909e2ee49f4130f2c167d (patch)
tree5f6049fe53d9305f7edb45e4ed94aed59f66aef7 /drivers/net/netxen/netxen_nic.h
parentd14e37e12087e98b63907518dff83a90297605d6 (diff)
RESEND [PATCH 3/3] NetXen: Graceful teardown of interface and hardware upon module unload
Resending patch 3/3 only. These changes allow driver close routine to be called during module unload, to clean-up buffers and other software resources, flush queues etc. Also, hardware is reset to pristine state. Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com> Signed-off-by: Milan Bag <mbag@netxen.com> Signed-off-by: Wen Xiong <wenxiong@us.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/netxen/netxen_nic.h')
-rw-r--r--drivers/net/netxen/netxen_nic.h78
1 files changed, 76 insertions, 2 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 6ce93fcbed32..619503742b7d 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -952,6 +952,24 @@ struct netxen_adapter {
952 int (*stop_port) (struct netxen_adapter *); 952 int (*stop_port) (struct netxen_adapter *);
953}; /* netxen_adapter structure */ 953}; /* netxen_adapter structure */
954 954
955/*
956 * NetXen dma watchdog control structure
957 *
958 * Bit 0 : enabled => R/O: 1 watchdog active, 0 inactive
959 * Bit 1 : disable_request => 1 req disable dma watchdog
960 * Bit 2 : enable_request => 1 req enable dma watchdog
961 * Bit 3-31 : unused
962 */
963
964#define netxen_set_dma_watchdog_disable_req(config_word) \
965 _netxen_set_bits(config_word, 1, 1, 1)
966#define netxen_set_dma_watchdog_enable_req(config_word) \
967 _netxen_set_bits(config_word, 2, 1, 1)
968#define netxen_get_dma_watchdog_enabled(config_word) \
969 ((config_word) & 0x1)
970#define netxen_get_dma_watchdog_disabled(config_word) \
971 (((config_word) >> 1) & 0x1)
972
955/* Max number of xmit producer threads that can run simultaneously */ 973/* Max number of xmit producer threads that can run simultaneously */
956#define MAX_XMIT_PRODUCERS 16 974#define MAX_XMIT_PRODUCERS 16
957 975
@@ -1031,8 +1049,8 @@ int netxen_nic_erase_pxe(struct netxen_adapter *adapter);
1031/* Functions from netxen_nic_init.c */ 1049/* Functions from netxen_nic_init.c */
1032void netxen_free_adapter_offload(struct netxen_adapter *adapter); 1050void netxen_free_adapter_offload(struct netxen_adapter *adapter);
1033int netxen_initialize_adapter_offload(struct netxen_adapter *adapter); 1051int netxen_initialize_adapter_offload(struct netxen_adapter *adapter);
1034void netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val); 1052int netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val);
1035void netxen_load_firmware(struct netxen_adapter *adapter); 1053int netxen_load_firmware(struct netxen_adapter *adapter);
1036int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose); 1054int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose);
1037int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp); 1055int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp);
1038int netxen_rom_fast_read_words(struct netxen_adapter *adapter, int addr, 1056int netxen_rom_fast_read_words(struct netxen_adapter *adapter, int addr,
@@ -1234,6 +1252,62 @@ static inline void get_brd_name_by_type(u32 type, char *name)
1234 name = "Unknown"; 1252 name = "Unknown";
1235} 1253}
1236 1254
1255static inline int
1256dma_watchdog_shutdown_request(struct netxen_adapter *adapter)
1257{
1258 u32 ctrl;
1259
1260 /* check if already inactive */
1261 if (netxen_nic_hw_read_wx(adapter,
1262 NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), &ctrl, 4))
1263 printk(KERN_ERR "failed to read dma watchdog status\n");
1264
1265 if (netxen_get_dma_watchdog_enabled(ctrl) == 0)
1266 return 1;
1267
1268 /* Send the disable request */
1269 netxen_set_dma_watchdog_disable_req(ctrl);
1270 netxen_crb_writelit_adapter(adapter,
1271 NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), ctrl);
1272
1273 return 0;
1274}
1275
1276static inline int
1277dma_watchdog_shutdown_poll_result(struct netxen_adapter *adapter)
1278{
1279 u32 ctrl;
1280
1281 if (netxen_nic_hw_read_wx(adapter,
1282 NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), &ctrl, 4))
1283 printk(KERN_ERR "failed to read dma watchdog status\n");
1284
1285 return ((netxen_get_dma_watchdog_enabled(ctrl) == 0) &&
1286 (netxen_get_dma_watchdog_disabled(ctrl) == 0));
1287}
1288
1289static inline int
1290dma_watchdog_wakeup(struct netxen_adapter *adapter)
1291{
1292 u32 ctrl;
1293
1294 if (netxen_nic_hw_read_wx(adapter,
1295 NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), &ctrl, 4))
1296 printk(KERN_ERR "failed to read dma watchdog status\n");
1297
1298 if (netxen_get_dma_watchdog_enabled(ctrl))
1299 return 1;
1300
1301 /* send the wakeup request */
1302 netxen_set_dma_watchdog_enable_req(ctrl);
1303
1304 netxen_crb_writelit_adapter(adapter,
1305 NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), ctrl);
1306
1307 return 0;
1308}
1309
1310
1237int netxen_is_flash_supported(struct netxen_adapter *adapter); 1311int netxen_is_flash_supported(struct netxen_adapter *adapter);
1238int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, u64 mac[]); 1312int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, u64 mac[]);
1239extern void netxen_change_ringparam(struct netxen_adapter *adapter); 1313extern void netxen_change_ringparam(struct netxen_adapter *adapter);