xsk: Diversify return codes in xsk_rcv_check()
authorMaciej Fijalkowski <maciej.fijalkowski@intel.com>
Wed, 13 Apr 2022 15:30:03 +0000 (17:30 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 15 Apr 2022 19:09:44 +0000 (21:09 +0200)
commit2be4a677ccb2cae1f72a9467e922642655efc0be
tree57d673506021ce55a96187733843f4c684cdcea8
parentc6c1f11b691e619802474f886355cb3bc9034021
xsk: Diversify return codes in xsk_rcv_check()

Inspired by patch that made xdp_do_redirect() return values for XSKMAP
more meaningful, return -ENXIO instead of -EINVAL for socket being
unbound in xsk_rcv_check() as this is the usual value that is returned
for such event. In turn, it is now possible to easily distinguish what
went wrong, which is a bit harder when for both cases checked, -EINVAL
was returned.

Return codes can be counted in a nice way via bpftrace oneliner that
Jesper has shown:

bpftrace -e 'tracepoint:xdp:xdp_redirect* {@err[-args->err] = count();}'

Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Link: https://lore.kernel.org/bpf/20220413153015.453864-3-maciej.fijalkowski@intel.com
net/xdp/xsk.c