diff options
author | David S. Miller <davem@davemloft.net> | 2009-08-13 22:59:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-08-13 22:59:44 -0400 |
commit | 5c16807d3d196203d2d3c9fae51ac7e422091904 (patch) | |
tree | 850c33533f80fe426b477c4660c61ba22315a808 /drivers/net/netxen | |
parent | e5e2a8fd8358d1b3a2c51c3248edee72e4194703 (diff) | |
parent | 232e7d68d50c9ac3a55d716e5ae215ecd1e043b9 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/net/netxen/netxen_nic_main.c
Diffstat (limited to 'drivers/net/netxen')
-rw-r--r-- | drivers/net/netxen/netxen_nic.h | 2 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_init.c | 7 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_main.c | 99 |
3 files changed, 66 insertions, 42 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index ae81f7022d23..5abb41e2d02c 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -1112,7 +1112,7 @@ struct netxen_adapter { | |||
1112 | u8 mc_enabled; | 1112 | u8 mc_enabled; |
1113 | u8 max_mc_count; | 1113 | u8 max_mc_count; |
1114 | u8 rss_supported; | 1114 | u8 rss_supported; |
1115 | u8 resv2; | 1115 | u8 link_changed; |
1116 | u32 resv3; | 1116 | u32 resv3; |
1117 | 1117 | ||
1118 | u8 has_link_events; | 1118 | u8 has_link_events; |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index 582828756ef4..e8bdbf9fefbb 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -184,13 +184,6 @@ void netxen_free_sw_resources(struct netxen_adapter *adapter) | |||
184 | kfree(recv_ctx->rds_rings); | 184 | kfree(recv_ctx->rds_rings); |
185 | 185 | ||
186 | skip_rds: | 186 | skip_rds: |
187 | if (recv_ctx->sds_rings == NULL) | ||
188 | goto skip_sds; | ||
189 | |||
190 | for(ring = 0; ring < adapter->max_sds_rings; ring++) | ||
191 | recv_ctx->sds_rings[ring].consumer = 0; | ||
192 | |||
193 | skip_sds: | ||
194 | if (adapter->tx_ring == NULL) | 187 | if (adapter->tx_ring == NULL) |
195 | return; | 188 | return; |
196 | 189 | ||
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 98271f962ae4..4e3fb30d66fe 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -95,10 +95,6 @@ static struct pci_device_id netxen_pci_tbl[] __devinitdata = { | |||
95 | 95 | ||
96 | MODULE_DEVICE_TABLE(pci, netxen_pci_tbl); | 96 | MODULE_DEVICE_TABLE(pci, netxen_pci_tbl); |
97 | 97 | ||
98 | static struct workqueue_struct *netxen_workq; | ||
99 | #define SCHEDULE_WORK(tp) queue_work(netxen_workq, tp) | ||
100 | #define FLUSH_SCHEDULED_WORK() flush_workqueue(netxen_workq) | ||
101 | |||
102 | static void netxen_watchdog(unsigned long); | 98 | static void netxen_watchdog(unsigned long); |
103 | 99 | ||
104 | static uint32_t crb_cmd_producer[4] = { | 100 | static uint32_t crb_cmd_producer[4] = { |
@@ -172,6 +168,8 @@ netxen_free_sds_rings(struct netxen_recv_context *recv_ctx) | |||
172 | { | 168 | { |
173 | if (recv_ctx->sds_rings != NULL) | 169 | if (recv_ctx->sds_rings != NULL) |
174 | kfree(recv_ctx->sds_rings); | 170 | kfree(recv_ctx->sds_rings); |
171 | |||
172 | recv_ctx->sds_rings = NULL; | ||
175 | } | 173 | } |
176 | 174 | ||
177 | static int | 175 | static int |
@@ -194,6 +192,21 @@ netxen_napi_add(struct netxen_adapter *adapter, struct net_device *netdev) | |||
194 | } | 192 | } |
195 | 193 | ||
196 | static void | 194 | static void |
195 | netxen_napi_del(struct netxen_adapter *adapter) | ||
196 | { | ||
197 | int ring; | ||
198 | struct nx_host_sds_ring *sds_ring; | ||
199 | struct netxen_recv_context *recv_ctx = &adapter->recv_ctx; | ||
200 | |||
201 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | ||
202 | sds_ring = &recv_ctx->sds_rings[ring]; | ||
203 | netif_napi_del(&sds_ring->napi); | ||
204 | } | ||
205 | |||
206 | netxen_free_sds_rings(&adapter->recv_ctx); | ||
207 | } | ||
208 | |||
209 | static void | ||
197 | netxen_napi_enable(struct netxen_adapter *adapter) | 210 | netxen_napi_enable(struct netxen_adapter *adapter) |
198 | { | 211 | { |
199 | int ring; | 212 | int ring; |
@@ -910,7 +923,6 @@ netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev) | |||
910 | spin_unlock(&adapter->tx_clean_lock); | 923 | spin_unlock(&adapter->tx_clean_lock); |
911 | 924 | ||
912 | del_timer_sync(&adapter->watchdog_timer); | 925 | del_timer_sync(&adapter->watchdog_timer); |
913 | FLUSH_SCHEDULED_WORK(); | ||
914 | } | 926 | } |
915 | 927 | ||
916 | 928 | ||
@@ -927,10 +939,12 @@ netxen_nic_attach(struct netxen_adapter *adapter) | |||
927 | return 0; | 939 | return 0; |
928 | 940 | ||
929 | err = netxen_init_firmware(adapter); | 941 | err = netxen_init_firmware(adapter); |
930 | if (err != 0) { | 942 | if (err) |
931 | printk(KERN_ERR "Failed to init firmware\n"); | 943 | return err; |
932 | return -EIO; | 944 | |
933 | } | 945 | err = netxen_napi_add(adapter, netdev); |
946 | if (err) | ||
947 | return err; | ||
934 | 948 | ||
935 | err = netxen_alloc_sw_resources(adapter); | 949 | err = netxen_alloc_sw_resources(adapter); |
936 | if (err) { | 950 | if (err) { |
@@ -995,6 +1009,7 @@ netxen_nic_detach(struct netxen_adapter *adapter) | |||
995 | netxen_free_hw_resources(adapter); | 1009 | netxen_free_hw_resources(adapter); |
996 | netxen_release_rx_buffers(adapter); | 1010 | netxen_release_rx_buffers(adapter); |
997 | netxen_nic_free_irq(adapter); | 1011 | netxen_nic_free_irq(adapter); |
1012 | netxen_napi_del(adapter); | ||
998 | netxen_free_sw_resources(adapter); | 1013 | netxen_free_sw_resources(adapter); |
999 | 1014 | ||
1000 | adapter->is_up = 0; | 1015 | adapter->is_up = 0; |
@@ -1245,13 +1260,15 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
1245 | 1260 | ||
1246 | unregister_netdev(netdev); | 1261 | unregister_netdev(netdev); |
1247 | 1262 | ||
1263 | cancel_work_sync(&adapter->watchdog_task); | ||
1264 | cancel_work_sync(&adapter->tx_timeout_task); | ||
1265 | |||
1248 | netxen_nic_detach(adapter); | 1266 | netxen_nic_detach(adapter); |
1249 | 1267 | ||
1250 | if (adapter->portnum == 0) | 1268 | if (adapter->portnum == 0) |
1251 | netxen_free_dummy_dma(adapter); | 1269 | netxen_free_dummy_dma(adapter); |
1252 | 1270 | ||
1253 | netxen_teardown_intr(adapter); | 1271 | netxen_teardown_intr(adapter); |
1254 | netxen_free_sds_rings(&adapter->recv_ctx); | ||
1255 | 1272 | ||
1256 | netxen_cleanup_pci_map(adapter); | 1273 | netxen_cleanup_pci_map(adapter); |
1257 | 1274 | ||
@@ -1277,6 +1294,9 @@ netxen_nic_suspend(struct pci_dev *pdev, pm_message_t state) | |||
1277 | if (netif_running(netdev)) | 1294 | if (netif_running(netdev)) |
1278 | netxen_nic_down(adapter, netdev); | 1295 | netxen_nic_down(adapter, netdev); |
1279 | 1296 | ||
1297 | cancel_work_sync(&adapter->watchdog_task); | ||
1298 | cancel_work_sync(&adapter->tx_timeout_task); | ||
1299 | |||
1280 | netxen_nic_detach(adapter); | 1300 | netxen_nic_detach(adapter); |
1281 | 1301 | ||
1282 | pci_save_state(pdev); | 1302 | pci_save_state(pdev); |
@@ -1643,11 +1663,6 @@ static int netxen_nic_check_temp(struct netxen_adapter *adapter) | |||
1643 | "%s: Device temperature %d degrees C exceeds" | 1663 | "%s: Device temperature %d degrees C exceeds" |
1644 | " maximum allowed. Hardware has been shut down.\n", | 1664 | " maximum allowed. Hardware has been shut down.\n", |
1645 | netdev->name, temp_val); | 1665 | netdev->name, temp_val); |
1646 | |||
1647 | netif_device_detach(netdev); | ||
1648 | netxen_nic_down(adapter, netdev); | ||
1649 | netxen_nic_detach(adapter); | ||
1650 | |||
1651 | rv = 1; | 1666 | rv = 1; |
1652 | } else if (temp_state == NX_TEMP_WARN) { | 1667 | } else if (temp_state == NX_TEMP_WARN) { |
1653 | if (adapter->temp == NX_TEMP_NORMAL) { | 1668 | if (adapter->temp == NX_TEMP_NORMAL) { |
@@ -1681,10 +1696,7 @@ void netxen_advert_link_change(struct netxen_adapter *adapter, int linkup) | |||
1681 | netif_carrier_off(netdev); | 1696 | netif_carrier_off(netdev); |
1682 | netif_stop_queue(netdev); | 1697 | netif_stop_queue(netdev); |
1683 | } | 1698 | } |
1684 | 1699 | adapter->link_changed = !adapter->has_link_events; | |
1685 | if (!adapter->has_link_events) | ||
1686 | netxen_nic_set_link_parameters(adapter); | ||
1687 | |||
1688 | } else if (!adapter->ahw.linkup && linkup) { | 1700 | } else if (!adapter->ahw.linkup && linkup) { |
1689 | printk(KERN_INFO "%s: %s NIC Link is up\n", | 1701 | printk(KERN_INFO "%s: %s NIC Link is up\n", |
1690 | netxen_nic_driver_name, netdev->name); | 1702 | netxen_nic_driver_name, netdev->name); |
@@ -1693,9 +1705,7 @@ void netxen_advert_link_change(struct netxen_adapter *adapter, int linkup) | |||
1693 | netif_carrier_on(netdev); | 1705 | netif_carrier_on(netdev); |
1694 | netif_wake_queue(netdev); | 1706 | netif_wake_queue(netdev); |
1695 | } | 1707 | } |
1696 | 1708 | adapter->link_changed = !adapter->has_link_events; | |
1697 | if (!adapter->has_link_events) | ||
1698 | netxen_nic_set_link_parameters(adapter); | ||
1699 | } | 1709 | } |
1700 | } | 1710 | } |
1701 | 1711 | ||
@@ -1722,11 +1732,36 @@ static void netxen_nic_handle_phy_intr(struct netxen_adapter *adapter) | |||
1722 | netxen_advert_link_change(adapter, linkup); | 1732 | netxen_advert_link_change(adapter, linkup); |
1723 | } | 1733 | } |
1724 | 1734 | ||
1735 | static void netxen_nic_thermal_shutdown(struct netxen_adapter *adapter) | ||
1736 | { | ||
1737 | struct net_device *netdev = adapter->netdev; | ||
1738 | |||
1739 | netif_device_detach(netdev); | ||
1740 | netxen_nic_down(adapter, netdev); | ||
1741 | netxen_nic_detach(adapter); | ||
1742 | } | ||
1743 | |||
1725 | static void netxen_watchdog(unsigned long v) | 1744 | static void netxen_watchdog(unsigned long v) |
1726 | { | 1745 | { |
1727 | struct netxen_adapter *adapter = (struct netxen_adapter *)v; | 1746 | struct netxen_adapter *adapter = (struct netxen_adapter *)v; |
1728 | 1747 | ||
1729 | SCHEDULE_WORK(&adapter->watchdog_task); | 1748 | if (netxen_nic_check_temp(adapter)) |
1749 | goto do_sched; | ||
1750 | |||
1751 | if (!adapter->has_link_events) { | ||
1752 | netxen_nic_handle_phy_intr(adapter); | ||
1753 | |||
1754 | if (adapter->link_changed) | ||
1755 | goto do_sched; | ||
1756 | } | ||
1757 | |||
1758 | if (netif_running(adapter->netdev)) | ||
1759 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); | ||
1760 | |||
1761 | return; | ||
1762 | |||
1763 | do_sched: | ||
1764 | schedule_work(&adapter->watchdog_task); | ||
1730 | } | 1765 | } |
1731 | 1766 | ||
1732 | void netxen_watchdog_task(struct work_struct *work) | 1767 | void netxen_watchdog_task(struct work_struct *work) |
@@ -1734,11 +1769,13 @@ void netxen_watchdog_task(struct work_struct *work) | |||
1734 | struct netxen_adapter *adapter = | 1769 | struct netxen_adapter *adapter = |
1735 | container_of(work, struct netxen_adapter, watchdog_task); | 1770 | container_of(work, struct netxen_adapter, watchdog_task); |
1736 | 1771 | ||
1737 | if (netxen_nic_check_temp(adapter)) | 1772 | if (adapter->temp == NX_TEMP_PANIC) { |
1773 | netxen_nic_thermal_shutdown(adapter); | ||
1738 | return; | 1774 | return; |
1775 | } | ||
1739 | 1776 | ||
1740 | if (!adapter->has_link_events) | 1777 | if (adapter->link_changed) |
1741 | netxen_nic_handle_phy_intr(adapter); | 1778 | netxen_nic_set_link_parameters(adapter); |
1742 | 1779 | ||
1743 | if (netif_running(adapter->netdev)) | 1780 | if (netif_running(adapter->netdev)) |
1744 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); | 1781 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); |
@@ -1746,12 +1783,10 @@ void netxen_watchdog_task(struct work_struct *work) | |||
1746 | 1783 | ||
1747 | static void netxen_tx_timeout(struct net_device *netdev) | 1784 | static void netxen_tx_timeout(struct net_device *netdev) |
1748 | { | 1785 | { |
1749 | struct netxen_adapter *adapter = (struct netxen_adapter *) | 1786 | struct netxen_adapter *adapter = netdev_priv(netdev); |
1750 | netdev_priv(netdev); | ||
1751 | 1787 | ||
1752 | dev_err(&netdev->dev, "transmit timeout, resetting.\n"); | 1788 | dev_err(&netdev->dev, "transmit timeout, resetting.\n"); |
1753 | 1789 | schedule_work(&adapter->tx_timeout_task); | |
1754 | SCHEDULE_WORK(&adapter->tx_timeout_task); | ||
1755 | } | 1790 | } |
1756 | 1791 | ||
1757 | static void netxen_reset_task(struct work_struct *work) | 1792 | static void netxen_reset_task(struct work_struct *work) |
@@ -2025,9 +2060,6 @@ static int __init netxen_init_module(void) | |||
2025 | { | 2060 | { |
2026 | printk(KERN_INFO "%s\n", netxen_nic_driver_string); | 2061 | printk(KERN_INFO "%s\n", netxen_nic_driver_string); |
2027 | 2062 | ||
2028 | if ((netxen_workq = create_singlethread_workqueue("netxen")) == NULL) | ||
2029 | return -ENOMEM; | ||
2030 | |||
2031 | #ifdef CONFIG_INET | 2063 | #ifdef CONFIG_INET |
2032 | register_netdevice_notifier(&netxen_netdev_cb); | 2064 | register_netdevice_notifier(&netxen_netdev_cb); |
2033 | register_inetaddr_notifier(&netxen_inetaddr_cb); | 2065 | register_inetaddr_notifier(&netxen_inetaddr_cb); |
@@ -2046,7 +2078,6 @@ static void __exit netxen_exit_module(void) | |||
2046 | unregister_inetaddr_notifier(&netxen_inetaddr_cb); | 2078 | unregister_inetaddr_notifier(&netxen_inetaddr_cb); |
2047 | unregister_netdevice_notifier(&netxen_netdev_cb); | 2079 | unregister_netdevice_notifier(&netxen_netdev_cb); |
2048 | #endif | 2080 | #endif |
2049 | destroy_workqueue(netxen_workq); | ||
2050 | } | 2081 | } |
2051 | 2082 | ||
2052 | module_exit(netxen_exit_module); | 2083 | module_exit(netxen_exit_module); |