History

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.

John Fastabend committed 9 years ago

Commit 464bc0f1 parent 901c5d213 files · +116 −151Browse files

Showing the changes to include/uapi/linux (1 of 13 files). Show all

Unified · Split

include/uapi/linux/bpf.h+3−6
@@ -136,7 +136,8 @@ enum bpf_attach_type { · 135 unmodified lines
136136 BPF_CGROUP_INET_EGRESS,
137137 BPF_CGROUP_INET_SOCK_CREATE,
138138 BPF_CGROUP_SOCK_OPS,
139− BPF_CGROUP_SMAP_INGRESS,
139+ BPF_SK_SKB_STREAM_PARSER,
140+ BPF_SK_SKB_STREAM_VERDICT,
140141 __MAX_BPF_ATTACH_TYPE
141142 };
142143
@@ -224,7 +225,6 @@ union bpf_attr { · 81 unmodified lines
224225 __u32 attach_bpf_fd; /* eBPF program to attach */
225226 __u32 attach_type;
226227 __u32 attach_flags;
227− __u32 attach_bpf_fd2;
228228 };
229229
230230 struct { /* anonymous struct used by BPF_PROG_TEST_RUN command */
@@ -580,14 +580,11 @@ union bpf_attr { · 349 unmodified lines
580580 * @flags: reserved for future use
581581 * Return: SK_REDIRECT
582582 *
583− * int bpf_sock_map_update(skops, map, key, flags, map_flags)
583+ * int bpf_sock_map_update(skops, map, key, flags)
584584 * @skops: pointer to bpf_sock_ops
585585 * @map: pointer to sockmap to update
586586 * @key: key to insert/update sock in map
587587 * @flags: same flags as map update elem
588− * @map_flags: sock map specific flags
589− * bit 1: Enable strparser
590− * other bits: reserved
591588 */
592589 #define __BPF_FUNC_MAPPER(FN) \
593590 FN(unspec), \