All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
To: intel-wired-lan@lists.osuosl.org
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org,
	magnus.karlsson@intel.com, bjorn.topel@intel.com,
	maciej.fijalkowski@intel.com, edwin.verplanke@intel.com,
	cristian.dumitrescu@intel.com
Subject: [PATCH net-next 2/4] i40e: remove unnecessary cleaned_count updates
Date: Thu, 14 Jan 2021 14:33:16 +0000	[thread overview]
Message-ID: <20210114143318.2171-3-cristian.dumitrescu@intel.com> (raw)
In-Reply-To: <20210114143318.2171-1-cristian.dumitrescu@intel.com>

For performance reasons, remove the redundant updates of the cleaned_count
variable, as its value can be computed based on the ring next-to-clean
variable, which is consistently udpated.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_xsk.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
index dc11ecd1a55c..453ef30d9498 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
@@ -300,7 +300,6 @@ int i40e_clean_rx_irq_zc(struct i40e_ring *rx_ring, int budget)
 			bi = i40e_rx_bi(rx_ring, next_to_clean);
 			xsk_buff_free(*bi);
 			*bi = NULL;
-			cleaned_count++;
 			next_to_clean = (next_to_clean + 1) & count_mask;
 			continue;
 		}
@@ -325,7 +324,6 @@ int i40e_clean_rx_irq_zc(struct i40e_ring *rx_ring, int budget)
 			total_rx_bytes += size;
 			total_rx_packets++;
 
-			cleaned_count++;
 			next_to_clean = (next_to_clean + 1) & count_mask;
 			continue;
 		}
@@ -344,7 +342,6 @@ int i40e_clean_rx_irq_zc(struct i40e_ring *rx_ring, int budget)
 			break;
 		}
 
-		cleaned_count++;
 		next_to_clean = (next_to_clean + 1) & count_mask;
 
 		if (eth_skb_pad(skb))
@@ -358,6 +355,7 @@ int i40e_clean_rx_irq_zc(struct i40e_ring *rx_ring, int budget)
 	}
 
 	rx_ring->next_to_clean = next_to_clean;
+	cleaned_count = (next_to_clean - rx_ring->next_to_use - 1) & count_mask;
 
 	if (cleaned_count >= I40E_RX_BUFFER_WRITE)
 		failure = !i40e_alloc_rx_buffers_zc(rx_ring, cleaned_count);
-- 
2.25.1


WARNING: multiple messages have this Message-ID (diff)
From: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH net-next 2/4] i40e: remove unnecessary cleaned_count updates
Date: Thu, 14 Jan 2021 14:33:16 +0000	[thread overview]
Message-ID: <20210114143318.2171-3-cristian.dumitrescu@intel.com> (raw)
In-Reply-To: <20210114143318.2171-1-cristian.dumitrescu@intel.com>

For performance reasons, remove the redundant updates of the cleaned_count
variable, as its value can be computed based on the ring next-to-clean
variable, which is consistently udpated.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_xsk.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
index dc11ecd1a55c..453ef30d9498 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
@@ -300,7 +300,6 @@ int i40e_clean_rx_irq_zc(struct i40e_ring *rx_ring, int budget)
 			bi = i40e_rx_bi(rx_ring, next_to_clean);
 			xsk_buff_free(*bi);
 			*bi = NULL;
-			cleaned_count++;
 			next_to_clean = (next_to_clean + 1) & count_mask;
 			continue;
 		}
@@ -325,7 +324,6 @@ int i40e_clean_rx_irq_zc(struct i40e_ring *rx_ring, int budget)
 			total_rx_bytes += size;
 			total_rx_packets++;
 
-			cleaned_count++;
 			next_to_clean = (next_to_clean + 1) & count_mask;
 			continue;
 		}
@@ -344,7 +342,6 @@ int i40e_clean_rx_irq_zc(struct i40e_ring *rx_ring, int budget)
 			break;
 		}
 
-		cleaned_count++;
 		next_to_clean = (next_to_clean + 1) & count_mask;
 
 		if (eth_skb_pad(skb))
@@ -358,6 +355,7 @@ int i40e_clean_rx_irq_zc(struct i40e_ring *rx_ring, int budget)
 	}
 
 	rx_ring->next_to_clean = next_to_clean;
+	cleaned_count = (next_to_clean - rx_ring->next_to_use - 1) & count_mask;
 
 	if (cleaned_count >= I40E_RX_BUFFER_WRITE)
 		failure = !i40e_alloc_rx_buffers_zc(rx_ring, cleaned_count);
-- 
2.25.1


  parent reply	other threads:[~2021-01-14 14:34 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-14 14:33 [PATCH net-next 0/4] i40e: small improvements on XDP path Cristian Dumitrescu
2021-01-14 14:33 ` [Intel-wired-lan] " Cristian Dumitrescu
2021-01-14 14:33 ` [PATCH net-next 1/4] i40e: remove unnecessary memory writes of the next to clean pointer Cristian Dumitrescu
2021-01-14 14:33   ` [Intel-wired-lan] " Cristian Dumitrescu
2021-01-14 14:33 ` Cristian Dumitrescu [this message]
2021-01-14 14:33   ` [Intel-wired-lan] [PATCH net-next 2/4] i40e: remove unnecessary cleaned_count updates Cristian Dumitrescu
2021-01-14 14:33 ` [PATCH net-next 3/4] i40e: remove the redundant buffer info updates Cristian Dumitrescu
2021-01-14 14:33   ` [Intel-wired-lan] " Cristian Dumitrescu
2021-01-14 14:33 ` [PATCH net-next 4/4] i40: consolidate handling of XDP program actions Cristian Dumitrescu
2021-01-14 14:33   ` [Intel-wired-lan] " Cristian Dumitrescu
2021-01-14 22:59 ` [PATCH net-next 0/4] i40e: small improvements on XDP path Saeed Mahameed
2021-01-14 22:59   ` [Intel-wired-lan] " Saeed Mahameed
2021-01-18  7:24 ` Magnus Karlsson
2021-01-18  7:31 ` Magnus Karlsson
2021-01-18  7:31   ` [Intel-wired-lan] " Magnus Karlsson
2021-01-18 18:32   ` Jakub Kicinski
2021-01-18 18:32     ` [Intel-wired-lan] " Jakub Kicinski
2021-05-07 22:11     ` Maciej Fijalkowski
2021-05-07 22:11       ` [Intel-wired-lan] " Maciej Fijalkowski
2021-05-07 22:53       ` Nguyen, Anthony L
2021-05-07 22:53         ` [Intel-wired-lan] " Nguyen, Anthony L

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=20210114143318.2171-3-cristian.dumitrescu@intel.com \
    --to=cristian.dumitrescu@intel.com \
    --cc=bjorn.topel@intel.com \
    --cc=bpf@vger.kernel.org \
    --cc=edwin.verplanke@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    /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 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.