Netdev List
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Emil Tantilov <emil.s.tantilov@intel.com>,
	netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
	jogreene@redhat.com,
	Alexander Duyck <alexander.h.duyck@redhat.com>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next v2 04/15] ixgbevf: Cleanup variable usage, improve stack performance
Date: Thu, 20 Nov 2014 15:09:02 -0800	[thread overview]
Message-ID: <1416524953-15161-5-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1416524953-15161-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Emil Tantilov <emil.s.tantilov@intel.com>

This change is meant to help cleanup the usage of temporary variables
within the Rx hot-path by removing unnecessary variables and reducing
the scope of variables that do not need to exist outside the main loop.

CC: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index 36b005e..f864da9 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -517,26 +517,28 @@ static int ixgbevf_clean_rx_irq(struct ixgbevf_q_vector *q_vector,
 				struct ixgbevf_ring *rx_ring,
 				int budget)
 {
-	union ixgbe_adv_rx_desc *rx_desc, *next_rxd;
-	struct ixgbevf_rx_buffer *rx_buffer_info, *next_buffer;
-	struct sk_buff *skb;
+	union ixgbe_adv_rx_desc *rx_desc;
 	unsigned int i;
 	unsigned int total_rx_bytes = 0, total_rx_packets = 0;
 	u16 cleaned_count = ixgbevf_desc_unused(rx_ring);
 
 	i = rx_ring->next_to_clean;
 	rx_desc = IXGBEVF_RX_DESC(rx_ring, i);
-	rx_buffer_info = &rx_ring->rx_buffer_info[i];
 
 	while (ixgbevf_test_staterr(rx_desc, IXGBE_RXD_STAT_DD)) {
+		union ixgbe_adv_rx_desc *next_rxd;
+		struct ixgbevf_rx_buffer *rx_buffer_info;
+		struct sk_buff *skb;
+
 		if (!budget)
 			break;
 		budget--;
 
 		rmb(); /* read descriptor and rx_buffer_info after status DD */
 
+		rx_buffer_info = &rx_ring->rx_buffer_info[i];
 		skb = rx_buffer_info->skb;
-		prefetch(skb->data - NET_IP_ALIGN);
+		prefetch(skb->data);
 		rx_buffer_info->skb = NULL;
 
 		dma_unmap_single(rx_ring->dev, rx_buffer_info->dma,
@@ -545,18 +547,17 @@ static int ixgbevf_clean_rx_irq(struct ixgbevf_q_vector *q_vector,
 		rx_buffer_info->dma = 0;
 		skb_put(skb, le16_to_cpu(rx_desc->wb.upper.length));
 
+		cleaned_count++;
+
 		i++;
 		if (i == rx_ring->count)
 			i = 0;
 
 		next_rxd = IXGBEVF_RX_DESC(rx_ring, i);
 		prefetch(next_rxd);
-		cleaned_count++;
-
-		next_buffer = &rx_ring->rx_buffer_info[i];
 
 		if (!(ixgbevf_test_staterr(rx_desc, IXGBE_RXD_STAT_EOP))) {
-			skb->next = next_buffer->skb;
+			skb->next = rx_ring->rx_buffer_info[i].skb;
 			IXGBE_CB(skb->next)->prev = skb;
 			rx_ring->rx_stats.non_eop_descs++;
 			goto next_desc;
@@ -609,6 +610,7 @@ next_desc:
 		/* use prefetched values */
 		rx_desc = next_rxd;
 		rx_buffer_info = &rx_ring->rx_buffer_info[i];
+		rx_desc = IXGBEVF_RX_DESC(rx_ring, i);
 	}
 
 	rx_ring->next_to_clean = i;
-- 
1.9.3

  parent reply	other threads:[~2014-11-20 23:09 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-20 23:08 [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2014-11-20 Jeff Kirsher
2014-11-20 23:08 ` [net-next v2 01/15] ixgbevf: Update ixgbevf_alloc_rx_buffers to handle clearing of status bits Jeff Kirsher
2014-11-20 23:09 ` [net-next v2 02/15] ixgbevf: Test Rx status bits directly out of the descriptor Jeff Kirsher
2014-11-20 23:09 ` [net-next v2 03/15] ixgbevf: Combine the logic for post Rx processing into single function Jeff Kirsher
2014-11-20 23:09 ` Jeff Kirsher [this message]
2014-11-20 23:09 ` [net-next v2 05/15] ixgbevf: reorder main loop in ixgbe_clean_rx_irq to allow for do/while/continue Jeff Kirsher
2014-11-20 23:09 ` [net-next v2 06/15] ixgbevf: Update Rx next to clean in real time Jeff Kirsher
2014-11-20 23:09 ` [net-next v2 07/15] ixgbevf: Change receive model to use double buffered page based receives Jeff Kirsher
2014-11-20 23:09 ` [net-next v2 08/15] ixgbevf: compare total_rx_packets and budget in ixgbevf_clean_rx_irq Jeff Kirsher
2014-11-21 11:07   ` David Laight
2014-11-21 14:59     ` Tantilov, Emil S
2014-11-20 23:09 ` [net-next v2 09/15] ixgbevf: add netpoll support Jeff Kirsher
2014-11-20 23:09 ` [net-next v2 10/15] i40e: don't overload fields Jeff Kirsher
2014-11-20 23:09 ` [net-next v2 11/15] i40evf: update header comments Jeff Kirsher
2014-11-20 23:09 ` [net-next v2 12/15] i40evf: make checkpatch happy Jeff Kirsher
2014-11-20 23:09 ` [net-next v2 13/15] i40evf: make comparisons consistent Jeff Kirsher
2014-11-20 23:09 ` [net-next v2 14/15] i40evf: remove unnecessary else Jeff Kirsher
2014-11-20 23:09 ` [net-next v2 15/15] i40e: trigger SW INT with no ITR wait Jeff Kirsher
2014-11-21 20:24 ` [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2014-11-20 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1416524953-15161-5-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=alexander.h.duyck@redhat.com \
    --cc=davem@davemloft.net \
    --cc=emil.s.tantilov@intel.com \
    --cc=jogreene@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@redhat.com \
    --cc=sassmann@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox