netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/9][pull request] 10GbE Intel Wired LAN Driver Updates 2021-12-28
@ 2021-12-28 17:58 Tony Nguyen
  2021-12-28 17:58 ` [PATCH net-next 1/9] e1000: switch to napi_consume_skb() Tony Nguyen
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: Tony Nguyen @ 2021-12-28 17:58 UTC (permalink / raw)
  To: davem, kuba; +Cc: Tony Nguyen, netdev, alexandr.lobakin

Alexander Lobakin says:

napi_build_skb() I introduced earlier this year ([0]) aims
to decrease MM pressure and the overhead from in-place
kmem_cache_alloc() on each Rx entry processing by decaching
skbuff_heads from NAPI per-cpu cache filled prior to that by
napi_consume_skb() (so it is sort of a direct shortcut for
free -> mm -> alloc cycle).
Currently, no in-tree drivers use it. Switch all Intel Ethernet
drivers to it to get slight-to-medium perf boosts depending on
the frame size.

ice driver, 50 Gbps link, pktgen + XDP_PASS (local in) sample:

frame_size/nthreads  64/42  128/20  256/8  512/4  1024/2  1532/1

net-next (Kpps)      46062  34654   18248  9830   5343    2714
series               47438  34708   18330  9875   5435    2777
increase             2.9%   0.15%   0.45%  0.46%  1.72%   2.32%

Additionally, e1000's been switched to napi_consume_skb() as it's
safe and works fine there, and there's no point in napi_build_skb()
without paired NAPI cache feeding point.

[0] https://lore.kernel.org/all/20210213141021.87840-1-alobakin@pm.me

The following are changes since commit 0f1eae8e565e632f64670a5730894f22819fcaad:
  net: caif: remove redundant assignment to variable expectlen
and are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue 10GbE

Alexander Lobakin (9):
  e1000: switch to napi_consume_skb()
  e1000: switch to napi_build_skb()
  i40e: switch to napi_build_skb()
  iavf: switch to napi_build_skb()
  ice: switch to napi_build_skb()
  igb: switch to napi_build_skb()
  igc: switch to napi_build_skb()
  ixgbe: switch to napi_build_skb()
  ixgbevf: switch to napi_build_skb()

 drivers/net/ethernet/intel/e1000/e1000_main.c     | 14 ++++++++------
 drivers/net/ethernet/intel/i40e/i40e_txrx.c       |  2 +-
 drivers/net/ethernet/intel/iavf/iavf_txrx.c       |  2 +-
 drivers/net/ethernet/intel/ice/ice_txrx.c         |  2 +-
 drivers/net/ethernet/intel/igb/igb_main.c         |  2 +-
 drivers/net/ethernet/intel/igc/igc_main.c         |  2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c     |  2 +-
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |  2 +-
 8 files changed, 15 insertions(+), 13 deletions(-)

-- 
2.31.1


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

* [PATCH net-next 1/9] e1000: switch to napi_consume_skb()
  2021-12-28 17:58 [PATCH net-next 0/9][pull request] 10GbE Intel Wired LAN Driver Updates 2021-12-28 Tony Nguyen
@ 2021-12-28 17:58 ` Tony Nguyen
  2021-12-28 17:58 ` [PATCH net-next 2/9] e1000: switch to napi_build_skb() Tony Nguyen
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Tony Nguyen @ 2021-12-28 17:58 UTC (permalink / raw)
  To: davem, kuba
  Cc: Alexander Lobakin, netdev, anthony.l.nguyen, Michal Swiatkowski,
	Tony Brelinski

From: Alexander Lobakin <alexandr.lobakin@intel.com>

In order to take the best from per-cpu NAPI skbuff_head caches and
CPU cycles, let's switch from dev_kfree_skb_any(), which passes skb
back to the mm layer, to napi_consume_skb(), which feeds those
caches on non-zero budget instead (falls back to the former on 0).
Do the replacement in e1000_unmap_and_free_tx_resource(). There are
4 call sites of this function throughout the driver:
 * e1000_clean_tx_ring(). Slowpath, process context, cleans the
   whole Tx ring on ifdown. Use budget of 0 here;
 * e1000_tx_map(). Hotpath, net Tx softirq, unmaps the buffers in
   case of error. Use 0 as well;
 * e1000_clean_tx_irq(). Hotpath, NAPI Tx completion polling cycle.
   As the driver doesn't count completed Tx entries towards the NAPI
   budget, just use the poll budget of 64 to utilize caches.

Apart from being a preparation for switching to napi_build_skb(),
this is useful on its own as well, as napi_consume_skb() flushes
skb caches by batches of 32 instead of one-at-a-time.

Signed-off-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tested-by: Tony Brelinski <tony.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/e1000/e1000_main.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index 669060a2e6aa..975a145d48ef 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -1953,7 +1953,8 @@ void e1000_free_all_tx_resources(struct e1000_adapter *adapter)
 
 static void
 e1000_unmap_and_free_tx_resource(struct e1000_adapter *adapter,
-				 struct e1000_tx_buffer *buffer_info)
+				 struct e1000_tx_buffer *buffer_info,
+				 int budget)
 {
 	if (buffer_info->dma) {
 		if (buffer_info->mapped_as_page)
@@ -1966,7 +1967,7 @@ e1000_unmap_and_free_tx_resource(struct e1000_adapter *adapter,
 		buffer_info->dma = 0;
 	}
 	if (buffer_info->skb) {
-		dev_kfree_skb_any(buffer_info->skb);
+		napi_consume_skb(buffer_info->skb, budget);
 		buffer_info->skb = NULL;
 	}
 	buffer_info->time_stamp = 0;
@@ -1990,7 +1991,7 @@ static void e1000_clean_tx_ring(struct e1000_adapter *adapter,
 
 	for (i = 0; i < tx_ring->count; i++) {
 		buffer_info = &tx_ring->buffer_info[i];
-		e1000_unmap_and_free_tx_resource(adapter, buffer_info);
+		e1000_unmap_and_free_tx_resource(adapter, buffer_info, 0);
 	}
 
 	netdev_reset_queue(adapter->netdev);
@@ -2958,7 +2959,7 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
 			i += tx_ring->count;
 		i--;
 		buffer_info = &tx_ring->buffer_info[i];
-		e1000_unmap_and_free_tx_resource(adapter, buffer_info);
+		e1000_unmap_and_free_tx_resource(adapter, buffer_info, 0);
 	}
 
 	return 0;
@@ -3856,7 +3857,8 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,
 				}
 
 			}
-			e1000_unmap_and_free_tx_resource(adapter, buffer_info);
+			e1000_unmap_and_free_tx_resource(adapter, buffer_info,
+							 64);
 			tx_desc->upper.data = 0;
 
 			if (unlikely(++i == tx_ring->count))
-- 
2.31.1


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

* [PATCH net-next 2/9] e1000: switch to napi_build_skb()
  2021-12-28 17:58 [PATCH net-next 0/9][pull request] 10GbE Intel Wired LAN Driver Updates 2021-12-28 Tony Nguyen
  2021-12-28 17:58 ` [PATCH net-next 1/9] e1000: switch to napi_consume_skb() Tony Nguyen
