Skip to contentSkip to conversation

net: lantiq_xrx200: use skb cache

PATCH In review Aleksander Jan Bajkowski 2 participants 3 messages Aug 28, 2022 – Aug 31, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover 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.

Changelog:

v2:
- rebased patch to avoid conflicts

Aleksander Jan Bajkowski (1):
net: lantiq_xrx200: use skb cache

 drivers/net/ethernet/lantiq_xrx200.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.30.2
#1 lore raw

PATCH v2 1/1 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

---
 drivers/net/ethernet/lantiq_xrx200.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/lantiq_xrx200.c +2 -2
index 57f27cc7724e..13899720423f 100644
@@ -239,7 +239,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);
 	if (!skb) {
 		skb_free_frag(buf);
 		net_dev->stats.rx_dropped++;
@@ -328,7 +328,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++;
Signature · 1 line
2.30.2
maintainer
#2 lore raw

drivers/net/ethernet/lantiq_xrx200.c static int xrx200_hw_receive(struct xrx200_chan *ch) · line 242

Quoted 6 lines · On Sun, 28 Aug 2022 21:19:31 +0200 Aleksander Jan Bajkowski wrote:
drivers/net/ethernet/lantiq_xrx200.c +1 -1
@@ -239,7 +239,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);

This gets called on MTU change, outside of softirq context, no?