diff options
author | Alexander Duyck <alexander.h.duyck@intel.com> | 2008-07-08 18:13:38 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-07-11 01:20:33 -0400 |
commit | a88f10ec7a5b3d87cb9372481055340018652389 (patch) | |
tree | 0a024c743f335797a2a68922d40771f527bdfcf1 /drivers | |
parent | d8156534040996f6a93a24d3592d5d587f2587e5 (diff) |
igb: update suspend resume
Updates the suspend and resume to better handle the possibility of MSIX
vector changes.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/igb/igb_main.c | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index 89416ebda9ef..00e2e8d30ba2 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -272,6 +272,17 @@ static int igb_alloc_queues(struct igb_adapter *adapter) | |||
272 | return 0; | 272 | return 0; |
273 | } | 273 | } |
274 | 274 | ||
275 | static void igb_free_queues(struct igb_adapter *adapter) | ||
276 | { | ||
277 | int i; | ||
278 | |||
279 | for (i = 0; i < adapter->num_rx_queues; i++) | ||
280 | netif_napi_del(&adapter->rx_ring[i].napi); | ||
281 | |||
282 | kfree(adapter->tx_ring); | ||
283 | kfree(adapter->rx_ring); | ||
284 | } | ||
285 | |||
275 | #define IGB_N0_QUEUE -1 | 286 | #define IGB_N0_QUEUE -1 |
276 | static void igb_assign_vector(struct igb_adapter *adapter, int rx_queue, | 287 | static void igb_assign_vector(struct igb_adapter *adapter, int rx_queue, |
277 | int tx_queue, int msix_vector) | 288 | int tx_queue, int msix_vector) |
@@ -1322,8 +1333,7 @@ err_eeprom: | |||
1322 | iounmap(hw->flash_address); | 1333 | iounmap(hw->flash_address); |
1323 | 1334 | ||
1324 | igb_remove_device(hw); | 1335 | igb_remove_device(hw); |
1325 | kfree(adapter->tx_ring); | 1336 | igb_free_queues(adapter); |
1326 | kfree(adapter->rx_ring); | ||
1327 | err_sw_init: | 1337 | err_sw_init: |
1328 | err_hw_init: | 1338 | err_hw_init: |
1329 | iounmap(hw->hw_addr); | 1339 | iounmap(hw->hw_addr); |
@@ -1381,8 +1391,7 @@ static void __devexit igb_remove(struct pci_dev *pdev) | |||
1381 | igb_remove_device(&adapter->hw); | 1391 | igb_remove_device(&adapter->hw); |
1382 | igb_reset_interrupt_capability(adapter); | 1392 | igb_reset_interrupt_capability(adapter); |
1383 | 1393 | ||
1384 | kfree(adapter->tx_ring); | 1394 | igb_free_queues(adapter); |
1385 | kfree(adapter->rx_ring); | ||
1386 | 1395 | ||
1387 | iounmap(adapter->hw.hw_addr); | 1396 | iounmap(adapter->hw.hw_addr); |
1388 | if (adapter->hw.flash_address) | 1397 | if (adapter->hw.flash_address) |
@@ -4324,11 +4333,12 @@ static int igb_suspend(struct pci_dev *pdev, pm_message_t state) | |||
4324 | 4333 | ||
4325 | netif_device_detach(netdev); | 4334 | netif_device_detach(netdev); |
4326 | 4335 | ||
4327 | if (netif_running(netdev)) { | 4336 | if (netif_running(netdev)) |
4328 | WARN_ON(test_bit(__IGB_RESETTING, &adapter->state)); | 4337 | igb_close(netdev); |
4329 | igb_down(adapter); | 4338 | |
4330 | igb_free_irq(adapter); | 4339 | igb_reset_interrupt_capability(adapter); |
4331 | } | 4340 | |
4341 | igb_free_queues(adapter); | ||
4332 | 4342 | ||
4333 | #ifdef CONFIG_PM | 4343 | #ifdef CONFIG_PM |
4334 | retval = pci_save_state(pdev); | 4344 | retval = pci_save_state(pdev); |
@@ -4415,10 +4425,11 @@ static int igb_resume(struct pci_dev *pdev) | |||
4415 | pci_enable_wake(pdev, PCI_D3hot, 0); | 4425 | pci_enable_wake(pdev, PCI_D3hot, 0); |
4416 | pci_enable_wake(pdev, PCI_D3cold, 0); | 4426 | pci_enable_wake(pdev, PCI_D3cold, 0); |
4417 | 4427 | ||
4418 | if (netif_running(netdev)) { | 4428 | igb_set_interrupt_capability(adapter); |
4419 | err = igb_request_irq(adapter); | 4429 | |
4420 | if (err) | 4430 | if (igb_alloc_queues(adapter)) { |
4421 | return err; | 4431 | dev_err(&pdev->dev, "Unable to allocate memory for queues\n"); |
4432 | return -ENOMEM; | ||
4422 | } | 4433 | } |
4423 | 4434 | ||
4424 | /* e1000_power_up_phy(adapter); */ | 4435 | /* e1000_power_up_phy(adapter); */ |
@@ -4426,10 +4437,11 @@ static int igb_resume(struct pci_dev *pdev) | |||
4426 | igb_reset(adapter); | 4437 | igb_reset(adapter); |
4427 | wr32(E1000_WUS, ~0); | 4438 | wr32(E1000_WUS, ~0); |
4428 | 4439 | ||
4429 | igb_init_manageability(adapter); | 4440 | if (netif_running(netdev)) { |
4430 | 4441 | err = igb_open(netdev); | |
4431 | if (netif_running(netdev)) | 4442 | if (err) |
4432 | igb_up(adapter); | 4443 | return err; |
4444 | } | ||
4433 | 4445 | ||
4434 | netif_device_attach(netdev); | 4446 | netif_device_attach(netdev); |
4435 | 4447 | ||