On Fri, 5 Sep 2025 10:33:47 -0700 Amery Hung wrote: > + * Direct packet access allows reading and writing linear XDP data through > + * packet pointers (i.e., &xdp_md->data + offsets). Add: The amount of data which ends up in the linear part of the xdp_buf depends on the NIC and its configuration. > When an eBPF program wants > + * to directly access data that may be in the non-linear area, call this kfunc ^^^^ maybe s/data/headers > + * to make sure the data is available in the linear area. Should we add a mention here of the copy helpers and dynptr for accessing data without pulling? > + * This kfunc can also be used with bpf_xdp_adjust_head() to decapsulate > + * headers in the non-linear data area. > + * > + * A call to this kfunc is susceptible to change the underlying packet buffer. Maybe: A call to this kfunc will modify the buffer geometry. > + * Therefore, at load time, all checks on pointers previously done by the > + * verifier are invalidated and must be performed again, if the kfunc is used > + * in combination with direct packet access. > void *data_end = xdp->data + len; nit: I think the code would be easier to follow if we renamed this to "new_end"? Larger note: I wonder if we should support "shifting the buffer down" if there's insufficient tailroom. XDP has rather copious headroom, but tailroom may be pretty tight, and it may depend on the length of the headers. So if there's not enough tailroom but there's enough headroom -- should we try to memmove the existing headers?