bpf: convert sockmap field attach_bpf_fd2 to type
authorJohn Fastabend <john.fastabend@gmail.com>
Mon, 28 Aug 2017 14:10:04 +0000 (07:10 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Aug 2017 18:13:21 +0000 (11:13 -0700)
commit464bc0fd6273d518aee79fbd37211dd9bc35d863
tree32280f0588583c50f6712de2ad0e3af886dcaadd
parent901c5d2fbfcdc5d1d49a7a835b9ce9be5eee6393
bpf: convert sockmap field attach_bpf_fd2 to type

In the initial sockmap API we provided strparser and verdict programs
using a single attach command by extending the attach API with a the
attach_bpf_fd2 field.

However, if we add other programs in the future we will be adding a
field for every new possible type, attach_bpf_fd(3,4,..). This
seems a bit clumsy for an API. So lets push the programs using two
new type fields.

   BPF_SK_SKB_STREAM_PARSER
   BPF_SK_SKB_STREAM_VERDICT

This has the advantage of having a readable name and can easily be
extended in the future.

Updates to samples and sockmap included here also generalize tests
slightly to support upcoming patch for multiple map support.

Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Fixes: 174a79ff9515 ("bpf: sockmap with sk redirect support")
Suggested-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 files changed:
include/linux/bpf.h
include/uapi/linux/bpf.h
kernel/bpf/sockmap.c
kernel/bpf/syscall.c
samples/sockmap/sockmap_kern.c
samples/sockmap/sockmap_user.c
tools/include/uapi/linux/bpf.h
tools/lib/bpf/bpf.c
tools/lib/bpf/bpf.h
tools/testing/selftests/bpf/bpf_helpers.h
tools/testing/selftests/bpf/sockmap_parse_prog.c
tools/testing/selftests/bpf/sockmap_verdict_prog.c
tools/testing/selftests/bpf/test_maps.c