bpf: allow BPF read access to qdisc pkt_len
The pkt_len field in qdisc_skb_cb stores the skb length as it will appear on the wire after segmentation. For byte accounting, this value is more accurate than skb->len. It is computed on entry to the TC layer, so only valid there. Allow read access to this field from BPF tc classifier and action programs. The implementation is analogous to tc_classid, aside from restricting to read access. To distinguish it from skb->len and self-describe export as wire_len. Changes v1->v2 - Rename pkt_len to wire_len Signed-off-by:Petar Penkov <ppenkov@google.com> Signed-off-by:
Vlad Dumitrescu <vladum@google.com> Signed-off-by:
Willem de Bruijn <willemb@google.com> Acked-by:
Song Liu <songliubraving@fb.com> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net>
Showing
- include/uapi/linux/bpf.h 1 addition, 0 deletionsinclude/uapi/linux/bpf.h
- net/core/filter.c 16 additions, 0 deletionsnet/core/filter.c
- tools/include/uapi/linux/bpf.h 1 addition, 0 deletionstools/include/uapi/linux/bpf.h
- tools/testing/selftests/bpf/test_verifier.c 32 additions, 0 deletionstools/testing/selftests/bpf/test_verifier.c
Loading
Please register or sign in to comment