Skip to content

bpf: introduce skb refcount kfuncs

Maciej Fijalkowski bpf netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 10 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3bpf: call btf_is_projection_of() conditionallyinclude/linux/btf.h kernel/bpf/btf.c kernel/bpf/verifier.c+10 -80 replies
2/3bpf: add kfunc for skb refcountingnet/core/filter.c+62 -06 replies
3/3selftests: bpf: implement test case for skb kptr map storagetools/testing/selftests/bpf/prog_tests/skb_map_kptrs.c tools/testing/selftests/bpf/progs/skb_map_kptrs.c+152 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH bpf-next 0/3] bpf: introduce skb refcount kfuncs

Hi!

This patchset provides what is needed for storing skbs as kptrs in bpf maps. We start with necessary kernel change as discussed at [0] with Martin, then next patch adds kfuncs for handling skb refcount and on top of that a test case is added where one program stores skbs and then next program is able to retrieve them from map.

Martin, regarding the kernel change I decided to go with boolean approach instead of what you initially suggested. Let me know if it works for you.

Thanks,
Maciej

[0]: https://lore.kernel.org/bpf/Z0X%2F9PhIhvQwsgfW@boxer/

Maciej Fijalkowski (3):
bpf: call btf_is_projection_of() conditionally
bpf: add kfunc for skb refcounting
selftests: bpf: implement test case for skb kptr map storage

 include/linux/btf.h                           |  4 +-
 kernel/bpf/btf.c                              | 11 +--
 kernel/bpf/verifier.c                         |  3 +-
 net/core/filter.c                             | 62 +++++++++++++++
 .../selftests/bpf/prog_tests/skb_map_kptrs.c  | 75 ++++++++++++++++++
 .../selftests/bpf/progs/skb_map_kptrs.c       | 77 +++++++++++++++++++
 6 files changed, 224 insertions(+), 8 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/skb_map_kptrs.c
 create mode 100644 tools/testing/selftests/bpf/progs/skb_map_kptrs.c
Signature · 1 line
2.43.0