linma / rpms / iproute

Forked from rpms/iproute 4 years ago
Clone

Blame SOURCES/0067-uapi-update-bpf-header.patch

7e752c
From 415044d7e6f956daec990a7ae358f9f324bd2dcd Mon Sep 17 00:00:00 2001
7e752c
From: Andrea Claudi <aclaudi@redhat.com>
7e752c
Date: Thu, 13 Jun 2019 14:37:57 +0200
7e752c
Subject: [PATCH] uapi: update bpf header
7e752c
7e752c
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1716361
7e752c
Upstream Status: iproute2.git commit 028766aed21a4
7e752c
7e752c
commit 028766aed21a4d8eb2e60c9ef667f75f9354a104
7e752c
Author: Stephen Hemminger <stephen@networkplumber.org>
7e752c
Date:   Mon Dec 10 09:22:23 2018 -0800
7e752c
7e752c
    uapi: update bpf header
7e752c
7e752c
    Changes from 4.20-rc6
7e752c
7e752c
    Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
7e752c
---
7e752c
 include/uapi/linux/bpf.h | 56 ++++++++++++++++++++++++++--------------
7e752c
 1 file changed, 37 insertions(+), 19 deletions(-)
7e752c
7e752c
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
7e752c
index 2bbe33db8aefa..ff651ca661308 100644
7e752c
--- a/include/uapi/linux/bpf.h
7e752c
+++ b/include/uapi/linux/bpf.h
7e752c
@@ -2170,7 +2170,7 @@ union bpf_attr {
7e752c
  *	Return
7e752c
  *		0 on success, or a negative error in case of failure.
7e752c
  *
7e752c
- * struct bpf_sock *bpf_sk_lookup_tcp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u32 netns, u64 flags)
7e752c
+ * struct bpf_sock *bpf_sk_lookup_tcp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags)
7e752c
  *	Description
7e752c
  *		Look for TCP socket matching *tuple*, optionally in a child
7e752c
  *		network namespace *netns*. The return value must be checked,
7e752c
@@ -2187,12 +2187,14 @@ union bpf_attr {
7e752c
  *		**sizeof**\ (*tuple*\ **->ipv6**)
7e752c
  *			Look for an IPv6 socket.
7e752c
  *
7e752c
- *		If the *netns* is zero, then the socket lookup table in the
7e752c
- *		netns associated with the *ctx* will be used. For the TC hooks,
7e752c
- *		this in the netns of the device in the skb. For socket hooks,
7e752c
- *		this in the netns of the socket. If *netns* is non-zero, then
7e752c
- *		it specifies the ID of the netns relative to the netns
7e752c
- *		associated with the *ctx*.
7e752c
+ *		If the *netns* is a negative signed 32-bit integer, then the
7e752c
+ *		socket lookup table in the netns associated with the *ctx* will
7e752c
+ *		will be used. For the TC hooks, this is the netns of the device
7e752c
+ *		in the skb. For socket hooks, this is the netns of the socket.
7e752c
+ *		If *netns* is any other signed 32-bit value greater than or
7e752c
+ *		equal to zero then it specifies the ID of the netns relative to
7e752c
+ *		the netns associated with the *ctx*. *netns* values beyond the
7e752c
+ *		range of 32-bit integers are reserved for future use.
7e752c
  *
7e752c
  *		All values for *flags* are reserved for future usage, and must
7e752c
  *		be left at zero.
7e752c
@@ -2201,8 +2203,10 @@ union bpf_attr {
7e752c
  *		**CONFIG_NET** configuration option.
7e752c
  *	Return
7e752c
  *		Pointer to *struct bpf_sock*, or NULL in case of failure.
7e752c
+ *		For sockets with reuseport option, the *struct bpf_sock*
7e752c
+ *		result is from reuse->socks[] using the hash of the tuple.
7e752c
  *
7e752c
- * struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u32 netns, u64 flags)
7e752c
+ * struct bpf_sock *bpf_sk_lookup_udp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags)
7e752c
  *	Description
7e752c
  *		Look for UDP socket matching *tuple*, optionally in a child
7e752c
  *		network namespace *netns*. The return value must be checked,
