diff options
author | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2006-01-12 19:51:34 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-01-17 07:51:03 -0500 |
commit | 8241e35e0c6ae7531fe270de34608edfdc2ea483 (patch) | |
tree | 9a87f5b49d41f3b37c6ae643fc5e3111ace5afde /drivers/net | |
parent | a292ca6efbc1f259ddfb9c902367f2588e0e8b0f (diff) |
[PATCH] e1000: Cleaned up code and removed hard coded numbers
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: John Ronciak <john.ronciak@intel.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index bef4d9d6f2d5..e246b5e0f21a 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -1920,12 +1920,10 @@ e1000_unmap_and_free_tx_resource(struct e1000_adapter *adapter, | |||
1920 | buffer_info->dma, | 1920 | buffer_info->dma, |
1921 | buffer_info->length, | 1921 | buffer_info->length, |
1922 | PCI_DMA_TODEVICE); | 1922 | PCI_DMA_TODEVICE); |
1923 | buffer_info->dma = 0; | ||
1924 | } | 1923 | } |
1925 | if(buffer_info->skb) { | 1924 | if (buffer_info->skb) |
1926 | dev_kfree_skb_any(buffer_info->skb); | 1925 | dev_kfree_skb_any(buffer_info->skb); |
1927 | buffer_info->skb = NULL; | 1926 | memset(buffer_info, 0, sizeof(struct e1000_buffer)); |
1928 | } | ||
1929 | } | 1927 | } |
1930 | 1928 | ||
1931 | /** | 1929 | /** |
@@ -2044,8 +2042,6 @@ e1000_clean_rx_ring(struct e1000_adapter *adapter, | |||
2044 | for(i = 0; i < rx_ring->count; i++) { | 2042 | for(i = 0; i < rx_ring->count; i++) { |
2045 | buffer_info = &rx_ring->buffer_info[i]; | 2043 | buffer_info = &rx_ring->buffer_info[i]; |
2046 | if(buffer_info->skb) { | 2044 | if(buffer_info->skb) { |
2047 | ps_page = &rx_ring->ps_page[i]; | ||
2048 | ps_page_dma = &rx_ring->ps_page_dma[i]; | ||
2049 | pci_unmap_single(pdev, | 2045 | pci_unmap_single(pdev, |
2050 | buffer_info->dma, | 2046 | buffer_info->dma, |
2051 | buffer_info->length, | 2047 | buffer_info->length, |
@@ -2543,11 +2539,11 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, | |||
2543 | if (++i == tx_ring->count) i = 0; | 2539 | if (++i == tx_ring->count) i = 0; |
2544 | tx_ring->next_to_use = i; | 2540 | tx_ring->next_to_use = i; |
2545 | 2541 | ||
2546 | return 1; | 2542 | return TRUE; |
2547 | } | 2543 | } |
2548 | #endif | 2544 | #endif |
2549 | 2545 | ||
2550 | return 0; | 2546 | return FALSE; |
2551 | } | 2547 | } |
2552 | 2548 | ||
2553 | static inline boolean_t | 2549 | static inline boolean_t |
@@ -3383,7 +3379,19 @@ e1000_clean(struct net_device *poll_dev, int *budget) | |||
3383 | BUG(); | 3379 | BUG(); |
3384 | } | 3380 | } |
3385 | 3381 | ||
3386 | tx_cleaned = e1000_clean_tx_irq(adapter, &adapter->tx_ring[i]); | 3382 | if (likely(adapter->num_tx_queues == 1)) { |
3383 | /* e1000_clean is called per-cpu. This lock protects | ||
3384 | * tx_ring[0] from being cleaned by multiple cpus | ||
3385 | * simultaneously. A failure obtaining the lock means | ||
3386 | * tx_ring[0] is currently being cleaned anyway. */ | ||
3387 | if (spin_trylock(&adapter->tx_queue_lock)) { | ||
3388 | tx_cleaned = e1000_clean_tx_irq(adapter, | ||
3389 | &adapter->tx_ring[0]); | ||
3390 | spin_unlock(&adapter->tx_queue_lock); | ||
3391 | } | ||
3392 | } else | ||
3393 | tx_cleaned = e1000_clean_tx_irq(adapter, &adapter->tx_ring[i]); | ||
3394 | |||
3387 | adapter->clean_rx(adapter, &adapter->rx_ring[i], | 3395 | adapter->clean_rx(adapter, &adapter->rx_ring[i], |
3388 | &work_done, work_to_do); | 3396 | &work_done, work_to_do); |
3389 | 3397 | ||
@@ -3428,11 +3436,11 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter, | |||
3428 | buffer_info = &tx_ring->buffer_info[i]; | 3436 | buffer_info = &tx_ring->buffer_info[i]; |
3429 | cleaned = (i == eop); | 3437 | cleaned = (i == eop); |
3430 | 3438 | ||
3439 | #ifdef CONFIG_E1000_MQ | ||
3440 | tx_ring->tx_stats.bytes += buffer_info->length; | ||
3441 | #endif | ||
3431 | e1000_unmap_and_free_tx_resource(adapter, buffer_info); | 3442 | e1000_unmap_and_free_tx_resource(adapter, buffer_info); |
3432 | 3443 | memset(tx_desc, 0, sizeof(struct e1000_tx_desc)); | |
3433 | tx_desc->buffer_addr = 0; | ||
3434 | tx_desc->lower.data = 0; | ||
3435 | tx_desc->upper.data = 0; | ||
3436 | 3444 | ||
3437 | if(unlikely(++i == tx_ring->count)) i = 0; | 3445 | if(unlikely(++i == tx_ring->count)) i = 0; |
3438 | } | 3446 | } |