On 11/10/26 04:57, Tianyi Gao wrote:
bpf_xdp_skb_ext_del() deletes the stored entry for an id. A program on
cpumap or veth can use it to drop RX metadata that an earlier program
stored.

Without the XDP_FLAGS_HAS_SKB_EXT flag, the kfunc does nothing, because
the header bytes may then belong to the packet.

The kfunc only clears XDP_SKB_EXT_ENTRY_ACTIVE, so a later store of the
same id reuses its offset. The flag and the size of the area stay the
same, also after the last delete. To give the bytes back, the kfunc
would have to move the entries after the deleted one. The cost is
headroom that bpf_xdp_adjust_head() and bpf_xdp_adjust_meta() cannot
use.

Signed-off-by: Tianyi Gao <[email protected]>
---
__skb_ext_del() frees struct skb_ext after the last delete, because it
comes from a slab cache. The skb core extension area uses existing
headroom, so it is not freed.
---
  include/net/xdp.h |  8 ++++++++
  net/core/xdp.c    | 26 ++++++++++++++++++++++++++
  2 files changed, 34 insertions(+)

I think this approach of simply disabling the entry is okay.
This is trading off performance vs small area memory usage.

Acked-by: Jesper Dangaard Brouer <[email protected]>

--Jesper

Reply via email to