# Re: \[PATCH bpf-next v4 1/2\] bpf, xdp: make bpf\_redirect\_map() a map operation

- From: Jesper Dangaard Brouer \<hidden\>
- Date: 2021-02-26 14:31:55 
- List: netdev
- Page: https://ratatoskr.run/netdev/2021/02/7761505
- Thread: https://ratatoskr.run/netdev/2021/02/7761492/t.md

```text
On Fri, 26 Feb 2021 12:37:40 +0100
Toke Høiland-Jørgensen [ref] wrote:

> Björn Töpel [ref] writes:
> 
> > From: Björn Töpel <redacted>
> >
> > Currently the bpf_redirect_map() implementation dispatches to the
> > correct map-lookup function via a switch-statement. To avoid the
> > dispatching, this change adds bpf_redirect_map() as a map
> > operation. Each map provides its bpf_redirect_map() version, and
> > correct function is automatically selected by the BPF verifier.
> >
> > A nice side-effect of the code movement is that the map lookup
> > functions are now local to the map implementation files, which removes
> > one additional function call.
> >
> > Signed-off-by: Björn Töpel <redacted>  
> 
> Nice! I agree that this is a much nicer approach! :)

I agree :-)

Acked-by: Jesper Dangaard Brouer <redacted>

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

```
