On Tue, 9 Jun 2020 at 21:47, Toke Høiland-Jørgensen <toke@xxxxxxxxxx> wrote: > > Björn Töpel <bjorn.topel@xxxxxxxxx> writes: > > > From: Björn Töpel <bjorn.topel@xxxxxxxxx> > > > > If an XDP program, where all the bpf_redirect_map() calls are tail > > calls (as defined by the previous commit), the driver does not need to > > explicitly call xdp_do_redirect(). > > > > The driver checks the active XDP program, and notifies the BPF helper > > indirectly via xdp_set_redirect_tailcall(). > > > > This is just a naive, as-simple-as-possible implementation, calling > > xdp_set_redirect_tailcall() for each packet. > > Do you really need the driver changes? The initial setup could be moved > to bpf_prog_run_xdp(), and xdp_do_redirect() could be changed to an > inline wrapper that just checks a flag and immediately returns 0 if the > redirect action was already performed. Or am I missing some reason why > this wouldn't work? > Indeed! That's a good idea! Björn > -Toke >