On Thu, Sep 8, 2022 at 1:10 AM Joanne Koong <joannelkoong@xxxxxxxxx> wrote: > > Add two new helper functions: bpf_dynptr_trim and bpf_dynptr_advance. > > bpf_dynptr_trim decreases the size of a dynptr by the specified > number of bytes (offset remains the same). bpf_dynptr_advance advances > the offset of the dynptr by the specified number of bytes (size > decreases correspondingly). > > One example where trimming / advancing the dynptr may useful is for > hashing. If the dynptr points to a larger struct, it is possible to hash > an individual field within the struct through dynptrs by using > bpf_dynptr_advance+trim. > > Signed-off-by: Joanne Koong <joannelkoong@xxxxxxxxx> Acked-by: Song Liu <song@xxxxxxxxxx>