]> git.baikalelectronics.ru Git - kernel.git/commit
samples/bpf: Optimize l2fwd performance in xdpsock
authorMagnus Karlsson <magnus.karlsson@intel.com>
Fri, 28 Aug 2020 12:51:05 +0000 (14:51 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 31 Aug 2020 20:34:25 +0000 (22:34 +0200)
commite5990221f599fbc5bce945656c1fc0f29208662b
tree7bb041c8f5e73a19617a6dfddeaee3f7a00f3f28
parent5d3f789c502584cbdf42041faa7a8cbbe080ea73
samples/bpf: Optimize l2fwd performance in xdpsock

Optimize the throughput performance of the l2fwd sub-app in the
xdpsock sample application by removing a duplicate syscall and
increasing the size of the fill ring.

The latter needs some further explanation. We recommend that you set
the fill ring size >= HW RX ring size + AF_XDP RX ring size. Make sure
you fill up the fill ring with buffers at regular intervals, and you
will with this setting avoid allocation failures in the driver. These
are usually quite expensive since drivers have not been written to
assume that allocation failures are common. For regular sockets,
kernel allocated memory is used that only runs out in OOM situations
that should be rare.

These two performance optimizations together lead to a 6% percent
improvement for the l2fwd app on my machine.

Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/1598619065-1944-1-git-send-email-magnus.karlsson@intel.com
samples/bpf/xdpsock_user.c