History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next

Daniel Borkmann says: ==================== pull-request: bpf-next 2018-08-13 The following pull-request contains BPF updates for your *net-next* tree. The main changes are: 1) Add driver XDP support for veth. This can be used in conjunction with redirect of another XDP program e.g. sitting on NIC so the xdp_frame can be forwarded to the peer veth directly without modification, from Toshiaki. 2) Add a new BPF map type REUSEPORT_SOCKARRAY and prog type SK_REUSEPORT in order to provide more control and visibility on where a SO_REUSEPORT sk should be located, and the latter enables to directly select a sk from the bpf map. This also enables map-in-map for application migration use cases, from Martin. 3) Add a new BPF helper bpf_skb_ancestor_cgroup_id() that returns the id of cgroup v2 that is the ancestor of the cgroup associated with the skb at the ancestor_level, from Andrey. 4) Implement BPF fs map pretty-print support based on BTF data for regular hash table and LRU map, from Yonghong. 5) Decouple the ability to attach BTF for a map from the key and value pretty-printer in BPF fs, and enable further support of BTF for maps for percpu and LPM trie, from Daniel. 6) Implement a better BPF sample of using XDP's CPU redirect feature for load balancing SKB processing to remote CPU. The sample implements the same XDP load balancing as Suricata does which is symmetric hash based on IP and L4 protocol, from Jesper. 7) Revert adding NULL pointer check with WARN_ON_ONCE() in __xdp_return()'s critical path as it is ensured that the allocator is present, from Björn. ====================

David S. Miller committed 8 years ago

Commit c1617fb2 parents 961d973 2ce320656 files · +3707 −176Browse files

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

Unified · Split

include/uapi/linux/bpf.h+55−1
@@ -126,6 +126,7 @@ enum bpf_map_type { · 125 unmodified lines
126126 BPF_MAP_TYPE_XSKMAP,
127127 BPF_MAP_TYPE_SOCKHASH,
128128 BPF_MAP_TYPE_CGROUP_STORAGE,
129+ BPF_MAP_TYPE_REUSEPORT_SOCKARRAY,
129130 };
130131
131132 enum bpf_prog_type {
@@ -150,6 +151,7 @@ enum bpf_prog_type { · 18 unmodified lines
150151 BPF_PROG_TYPE_CGROUP_SOCK_ADDR,
151152 BPF_PROG_TYPE_LWT_SEG6LOCAL,
152153 BPF_PROG_TYPE_LIRC_MODE2,
154+ BPF_PROG_TYPE_SK_REUSEPORT,
153155 };
154156
155157 enum bpf_attach_type {
@@ -2091,6 +2093,24 @@ union bpf_attr { · 1935 unmodified lines
20912093 * Return
20922094 * The id is returned or 0 in case the id could not be retrieved.
20932095 *
2096+ * u64 bpf_skb_ancestor_cgroup_id(struct sk_buff *skb, int ancestor_level)
2097+ * Description
2098+ * Return id of cgroup v2 that is ancestor of cgroup associated
2099+ * with the *skb* at the *ancestor_level*. The root cgroup is at
2100+ * *ancestor_level* zero and each step down the hierarchy
2101+ * increments the level. If *ancestor_level* == level of cgroup
2102+ * associated with *skb*, then return value will be same as that
2103+ * of **bpf_skb_cgroup_id**\ ().
2104+ *
2105+ * The helper is useful to implement policies based on cgroups
2106+ * that are upper in hierarchy than immediate cgroup associated
2107+ * with *skb*.
2108+ *
2109+ * The format of returned id and helper limitations are same as in
2110+ * **bpf_skb_cgroup_id**\ ().
2111+ * Return
2112+ * The id is returned or 0 in case the id could not be retrieved.
2113+ *
20942114 * u64 bpf_get_current_cgroup_id(void)
20952115 * Return
20962116 * A 64-bit integer containing the current cgroup id based
@@ -2113,6 +2133,14 @@ union bpf_attr { · 16 unmodified lines
21132133 * the shared data.
21142134 * Return
21152135 * Pointer to the local storage area.
2136+ *
2137+ * int bpf_sk_select_reuseport(struct sk_reuseport_md *reuse, struct bpf_map *map, void *key, u64 flags)
2138+ * Description
2139+ * Select a SO_REUSEPORT sk from a BPF_MAP_TYPE_REUSEPORT_ARRAY map
2140+ * It checks the selected sk is matching the incoming
2141+ * request in the skb.
2142+ * Return
2143+ * 0 on success, or a negative error in case of failure.
21162144 */
21172145 #define __BPF_FUNC_MAPPER(FN) \
21182146 FN(unspec), \
@@ -2196,7 +2224,9 @@ union bpf_attr { · 77 unmodified lines
21962224 FN(rc_keydown), \
21972225 FN(skb_cgroup_id), \
21982226 FN(get_current_cgroup_id), \
2199− FN(get_local_storage),
2227+ FN(get_local_storage), \
2228+ FN(sk_select_reuseport), \
2229+ FN(skb_ancestor_cgroup_id),
22002230
22012231 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
22022232 * function eBPF program intends to call
@@ -2413,6 +2443,30 @@ struct sk_msg_md { · 210 unmodified lines
24132443 __u32 local_port; /* stored in host byte order */
24142444 };
24152445
2446+struct sk_reuseport_md {
2447+ /*
2448+ * Start of directly accessible data. It begins from
2449+ * the tcp/udp header.
2450+ */
2451+ void *data;
2452+ void *data_end; /* End of directly accessible data */
2453+ /*
2454+ * Total length of packet (starting from the tcp/udp header).
2455+ * Note that the directly accessible bytes (data_end - data)
2456+ * could be less than this "len". Those bytes could be
2457+ * indirectly read by a helper "bpf_skb_load_bytes()".
2458+ */
2459+ __u32 len;
2460+ /*
2461+ * Eth protocol in the mac header (network byte order). e.g.
2462+ * ETH_P_IP(0x0800) and ETH_P_IPV6(0x86DD)
2463+ */
2464+ __u32 eth_protocol;
2465+ __u32 ip_protocol; /* IP protocol. e.g. IPPROTO_TCP, IPPROTO_UDP */
2466+ __u32 bind_inany; /* Is sock bound to an INANY address? */
2467+ __u32 hash; /* A hash of the packet 4 tuples */
2468+};
2469+
24162470 #define BPF_TAG_SIZE 8
24172471
24182472 struct bpf_prog_info {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t