# Re: \[PATCH bpf-next v2 1/8\] xdp: restructure redirect actions

- From: Björn Töpel \<hidden\>
- Date: 2021-01-20 17:36:18 
- List: netdev
- Page: https://ratatoskr.run/netdev/2021/01/7757902
- Thread: https://ratatoskr.run/netdev/2021/01/7757843/t.md

```text
On 2021-01-20 17:30, Toke Høiland-Jørgensen wrote:
> Björn Töpel [ref] writes:
>
[...]
>>
>> It can't be free'd but, ri->map can be cleared via
>> bpf_clear_redirect_map(). So, between the helper (setting) and the
>> tracepoint in xdp_do_redirect() it can be cleared (say if the XDP
>> program is swapped out, prior running xdp_do_redirect()).
>
> But xdp_do_redirect() should be called on driver flush before exiting
> the NAPI cycle, so how can the XDP program be swapped out?
>

To clarify; xdp_do_redirect() is called for each packet in the NAPI poll loop.

Yeah, you're right. The xdp_do_redirect() is within the RCU scope, so
the program wont be destroyed (but can be swapped though!).

Hmm, so IOW the bpf_clear_redirect_map() is not needed anymore...


Björn

[...]
```