7e752c
@@ -2219,12 +2223,14 @@ union bpf_attr {
7e752c
  *		**sizeof**\ (*tuple*\ **->ipv6**)
7e752c
  *			Look for an IPv6 socket.
7e752c
  *
7e752c
- *		If the *netns* is zero, then the socket lookup table in the
7e752c
- *		netns associated with the *ctx* will be used. For the TC hooks,
7e752c
- *		this in the netns of the device in the skb. For socket hooks,
7e752c
- *		this in the netns of the socket. If *netns* is non-zero, then
7e752c
- *		it specifies the ID of the netns relative to the netns
7e752c
- *		associated with the *ctx*.
7e752c
+ *		If the *netns* is a negative signed 32-bit integer, then the
7e752c
+ *		socket lookup table in the netns associated with the *ctx* will
7e752c
+ *		will be used. For the TC hooks, this is the netns of the device
7e752c
+ *		in the skb. For socket hooks, this is the netns of the socket.
7e752c
+ *		If *netns* is any other signed 32-bit value greater than or
7e752c
+ *		equal to zero then it specifies the ID of the netns relative to
7e752c
+ *		the netns associated with the *ctx*. *netns* values beyond the
7e752c
+ *		range of 32-bit integers are reserved for future use.
7e752c
  *
7e752c
  *		All values for *flags* are reserved for future usage, and must
7e752c
  *		be left at zero.
7e752c
@@ -2233,6 +2239,8 @@ union bpf_attr {
7e752c
  *		**CONFIG_NET** configuration option.
7e752c
  *	Return
7e752c
  *		Pointer to *struct bpf_sock*, or NULL in case of failure.
7e752c
+ *		For sockets with reuseport option, the *struct bpf_sock*
7e752c
+ *		result is from reuse->socks[] using the hash of the tuple.
7e752c
  *
7e752c
  * int bpf_sk_release(struct bpf_sock *sk)
7e752c
  *	Description
7e752c
@@ -2405,6 +2413,9 @@ enum bpf_func_id {
7e752c
 /* BPF_FUNC_perf_event_output for sk_buff input context. */
7e752c
 #define BPF_F_CTXLEN_MASK		(0xfffffULL << 32)
7e752c
 
7e752c
+/* Current network namespace */
7e752c
+#define BPF_F_CURRENT_NETNS		(-1L)
7e752c
+
7e752c
 /* Mode for BPF_FUNC_skb_adjust_room helper. */
7e752c
 enum bpf_adj_room_mode {
7e752c
 	BPF_ADJ_ROOM_NET,
7e752c
@@ -2422,6 +2433,12 @@ enum bpf_lwt_encap_mode {
7e752c
 	BPF_LWT_ENCAP_SEG6_INLINE
7e752c
 };
7e752c
 
7e752c
+#define __bpf_md_ptr(type, name)	\
7e752c
+union {					\
7e752c
+	type name;			\
7e752c
+	__u64 :64;			\
7e752c
+} __attribute__((aligned(8)))
7e752c
+
7e752c
 /* user accessible mirror of in-kernel sk_buff.
7e752c
  * new fields can only be added to the end of this structure
7e752c
  */
7e752c
@@ -2456,7 +2473,7 @@ struct __sk_buff {
7e752c
 	/* ... here. */
7e752c
 
7e752c
 	__u32 data_meta;
7e752c
-	struct bpf_flow_keys *flow_keys;
7e752c
+	__bpf_md_ptr(struct bpf_flow_keys *, flow_keys);
7e752c
 };
7e752c
 
7e752c
 struct bpf_tunnel_key {
7e752c
@@ -2572,8 +2589,8 @@ enum sk_action {
7e752c
  * be added to the end of this structure
7e752c
  */
7e752c
 struct sk_msg_md {
7e752c
-	void *data;
7e752c
-	void *data_end;
7e752c
+	__bpf_md_ptr(void *, data);
7e752c
+	__bpf_md_ptr(void *, data_end);
7e752c
 
7e752c
 	__u32 family;
7e752c
 	__u32 remote_ip4;	/* Stored in network byte order */
7e752c
@@ -2589,8 +2606,9 @@ struct sk_reuseport_md {
7e752c
 	 * Start of directly accessible data. It begins from
7e752c
 	 * the tcp/udp header.
7e752c
 	 */
7e752c
-	void *data;
7e752c
-	void *data_end;		/* End of directly accessible data */
7e752c
+	__bpf_md_ptr(void *, data);
7e752c
+	/* End of directly accessible data */
7e752c
+	__bpf_md_ptr(void *, data_end);
7e752c
 	/*
7e752c
 	 * Total length of packet (starting from the tcp/udp header).
7e752c
 	 * Note that the directly accessible bytes (data_end - data)
7e752c
-- 
7e752c
2.20.1
7e752c