@ 2021-12-28 17:58 ` Tony Nguyen
  2021-12-28 17:58 ` [PATCH net-next 3/9] i40e: " Tony Nguyen
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Tony Nguyen @ 2021-12-28 17:58 UTC (permalink / raw)
  To: davem, kuba
  Cc: Alexander Lobakin, netdev, anthony.l.nguyen, Michal Swiatkowski,
	Tony Brelinski

From: Alexander Lobakin <alexandr.lobakin@intel.com>

napi_build_skb() reuses per-cpu NAPI skbuff_head cache in order
to save some cycles on freeing/allocating skbuff_heads on every
new Rx or completed Tx element.
e1000 driver runs Tx completion polling cycle right before the Rx
one. Now that e1000 uses napi_consume_skb() to put skbuff_heads of
completed entries into the cache, it will never empty and always
warm at that moment. Switch to the napi_build_skb() to relax mm
pressure on heavy Rx and increase throughput.

Signed-off-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tested-by: Tony Brelinski <tony.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/e1000/e1000_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index 975a145d48ef..3f5feb55cfba 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -4384,7 +4384,7 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
 		if (!skb) {
 			unsigned int frag_len = e1000_frag_len(adapter);
 
-			skb = build_skb(data - E1000_HEADROOM, frag_len);
+			skb = napi_build_skb(data - E1000_HEADROOM, frag_len);
 			if (!skb) {
 				adapter->alloc_rx_buff_failed++;
 				break;
-- 
2.31.1


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

* [PATCH net-next 3/9] i40e: switch to napi_build_skb()
  2021-12-28 17:58 [PATCH net-next 0/9][pull request] 10GbE Intel Wired LAN Driver Updates 2021-12-28 Tony Nguyen
  2021-12-28 17:58 ` [PATCH net-next 1/9] e1000: switch to napi_consume_skb() Tony Nguyen
  2021-12-28 17:58 ` [PATCH net-next 2/9] e1000: switch to napi_build_skb() Tony Nguyen
@ 2021-12-28 17:58 ` Tony Nguyen
  2021-12-28 17:58 ` [PATCH net-next 4/9] iavf: " Tony Nguyen
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Tony Nguyen @ 2021-12-28 17:58 UTC (permalink / raw)
  To: davem, kuba
  Cc: Alexander Lobakin, netdev, anthony.l.nguyen, Michal Swiatkowski,
	Gurucharan G

From: Alexander Lobakin <alexandr.lobakin@intel.com>

napi_build_skb() reuses per-cpu NAPI skbuff_head cache in order
to save some cycles on freeing/allocating skbuff_heads on every
new Rx or completed Tx.
i40e driver runs Tx completion polling cycle right before the Rx
one and uses napi_consume_skb() to feed the cache with skbuff_heads
of completed entries, so it's never empty and always warm at that
moment. Switch to the napi_build_skb() to relax mm pressure on
heavy Rx.

Signed-off-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_txrx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 10a83e5385c7..9e3991caa5c9 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -2204,7 +2204,7 @@ static struct sk_buff *i40e_build_skb(struct i40e_ring *rx_ring,
 	net_prefetch(xdp->data_meta);
 
 	/* build an skb around the page buffer */
-	skb = build_skb(xdp->data_hard_start, truesize);
+	skb = napi_build_skb(xdp->data_hard_start, truesize);
 	if (unlikely(!skb))
 		return NULL;
 
-- 
2.31.1


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

* [PATCH net-next 4/9] iavf: switch to napi_build_skb()
  2021-12-28 17:58 [PATCH net-next 0/9][pull request] 10GbE Intel Wired LAN Driver Updates 2021-12-28 Tony Nguyen
                   ` (2 preceding siblings ...)
  2021-12-28 17:58 ` [PATCH net-next 3/9] i40e: " Tony Nguyen
@ 2021-12-28 17:58 ` Tony Nguyen
  2021-12-28 17:58 ` [PATCH net-next 5/9] ice: " Tony Nguyen
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Tony Nguyen @ 2021-12-28 17:58 UTC (permalink / raw)
  To: davem, kuba
  Cc: Alexander Lobakin, netdev, anthony.l.nguyen, Michal Swiatkowski,
	Konrad Jankowski

From: Alexander Lobakin <alexandr.lobakin@intel.com>

napi_build_skb() reuses per-cpu NAPI skbuff_head cache in order
to save some cycles on freeing/allocating skbuff_heads on every
new Rx or completed Tx.
iavf driver runs Tx completion polling cycle right before the Rx
one and uses napi_consume_skb() to feed the cache with skbuff_heads
of completed entries, so it's never empty and always warm at that
moment. Switch to the napi_build_skb() to relax mm pressure on
heavy Rx.

Signed-off-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/iavf/iavf_txrx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/iavf/iavf_txrx.c b/drivers/net/ethernet/intel/iavf/iavf_txrx.c
index a0b1c18a3273..8cbe7ad1347c 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_txrx.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_txrx.c
@@ -1366,7 +1366,7 @@ static struct sk_buff *iavf_build_skb(struct iavf_ring *rx_ring,
 	net_prefetch(va);
 
 	/* build an skb around the page buffer */
-	skb = build_skb(va - IAVF_SKB_PAD, truesize);
+	skb = napi_build_skb(va - IAVF_SKB_PAD, truesize);
 	if (unlikely(!skb))
 		return NULL;
 
-- 
2.31.1


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

* [PATCH net-next 5/9] ice: switch to napi_build_skb()
  2021-12-28 17:58 [PATCH net-next 0/9][pull request] 10GbE Intel Wired LAN Driver Updates 2021-12-28 Tony Nguyen
                   ` (3 preceding siblings ...)
  2021-12-28 17:58 ` [PATCH net-next 4/9] iavf: " Tony Nguyen
@ 2021-12-28 17:58 ` Tony Nguyen
  2021-12-28 17:58 ` [PATCH net-next 6/9] igb: " Tony Nguyen
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Tony Nguyen @ 2021-12-28 17:58 UTC (permalink / raw)
  To: davem, kuba
  Cc: Alexander Lobakin, netdev, anthony.l.nguyen, Michal Swiatkowski,
	Gurucharan G

From: Alexander Lobakin <alexandr.lobakin@intel.com>

napi_build_skb() reuses per-cpu NAPI skbuff_head cache in order
to save some cycles on freeing/allocating skbuff_heads on every
new Rx or completed Tx.
ice driver runs Tx completion polling cycle right before the Rx
one and uses napi_consume_skb() to feed the cache with skbuff_heads
of completed entries, so it's never empty and always warm at that
moment. Switch to the napi_build_skb() to relax mm pressure on
heavy Rx.

Signed-off-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_txrx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c
index 47057010b172..486fc5509d13 100644
--- a/drivers/net/ethernet/intel/ice/ice_txrx.c
+++ b/drivers/net/ethernet/intel/ice/ice_txrx.c
@@ -948,7 +948,7 @@ ice_build_skb(struct ice_rx_ring *rx_ring, struct ice_rx_buf *rx_buf,
 	 */
 	net_prefetch(xdp->data_meta);
 	/* build an skb around the page buffer */
-	skb = build_skb(xdp->data_hard_start, truesize);
+	skb = napi_build_skb(xdp->data_hard_start, truesize);
 	if (unlikely(!skb))
 		return NULL;
 
-- 
2.31.1


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

* [PATCH net-next 6/9] igb: switch to napi_build_skb()
  2021-12-28 17:58 [PATCH net-next 0/9][pull request] 10GbE Intel Wired LAN Driver Updates 2021-12-28 Tony Nguyen
                   ` (4 preceding siblings ...)
  2021-12-28 17:58 ` [PATCH net-next 5/9] ice: " Tony Nguyen
@ 2021-12-28 17:58 ` Tony Nguyen
  2021-12-28 17:58 ` [PATCH net-next 7/9] igc: " Tony Nguyen
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Tony Nguyen @ 2021-12-28 17:58 UTC (permalink / raw)
  To: davem, kuba
  Cc: Alexander Lobakin, netdev, anthony.l.nguyen, Michal Swiatkowski,
	Gurucharan G

From: Alexander Lobakin <alexandr.lobakin@intel.com>

napi_build_skb() reuses per-cpu NAPI skbuff_head cache in order
to save some cycles on freeing/allocating skbuff_heads on every
new Rx or completed Tx.
igb driver runs Tx completion polling cycle right before the Rx
one and uses napi_consume_skb() to feed the cache with skbuff_heads
of completed entries, so it's never empty and always warm at that
moment. Switch to the napi_build_skb() to relax mm pressure on
heavy Rx.

Signed-off-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/igb/igb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index ffe457e395a1..47ece02fce99 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -8367,7 +8367,7 @@ static struct sk_buff *igb_build_skb(struct igb_ring *rx_ring,
 	net_prefetch(xdp->data_meta);
 
 	/* build an skb around the page buffer */
-	skb = build_skb(xdp->data_hard_start, truesize);
+	skb = napi_build_skb(xdp->data_hard_start, truesize);
 	if (unlikely(!skb))
 		return NULL;
 
-- 
2.31.1


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

* [PATCH net-next 7/9] igc: switch to napi_build_skb()
  2021-12-28 17:58 [PATCH net-next 0/9][pull request] 10GbE Intel Wired LAN Driver Updates 2021-12-28 Tony Nguyen
                   ` (5 preceding siblings ...)
  2021-12-28 17:58 ` [PATCH net-next 6/9] igb: " Tony Nguyen
@ 2021-12-28 17:58 ` Tony Nguyen
  2021-12-28 17:58 ` [PATCH net-next 8/9] ixgbe: " Tony Nguyen
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Tony Nguyen @ 2021-12-28 17:58 UTC (permalink / raw)
  To: davem, kuba
  Cc: Alexander Lobakin, netdev, anthony.l.nguyen, Michal Swiatkowski,
	Nechama Kraus

From: Alexander Lobakin <alexandr.lobakin@intel.com>

napi_build_skb() reuses per-cpu NAPI skbuff_head cache in order
to save some cycles on freeing/allocating skbuff_heads on every
new Rx or completed Tx.
igc driver runs Tx completion polling cycle right before the Rx
one and uses napi_consume_skb() to feed the cache with skbuff_heads
of completed entries, so it's never empty and always warm at that
moment. Switch to the napi_build_skb() to relax mm pressure on
heavy Rx.

Signed-off-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tested-by: Nechama Kraus <nechamax.kraus@linux.intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/igc/igc_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index 142c57b7a451..8af267512afa 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -1729,7 +1729,7 @@ static struct sk_buff *igc_build_skb(struct igc_ring *rx_ring,
 	net_prefetch(xdp->data_meta);
 
 	/* build an skb around the page buffer */
-	skb = build_skb(xdp->data_hard_start, truesize);
+	skb = napi_build_skb(xdp->data_hard_start, truesize);
 	if (unlikely(!skb))
 		return NULL;
 
-- 
2.31.1


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

* [PATCH net-next 8/9] ixgbe: switch to napi_build_skb()
  2021-12-28 17:58 [PATCH net-next 0/9][pull request] 10GbE Intel Wired LAN Driver Updates 2021-12-28 Tony Nguyen
                   ` (6 preceding siblings ...)
  2021-12-28 17:58 ` [PATCH net-next 7/9] igc: " Tony Nguyen
@ 2021-12-28 17:58 ` Tony Nguyen
  2021-12-28 17:58 ` [PATCH net-next 9/9] ixgbevf: " Tony Nguyen
  2021-12-29  0:20 ` [PATCH net-next 0/9][pull request] 10GbE Intel Wired LAN Driver Updates 2021-12-28 patchwork-bot+netdevbpf
  9 siblings, 0 replies; 12+ messages in thread
From: Tony Nguyen @ 2021-12-28 17:58 UTC (permalink / raw)
  To: davem, kuba
  Cc: Alexander Lobakin, netdev, anthony.l.nguyen, Michal Swiatkowski,
	Gurucharan G

From: Alexander Lobakin <alexandr.lobakin@intel.com>

napi_build_skb() reuses per-cpu NAPI skbuff_head cache in order
to save some cycles on freeing/allocating skbuff_heads on every
new Rx or completed Tx.
ixgbe driver runs Tx completion polling cycle right before the Rx
one and uses napi_consume_skb() to feed the cache with skbuff_heads
of completed entries, so it's never empty and always warm at that
moment. Switch to the napi_build_skb() to relax mm pressure on
heavy Rx.

Signed-off-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 45e2ec4d264d..15095ac868d5 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -2170,7 +2170,7 @@ static struct sk_buff *ixgbe_build_skb(struct ixgbe_ring *rx_ring,
 	net_prefetch(xdp->data_meta);
 
 	/* build an skb to around the page buffer */
-	skb = build_skb(xdp->data_hard_start, truesize);
+	skb = napi_build_skb(xdp->data_hard_start, truesize);
 	if (unlikely(!skb))
 		return NULL;
 
-- 
2.31.1


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

* [PATCH net-next 9/9] ixgbevf: switch to napi_build_skb()
  2021-12-28 17:58 [PATCH net-next 0/9][pull request] 10GbE Intel Wired LAN Driver Updates 2021-12-28 Tony Nguyen
                   ` (7 preceding siblings ...)
  2021-12-28 17:58 ` [PATCH net-next 8/9] ixgbe: " Tony Nguyen
@ 2021-12-28 17:58 ` Tony Nguyen
  2021-12-29  0:20 ` [PATCH net-next 0/9][pull request] 10GbE Intel Wired LAN Driver Updates 2021-12-28 patchwork-bot+netdevbpf
  9 siblings, 0 replies; 12+ messages in thread
From: Tony Nguyen @ 2021-12-28 17:58 UTC (permalink / raw)
  To: davem, kuba
  Cc: Alexander Lobakin, netdev, anthony.l.nguyen, Michal Swiatkowski,
	Konrad Jankowski

From: Alexander Lobakin <alexandr.lobakin@intel.com>

napi_build_skb() reuses per-cpu NAPI skbuff_head cache in order
to save some cycles on freeing/allocating skbuff_heads on every
new Rx or completed Tx.
ixgbevf driver runs Tx completion polling cycle right before the Rx
one and uses napi_consume_skb() to feed the cache with skbuff_heads
of completed entries, so it's never empty and always warm at that
moment. Switch to the napi_build_skb() to relax mm pressure on
heavy Rx.

Signed-off-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index b1dfbaff8b31..ea73fb3026bc 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -944,7 +944,7 @@ static struct sk_buff *ixgbevf_build_skb(struct ixgbevf_ring *rx_ring,
 	net_prefetch(xdp->data_meta);
 
 	/* build an skb around the page buffer */
-	skb = build_skb(xdp->data_hard_start, truesize);
+	skb = napi_build_skb(xdp->data_hard_start, truesize);
 	if (unlikely(!skb))
 		return NULL;
 
-- 
2.31.1


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

* Re: [PATCH net-next 0/9][pull request] 10GbE Intel Wired LAN Driver Updates 2021-12-28
  2021-12-28 17:58 [PATCH net-next 0/9][pull request] 10GbE Intel Wired LAN Driver Updates 2021-12-28 Tony Nguyen
                   ` (8 preceding siblings ...)
  2021-12-28 17:58 ` [PATCH net-next 9/9] ixgbevf: " Tony Nguyen
@ 2021-12-29  0:20 ` patchwork-bot+netdevbpf
  9 siblings, 0 replies; 12+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-12-29  0:20 UTC (permalink / raw)
  To: Tony Nguyen; +Cc: davem, kuba, netdev, alexandr.lobakin

Hello:

This series was applied to netdev/net-next.git (master)
by Tony Nguyen <anthony.l.nguyen@intel.com>:

On Tue, 28 Dec 2021 09:58:06 -0800 you wrote:
> Alexander Lobakin says:
> 
> napi_build_skb() I introduced earlier this year ([0]) aims
> to decrease MM pressure and the overhead from in-place
> kmem_cache_alloc() on each Rx entry processing by decaching
> skbuff_heads from NAPI per-cpu cache filled prior to that by
> napi_consume_skb() (so it is sort of a direct shortcut for
> free -> mm -> alloc cycle).
> Currently, no in-tree drivers use it. Switch all Intel Ethernet
> drivers to it to get slight-to-medium perf boosts depending on
> the frame size.
> 
> [...]

Here is the summary with links:
  - [net-next,1/9] e1000: switch to napi_consume_skb()
    https://git.kernel.org/netdev/net-next/c/dcb95f06eab8
  - [net-next,2/9] e1000: switch to napi_build_skb()
    https://git.kernel.org/netdev/net-next/c/89a354c03b2d
  - [net-next,3/9] i40e: switch to napi_build_skb()
    https://git.kernel.org/netdev/net-next/c/6e19cf7d3815
  - [net-next,4/9] iavf: switch to napi_build_skb()
    https://git.kernel.org/netdev/net-next/c/ef687d61e0e9
  - [net-next,5/9] ice: switch to napi_build_skb()
    https://git.kernel.org/netdev/net-next/c/5ce666315848
  - [net-next,6/9] igb: switch to napi_build_skb()
    https://git.kernel.org/netdev/net-next/c/fa441f0fa8bc
  - [net-next,7/9] igc: switch to napi_build_skb()
    https://git.kernel.org/netdev/net-next/c/4dd330a7e894
  - [net-next,8/9] ixgbe: switch to napi_build_skb()
    https://git.kernel.org/netdev/net-next/c/a39363367a37
  - [net-next,9/9] ixgbevf: switch to napi_build_skb()
    https://git.kernel.org/netdev/net-next/c/c15500198916

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* [PATCH net-next 8/9] ixgbe: switch to napi_build_skb()
  2021-11-23 17:18 [PATCH net-next 0/9] intel: switch to napi_build_skb() Alexander Lobakin
@ 2021-11-23 17:18 ` Alexander Lobakin
  0 siblings, 0 replies; 12+ messages in thread
From: Alexander Lobakin @ 2021-11-23 17:18 UTC (permalink / raw)
  To: intel-wired-lan
  Cc: Alexander Lobakin, Tony Nguyen, Jesse Brandeburg,
	Maciej Fijalkowski, Michal Swiatkowski, David S. Miller,
	Jakub Kicinski, netdev, linux-kernel

napi_build_skb() reuses per-cpu NAPI skbuff_head cache in order
to save some cycles on freeing/allocating skbuff_heads on every
new Rx or completed Tx.
ixgbe driver runs Tx completion polling cycle right before the Rx
one and uses napi_consume_skb() to feed the cache with skbuff_heads
of completed entries, so it's never empty and always warm at that
moment. Switch to the napi_build_skb() to relax mm pressure on
heavy Rx.

Signed-off-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 0f9f022260d7..80d2d10fd465 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -2170,7 +2170,7 @@ static struct sk_buff *ixgbe_build_skb(struct ixgbe_ring *rx_ring,
 	net_prefetch(xdp->data_meta);

 	/* build an skb to around the page buffer */
-	skb = build_skb(xdp->data_hard_start, truesize);
+	skb = napi_build_skb(xdp->data_hard_start, truesize);
 	if (unlikely(!skb))
 		return NULL;

--
2.33.1


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

end of thread, other threads:[~2021-12-29  0:20 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-28 17:58 [PATCH net-next 0/9][pull request] 10GbE Intel Wired LAN Driver Updates 2021-12-28 Tony Nguyen
2021-12-28 17:58 ` [PATCH net-next 1/9] e1000: switch to napi_consume_skb() Tony Nguyen
2021-12-28 17:58 ` [PATCH net-next 2/9] e1000: switch to napi_build_skb() Tony Nguyen
2021-12-28 17:58 ` [PATCH net-next 3/9] i40e: " Tony Nguyen
2021-12-28 17:58 ` [PATCH net-next 4/9] iavf: " Tony Nguyen
2021-12-28 17:58 ` [PATCH net-next 5/9] ice: " Tony Nguyen
2021-12-28 17:58 ` [PATCH net-next 6/9] igb: " Tony Nguyen
2021-12-28 17:58 ` [PATCH net-next 7/9] igc: " Tony Nguyen
2021-12-28 17:58 ` [PATCH net-next 8/9] ixgbe: " Tony Nguyen
2021-12-28 17:58 ` [PATCH net-next 9/9] ixgbevf: " Tony Nguyen
2021-12-29  0:20 ` [PATCH net-next 0/9][pull request] 10GbE Intel Wired LAN Driver Updates 2021-12-28 patchwork-bot+netdevbpf
  -- strict thread matches above, loose matches on Subject: below --
2021-11-23 17:18 [PATCH net-next 0/9] intel: switch to napi_build_skb() Alexander Lobakin
2021-11-23 17:18 ` [PATCH net-next 8/9] ixgbe: " Alexander Lobakin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).