All of lore.kernel.org
 help / color / mirror / Atom feed
* [net-next PATCH 01/26] igb: optomize/refactor receive path
@ 2009-02-07  9:15 Jeff Kirsher
  2009-02-07  9:15 ` [net-next PATCH 02/26] igb: move setting of buffsz out of repeated path in alloc_rx_buffers Jeff Kirsher
                   ` (25 more replies)
  0 siblings, 26 replies; 27+ messages in thread
From: Jeff Kirsher @ 2009-02-07  9:15 UTC (permalink / raw)
  To: davem; +Cc: netdev, jeff, gospo, Alexander Duyck, Jeff Kirsher

From: Alexander Duyck <alexander.h.duyck@intel.com>

While cleaning up the skb_over panic with small frames I found there was
room for improvement in the ordering of operations within the rx receive
flow.  These changes will place the prefetch for the next descriptor to a
point earlier in the rx path.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---

 drivers/net/igb/igb_main.c |   44 ++++++++++++++++++++++----------------------
 1 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 8b80fe3..21f0c22 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -3803,6 +3803,7 @@ static bool igb_clean_rx_irq_adv(struct igb_ring *rx_ring,
 	unsigned int total_bytes = 0, total_packets = 0;
 
 	i = rx_ring->next_to_clean;
+	buffer_info = &rx_ring->buffer_info[i];
 	rx_desc = E1000_RX_DESC_ADV(*rx_ring, i);
 	staterr = le32_to_cpu(rx_desc->wb.upper.status_error);
 
@@ -3810,25 +3811,22 @@ static bool igb_clean_rx_irq_adv(struct igb_ring *rx_ring,
 		if (*work_done >= budget)
 			break;
 		(*work_done)++;
-		buffer_info = &rx_ring->buffer_info[i];
 
-		/* HW will not DMA in data larger than the given buffer, even
-		 * if it parses the (NFS, of course) header to be larger.  In
-		 * that case, it fills the header buffer and spills the rest
-		 * into the page.
-		 */
-		hlen = (le16_to_cpu(rx_desc->wb.lower.lo_dword.hdr_info) &
-		  E1000_RXDADV_HDRBUFLEN_MASK) >> E1000_RXDADV_HDRBUFLEN_SHIFT;
-		if (hlen > adapter->rx_ps_hdr_size)
-			hlen = adapter->rx_ps_hdr_size;
+		skb = buffer_info->skb;
+		prefetch(skb->data - NET_IP_ALIGN);
+		buffer_info->skb = NULL;
+
+		i++;
+		if (i == rx_ring->count)
+			i = 0;
+		next_rxd = E1000_RX_DESC_ADV(*rx_ring, i);
+		prefetch(next_rxd);
+		next_buffer = &rx_ring->buffer_info[i];
 
 		length = le16_to_cpu(rx_desc->wb.upper.length);
 		cleaned = true;
 		cleaned_count++;
 
-		skb = buffer_info->skb;
-		prefetch(skb->data - NET_IP_ALIGN);
-		buffer_info->skb = NULL;
 		if (!adapter->rx_ps_hdr_size) {
 			pci_unmap_single(pdev, buffer_info->dma,
 					 adapter->rx_buffer_len +
@@ -3838,6 +3836,16 @@ static bool igb_clean_rx_irq_adv(struct igb_ring *rx_ring,
 			goto send_up;
 		}
 
+		/* HW will not DMA in data larger than the given buffer, even
+		 * if it parses the (NFS, of course) header to be larger.  In
+		 * that case, it fills the header buffer and spills the rest
+		 * into the page.
+		 */
+		hlen = (le16_to_cpu(rx_desc->wb.lower.lo_dword.hdr_info) &
+		  E1000_RXDADV_HDRBUFLEN_MASK) >> E1000_RXDADV_HDRBUFLEN_SHIFT;
+		if (hlen > adapter->rx_ps_hdr_size)
+			hlen = adapter->rx_ps_hdr_size;
+
 		if (!skb_shinfo(skb)->nr_frags) {
 			pci_unmap_single(pdev, buffer_info->dma,
 					 adapter->rx_ps_hdr_size +
@@ -3867,13 +3875,6 @@ static bool igb_clean_rx_irq_adv(struct igb_ring *rx_ring,
 
 			skb->truesize += length;
 		}
-send_up:
-		i++;
-		if (i == rx_ring->count)
-			i = 0;
-		next_rxd = E1000_RX_DESC_ADV(*rx_ring, i);
-		prefetch(next_rxd);
-		next_buffer = &rx_ring->buffer_info[i];
 
 		if (!(staterr & E1000_RXD_STAT_EOP)) {
 			buffer_info->skb = next_buffer->skb;
@@ -3882,7 +3883,7 @@ send_up:
 			next_buffer->dma = 0;
 			goto next_desc;
 		}
-
+send_up:
 		if (staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK) {
 			dev_kfree_skb_irq(skb);
 			goto next_desc;
@@ -3909,7 +3910,6 @@ next_desc:
 		/* use prefetched values */
 		rx_desc = next_rxd;
 		buffer_info = next_buffer;
-
 		staterr = le32_to_cpu(rx_desc->wb.upper.status_error);
 	}
 


^ permalink raw reply related	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2009-02-07 10:46 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-07  9:15 [net-next PATCH 01/26] igb: optomize/refactor receive path Jeff Kirsher
2009-02-07  9:15 ` [net-next PATCH 02/26] igb: move setting of buffsz out of repeated path in alloc_rx_buffers Jeff Kirsher
2009-02-07  9:15 ` [net-next PATCH 03/26] igb: move initialization of number of queues into set_interrupt_capability Jeff Kirsher
2009-02-07  9:16 ` [net-next PATCH 04/26] igb: remove check for needing an io port Jeff Kirsher
2009-02-07  9:16 ` [net-next PATCH 05/26] igb: add link check function Jeff Kirsher
2009-02-07  9:16 ` [net-next PATCH 06/26] igb: make dev_spec a union and remove dynamic allocation Jeff Kirsher
2009-02-07  9:17 ` [net-next PATCH 07/26] igb: read address from RAH/RAL instead of from EEPROM Jeff Kirsher
2009-02-07  9:17 ` [net-next PATCH 08/26] igb: rename phy ops Jeff Kirsher
2009-02-07  9:17 ` [net-next PATCH 09/26] igb: rename nvm ops Jeff Kirsher
2009-02-07  9:18 ` [net-next PATCH 10/26] igb: remove unused rx_hdr_split statistic Jeff Kirsher
2009-02-07  9:18 ` [net-next PATCH 11/26] igb: update feature flags supported in ethtool Jeff Kirsher
2009-02-07  9:18 ` [net-next PATCH 12/26] igb: update testing done by ethtool Jeff Kirsher
2009-02-07  9:19 ` [net-next PATCH 13/26] igb: add counter for dma out of sync errors Jeff Kirsher
2009-02-07  9:19 ` [net-next PATCH 14/26] igb: cleanup igb_netpoll to be more friendly with napi & GRO Jeff Kirsher
2009-02-07  9:19 ` [net-next PATCH 15/26] igb: remove redundant timer updates and cleanup watchdog_task Jeff Kirsher
2009-02-07  9:20 ` [net-next PATCH 16/26] igb: rename igb_update_mc_addr_list_82575 to not include the 82575 Jeff Kirsher
2009-02-07  9:20 ` [net-next PATCH 17/26] igb: remove unnecessary adapter->hw calls when just hw-> will do Jeff Kirsher
2009-02-07  9:20 ` [net-next PATCH 18/26] igb: don't read eicr when responding to legacy interrupts Jeff Kirsher
2009-02-07  9:21 ` [net-next PATCH 19/26] igb: move get_hw_control within igb_resume Jeff Kirsher
2009-02-07  9:21 ` [net-next PATCH 20/26] igb: change pba size determination from if to switch statement Jeff Kirsher
2009-02-07  9:21 ` [net-next PATCH 21/26] igb: remove disable_av variable from mac_info struct Jeff Kirsher
2009-02-07  9:22 ` [net-next PATCH 22/26] igb: remove redundant count set and err_hw_init Jeff Kirsher
2009-02-07  9:22 ` [net-next PATCH 23/26] igb: update stats before doing reset in igb_down Jeff Kirsher
2009-02-07  9:22 ` [net-next PATCH 24/26] igb: fix two minor items found during code review Jeff Kirsher
2009-02-07  9:23 ` [net-next PATCH 25/26] igb: update version number and copyright dates Jeff Kirsher
2009-02-07  9:23 ` [net-next PATCH 26/26] igb: remove dead code in transmit routine Jeff Kirsher
2009-02-07 10:46 ` [net-next PATCH 01/26] igb: optomize/refactor receive path David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.