aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/igb/igb_main.c
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2009-02-06 18:15:25 -0500
committerDavid S. Miller <davem@davemloft.net>2009-02-07 05:43:02 -0500
commitdb76176215ec5af7a67386e0eacb5ea53e040f10 (patch)
treeeb68c1e9151058e130a919e10779561d4a8edfa9 /drivers/net/igb/igb_main.c
parent69d3ca5357bb93bb3a139c5d90077407f8828bd1 (diff)
igb: move setting of buffsz out of repeated path in alloc_rx_buffers
buffsz is being repeatedly set when allocaing buffers. Since this value should only need to be set once in the function I am moving it out of the looped portion of the path. 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.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 21f0c229b64e..ec5855a10ffb 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -3943,10 +3943,17 @@ static void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring,
3943 struct igb_buffer *buffer_info; 3943 struct igb_buffer *buffer_info;
3944 struct sk_buff *skb; 3944 struct sk_buff *skb;
3945 unsigned int i; 3945 unsigned int i;
3946 int bufsz;
3946 3947
3947 i = rx_ring->next_to_use; 3948 i = rx_ring->next_to_use;
3948 buffer_info = &rx_ring->buffer_info[i]; 3949 buffer_info = &rx_ring->buffer_info[i];
3949 3950
3951 if (adapter->rx_ps_hdr_size)
3952 bufsz = adapter->rx_ps_hdr_size;
3953 else
3954 bufsz = adapter->rx_buffer_len;
3955 bufsz += NET_IP_ALIGN;
3956
3950 while (cleaned_count--) { 3957 while (cleaned_count--) {
3951 rx_desc = E1000_RX_DESC_ADV(*rx_ring, i); 3958 rx_desc = E1000_RX_DESC_ADV(*rx_ring, i);
3952 3959
@@ -3962,23 +3969,14 @@ static void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring,
3962 buffer_info->page_offset ^= PAGE_SIZE / 2; 3969 buffer_info->page_offset ^= PAGE_SIZE / 2;
3963 } 3970 }
3964 buffer_info->page_dma = 3971 buffer_info->page_dma =
3965 pci_map_page(pdev, 3972 pci_map_page(pdev, buffer_info->page,
3966 buffer_info->page,
3967 buffer_info->page_offset, 3973 buffer_info->page_offset,
3968 PAGE_SIZE / 2, 3974 PAGE_SIZE / 2,
3969 PCI_DMA_FROMDEVICE); 3975 PCI_DMA_FROMDEVICE);
3970 } 3976 }
3971 3977
3972 if (!buffer_info->skb) { 3978 if (!buffer_info->skb) {
3973 int bufsz;
3974
3975 if (adapter->rx_ps_hdr_size)
3976 bufsz = adapter->rx_ps_hdr_size;
3977 else
3978 bufsz = adapter->rx_buffer_len;
3979 bufsz += NET_IP_ALIGN;
3980 skb = netdev_alloc_skb(netdev, bufsz); 3979 skb = netdev_alloc_skb(netdev, bufsz);
3981
3982 if (!skb) { 3980 if (!skb) {
3983 adapter->alloc_rx_buff_failed++; 3981 adapter->alloc_rx_buff_failed++;
3984 goto no_buffers; 3982 goto no_buffers;
@@ -3994,7 +3992,6 @@ static void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring,
3994 buffer_info->dma = pci_map_single(pdev, skb->data, 3992 buffer_info->dma = pci_map_single(pdev, skb->data,
3995 bufsz, 3993 bufsz,
3996 PCI_DMA_FROMDEVICE); 3994 PCI_DMA_FROMDEVICE);
3997
3998 } 3995 }
3999 /* Refresh the desc even if buffer_addrs didn't change because 3996 /* Refresh the desc even if buffer_addrs didn't change because
4000 * each write-back erases this info. */ 3997 * each write-back erases this info. */