[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aUOddielBMkrmwhd@test-OptiPlex-Tower-Plus-7010>
Date: Thu, 18 Dec 2025 11:51:42 +0530
From: Hariprasad Kelam <hkelam@...vell.com>
To: Wei Fang <wei.fang@....com>
CC: "andrew+netdev@...n.ch" <andrew+netdev@...n.ch>,
"davem@...emloft.net"
<davem@...emloft.net>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"kuba@...nel.org" <kuba@...nel.org>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"mcoquelin.stm32@...il.com" <mcoquelin.stm32@...il.com>,
"alexandre.torgue@...s.st.com" <alexandre.torgue@...s.st.com>,
"ast@...nel.org" <ast@...nel.org>,
"daniel@...earbox.net"
<daniel@...earbox.net>,
"hawk@...nel.org" <hawk@...nel.org>,
"john.fastabend@...il.com" <john.fastabend@...il.com>,
"sdf@...ichev.me"
<sdf@...ichev.me>,
"rmk+kernel@...linux.org.uk" <rmk+kernel@...linux.org.uk>,
"0x1207@...il.com" <0x1207@...il.com>,
"hayashi.kunihiko@...ionext.com"
<hayashi.kunihiko@...ionext.com>,
Vladimir Oltean <vladimir.oltean@....com>,
"boon.leong.ong@...el.com" <boon.leong.ong@...el.com>,
"imx@...ts.linux.dev"
<imx@...ts.linux.dev>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-stm32@...md-mailman.stormreply.com"
<linux-stm32@...md-mailman.stormreply.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"bpf@...r.kernel.org"
<bpf@...r.kernel.org>
Subject: Re: [PATCH net] net: stmmac: fix the crash issue for zero copy
XDP_TX action
On 2025-12-17 at 18:19:19, Wei Fang (wei.fang@....com) wrote:
> > > - res = stmmac_xdp_xmit_xdpf(priv, queue, xdpf, false);
> > > - if (res == STMMAC_XDP_TX)
> > > + /* For zero copy XDP_TX action, dma_map is true */
> > > + res = stmmac_xdp_xmit_xdpf(priv, queue, xdpf, zc);
> > Seems stmmac_xdp_xmit_xdpf is using dma_map_single if we pass zc is
> > true.
> > Ideally in case of zc, driver can use page_pool_get_dma_addr, may be
> > you
> > need pass zc param as false. Please check
> >
>
> No, the memory type of xdpf->data is MEM_TYPE_PAGE_ORDER0 rather
> than MEM_TYPE_PAGE_POOL, so we should use dma_map_single().
> Otherwise, it will lead to invalid mappings and cause the crash.
>
>
ACK, found below code bit confusing
case STMMAC_XDP_CONSUMED:
xsk_buff_free(buf->xdp);
+ fallthrough;
+ case STMMAC_XSK_CONSUMED:
rx_dropped++;
Ideally in case of STMMAC_XSK_CONSUMED, driver needs to call xsk_buff_free.
And in case of STMMAC_XDP_CONSUMED, driver needs to call xdp_return_frame.
May be you can move all buffer free logic to stmmac_rx_zc with above suggested
changes.
Powered by blists - more mailing lists