diff options
Diffstat (limited to 'drivers/net/netxen/netxen_nic_main.c')
-rw-r--r-- | drivers/net/netxen/netxen_nic_main.c | 49 |
1 files changed, 39 insertions, 10 deletions
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index e5d187fce51b..f4996846a234 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -946,8 +946,9 @@ netxen_nic_init_coalesce_defaults(struct netxen_adapter *adapter) | |||
946 | NETXEN_DEFAULT_INTR_COALESCE_TX_PACKETS; | 946 | NETXEN_DEFAULT_INTR_COALESCE_TX_PACKETS; |
947 | } | 947 | } |
948 | 948 | ||
949 | /* with rtnl_lock */ | ||
949 | static int | 950 | static int |
950 | netxen_nic_up(struct netxen_adapter *adapter, struct net_device *netdev) | 951 | __netxen_nic_up(struct netxen_adapter *adapter, struct net_device *netdev) |
951 | { | 952 | { |
952 | int err; | 953 | int err; |
953 | 954 | ||
@@ -988,14 +989,32 @@ netxen_nic_up(struct netxen_adapter *adapter, struct net_device *netdev) | |||
988 | return 0; | 989 | return 0; |
989 | } | 990 | } |
990 | 991 | ||
992 | /* Usage: During resume and firmware recovery module.*/ | ||
993 | |||
994 | static inline int | ||
995 | netxen_nic_up(struct netxen_adapter *adapter, struct net_device *netdev) | ||
996 | { | ||
997 | int err = 0; | ||
998 | |||
999 | rtnl_lock(); | ||
1000 | if (netif_running(netdev)) | ||
1001 | err = __netxen_nic_up(adapter, netdev); | ||
1002 | rtnl_unlock(); | ||
1003 | |||
1004 | return err; | ||
1005 | } | ||
1006 | |||
1007 | /* with rtnl_lock */ | ||
991 | static void | 1008 | static void |
992 | netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev) | 1009 | __netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev) |
993 | { | 1010 | { |
994 | if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC) | 1011 | if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC) |
995 | return; | 1012 | return; |
996 | 1013 | ||
997 | clear_bit(__NX_DEV_UP, &adapter->state); | 1014 | if (!test_and_clear_bit(__NX_DEV_UP, &adapter->state)) |
1015 | return; | ||
998 | 1016 | ||
1017 | smp_mb(); | ||
999 | spin_lock(&adapter->tx_clean_lock); | 1018 | spin_lock(&adapter->tx_clean_lock); |
1000 | netif_carrier_off(netdev); | 1019 | netif_carrier_off(netdev); |
1001 | netif_tx_disable(netdev); | 1020 | netif_tx_disable(netdev); |
@@ -1014,6 +1033,17 @@ netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev) | |||
1014 | spin_unlock(&adapter->tx_clean_lock); | 1033 | spin_unlock(&adapter->tx_clean_lock); |
1015 | } | 1034 | } |
1016 | 1035 | ||
1036 | /* Usage: During suspend and firmware recovery module */ | ||
1037 | |||
1038 | static inline void | ||
1039 | netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev) | ||
1040 | { | ||
1041 | rtnl_lock(); | ||
1042 | if (netif_running(netdev)) | ||
1043 | __netxen_nic_down(adapter, netdev); | ||
1044 | rtnl_unlock(); | ||
1045 | |||
1046 | } | ||
1017 | 1047 | ||
1018 | static int | 1048 | static int |
1019 | netxen_nic_attach(struct netxen_adapter *adapter) | 1049 | netxen_nic_attach(struct netxen_adapter *adapter) |
@@ -1122,14 +1152,14 @@ netxen_nic_reset_context(struct netxen_adapter *adapter) | |||
1122 | netif_device_detach(netdev); | 1152 | netif_device_detach(netdev); |
1123 | 1153 | ||
1124 | if (netif_running(netdev)) | 1154 | if (netif_running(netdev)) |
1125 | netxen_nic_down(adapter, netdev); | 1155 | __netxen_nic_down(adapter, netdev); |
1126 | 1156 | ||
1127 | netxen_nic_detach(adapter); | 1157 | netxen_nic_detach(adapter); |
1128 | 1158 | ||
1129 | if (netif_running(netdev)) { | 1159 | if (netif_running(netdev)) { |
1130 | err = netxen_nic_attach(adapter); | 1160 | err = netxen_nic_attach(adapter); |
1131 | if (!err) | 1161 | if (!err) |
1132 | err = netxen_nic_up(adapter, netdev); | 1162 | err = __netxen_nic_up(adapter, netdev); |
1133 | 1163 | ||
1134 | if (err) | 1164 | if (err) |
1135 | goto done; | 1165 | goto done; |
@@ -1499,7 +1529,7 @@ static int netxen_nic_open(struct net_device *netdev) | |||
1499 | if (err) | 1529 | if (err) |
1500 | return err; | 1530 | return err; |
1501 | 1531 | ||
1502 | err = netxen_nic_up(adapter, netdev); | 1532 | err = __netxen_nic_up(adapter, netdev); |
1503 | if (err) | 1533 | if (err) |
1504 | goto err_out; | 1534 | goto err_out; |
1505 | 1535 | ||
@@ -1519,7 +1549,7 @@ static int netxen_nic_close(struct net_device *netdev) | |||
1519 | { | 1549 | { |
1520 | struct netxen_adapter *adapter = netdev_priv(netdev); | 1550 | struct netxen_adapter *adapter = netdev_priv(netdev); |
1521 | 1551 | ||
1522 | netxen_nic_down(adapter, netdev); | 1552 | __netxen_nic_down(adapter, netdev); |
1523 | return 0; | 1553 | return 0; |
1524 | } | 1554 | } |
1525 | 1555 | ||
@@ -2025,7 +2055,7 @@ static int netxen_nic_poll(struct napi_struct *napi, int budget) | |||
2025 | 2055 | ||
2026 | if ((work_done < budget) && tx_complete) { | 2056 | if ((work_done < budget) && tx_complete) { |
2027 | napi_complete(&sds_ring->napi); | 2057 | napi_complete(&sds_ring->napi); |
2028 | if (netif_running(adapter->netdev)) | 2058 | if (test_bit(__NX_DEV_UP, &adapter->state)) |
2029 | netxen_nic_enable_int(sds_ring); | 2059 | netxen_nic_enable_int(sds_ring); |
2030 | } | 2060 | } |
2031 | 2061 | ||
@@ -2210,8 +2240,7 @@ netxen_detach_work(struct work_struct *work) | |||
2210 | 2240 | ||
2211 | netif_device_detach(netdev); | 2241 | netif_device_detach(netdev); |
2212 | 2242 | ||
2213 | if (netif_running(netdev)) | 2243 | netxen_nic_down(adapter, netdev); |
2214 | netxen_nic_down(adapter, netdev); | ||
2215 | 2244 | ||
2216 | netxen_nic_detach(adapter); | 2245 | netxen_nic_detach(adapter); |
2217 | 2246 | ||