Blame SOURCES/bcc-0.16.0-sync-with-libbpf-repo.patch

bed121
From da9ec2b1673ddf6b956304dca6ed6918d89d4631 Mon Sep 17 00:00:00 2001
bed121
From: Yonghong Song <yhs@fb.com>
bed121
Date: Sat, 22 Aug 2020 15:19:46 -0700
bed121
Subject: [PATCH] sync with libbpf repo
bed121
bed121
sync with latest libbpf repo.
bed121
bed121
Strut definition for btf_ext_header is defined in libbpf/src/btf.h
bed121
previously and used by bcc. Now, the struct is moved to
bed121
libbpf/src/libbpf_internal.h and not available to bcc.
bed121
We do not want to include libbpf/src/libbpf_internal.h as
bed121
it is really libbpf internal. Let us define bcc version
bed121
of btf_ext_header with struct name bcc_btf_ext_header.
bed121
The new name is to avoid conflict when compiling with
bed121
old libbpf package.
bed121
bed121
Signed-off-by: Yonghong Song <yhs@fb.com>
bed121
---
bed121
 src/cc/bcc_btf.cc                 |  2 +-
bed121
 src/cc/bcc_btf.h                  | 17 +++++++++++++++++
bed121
 src/cc/compat/linux/virtual_bpf.h | 17 ++++++++++++-----
bed121
 4 files changed, 31 insertions(+), 7 deletions(-)
bed121
bed121
diff --git a/src/cc/bcc_btf.cc b/src/cc/bcc_btf.cc
bed121
index e220f117..1056950c 100644
bed121
--- a/src/cc/bcc_btf.cc
bed121
+++ b/src/cc/bcc_btf.cc
bed121
@@ -185,7 +185,7 @@ void BTF::adjust(uint8_t *btf_sec, uintptr_t btf_sec_size,
bed121
   }
bed121
 
bed121
   struct btf_header *hdr = (struct btf_header *)btf_sec;
bed121
-  struct btf_ext_header *ehdr = (struct btf_ext_header *)btf_ext_sec;
bed121
+  struct bcc_btf_ext_header *ehdr = (struct bcc_btf_ext_header *)btf_ext_sec;
bed121
 
bed121
   // Fixup btf for old kernels or kernel requirements.
bed121
   fixup_btf(btf_sec + hdr->hdr_len + hdr->type_off, hdr->type_len,
bed121
diff --git a/src/cc/bcc_btf.h b/src/cc/bcc_btf.h
bed121
index 438c1f73..75b47cc3 100644
bed121
--- a/src/cc/bcc_btf.h
bed121
+++ b/src/cc/bcc_btf.h
bed121
@@ -45,6 +45,23 @@ class BTFStringTable {
bed121
 };
bed121
 
bed121
 class BTF {
bed121
+  struct bcc_btf_ext_header {
bed121
+    uint16_t magic;
bed121
+    uint8_t version;
bed121
+    uint8_t flags;
bed121
+    uint32_t hdr_len;
bed121
+
bed121
+    /* All offsets are in bytes relative to the end of this header */
bed121
+    uint32_t func_info_off;
bed121
+    uint32_t func_info_len;
bed121
+    uint32_t line_info_off;
bed121
+    uint32_t line_info_len;
bed121
+
bed121
+    /* optional part of .BTF.ext header */
bed121
+    uint32_t core_relo_off;
bed121
+    uint32_t core_relo_len;
bed121
+};
bed121
+
bed121
  public:
bed121
   BTF(bool debug, sec_map_def &sections);
bed121
   ~BTF();
bed121
diff --git a/src/cc/compat/linux/virtual_bpf.h b/src/cc/compat/linux/virtual_bpf.h
bed121
index 38262630..0387b970 100644
bed121
--- a/src/cc/compat/linux/virtual_bpf.h
bed121
+++ b/src/cc/compat/linux/virtual_bpf.h
bed121
@@ -768,7 +768,7 @@ union bpf_attr {
bed121
  *
bed121
  * 		Also, note that **bpf_trace_printk**\ () is slow, and should
bed121
  * 		only be used for debugging purposes. For this reason, a notice
bed121
- * 		bloc (spanning several lines) is printed to kernel logs and
bed121
+ * 		block (spanning several lines) is printed to kernel logs and
bed121
  * 		states that the helper should not be used "for production use"
bed121
  * 		the first time this helper is used (or more precisely, when
bed121
  * 		**trace_printk**\ () buffers are allocated). For passing values
bed121
@@ -1034,14 +1034,14 @@ union bpf_attr {
bed121
  *
bed121
  * 			int ret;
bed121
  * 			struct bpf_tunnel_key key = {};
bed121
- * 			
bed121
+ *
bed121
  * 			ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), 0);
bed121
  * 			if (ret < 0)
bed121
  * 				return TC_ACT_SHOT;	// drop packet
bed121
- * 			
bed121
+ *
bed121
  * 			if (key.remote_ipv4 != 0x0a000001)
bed121
  * 				return TC_ACT_SHOT;	// drop packet
bed121
- * 			
bed121
+ *
bed121
  * 			return TC_ACT_OK;		// accept packet
bed121
  *
bed121
  * 		This interface can also be used with all encapsulation devices
bed121
@@ -1148,7 +1148,7 @@ union bpf_attr {
bed121
  * 	Description
bed121
  * 		Retrieve the realm or the route, that is to say the
bed121
  * 		**tclassid** field of the destination for the *skb*. The
bed121
- * 		indentifier retrieved is a user-provided tag, similar to the
bed121
+ * 		identifier retrieved is a user-provided tag, similar to the
bed121
  * 		one used with the net_cls cgroup (see description for
bed121
  * 		**bpf_get_cgroup_classid**\ () helper), but here this tag is
bed121
  * 		held by a route (a destination entry), not by a task.
bed121
@@ -4072,6 +4072,13 @@ struct bpf_link_info {
bed121
 			__u64 cgroup_id;
bed121
 			__u32 attach_type;
bed121
 		} cgroup;
bed121
+		struct {
bed121
+			__aligned_u64 target_name; /* in/out: target_name buffer ptr */
bed121
+			__u32 target_name_len;	   /* in/out: target_name buffer len */
bed121
+			union {
bed121
+				__u32 map_id;
bed121
+			} map;
bed121
+		} iter;
bed121
 		struct  {
bed121
 			__u32 netns_ino;
bed121
 			__u32 attach_type;
bed121
-- 
bed121
2.29.2
bed121