]> git.baikalelectronics.ru Git - kernel.git/commit
selftests: xsk: Put the same buffer only once in the fill ring
authorMagnus Karlsson <magnus.karlsson@intel.com>
Wed, 22 Sep 2021 07:56:08 +0000 (09:56 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 27 Sep 2021 22:18:35 +0000 (00:18 +0200)
commitc54e2a360b749421d0e551aaaa89b3e3b4f124fe
tree389a4edb72a0d44f60e48055456de28ce8fb48a4
parentb16df13ee02b587470fa7fd497ddd6d5bfd0a0d7
selftests: xsk: Put the same buffer only once in the fill ring

Fix a problem where the fill ring was populated with too many
entries. If number of buffers in the umem was smaller than the fill
ring size, the code used to loop over from the beginning of the umem
and start putting the same buffers in again. This is racy indeed as a
later packet can be received overwriting an earlier one before the Rx
thread manages to validate it.

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-9-magnus.karlsson@gmail.com
tools/testing/selftests/bpf/xdpxceiver.c