naccyde / rpms / iproute

Forked from rpms/iproute a year ago
Clone

Blame SOURCES/0007-uapi-update-bpf-headers.patch

d8fb9e
From 6bc664d133faa4c04b5ad4fdcdca06f68616783e Mon Sep 17 00:00:00 2001
d8fb9e
From: Andrea Claudi <aclaudi@redhat.com>
d8fb9e
Date: Tue, 21 Apr 2020 14:53:23 +0200
d8fb9e
Subject: [PATCH] uapi: update bpf headers
d8fb9e
d8fb9e
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1637437
d8fb9e
Upstream Status: iproute2.git commit 0ebb420929dd1
d8fb9e
d8fb9e
commit 0ebb420929dd18562a1f76e9d09015719b913f75
d8fb9e
Author: Stephen Hemminger <stephen@networkplumber.org>
d8fb9e
Date:   Thu Aug 30 07:55:49 2018 -0700
d8fb9e
d8fb9e
    uapi: update bpf headers
d8fb9e
d8fb9e
    Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
d8fb9e
---
d8fb9e
 include/uapi/linux/bpf.h | 56 +++++++++++++++++++++++++++++++++++++++-
d8fb9e
 1 file changed, 55 insertions(+), 1 deletion(-)
d8fb9e
d8fb9e
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
d8fb9e
index 4bbe7e5d4c800..8eb284d2f1acb 100644
d8fb9e
--- a/include/uapi/linux/bpf.h
d8fb9e
+++ b/include/uapi/linux/bpf.h
d8fb9e
@@ -126,6 +126,7 @@ enum bpf_map_type {
d8fb9e
 	BPF_MAP_TYPE_XSKMAP,
d8fb9e
 	BPF_MAP_TYPE_SOCKHASH,
d8fb9e
 	BPF_MAP_TYPE_CGROUP_STORAGE,
d8fb9e
+	BPF_MAP_TYPE_REUSEPORT_SOCKARRAY,
d8fb9e
 };
d8fb9e
 
d8fb9e
 enum bpf_prog_type {
d8fb9e
@@ -150,6 +151,7 @@ enum bpf_prog_type {
d8fb9e
 	BPF_PROG_TYPE_CGROUP_SOCK_ADDR,
d8fb9e
 	BPF_PROG_TYPE_LWT_SEG6LOCAL,
d8fb9e
 	BPF_PROG_TYPE_LIRC_MODE2,
d8fb9e
+	BPF_PROG_TYPE_SK_REUSEPORT,
d8fb9e
 };
d8fb9e
 
d8fb9e
 enum bpf_attach_type {
d8fb9e
@@ -2091,6 +2093,24 @@ union bpf_attr {
d8fb9e
  * 	Return
d8fb9e
  * 		The id is returned or 0 in case the id could not be retrieved.
d8fb9e
  *
d8fb9e
+ * u64 bpf_skb_ancestor_cgroup_id(struct sk_buff *skb, int ancestor_level)
d8fb9e
+ *	Description
d8fb9e
+ *		Return id of cgroup v2 that is ancestor of cgroup associated
d8fb9e
+ *		with the *skb* at the *ancestor_level*.  The root cgroup is at
d8fb9e
+ *		*ancestor_level* zero and each step down the hierarchy
d8fb9e
+ *		increments the level. If *ancestor_level* == level of cgroup
d8fb9e
+ *		associated with *skb*, then return value will be same as that
d8fb9e
+ *		of **bpf_skb_cgroup_id**\ ().
d8fb9e
+ *
d8fb9e
+ *		The helper is useful to implement policies based on cgroups
d8fb9e
+ *		that are upper in hierarchy than immediate cgroup associated
d8fb9e
+ *		with *skb*.
d8fb9e
+ *
d8fb9e
+ *		The format of returned id and helper limitations are same as in
d8fb9e
+ *		**bpf_skb_cgroup_id**\ ().
d8fb9e
+ *	Return
d8fb9e
+ *		The id is returned or 0 in case the id could not be retrieved.
d8fb9e
+ *
d8fb9e
  * u64 bpf_get_current_cgroup_id(void)
d8fb9e
  * 	Return
d8fb9e
  * 		A 64-bit integer containing the current cgroup id based
d8fb9e
@@ -2113,6 +2133,14 @@ union bpf_attr {
d8fb9e
  *		the shared data.
d8fb9e
  *	Return
d8fb9e
  *		Pointer to the local storage area.
d8fb9e
+ *
d8fb9e
+ * int bpf_sk_select_reuseport(struct sk_reuseport_md *reuse, struct bpf_map *map, void *key, u64 flags)
d8fb9e
+ *	Description
d8fb9e
+ *		Select a SO_REUSEPORT sk from a	BPF_MAP_TYPE_REUSEPORT_ARRAY map
d8fb9e
+ *		It checks the selected sk is matching the incoming
d8fb9e
+ *		request in the skb.
d8fb9e
+ *	Return
d8fb9e
+ *		0 on success, or a negative error in case of failure.
d8fb9e
  */
d8fb9e
 #define __BPF_FUNC_MAPPER(FN)		\
d8fb9e
 	FN(unspec),			\
d8fb9e
@@ -2196,7 +2224,9 @@ union bpf_attr {
d8fb9e
 	FN(rc_keydown),			\
d8fb9e
 	FN(skb_cgroup_id),		\
d8fb9e
 	FN(get_current_cgroup_id),	\
d8fb9e
-	FN(get_local_storage),
d8fb9e
+	FN(get_local_storage),		\
d8fb9e
+	FN(sk_select_reuseport),	\
d8fb9e
+	FN(skb_ancestor_cgroup_id),
d8fb9e
 
d8fb9e
 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
d8fb9e
  * function eBPF program intends to call
d8fb9e
@@ -2413,6 +2443,30 @@ struct sk_msg_md {
d8fb9e
 	__u32 local_port;	/* stored in host byte order */
d8fb9e
 };
d8fb9e
 
d8fb9e
+struct sk_reuseport_md {
d8fb9e
+	/*
d8fb9e
+	 * Start of directly accessible data. It begins from
d8fb9e
+	 * the tcp/udp header.
d8fb9e
+	 */
d8fb9e
+	void *data;
d8fb9e
+	void *data_end;		/* End of directly accessible data */
d8fb9e
+	/*
d8fb9e
+	 * Total length of packet (starting from the tcp/udp header).
d8fb9e
+	 * Note that the directly accessible bytes (data_end - data)
d8fb9e
+	 * could be less than this "len".  Those bytes could be
d8fb9e
+	 * indirectly read by a helper "bpf_skb_load_bytes()".
d8fb9e
+	 */
d8fb9e
+	__u32 len;
d8fb9e
+	/*
d8fb9e
+	 * Eth protocol in the mac header (network byte order). e.g.
d8fb9e
+	 * ETH_P_IP(0x0800) and ETH_P_IPV6(0x86DD)
d8fb9e
+	 */
d8fb9e
+	__u32 eth_protocol;
d8fb9e
+	__u32 ip_protocol;	/* IP protocol. e.g. IPPROTO_TCP, IPPROTO_UDP */
d8fb9e
+	__u32 bind_inany;	/* Is sock bound to an INANY address? */
d8fb9e
+	__u32 hash;		/* A hash of the packet 4 tuples */
d8fb9e
+};
d8fb9e
+
d8fb9e
 #define BPF_TAG_SIZE	8
d8fb9e
 
d8fb9e
 struct bpf_prog_info {
d8fb9e
-- 
d8fb9e
2.25.3
d8fb9e