Thread (3 messages) 3 messages, 2 authors, 2025-08-19

Re: [net-next v18 5/7] net: mtip: Add mtip_switch_{rx|tx} functions to the L2 switch driver

flat view

From: Jakub Kicinski <kuba@kernel.org>
Date: 2025-08-19 14:42:16
Also in: imx, linux-devicetree, lkml, netdev

On Tue, 19 Aug 2025 10:31:19 +0200 Łukasz Majewski wrote:
quoted
The rx buffer circulation is very odd.  
The fec_main.c uses page_pool_alloc_pages() to allocate RX page from
the pool.

At the RX function the __build_skb(data, ...) is called to create skb.

Last step with the RX function is to call skb_mark_for_recycle(skb),
which sets skb->pp_recycle = 1.

And yes, in the MTIP I do copy the data to the newly created skb in RX
function (anyway, I need to swap bytes in the buffer). 

It seems like extra copy is performed in the RX function.
Right, so the use of page pool is entirely pointless.
The strength of the page pool is recycling the pages.
If you don't free / allocate pages on the fast path you're 
just paying the extra overhead (of having a populated cache)
quoted
Also you are releasing the page to be recycled without clearing it
from the ring. I think you'd free it again on shutdown, so it's a
double-free.  
No, the page is persistent. It will be removed when the driver is
closed and memory for pages and descriptors is released.
So remove the page_pool_recycle_direct() call, please:

  static int mtip_switch_rx(struct net_device *dev, int budget, int *port)
	...
	skb = netdev_alloc_skb(pndev, pkt_len + NET_IP_ALIGN);
	if (unlikely(!skb)) {
			...
			page_pool_recycle_direct(fep->page_pool, page);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help