lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 12 Jul 2022 20:14:56 +0200
From:   Aleksander Jan Bajkowski <olek2@...pl>
To:     hauke@...ke-m.de, davem@...emloft.net, edumazet@...gle.com,
        kuba@...nel.org, pabeni@...hat.com, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Cc:     Aleksander Jan Bajkowski <olek2@...pl>
Subject: [PATCH net-next] net: lantiq_xrx200: use skb cache

napi_build_skb() reuses NAPI skbuff_head cache in order to save some
cycles on freeing/allocating skbuff_heads on every new Rx or completed
Tx.
Use napi_consume_skb() to feed the cache with skbuff_heads of completed
Tx. The budget parameter is added to indicate NAPI context, as a value
of zero can be passed in the case of netpoll.

NAT performance results on BT Home Hub 5A (kernel 5.15.45, mtu 1500):

Fast path (Software Flow Offload):
	Up	Down
Before	702.4	719.3
After	707.3	739.9

Slow path:
	Up	Down
Before	91.8	184.1
After	92.0	185.7

Signed-off-by: Aleksander Jan Bajkowski <olek2@...pl>
---
 drivers/net/ethernet/lantiq_xrx200.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c
index 5edb68a8aab1..83e07404803f 100644
--- a/drivers/net/ethernet/lantiq_xrx200.c
+++ b/drivers/net/ethernet/lantiq_xrx200.c
@@ -238,7 +238,7 @@ static int xrx200_hw_receive(struct xrx200_chan *ch)
 		return ret;
 	}
 
-	skb = build_skb(buf, priv->rx_skb_size);
+	skb = napi_build_skb(buf, priv->rx_skb_size);
 	skb_reserve(skb, NET_SKB_PAD);
 	skb_put(skb, len);
 
@@ -321,7 +321,7 @@ static int xrx200_tx_housekeeping(struct napi_struct *napi, int budget)
 			pkts++;
 			bytes += skb->len;
 			ch->skb[ch->tx_free] = NULL;
-			consume_skb(skb);
+			napi_consume_skb(skb, budget);
 			memset(&ch->dma.desc_base[ch->tx_free], 0,
 			       sizeof(struct ltq_dma_desc));
 			ch->tx_free++;
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