* [PATCH net] net: mvneta: clear XDP pfmemalloc flag between frames
@ 2026-09-20 7:55 Lorenzo Bianconi
2026-09-21 12:32 ` Simon Horman
2026-09-23 2:01 ` Jakub Kicinski
0 siblings, 2 replies; 4+ messages in thread
From: Lorenzo Bianconi @ 2026-09-20 7:55 UTC (permalink / raw)
To: Marcin Wojtas, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Toke Hoiland-Jorgensen, Lorenzo Bianconi
Cc: netdev, bpf, Lorenzo Bianconi
In mvneta_swbm_add_rx_fragment() the XDP pfmemalloc flag is set on the
xdp_buff if the page under pressure is a pfmemalloc one. The xdp_buff is
reused for the next packet and the flag is never cleared, so a pfmemalloc
fragment in one packet wrongly marks the skb of a subsequent packet as
pfmemalloc. Clear the flag in mvneta_swbm_rx_frame(), which is invoked for
each new frame.
Fixes: ed7a58cb40bd ("net: marvell: rely on xdp_update_skb_shared_info utility routine")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
---
drivers/net/ethernet/marvell/mvneta.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 543e566425c1..32416999f3d6 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -2341,6 +2341,7 @@ mvneta_swbm_rx_frame(struct mvneta_port *pp,
/* Prefetch header */
prefetch(data);
xdp_buff_clear_frags_flag(xdp);
+ xdp_buff_clear_frag_pfmemalloc(xdp);
xdp_prepare_buff(xdp, data, pp->rx_offset_correction + MVNETA_MH_SIZE,
data_len, true);
}
---
base-commit: e3bfd25626b44b6fa61a13c17178922171d519ce
change-id: 20260919-mvneta-xdp-clear-frag-fix-7ac691e1659b
Best regards,
--
Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: mvneta: clear XDP pfmemalloc flag between frames
2026-09-20 7:55 [PATCH net] net: mvneta: clear XDP pfmemalloc flag between frames Lorenzo Bianconi
@ 2026-09-21 12:32 ` Simon Horman
2026-09-23 2:01 ` Jakub Kicinski
1 sibling, 0 replies; 4+ messages in thread
From: Simon Horman @ 2026-09-21 12:32 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: Marcin Wojtas, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Toke Hoiland-Jorgensen, Lorenzo Bianconi, netdev, bpf
On Sun, Sep 20, 2026 at 09:55:09AM +0200, Lorenzo Bianconi wrote:
> In mvneta_swbm_add_rx_fragment() the XDP pfmemalloc flag is set on the
> xdp_buff if the page under pressure is a pfmemalloc one. The xdp_buff is
> reused for the next packet and the flag is never cleared, so a pfmemalloc
> fragment in one packet wrongly marks the skb of a subsequent packet as
> pfmemalloc. Clear the flag in mvneta_swbm_rx_frame(), which is invoked for
> each new frame.
>
> Fixes: ed7a58cb40bd ("net: marvell: rely on xdp_update_skb_shared_info utility routine")
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: mvneta: clear XDP pfmemalloc flag between frames
2026-09-20 7:55 [PATCH net] net: mvneta: clear XDP pfmemalloc flag between frames Lorenzo Bianconi
2026-09-21 12:32 ` Simon Horman
@ 2026-09-23 2:01 ` Jakub Kicinski
2026-09-23 10:09 ` Lorenzo Bianconi
1 sibling, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2026-09-23 2:01 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: Marcin Wojtas, Andrew Lunn, David S. Miller, Eric Dumazet,
Paolo Abeni, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Toke Hoiland-Jorgensen, Lorenzo Bianconi, netdev, bpf
On Sun, 20 Sep 2026 09:55:09 +0200 Lorenzo Bianconi wrote:
> In mvneta_swbm_add_rx_fragment() the XDP pfmemalloc flag is set on the
> xdp_buff if the page under pressure is a pfmemalloc one. The xdp_buff is
> reused for the next packet and the flag is never cleared, so a pfmemalloc
> fragment in one packet wrongly marks the skb of a subsequent packet as
> pfmemalloc. Clear the flag in mvneta_swbm_rx_frame(), which is invoked for
> each new frame.
>
> Fixes: ed7a58cb40bd ("net: marvell: rely on xdp_update_skb_shared_info utility routine")
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
> ---
> drivers/net/ethernet/marvell/mvneta.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
> index 543e566425c1..32416999f3d6 100644
> --- a/drivers/net/ethernet/marvell/mvneta.c
> +++ b/drivers/net/ethernet/marvell/mvneta.c
> @@ -2341,6 +2341,7 @@ mvneta_swbm_rx_frame(struct mvneta_port *pp,
> /* Prefetch header */
> prefetch(data);
> xdp_buff_clear_frags_flag(xdp);
> + xdp_buff_clear_frag_pfmemalloc(xdp);
bit of a trap for your future self to clear the flags one by one.
Should we not write the flags to 0 ? Or maybe add:
/* Clear xdp_buf state for reuse on the same ring */
static __always_inline void xdp_reinit_buff(struct xdp_buff *xdp)
{
xdp->flags = 0;
}
and call that?
> xdp_prepare_buff(xdp, data, pp->rx_offset_correction + MVNETA_MH_SIZE,
> data_len, true);
> }
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: mvneta: clear XDP pfmemalloc flag between frames
2026-09-23 2:01 ` Jakub Kicinski
@ 2026-09-23 10:09 ` Lorenzo Bianconi
0 siblings, 0 replies; 4+ messages in thread
From: Lorenzo Bianconi @ 2026-09-23 10:09 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Marcin Wojtas, Andrew Lunn, David S. Miller, Eric Dumazet,
Paolo Abeni, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Stanislav Fomichev,
Toke Hoiland-Jorgensen, Lorenzo Bianconi, netdev, bpf
[-- Attachment #1: Type: text/plain, Size: 1683 bytes --]
> On Sun, 20 Sep 2026 09:55:09 +0200 Lorenzo Bianconi wrote:
> > In mvneta_swbm_add_rx_fragment() the XDP pfmemalloc flag is set on the
> > xdp_buff if the page under pressure is a pfmemalloc one. The xdp_buff is
> > reused for the next packet and the flag is never cleared, so a pfmemalloc
> > fragment in one packet wrongly marks the skb of a subsequent packet as
> > pfmemalloc. Clear the flag in mvneta_swbm_rx_frame(), which is invoked for
> > each new frame.
> >
> > Fixes: ed7a58cb40bd ("net: marvell: rely on xdp_update_skb_shared_info utility routine")
> > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
> > ---
> > drivers/net/ethernet/marvell/mvneta.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
> > index 543e566425c1..32416999f3d6 100644
> > --- a/drivers/net/ethernet/marvell/mvneta.c
> > +++ b/drivers/net/ethernet/marvell/mvneta.c
> > @@ -2341,6 +2341,7 @@ mvneta_swbm_rx_frame(struct mvneta_port *pp,
> > /* Prefetch header */
> > prefetch(data);
> > xdp_buff_clear_frags_flag(xdp);
> > + xdp_buff_clear_frag_pfmemalloc(xdp);
>
> bit of a trap for your future self to clear the flags one by one.
> Should we not write the flags to 0 ? Or maybe add:
>
> /* Clear xdp_buf state for reuse on the same ring */
> static __always_inline void xdp_reinit_buff(struct xdp_buff *xdp)
> {
> xdp->flags = 0;
> }
>
> and call that?
ack, I agree. I will fix it in v2.
Regards,
Lorenzo
>
> > xdp_prepare_buff(xdp, data, pp->rx_offset_correction + MVNETA_MH_SIZE,
> > data_len, true);
> > }
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-23 10:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-20 7:55 [PATCH net] net: mvneta: clear XDP pfmemalloc flag between frames Lorenzo Bianconi
2026-09-21 12:32 ` Simon Horman
2026-09-23 2:01 ` Jakub Kicinski
2026-09-23 10:09 ` Lorenzo Bianconi
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).