samples/bpf: Increment Tx stats at sending
authorMagnus Karlsson <magnus.karlsson@intel.com>
Mon, 16 Nov 2020 11:12:43 +0000 (12:12 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 17 Nov 2020 21:07:40 +0000 (22:07 +0100)
commit90da4b3208d32bdb5489ca08b91af16ed4a68d00
tree26b7122be1f5a4f8e196a184581404e95a0ee844
parentde91e631bdc7e6411989e1a9ab65501a31527e0b
samples/bpf: Increment Tx stats at sending

Increment the statistics over how many Tx packets have been sent at
the time of sending instead of at the time of completion. This as a
completion event means that the buffer has been sent AND returned to
user space. The packet always gets sent shortly after sendto() is
called. The kernel might, for performance reasons, decide to not
return every single buffer to user space immediately after sending,
for example, only after a batch of packets have been
transmitted. Incrementing the number of packets sent at completion,
will in that case be confusing as if you send a single packet, the
counter might show zero for a while even though the packet has been
transmitted.

Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/1605525167-14450-2-git-send-email-magnus.karlsson@gmail.com
samples/bpf/xdpsock_user.c