diff options
author | Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> | 2008-12-26 04:36:05 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-26 04:36:05 -0500 |
commit | 7adf1525befb5606462431eb1a4ea40ded5baef4 (patch) | |
tree | 5809dfe0f6d7335655d9eaacaddad93459e18460 /drivers/net/ixgbe | |
parent | d7b06636be162d3f74c9ce5d6d0d9ea4e5d362c8 (diff) |
ixgbe: Fix NAPI enable/disable path when using DCB
This change allows DCB mode to change the number of queues, and presumably
the number of NAPI instances, safely.
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ixgbe')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_dcb_nl.c | 4 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 11 |
2 files changed, 10 insertions, 5 deletions
diff --git a/drivers/net/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ixgbe/ixgbe_dcb_nl.c index 8ac639d0da03..4129976953f5 100644 --- a/drivers/net/ixgbe/ixgbe_dcb_nl.c +++ b/drivers/net/ixgbe/ixgbe_dcb_nl.c | |||
@@ -148,6 +148,7 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) | |||
148 | netdev->netdev_ops->ndo_stop(netdev); | 148 | netdev->netdev_ops->ndo_stop(netdev); |
149 | ixgbe_reset_interrupt_capability(adapter); | 149 | ixgbe_reset_interrupt_capability(adapter); |
150 | ixgbe_napi_del_all(adapter); | 150 | ixgbe_napi_del_all(adapter); |
151 | INIT_LIST_HEAD(&netdev->napi_list); | ||
151 | kfree(adapter->tx_ring); | 152 | kfree(adapter->tx_ring); |
152 | kfree(adapter->rx_ring); | 153 | kfree(adapter->rx_ring); |
153 | adapter->tx_ring = NULL; | 154 | adapter->tx_ring = NULL; |
@@ -157,7 +158,6 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) | |||
157 | adapter->flags &= ~IXGBE_FLAG_RSS_ENABLED; | 158 | adapter->flags &= ~IXGBE_FLAG_RSS_ENABLED; |
158 | adapter->flags |= IXGBE_FLAG_DCB_ENABLED; | 159 | adapter->flags |= IXGBE_FLAG_DCB_ENABLED; |
159 | ixgbe_init_interrupt_scheme(adapter); | 160 | ixgbe_init_interrupt_scheme(adapter); |
160 | ixgbe_napi_add_all(adapter); | ||
161 | if (netif_running(netdev)) | 161 | if (netif_running(netdev)) |
162 | netdev->netdev_ops->ndo_open(netdev); | 162 | netdev->netdev_ops->ndo_open(netdev); |
163 | } else { | 163 | } else { |
@@ -167,6 +167,7 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) | |||
167 | netdev->netdev_ops->ndo_stop(netdev); | 167 | netdev->netdev_ops->ndo_stop(netdev); |
168 | ixgbe_reset_interrupt_capability(adapter); | 168 | ixgbe_reset_interrupt_capability(adapter); |
169 | ixgbe_napi_del_all(adapter); | 169 | ixgbe_napi_del_all(adapter); |
170 | INIT_LIST_HEAD(&netdev->napi_list); | ||
170 | kfree(adapter->tx_ring); | 171 | kfree(adapter->tx_ring); |
171 | kfree(adapter->rx_ring); | 172 | kfree(adapter->rx_ring); |
172 | adapter->tx_ring = NULL; | 173 | adapter->tx_ring = NULL; |
@@ -176,7 +177,6 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) | |||
176 | adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED; | 177 | adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED; |
177 | adapter->flags |= IXGBE_FLAG_RSS_ENABLED; | 178 | adapter->flags |= IXGBE_FLAG_RSS_ENABLED; |
178 | ixgbe_init_interrupt_scheme(adapter); | 179 | ixgbe_init_interrupt_scheme(adapter); |
179 | ixgbe_napi_add_all(adapter); | ||
180 | if (netif_running(netdev)) | 180 | if (netif_running(netdev)) |
181 | netdev->netdev_ops->ndo_open(netdev); | 181 | netdev->netdev_ops->ndo_open(netdev); |
182 | } | 182 | } |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index b6ae9f674ba5..acef3c65cd2c 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -2064,6 +2064,8 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter) | |||
2064 | else | 2064 | else |
2065 | ixgbe_configure_msi_and_legacy(adapter); | 2065 | ixgbe_configure_msi_and_legacy(adapter); |
2066 | 2066 | ||
2067 | ixgbe_napi_add_all(adapter); | ||
2068 | |||
2067 | clear_bit(__IXGBE_DOWN, &adapter->state); | 2069 | clear_bit(__IXGBE_DOWN, &adapter->state); |
2068 | ixgbe_napi_enable_all(adapter); | 2070 | ixgbe_napi_enable_all(adapter); |
2069 | 2071 | ||
@@ -3176,8 +3178,13 @@ static int ixgbe_close(struct net_device *netdev) | |||
3176 | void ixgbe_napi_add_all(struct ixgbe_adapter *adapter) | 3178 | void ixgbe_napi_add_all(struct ixgbe_adapter *adapter) |
3177 | { | 3179 | { |
3178 | int q_idx, q_vectors; | 3180 | int q_idx, q_vectors; |
3181 | struct net_device *netdev = adapter->netdev; | ||
3179 | int (*poll)(struct napi_struct *, int); | 3182 | int (*poll)(struct napi_struct *, int); |
3180 | 3183 | ||
3184 | /* check if we already have our netdev->napi_list populated */ | ||
3185 | if (&netdev->napi_list != netdev->napi_list.next) | ||
3186 | return; | ||
3187 | |||
3181 | if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) { | 3188 | if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) { |
3182 | poll = &ixgbe_clean_rxonly; | 3189 | poll = &ixgbe_clean_rxonly; |
3183 | /* Only enable as many vectors as we have rx queues. */ | 3190 | /* Only enable as many vectors as we have rx queues. */ |
@@ -3271,6 +3278,7 @@ static int ixgbe_suspend(struct pci_dev *pdev, pm_message_t state) | |||
3271 | } | 3278 | } |
3272 | ixgbe_reset_interrupt_capability(adapter); | 3279 | ixgbe_reset_interrupt_capability(adapter); |
3273 | ixgbe_napi_del_all(adapter); | 3280 | ixgbe_napi_del_all(adapter); |
3281 | INIT_LIST_HEAD(&netdev->napi_list); | ||
3274 | kfree(adapter->tx_ring); | 3282 | kfree(adapter->tx_ring); |
3275 | kfree(adapter->rx_ring); | 3283 | kfree(adapter->rx_ring); |
3276 | 3284 | ||
@@ -4212,8 +4220,6 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
4212 | netif_carrier_off(netdev); | 4220 | netif_carrier_off(netdev); |
4213 | netif_tx_stop_all_queues(netdev); | 4221 | netif_tx_stop_all_queues(netdev); |
4214 | 4222 | ||
4215 | ixgbe_napi_add_all(adapter); | ||
4216 | |||
4217 | strcpy(netdev->name, "eth%d"); | 4223 | strcpy(netdev->name, "eth%d"); |
4218 | err = register_netdev(netdev); | 4224 | err = register_netdev(netdev); |
4219 | if (err) | 4225 | if (err) |
@@ -4299,7 +4305,6 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev) | |||
4299 | pci_release_regions(pdev); | 4305 | pci_release_regions(pdev); |
4300 | 4306 | ||
4301 | DPRINTK(PROBE, INFO, "complete\n"); | 4307 | DPRINTK(PROBE, INFO, "complete\n"); |
4302 | ixgbe_napi_del_all(adapter); | ||
4303 | kfree(adapter->tx_ring); | 4308 | kfree(adapter->tx_ring); |
4304 | kfree(adapter->rx_ring); | 4309 | kfree(adapter->rx_ring); |
4305 | 4310 | ||