[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87pnirb3dc.fsf@toke.dk>
Date: Sun, 20 Oct 2019 21:53:19 +0200
From: Toke Høiland-Jørgensen <toke@...hat.com>
To: Björn Töpel <bjorn.topel@...il.com>,
netdev@...r.kernel.org, ast@...nel.org, daniel@...earbox.net
Cc: Björn Töpel <bjorn.topel@...el.com>,
bpf@...r.kernel.org, magnus.karlsson@...il.com,
magnus.karlsson@...el.com, sridhar.samudrala@...el.com
Subject: Re: [PATCH bpf-next] libbpf: remove explicit XSKMAP lookup from AF_XDP XDP program
Björn Töpel <bjorn.topel@...il.com> writes:
> From: Björn Töpel <bjorn.topel@...el.com>
>
> In commit 43e74c0267a3 ("bpf_xdp_redirect_map: Perform map lookup in
> eBPF helper") the bpf_redirect_map() helper learned to do map lookup,
> which means that the explicit lookup in the XDP program for AF_XDP is
> not needed.
>
> This commit removes the map lookup, which simplifies the BPF code and
> improves the performance for the "rx_drop" [1] scenario with ~4%.
Nice, 4% is pretty good!
I wonder if the program needs to be backwards-compatible (with pre-5.3
kernels), though?
You can do that by something like this:
ret = bpf_redirect_map(&xsks_map, index, XDP_PASS);
if (ret > 0)
return ret;
if (bpf_map_lookup_elem(&xsks_map, &index))
return bpf_redirect_map(&xsks_map, index, 0);
return XDP_PASS;
This works because bpf_redirect_map() prior to 43e74c0267a3 will return
XDP_ABORTED on a non-0 flags value.
-Toke
Powered by blists - more mailing lists