diff options
author | Maciej Fijalkowski <maciej.fijalkowski@intel.com> | 2022-04-13 17:30:03 +0200 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2022-04-15 21:09:44 +0200 |
commit | 2be4a677ccb2cae1f72a9467e922642655efc0be (patch) | |
tree | 57d673506021ce55a96187733843f4c684cdcea8 /net | |
parent | c6c1f11b691e619802474f886355cb3bc9034021 (diff) | |
download | linux-stable-2be4a677ccb2cae1f72a9467e922642655efc0be.tar.gz linux-stable-2be4a677ccb2cae1f72a9467e922642655efc0be.tar.bz2 linux-stable-2be4a677ccb2cae1f72a9467e922642655efc0be.zip |
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
Diffstat (limited to 'net')
-rw-r--r-- | net/xdp/xsk.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index f75e121073e7..040c73345b7c 100644 --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c @@ -217,7 +217,7 @@ static bool xsk_is_bound(struct xdp_sock *xs) static int xsk_rcv_check(struct xdp_sock *xs, struct xdp_buff *xdp) { if (!xsk_is_bound(xs)) - return -EINVAL; + return -ENXIO; if (xs->dev != xdp->rxq->dev || xs->queue_id != xdp->rxq->queue_index) return -EINVAL; |