selftests/bpf: Don't refill on completion in xdp_metadata
authorStanislav Fomichev <sdf@google.com>
Wed, 1 Feb 2023 23:36:40 +0000 (15:36 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 2 Feb 2023 10:41:27 +0000 (11:41 +0100)
We only need to consume TX completion instead of refilling 'fill' ring.
It's currently not an issue because we never RX more than 8 packets.

Fixes: e2a46d54d7a1 ("selftests/bpf: Verify xdp_metadata xdp->af_xdp path")
Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20230201233640.367646-1-sdf@google.com
tools/testing/selftests/bpf/prog_tests/xdp_metadata.c

index 241909d71c7e3df35d8c8276ee6a6c3b2511437c..aa4beae99f4f6ed6df6f2c60d9b8470f229dd1b7 100644 (file)
@@ -205,9 +205,8 @@ static void complete_tx(struct xsk *xsk)
        if (ASSERT_EQ(xsk_ring_cons__peek(&xsk->comp, 1, &idx), 1, "xsk_ring_cons__peek")) {
                addr = *xsk_ring_cons__comp_addr(&xsk->comp, idx);
 
-               printf("%p: refill idx=%u addr=%llx\n", xsk, idx, addr);
-               *xsk_ring_prod__fill_addr(&xsk->fill, idx) = addr;
-               xsk_ring_prod__submit(&xsk->fill, 1);
+               printf("%p: complete tx idx=%u addr=%llx\n", xsk, idx, addr);
+               xsk_ring_cons__release(&xsk->comp, 1);
        }
 }