184544f56SYonghong Song /* SPDX-License-Identifier: GPL-2.0 */ 284544f56SYonghong Song /* Copyright (c) 2020 Facebook */ 384544f56SYonghong Song /* "undefine" structs in vmlinux.h, because we "override" them below */ 484544f56SYonghong Song #define bpf_iter_meta bpf_iter_meta___not_used 584544f56SYonghong Song #define bpf_iter__bpf_map bpf_iter__bpf_map___not_used 684544f56SYonghong Song #define bpf_iter__ipv6_route bpf_iter__ipv6_route___not_used 784544f56SYonghong Song #define bpf_iter__netlink bpf_iter__netlink___not_used 884544f56SYonghong Song #define bpf_iter__task bpf_iter__task___not_used 984544f56SYonghong Song #define bpf_iter__task_file bpf_iter__task_file___not_used 102767c977SYonghong Song #define bpf_iter__tcp bpf_iter__tcp___not_used 112767c977SYonghong Song #define tcp6_sock tcp6_sock___not_used 12ace6d6ecSYonghong Song #define bpf_iter__udp bpf_iter__udp___not_used 13ace6d6ecSYonghong Song #define udp6_sock udp6_sock___not_used 14*363885d7SAndrii Nakryiko #define bpf_iter__bpf_map_elem bpf_iter__bpf_map_elem___not_used 15*363885d7SAndrii Nakryiko #define bpf_iter__bpf_sk_storage_map bpf_iter__bpf_sk_storage_map___not_used 1684544f56SYonghong Song #include "vmlinux.h" 1784544f56SYonghong Song #undef bpf_iter_meta 1884544f56SYonghong Song #undef bpf_iter__bpf_map 1984544f56SYonghong Song #undef bpf_iter__ipv6_route 2084544f56SYonghong Song #undef bpf_iter__netlink 2184544f56SYonghong Song #undef bpf_iter__task 2284544f56SYonghong Song #undef bpf_iter__task_file 232767c977SYonghong Song #undef bpf_iter__tcp 242767c977SYonghong Song #undef tcp6_sock 25ace6d6ecSYonghong Song #undef bpf_iter__udp 26ace6d6ecSYonghong Song #undef udp6_sock 27*363885d7SAndrii Nakryiko #undef bpf_iter__bpf_map_elem 28*363885d7SAndrii Nakryiko #undef bpf_iter__bpf_sk_storage_map 2984544f56SYonghong Song 3084544f56SYonghong Song struct bpf_iter_meta { 3184544f56SYonghong Song struct seq_file *seq; 3284544f56SYonghong Song __u64 session_id; 3384544f56SYonghong Song __u64 seq_num; 3484544f56SYonghong Song } __attribute__((preserve_access_index)); 3584544f56SYonghong Song 3684544f56SYonghong Song struct bpf_iter__ipv6_route { 3784544f56SYonghong Song struct bpf_iter_meta *meta; 3884544f56SYonghong Song struct fib6_info *rt; 3984544f56SYonghong Song } __attribute__((preserve_access_index)); 4084544f56SYonghong Song 4184544f56SYonghong Song struct bpf_iter__netlink { 4284544f56SYonghong Song struct bpf_iter_meta *meta; 4384544f56SYonghong Song struct netlink_sock *sk; 4484544f56SYonghong Song } __attribute__((preserve_access_index)); 4584544f56SYonghong Song 4684544f56SYonghong Song struct bpf_iter__task { 4784544f56SYonghong Song struct bpf_iter_meta *meta; 4884544f56SYonghong Song struct task_struct *task; 4984544f56SYonghong Song } __attribute__((preserve_access_index)); 5084544f56SYonghong Song 5184544f56SYonghong Song struct bpf_iter__task_file { 5284544f56SYonghong Song struct bpf_iter_meta *meta; 5384544f56SYonghong Song struct task_struct *task; 5484544f56SYonghong Song __u32 fd; 5584544f56SYonghong Song struct file *file; 5684544f56SYonghong Song } __attribute__((preserve_access_index)); 5784544f56SYonghong Song 5884544f56SYonghong Song struct bpf_iter__bpf_map { 5984544f56SYonghong Song struct bpf_iter_meta *meta; 6084544f56SYonghong Song struct bpf_map *map; 6184544f56SYonghong Song } __attribute__((preserve_access_index)); 622767c977SYonghong Song 632767c977SYonghong Song struct bpf_iter__tcp { 642767c977SYonghong Song struct bpf_iter_meta *meta; 652767c977SYonghong Song struct sock_common *sk_common; 662767c977SYonghong Song uid_t uid; 672767c977SYonghong Song } __attribute__((preserve_access_index)); 682767c977SYonghong Song 692767c977SYonghong Song struct tcp6_sock { 702767c977SYonghong Song struct tcp_sock tcp; 712767c977SYonghong Song struct ipv6_pinfo inet6; 722767c977SYonghong Song } __attribute__((preserve_access_index)); 73ace6d6ecSYonghong Song 74ace6d6ecSYonghong Song struct bpf_iter__udp { 75ace6d6ecSYonghong Song struct bpf_iter_meta *meta; 76ace6d6ecSYonghong Song struct udp_sock *udp_sk; 77ace6d6ecSYonghong Song uid_t uid __attribute__((aligned(8))); 78ace6d6ecSYonghong Song int bucket __attribute__((aligned(8))); 79ace6d6ecSYonghong Song } __attribute__((preserve_access_index)); 80ace6d6ecSYonghong Song 81ace6d6ecSYonghong Song struct udp6_sock { 82ace6d6ecSYonghong Song struct udp_sock udp; 83ace6d6ecSYonghong Song struct ipv6_pinfo inet6; 84ace6d6ecSYonghong Song } __attribute__((preserve_access_index)); 85*363885d7SAndrii Nakryiko 86*363885d7SAndrii Nakryiko struct bpf_iter__bpf_map_elem { 87*363885d7SAndrii Nakryiko struct bpf_iter_meta *meta; 88*363885d7SAndrii Nakryiko struct bpf_map *map; 89*363885d7SAndrii Nakryiko void *key; 90*363885d7SAndrii Nakryiko void *value; 91*363885d7SAndrii Nakryiko }; 92*363885d7SAndrii Nakryiko 93*363885d7SAndrii Nakryiko struct bpf_iter__bpf_sk_storage_map { 94*363885d7SAndrii Nakryiko struct bpf_iter_meta *meta; 95*363885d7SAndrii Nakryiko struct bpf_map *map; 96*363885d7SAndrii Nakryiko struct sock *sk; 97*363885d7SAndrii Nakryiko void *value; 98*363885d7SAndrii Nakryiko }; 99