[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250126183714.00005068@gmail.com>
Date: Sun, 26 Jan 2025 18:37:14 +0800
From: Furong Xu <0x1207@...il.com>
To: Ido Schimmel <idosch@...sch.org>
Cc: Andrew Lunn <andrew@...n.ch>, Brad Griffis <bgriffis@...dia.com>, Jon
Hunter <jonathanh@...dia.com>, netdev@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Alexander Lobakin <aleksander.lobakin@...el.com>, Joe Damato
<jdamato@...tly.com>, Andrew Lunn <andrew+netdev@...n.ch>, "David S.
Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub
Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Maxime
Coquelin <mcoquelin.stm32@...il.com>, xfr@...look.com,
"linux-tegra@...r.kernel.org" <linux-tegra@...r.kernel.org>
Subject: Re: [PATCH net-next v3 1/4] net: stmmac: Switch to zero-copy in
non-XDP RX path
On Sun, 26 Jan 2025 10:41:23 +0200, Ido Schimmel wrote:
> SPH is the only scenario in which the driver uses multiple buffers per
> packet?
Yes.
Jumbo mode may use multiple buffers per packet too, but they are
high order pages, just like a single page in a page pool when using
a standard MTU.
> > pp_params.max_len = dma_conf->dma_buf_sz;
>
> Are you sure this is correct? Page pool documentation says that "For
> pages recycled on the XDP xmit and skb paths the page pool will use
> the max_len member of struct page_pool_params to decide how much of
> the page needs to be synced (starting at offset)" [1].
Page pool must sync an area of the buffer because both DMA and CPU may
touch this area, other areas are CPU exclusive, so no sync for them
seems better.
> While "no more than dma_conf->dma_buf_sz bytes will be written into a
> page buffer", for the head buffer they will be written starting at a
> non-zero offset unlike buffers used for the data, no?
Correct, they have different offsets.
The "SPH feature" splits header into buf->page (non-zero offset) and
splits payload into buf->sec_page (zero offset).
For buf->page, pp_params.max_len should be the size of L3/L4 header,
and with a offset of NET_SKB_PAD.
For buf->sec_page, pp_params.max_len should be dma_conf->dma_buf_sz,
and with a offset of 0.
This is always true:
sizeof(L3/L4 header) + NET_SKB_PAD < dma_conf->dma_buf_sz + 0
pp_params.max_len = dma_conf->dma_buf_sz;
make things simpler :)
Powered by blists - more mailing lists