Re: [PATCH bpf-next] libbpf: remove explicit XSKMAP lookup from AF_XDP XDP program

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 20 Oct 2019 at 21:53, Toke Høiland-Jørgensen <toke@xxxxxxxxxx> wrote:
>
> Björn Töpel <bjorn.topel@xxxxxxxxx> writes:
>
> > From: Björn Töpel <bjorn.topel@xxxxxxxxx>
> >
> > 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;
>

Ah, yes. Thanks for pointing that out. I'll do a respin.


Thanks,
Björn

>
> This works because bpf_redirect_map() prior to 43e74c0267a3 will return
> XDP_ABORTED on a non-0 flags value.
>
> -Toke
>




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux