Alexei Starovoitov says: ==================== pull-request: bpf-next 2020-07-13 The following pull-request contains BPF updates for your *net-next* tree. We've added 36 non-merge commits during the last 7 day(s) which contain a total of 62 files changed, 2242 insertions(+), 468 deletions(-). The main changes are: 1) Avoid trace_printk warning banner by switching bpf_trace_printk to use its own tracing event, from Alan. 2) Better libbpf support on older kernels, from Andrii. 3) Additional AF_XDP stats, from Ciara. 4) build time resolution of BTF IDs, from Jiri. 5) BPF_CGROUP_INET_SOCK_RELEASE hook, from Stanislav. ====================
Showing the changes to include/linux (2 of 62 files). Show all
Unified · Split
| @@ -210,6 +210,9 @@ int bpf_percpu_cgroup_storage_update(struct bpf_map *map, void *key, · 209 unmodified lines | ||
| 210 | 210 | #define BPF_CGROUP_RUN_PROG_INET_SOCK(sk) \ |
| 211 | 211 | BPF_CGROUP_RUN_SK_PROG(sk, BPF_CGROUP_INET_SOCK_CREATE) |
| 212 | 212 | |
| 213 | +#define BPF_CGROUP_RUN_PROG_INET_SOCK_RELEASE(sk) \ | |
| 214 | + BPF_CGROUP_RUN_SK_PROG(sk, BPF_CGROUP_INET_SOCK_RELEASE) | |
| 215 | + | |
| 213 | 216 | #define BPF_CGROUP_RUN_PROG_INET4_POST_BIND(sk) \ |
| 214 | 217 | BPF_CGROUP_RUN_SK_PROG(sk, BPF_CGROUP_INET4_POST_BIND) |
| 215 | 218 | |
| @@ -401,6 +404,7 @@ static inline int bpf_percpu_cgroup_storage_update(struct bpf_map *map, · 185 unmodified lines | ||
| 401 | 404 | #define BPF_CGROUP_RUN_PROG_INET_INGRESS(sk,skb) ({ 0; }) |
| 402 | 405 | #define BPF_CGROUP_RUN_PROG_INET_EGRESS(sk,skb) ({ 0; }) |
| 403 | 406 | #define BPF_CGROUP_RUN_PROG_INET_SOCK(sk) ({ 0; }) |
| 407 | +#define BPF_CGROUP_RUN_PROG_INET_SOCK_RELEASE(sk) ({ 0; }) | |
| 404 | 408 | #define BPF_CGROUP_RUN_PROG_INET4_BIND(sk, uaddr) ({ 0; }) |
| 405 | 409 | #define BPF_CGROUP_RUN_PROG_INET6_BIND(sk, uaddr) ({ 0; }) |
| 406 | 410 | #define BPF_CGROUP_RUN_PROG_INET4_POST_BIND(sk) ({ 0; }) |
| @@ -0,0 +1,87 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | + | |
| 3 | +#ifndef _LINUX_BTF_IDS_H | |
| 4 | +#define _LINUX_BTF_IDS_H | |
| 5 | + | |
| 6 | +#include <linux/compiler.h> /* for __PASTE */ | |
| 7 | + | |
| 8 | +/* | |
| 9 | + * Following macros help to define lists of BTF IDs placed | |
| 10 | + * in .BTF_ids section. They are initially filled with zeros | |
| 11 | + * (during compilation) and resolved later during the | |
| 12 | + * linking phase by resolve_btfids tool. | |
| 13 | + * | |
| 14 | + * Any change in list layout must be reflected in resolve_btfids | |
| 15 | + * tool logic. | |
| 16 | + */ | |
| 17 | + | |
| 18 | +#define BTF_IDS_SECTION ".BTF_ids" | |
| 19 | + | |
| 20 | +#define ____BTF_ID(symbol) \ | |
| 21 | +asm( \ | |
| 22 | +".pushsection " BTF_IDS_SECTION ",\"a\"; \n" \ | |
| 23 | +".local " #symbol " ; \n" \ | |
| 24 | +".type " #symbol ", @object; \n" \ | |
| 25 | +".size " #symbol ", 4; \n" \ | |
| 26 | +#symbol ": \n" \ | |
| 27 | +".zero 4 \n" \ | |
| 28 | +".popsection; \n"); | |
| 29 | + | |
| 30 | +#define __BTF_ID(symbol) \ | |
| 31 | + ____BTF_ID(symbol) | |
| 32 | + | |
| 33 | +#define __ID(prefix) \ | |
| 34 | + __PASTE(prefix, __COUNTER__) | |
| 35 | + | |
| 36 | +/* | |
| 37 | + * The BTF_ID defines unique symbol for each ID pointing | |
| 38 | + * to 4 zero bytes. | |
| 39 | + */ | |
| 40 | +#define BTF_ID(prefix, name) \ | |
| 41 | + __BTF_ID(__ID(__BTF_ID__##prefix##__##name##__)) | |
| 42 | + | |
| 43 | +/* | |
| 44 | + * The BTF_ID_LIST macro defines pure (unsorted) list | |
| 45 | + * of BTF IDs, with following layout: | |
| 46 | + * | |
| 47 | + * BTF_ID_LIST(list1) | |
| 48 | + * BTF_ID(type1, name1) | |
| 49 | + * BTF_ID(type2, name2) | |
| 50 | + * | |
| 51 | + * list1: | |
| 52 | + * __BTF_ID__type1__name1__1: | |
| 53 | + * .zero 4 | |
| 54 | + * __BTF_ID__type2__name2__2: | |
| 55 | + * .zero 4 | |
| 56 | + * | |
| 57 | + */ | |
| 58 | +#define __BTF_ID_LIST(name) \ | |
| 59 | +asm( \ | |
| 60 | +".pushsection " BTF_IDS_SECTION ",\"a\"; \n" \ | |
| 61 | +".local " #name "; \n" \ | |
| 62 | +#name ":; \n" \ | |
| 63 | +".popsection; \n"); \ | |
| 64 | + | |
| 65 | +#define BTF_ID_LIST(name) \ | |
| 66 | +__BTF_ID_LIST(name) \ | |
| 67 | +extern u32 name[]; | |
| 68 | + | |
| 69 | +/* | |
| 70 | + * The BTF_ID_UNUSED macro defines 4 zero bytes. | |
| 71 | + * It's used when we want to define 'unused' entry | |
| 72 | + * in BTF_ID_LIST, like: | |
| 73 | + * | |
| 74 | + * BTF_ID_LIST(bpf_skb_output_btf_ids) | |
| 75 | + * BTF_ID(struct, sk_buff) | |
| 76 | + * BTF_ID_UNUSED | |
| 77 | + * BTF_ID(struct, task_struct) | |
| 78 | + */ | |
| 79 | + | |
| 80 | +#define BTF_ID_UNUSED \ | |
| 81 | +asm( \ | |
| 82 | +".pushsection " BTF_IDS_SECTION ",\"a\"; \n" \ | |
| 83 | +".zero 4 \n" \ | |
| 84 | +".popsection; \n"); | |
| 85 | + | |
| 86 | + | |
| 87 | +#endif | |