Commit db761762 authored by Alexander Duyck's avatar Alexander Duyck Committed by David S. Miller

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: default avatarAlexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 69d3ca53
...@@ -3943,10 +3943,17 @@ static void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring, ...@@ -3943,10 +3943,17 @@ static void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring,
struct igb_buffer *buffer_info; struct igb_buffer *buffer_info;
struct sk_buff *skb; struct sk_buff *skb;
unsigned int i; unsigned int i;
int bufsz;
i = rx_ring->next_to_use; i = rx_ring->next_to_use;
buffer_info = &rx_ring->buffer_info[i]; buffer_info = &rx_ring->buffer_info[i];
if (adapter->rx_ps_hdr_size)
bufsz = adapter->rx_ps_hdr_size;
else
bufsz = adapter->rx_buffer_len;
bufsz += NET_IP_ALIGN;
while (cleaned_count--) { while (cleaned_count--) {
rx_desc = E1000_RX_DESC_ADV(*rx_ring, i); rx_desc = E1000_RX_DESC_ADV(*rx_ring, i);
...@@ -3962,23 +3969,14 @@ static void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring, ...@@ -3962,23 +3969,14 @@ static void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring,
buffer_info->page_offset ^= PAGE_SIZE / 2; buffer_info->page_offset ^= PAGE_SIZE / 2;
} }
buffer_info->page_dma = buffer_info->page_dma =
pci_map_page(pdev, pci_map_page(pdev, buffer_info->page,
buffer_info->page,
buffer_info->page_offset, buffer_info->page_offset,
PAGE_SIZE / 2, PAGE_SIZE / 2,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
} }
if (!buffer_info->skb) { if (!buffer_info->skb) {
int bufsz;
if (adapter->rx_ps_hdr_size)
bufsz = adapter->rx_ps_hdr_size;
else
bufsz = adapter->rx_buffer_len;
bufsz += NET_IP_ALIGN;
skb = netdev_alloc_skb(netdev, bufsz); skb = netdev_alloc_skb(netdev, bufsz);
if (!skb) { if (!skb) {
adapter->alloc_rx_buff_failed++; adapter->alloc_rx_buff_failed++;
goto no_buffers; goto no_buffers;
...@@ -3994,7 +3992,6 @@ static void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring, ...@@ -3994,7 +3992,6 @@ static void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring,
buffer_info->dma = pci_map_single(pdev, skb->data, buffer_info->dma = pci_map_single(pdev, skb->data,
bufsz, bufsz,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
} }
/* Refresh the desc even if buffer_addrs didn't change because /* Refresh the desc even if buffer_addrs didn't change because
* each write-back erases this info. */ * each write-back erases this info. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment