summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMagnus Karlsson <magnus.karlsson@intel.com>2021-09-22 10:56:09 +0300
committerDaniel Borkmann <daniel@iogearbox.net>2021-09-28 01:18:35 +0300
commit89013b8a29281fa42e39406b8b25672cb6ce2341 (patch)
treee6bd1c828ec6e37b54a5357f0dcd6cdfd27e9a41 /tools
parent872a1184dbf2b6ed9f435d6a37ad8007126da982 (diff)
downloadlinux-89013b8a29281fa42e39406b8b25672cb6ce2341.tar.xz
selftests: xsk: Fix socket creation retry
The socket creation retry unnecessarily registered the umem once for every retry. No reason to do this. It wastes memory and it might lead to too many pages being locked at some point and the failure of a test. Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20210922075613.12186-10-magnus.karlsson@gmail.com
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/bpf/xdpxceiver.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selftests/bpf/xdpxceiver.c
index c5c68b860ae0..aa5660dc0699 100644
--- a/tools/testing/selftests/bpf/xdpxceiver.c
+++ b/tools/testing/selftests/bpf/xdpxceiver.c
@@ -919,18 +919,17 @@ static void thread_common_ops(struct test_spec *test, struct ifobject *ifobject)
u64 umem_sz = ifobject->umem->num_frames * ifobject->umem->frame_size;
u32 ctr = 0;
void *bufs;
+ int ret;
bufs = mmap(NULL, umem_sz, PROT_READ | PROT_WRITE, mmap_flags, -1, 0);
if (bufs == MAP_FAILED)
exit_with_error(errno);
- while (ctr++ < SOCK_RECONF_CTR) {
- int ret;
-
- ret = xsk_configure_umem(&ifobject->umem_arr[i], bufs, umem_sz);
- if (ret)
- exit_with_error(-ret);
+ ret = xsk_configure_umem(&ifobject->umem_arr[i], bufs, umem_sz);
+ if (ret)
+ exit_with_error(-ret);
+ while (ctr++ < SOCK_RECONF_CTR) {
ret = xsk_configure_socket(&ifobject->xsk_arr[i], &ifobject->umem_arr[i],
ifobject, i);
if (!ret)