[PATCH 3/5] selftests/xsk: Remove umem from pkt_generate parameters

Tushar Vyavahare
2026-04-28T08:46:16Z

After moving UMEM ownership to socket-level state, passing UMEM
explicitly into pkt_generate() is redundant and can drift from the
active socket state.

Drop the UMEM parameter and use the socket-attached UMEM directly. This
simplifies call sites and keeps packet generation aligned with the
configured socket/UMEM pairing.

Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Tushar Vyavahare <tushar.vyavahare@intel.com>
---
tools/testing/selftests/bpf/prog_tests/test_xsk.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/test_xsk.c b/tools/testing/selftests/bpf/prog_tests/test_xsk.c
index ad5ada9216fc..ea229ea446ca 100644
--- a/tools/testing/selftests/bpf/prog_tests/test_xsk.c
+++ b/tools/testing/selftests/bpf/prog_tests/test_xsk.c
@@ -630,10 +630,10 @@ static void pkt_stream_cancel(struct pkt_stream *pkt_stream)
pkt_stream->current_pkt_nb--;
}

-static void pkt_generate(struct xsk_socket_info *xsk, struct xsk_umem_info *umem, u64 addr, u32 len,
- u32 pkt_nb, u32 bytes_written)
+static void pkt_generate(struct xsk_socket_info *xsk, u64 addr, u32 len, u32 pkt_nb,
+ u32 bytes_written)
{
- void *data = xsk_umem__get_data(umem->buffer, addr);
+ void *data = xsk_umem__get_data(xsk->umem->buffer, addr);

if (len < MIN_PKT_SIZE)
return;
@@ -1241,7 +1241,7 @@ static int __send_pkts(struct ifobject *ifobject, struct xsk_socket_info *xsk, b
tx_desc->options = 0;
}
if (pkt->valid)
- pkt_generate(xsk, umem, tx_desc->addr, tx_desc->len, pkt->pkt_nb,
+ pkt_generate(xsk, tx_desc->addr, tx_desc->len, pkt->pkt_nb,
bytes_written);
bytes_written += tx_desc->len;

--
2.43.0