Commit 50849d79 authored by Tom Herbert's avatar Tom Herbert Committed by David S. Miller

e1000e: reduce writes of RX producer ptr

Reduce number of writes to RX producer pointer.   When alloc'ing RX
buffers, only write the RX producer pointer once every
E1000_RX_BUFFER_WRITE (16) buffers created.
Signed-off-by: default avatarTom Herbert <therbert@google.com>
Acked-by: default avatarBruce Allan <bruce.w.allan@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9ed318d5
...@@ -548,17 +548,7 @@ static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter, ...@@ -548,17 +548,7 @@ static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter,
rx_desc = E1000_RX_DESC(*rx_ring, i); rx_desc = E1000_RX_DESC(*rx_ring, i);
rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma); rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma);
i++; if (unlikely(!(i & (E1000_RX_BUFFER_WRITE - 1)))) {
if (i == rx_ring->count)
i = 0;
buffer_info = &rx_ring->buffer_info[i];
}
if (rx_ring->next_to_use != i) {
rx_ring->next_to_use = i;
if (i-- == 0)
i = (rx_ring->count - 1);
/* /*
* Force memory writes to complete before letting h/w * Force memory writes to complete before letting h/w
* know there are new descriptors to fetch. (Only * know there are new descriptors to fetch. (Only
...@@ -568,6 +558,13 @@ static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter, ...@@ -568,6 +558,13 @@ static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter,
wmb(); wmb();
writel(i, adapter->hw.hw_addr + rx_ring->tail); writel(i, adapter->hw.hw_addr + rx_ring->tail);
} }
i++;
if (i == rx_ring->count)
i = 0;
buffer_info = &rx_ring->buffer_info[i];
}
rx_ring->next_to_use = i;
} }
/** /**
...@@ -649,19 +646,7 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, ...@@ -649,19 +646,7 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
rx_desc->read.buffer_addr[0] = cpu_to_le64(buffer_info->dma); rx_desc->read.buffer_addr[0] = cpu_to_le64(buffer_info->dma);
i++; if (unlikely(!(i & (E1000_RX_BUFFER_WRITE - 1)))) {
if (i == rx_ring->count)
i = 0;
buffer_info = &rx_ring->buffer_info[i];
}
no_buffers:
if (rx_ring->next_to_use != i) {
rx_ring->next_to_use = i;
if (!(i--))
i = (rx_ring->count - 1);
/* /*
* Force memory writes to complete before letting h/w * Force memory writes to complete before letting h/w
* know there are new descriptors to fetch. (Only * know there are new descriptors to fetch. (Only
...@@ -669,13 +654,17 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter, ...@@ -669,13 +654,17 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
* such as IA-64). * such as IA-64).
*/ */
wmb(); wmb();
/*
* Hardware increments by 16 bytes, but packet split
* descriptors are 32 bytes...so we increment tail
* twice as much.
*/
writel(i<<1, adapter->hw.hw_addr + rx_ring->tail); writel(i<<1, adapter->hw.hw_addr + rx_ring->tail);
} }
i++;
if (i == rx_ring->count)
i = 0;
buffer_info = &rx_ring->buffer_info[i];
}
no_buffers:
rx_ring->next_to_use = i;
} }
/** /**
......
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