From: Jakub Kicinski <kuba@kernel.org>
To: "Łukasz Majewski" <lukasz.majewski@mailbox.org>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
davem@davemloft.net, Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Richard Cochran <richardcochran@gmail.com>,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
Stefan Wahren <wahrenst@gmx.net>, Simon Horman <horms@kernel.org>
Subject: Re: [net-next v18 5/7] net: mtip: Add mtip_switch_{rx|tx} functions to the L2 switch driver
Date: Tue, 19 Aug 2025 07:42:14 -0700 [thread overview]
Message-ID: <20250819074214.23d4332a@kernel.org> (raw)
In-Reply-To: <20250819103119.42a64541@wsk>
On Tue, 19 Aug 2025 10:31:19 +0200 Łukasz Majewski wrote:
> > 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)
> > 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);
next prev parent reply other threads:[~2025-08-19 14:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-13 7:07 [net-next v18 0/7] net: mtip: Add support for MTIP imx287 L2 switch driver Lukasz Majewski
2025-08-13 7:07 ` [net-next v18 1/7] dt-bindings: net: Add MTIP L2 switch description Lukasz Majewski
2025-08-13 7:07 ` [net-next v18 2/7] net: mtip: The L2 switch driver for imx287 Lukasz Majewski
2025-08-16 1:29 ` Jakub Kicinski
2025-08-18 20:07 ` Łukasz Majewski
2025-08-13 7:07 ` [net-next v18 3/7] net: mtip: Add buffers management functions to the L2 switch driver Lukasz Majewski
2025-08-13 7:07 ` [net-next v18 4/7] net: mtip: Add net_device_ops " Lukasz Majewski
2025-08-13 7:07 ` [net-next v18 5/7] net: mtip: Add mtip_switch_{rx|tx} " Lukasz Majewski
2025-08-16 1:33 ` Jakub Kicinski
2025-08-19 8:31 ` Łukasz Majewski
2025-08-19 14:42 ` Jakub Kicinski [this message]
2025-08-13 7:07 ` [net-next v18 6/7] net: mtip: Extend the L2 switch driver with management operations Lukasz Majewski
2025-08-13 7:07 ` [net-next v18 7/7] net: mtip: Extend the L2 switch driver for imx287 with bridge operations Lukasz Majewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250819074214.23d4332a@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=festevam@gmail.com \
--cc=horms@kernel.org \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukasz.majewski@mailbox.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=wahrenst@gmx.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).