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 so it's never empty.
Signed-off-by: Sieng Piaw Liew <liew.s.piaw@gmail.com>
[ fixed commit title ]
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
if (!skb)
continue;
- dev_kfree_skb_any(skb);
+ napi_consume_skb(skb, !flush);
ring->buf[i].skb = NULL;
bytes_compl += ring->buf[i].len;
dev->stats.rx_packets++;
dev->stats.rx_bytes += pktlen;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0)
skb = build_skb(ring->buf[i].rx_buf, ag71xx_buffer_size(ag));
+#else
+ skb = napi_build_skb(ring->buf[i].rx_buf, ag71xx_buffer_size(ag));
+#endif
if (!skb) {
skb_free_frag(ring->buf[i].rx_buf);
goto next;