netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] xsk: respect the offsets when copying frags
@ 2025-04-23 10:10 Bui Quang Minh
  2025-04-23 14:41 ` Stanislav Fomichev
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Bui Quang Minh @ 2025-04-23 10:10 UTC (permalink / raw)
  To: netdev
  Cc: Alexei Starovoitov, Daniel Borkmann, David S. Miller,
	Jakub Kicinski, Jesper Dangaard Brouer, John Fastabend,
	Eric Dumazet, Paolo Abeni, Simon Horman, Maciej Fijalkowski,
	Alexander Lobakin, bpf, linux-kernel, Bui Quang Minh

Add the missing offsets when copying frags in xdp_copy_frags_from_zc().

Fixes: 560d958c6c68 ("xsk: add generic XSk &xdp_buff -> skb conversion")
Signed-off-by: Bui Quang Minh <minhquangbui99@gmail.com>
---
 net/core/xdp.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/core/xdp.c b/net/core/xdp.c
index f86eedad586a..a723dc301f94 100644
--- a/net/core/xdp.c
+++ b/net/core/xdp.c
@@ -697,7 +697,8 @@ static noinline bool xdp_copy_frags_from_zc(struct sk_buff *skb,
 	nr_frags = xinfo->nr_frags;
 
 	for (u32 i = 0; i < nr_frags; i++) {
-		u32 len = skb_frag_size(&xinfo->frags[i]);
+		const skb_frag_t *frag = &xinfo->frags[i];
+		u32 len = skb_frag_size(frag);
 		u32 offset, truesize = len;
 		netmem_ref netmem;
 
@@ -707,8 +708,8 @@ static noinline bool xdp_copy_frags_from_zc(struct sk_buff *skb,
 			return false;
 		}
 
-		memcpy(__netmem_address(netmem),
-		       __netmem_address(xinfo->frags[i].netmem),
+		memcpy(__netmem_address(netmem) + offset,
+		       __netmem_address(frag->netmem) + skb_frag_off(frag),
 		       LARGEST_ALIGN(len));
 		__skb_fill_netmem_desc_noacc(sinfo, i, netmem, offset, len);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-04-26  0:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-23 10:10 [PATCH net] xsk: respect the offsets when copying frags Bui Quang Minh
2025-04-23 14:41 ` Stanislav Fomichev
2025-04-23 14:58   ` Bui Quang Minh
2025-04-23 18:01     ` Maciej Fijalkowski
2025-04-24 14:02 ` Alexander Lobakin
2025-04-24 14:45   ` Bui Quang Minh
2025-04-25  0:29 ` Jakub Kicinski
2025-04-25 15:46 ` Bui Quang Minh
2025-04-26  0:23   ` Jakub Kicinski

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).