diff options
author | Daniel Borkmann | 2020-06-02 16:58:33 +0200 |
---|---|---|
committer | Alexei Starovoitov | 2020-06-02 11:50:23 -0700 |
commit | 7cdec54f9713256bb170873a1fc5c75c9127c9d2 (patch) | |
tree | 2de575e883f9cb33b9722b135a4a54c352cdb984 /include/uapi/linux/hiddev.h | |
parent | 836e66c218f355ec01ba57671c85abf32961dcea (diff) |
bpf: Add csum_level helper for fixing up csum levels
Add a bpf_csum_level() helper which BPF programs can use in combination
with bpf_skb_adjust_room() when they pass in BPF_F_ADJ_ROOM_NO_CSUM_RESET
flag to the latter to avoid falling back to CHECKSUM_NONE.
The bpf_csum_level() allows to adjust CHECKSUM_UNNECESSARY skb->csum_levels
via BPF_CSUM_LEVEL_{INC,DEC} which calls __skb_{incr,decr}_checksum_unnecessary()
on the skb. The helper also allows a BPF_CSUM_LEVEL_RESET which sets the skb's
csum to CHECKSUM_NONE as well as a BPF_CSUM_LEVEL_QUERY to just return the
current level. Without this helper, there is no way to otherwise adjust the
skb->csum_level. I did not add an extra dummy flags as there is plenty of free
bitspace in level argument itself iff ever needed in future.
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Alan Maguire <alan.maguire@oracle.com>
Acked-by: Lorenz Bauer <lmb@cloudflare.com>
Link: https://lore.kernel.org/bpf/279ae3717cb3d03c0ffeb511493c93c450a01e1a.1591108731.git.daniel@iogearbox.net
Diffstat (limited to 'include/uapi/linux/hiddev.h')
0 files changed, 0 insertions, 0 deletions