aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/igb/igb_main.c
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2008-11-20 03:48:10 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-20 03:48:10 -0500
commit68fd991020fdf51bc94327d288ae4ae5d0b8dced (patch)
treeff3f911ef077496ac3a4374c57ee97fe581590f5 /drivers/net/igb/igb_main.c
parentb2d565365e02947699a8e3d594275662a8d00646 (diff)
igb: Fix tx/rx_ring_count parameters for igb on suspend/resume/ring resize
When suspending the device the ring structure is freed which causes it to loose track of the count. To resolve this we need to move the ring count outside of the ring structure and store it in the adapter struct. In addition to resolving the suspend/resume issue this patch also addresses issues seen in the event of memory allocation errors causing uneven ring sizes on multiple queues. Signed-off-by: Alexander Duyck <alexander.h.duyck@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/igb/igb_main.c')
-rw-r--r--drivers/net/igb/igb_main.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 0d33378edc63..ceb0a0458796 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -76,8 +76,6 @@ static int igb_setup_all_tx_resources(struct igb_adapter *);
76static int igb_setup_all_rx_resources(struct igb_adapter *); 76static int igb_setup_all_rx_resources(struct igb_adapter *);
77static void igb_free_all_tx_resources(struct igb_adapter *); 77static void igb_free_all_tx_resources(struct igb_adapter *);
78static void igb_free_all_rx_resources(struct igb_adapter *); 78static void igb_free_all_rx_resources(struct igb_adapter *);
79static void igb_free_tx_resources(struct igb_ring *);
80static void igb_free_rx_resources(struct igb_ring *);
81void igb_update_stats(struct igb_adapter *); 79void igb_update_stats(struct igb_adapter *);
82static int igb_probe(struct pci_dev *, const struct pci_device_id *); 80static int igb_probe(struct pci_dev *, const struct pci_device_id *);
83static void __devexit igb_remove(struct pci_dev *pdev); 81static void __devexit igb_remove(struct pci_dev *pdev);
@@ -259,11 +257,13 @@ static int igb_alloc_queues(struct igb_adapter *adapter)
259 257
260 for (i = 0; i < adapter->num_tx_queues; i++) { 258 for (i = 0; i < adapter->num_tx_queues; i++) {
261 struct igb_ring *ring = &(adapter->tx_ring[i]); 259 struct igb_ring *ring = &(adapter->tx_ring[i]);
260 ring->count = adapter->tx_ring_count;
262 ring->adapter = adapter; 261 ring->adapter = adapter;
263 ring->queue_index = i; 262 ring->queue_index = i;
264 } 263 }
265 for (i = 0; i < adapter->num_rx_queues; i++) { 264 for (i = 0; i < adapter->num_rx_queues; i++) {
266 struct igb_ring *ring = &(adapter->rx_ring[i]); 265 struct igb_ring *ring = &(adapter->rx_ring[i]);
266 ring->count = adapter->rx_ring_count;
267 ring->adapter = adapter; 267 ring->adapter = adapter;
268 ring->queue_index = i; 268 ring->queue_index = i;
269 ring->itr_register = E1000_ITR; 269 ring->itr_register = E1000_ITR;
@@ -1400,6 +1400,8 @@ static int __devinit igb_sw_init(struct igb_adapter *adapter)
1400 1400
1401 pci_read_config_word(pdev, PCI_COMMAND, &hw->bus.pci_cmd_word); 1401 pci_read_config_word(pdev, PCI_COMMAND, &hw->bus.pci_cmd_word);
1402 1402
1403 adapter->tx_ring_count = IGB_DEFAULT_TXD;
1404 adapter->rx_ring_count = IGB_DEFAULT_RXD;
1403 adapter->rx_buffer_len = MAXIMUM_ETHERNET_VLAN_SIZE; 1405 adapter->rx_buffer_len = MAXIMUM_ETHERNET_VLAN_SIZE;
1404 adapter->rx_ps_hdr_size = 0; /* disable packet split */ 1406 adapter->rx_ps_hdr_size = 0; /* disable packet split */
1405 adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; 1407 adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
@@ -1988,7 +1990,7 @@ static void igb_configure_rx(struct igb_adapter *adapter)
1988 * 1990 *
1989 * Free all transmit software resources 1991 * Free all transmit software resources
1990 **/ 1992 **/
1991static void igb_free_tx_resources(struct igb_ring *tx_ring) 1993void igb_free_tx_resources(struct igb_ring *tx_ring)
1992{ 1994{
1993 struct pci_dev *pdev = tx_ring->adapter->pdev; 1995 struct pci_dev *pdev = tx_ring->adapter->pdev;
1994 1996
@@ -2088,7 +2090,7 @@ static void igb_clean_all_tx_rings(struct igb_adapter *adapter)
2088 * 2090 *
2089 * Free all receive software resources 2091 * Free all receive software resources
2090 **/ 2092 **/
2091static void igb_free_rx_resources(struct igb_ring *rx_ring) 2093void igb_free_rx_resources(struct igb_ring *rx_ring)
2092{ 2094{
2093 struct pci_dev *pdev = rx_ring->adapter->pdev; 2095 struct pci_dev *pdev = rx_ring->adapter->pdev;
2094 2096