/Linux-v4.19/drivers/net/ethernet/netronome/nfp/bpf/ |
D | cmsg.c | 48 static bool nfp_bpf_all_tags_busy(struct nfp_app_bpf *bpf) in nfp_bpf_all_tags_busy() argument 52 used_tags = bpf->tag_alloc_next - bpf->tag_alloc_last; in nfp_bpf_all_tags_busy() 57 static int nfp_bpf_alloc_tag(struct nfp_app_bpf *bpf) in nfp_bpf_alloc_tag() argument 63 if (nfp_bpf_all_tags_busy(bpf)) { in nfp_bpf_alloc_tag() 64 cmsg_warn(bpf, "all FW request contexts busy!\n"); in nfp_bpf_alloc_tag() 68 WARN_ON(__test_and_set_bit(bpf->tag_alloc_next, bpf->tag_allocator)); in nfp_bpf_alloc_tag() 69 return bpf->tag_alloc_next++; in nfp_bpf_alloc_tag() 72 static void nfp_bpf_free_tag(struct nfp_app_bpf *bpf, u16 tag) in nfp_bpf_free_tag() argument 74 WARN_ON(!__test_and_clear_bit(tag, bpf->tag_allocator)); in nfp_bpf_free_tag() 76 while (!test_bit(bpf->tag_alloc_last, bpf->tag_allocator) && in nfp_bpf_free_tag() [all …]
|
D | main.c | 243 nfp_bpf_parse_cap_adjust_head(struct nfp_app_bpf *bpf, void __iomem *value, in nfp_bpf_parse_cap_adjust_head() argument 247 struct nfp_cpp *cpp = bpf->app->pf->cpp; in nfp_bpf_parse_cap_adjust_head() 254 bpf->adjust_head.flags = readl(&cap->flags); in nfp_bpf_parse_cap_adjust_head() 255 bpf->adjust_head.off_min = readl(&cap->off_min); in nfp_bpf_parse_cap_adjust_head() 256 bpf->adjust_head.off_max = readl(&cap->off_max); in nfp_bpf_parse_cap_adjust_head() 257 bpf->adjust_head.guaranteed_sub = readl(&cap->guaranteed_sub); in nfp_bpf_parse_cap_adjust_head() 258 bpf->adjust_head.guaranteed_add = readl(&cap->guaranteed_add); in nfp_bpf_parse_cap_adjust_head() 260 if (bpf->adjust_head.off_min > bpf->adjust_head.off_max) { in nfp_bpf_parse_cap_adjust_head() 264 if (!FIELD_FIT(UR_REG_IMM_MAX, bpf->adjust_head.off_min) || in nfp_bpf_parse_cap_adjust_head() 265 !FIELD_FIT(UR_REG_IMM_MAX, bpf->adjust_head.off_max)) { in nfp_bpf_parse_cap_adjust_head() [all …]
|
D | offload.c | 60 nfp_map_ptr_record(struct nfp_app_bpf *bpf, struct nfp_prog *nfp_prog, in nfp_map_ptr_record() argument 70 record = rhashtable_lookup_fast(&bpf->maps_neutral, &map->id, in nfp_map_ptr_record() 95 err = rhashtable_insert_fast(&bpf->maps_neutral, &record->l, in nfp_map_ptr_record() 112 nfp_map_ptrs_forget(struct nfp_app_bpf *bpf, struct nfp_prog *nfp_prog) in nfp_map_ptrs_forget() argument 125 WARN_ON(rhashtable_remove_fast(&bpf->maps_neutral, in nfp_map_ptrs_forget() 147 nfp_map_ptrs_record(struct nfp_app_bpf *bpf, struct nfp_prog *nfp_prog, in nfp_map_ptrs_record() argument 168 err = nfp_map_ptr_record(bpf, nfp_prog, in nfp_map_ptrs_record() 171 nfp_map_ptrs_forget(bpf, nfp_prog); in nfp_map_ptrs_record() 220 struct netdev_bpf *bpf) in nfp_bpf_verifier_prep() argument 222 struct bpf_prog *prog = bpf->verifier.prog; in nfp_bpf_verifier_prep() [all …]
|
D | verifier.c | 76 nfp_record_adjust_head(struct nfp_app_bpf *bpf, struct nfp_prog *nfp_prog, in nfp_record_adjust_head() argument 93 if (imm > (int)bpf->adjust_head.guaranteed_add || in nfp_record_adjust_head() 94 imm < -bpf->adjust_head.guaranteed_sub) in nfp_record_adjust_head() 164 struct nfp_app_bpf *bpf = nfp_prog->bpf; in nfp_bpf_check_call() local 169 if (!bpf->adjust_head.off_max) { in nfp_bpf_check_call() 173 if (!(bpf->adjust_head.flags & NFP_BPF_ADJUST_HEAD_NO_META)) { in nfp_bpf_check_call() 178 nfp_record_adjust_head(bpf, nfp_prog, meta, reg2); in nfp_bpf_check_call() 182 if (!bpf->adjust_tail) { in nfp_bpf_check_call() 190 bpf->helpers.map_lookup, reg1) || in nfp_bpf_check_call() 198 bpf->helpers.map_update, reg1) || in nfp_bpf_check_call() [all …]
|
D | main.h | 50 #define cmsg_warn(bpf, msg...) nn_dp_warn(&(bpf)->app->ctrl->dp, msg) argument 219 struct nfp_app_bpf *bpf; member 436 struct nfp_app_bpf *bpf; member 485 struct netdev_bpf *bpf); 496 nfp_bpf_ctrl_alloc_map(struct nfp_app_bpf *bpf, struct bpf_map *map); 498 nfp_bpf_ctrl_free_map(struct nfp_app_bpf *bpf, struct nfp_bpf_map *nfp_map); 509 int nfp_bpf_event_output(struct nfp_app_bpf *bpf, const void *data,
|
/Linux-v4.19/net/core/ |
D | lwt_bpf.c | 92 struct bpf_lwt *bpf; in bpf_input() local 95 bpf = bpf_lwt_lwtunnel(dst->lwtstate); in bpf_input() 96 if (bpf->in.prog) { in bpf_input() 97 ret = run_lwt_bpf(skb, &bpf->in, dst, NO_REDIRECT); in bpf_input() 104 bpf->out.name); in bpf_input() 115 struct bpf_lwt *bpf; in bpf_output() local 118 bpf = bpf_lwt_lwtunnel(dst->lwtstate); in bpf_output() 119 if (bpf->out.prog) { in bpf_output() 120 ret = run_lwt_bpf(skb, &bpf->out, dst, NO_REDIRECT); in bpf_output() 127 bpf->out.name); in bpf_output() [all …]
|
D | xdp.c | 372 struct netdev_bpf *bpf) in xdp_attachment_query() argument 374 bpf->prog_id = info->prog ? info->prog->aux->id : 0; in xdp_attachment_query() 375 bpf->prog_flags = info->prog ? info->flags : 0; in xdp_attachment_query() 381 struct netdev_bpf *bpf) in xdp_attachment_flags_ok() argument 383 if (info->prog && (bpf->flags ^ info->flags) & XDP_FLAGS_MODES) { in xdp_attachment_flags_ok() 384 NL_SET_ERR_MSG(bpf->extack, in xdp_attachment_flags_ok() 393 struct netdev_bpf *bpf) in xdp_attachment_setup() argument 397 info->prog = bpf->prog; in xdp_attachment_setup() 398 info->flags = bpf->flags; in xdp_attachment_setup()
|
/Linux-v4.19/drivers/net/netdevsim/ |
D | bpf.c | 186 static int nsim_xdp_offload_prog(struct netdevsim *ns, struct netdev_bpf *bpf) in nsim_xdp_offload_prog() argument 188 if (!nsim_xdp_offload_active(ns) && !bpf->prog) in nsim_xdp_offload_prog() 190 if (!nsim_xdp_offload_active(ns) && bpf->prog && ns->bpf_offloaded) { in nsim_xdp_offload_prog() 191 NSIM_EA(bpf->extack, "TC program is already loaded"); in nsim_xdp_offload_prog() 195 return nsim_bpf_offload(ns, bpf->prog, nsim_xdp_offload_active(ns)); in nsim_xdp_offload_prog() 199 nsim_xdp_set_prog(struct netdevsim *ns, struct netdev_bpf *bpf, in nsim_xdp_set_prog() argument 204 if (!xdp_attachment_flags_ok(xdp, bpf)) in nsim_xdp_set_prog() 207 if (bpf->command == XDP_SETUP_PROG && !ns->bpf_xdpdrv_accept) { in nsim_xdp_set_prog() 208 NSIM_EA(bpf->extack, "driver XDP disabled in DebugFS"); in nsim_xdp_set_prog() 211 if (bpf->command == XDP_SETUP_PROG_HW && !ns->bpf_xdpoffload_accept) { in nsim_xdp_set_prog() [all …]
|
/Linux-v4.19/kernel/bpf/ |
D | cgroup.c | 30 for (type = 0; type < ARRAY_SIZE(cgrp->bpf.progs); type++) { in cgroup_bpf_put() 31 struct list_head *progs = &cgrp->bpf.progs[type]; in cgroup_bpf_put() 42 bpf_prog_array_free(cgrp->bpf.effective[type]); in cgroup_bpf_put() 76 u32 flags = p->bpf.flags[type]; in hierarchy_allows_attach() 81 cnt = prog_list_length(&p->bpf.progs[type]); in hierarchy_allows_attach() 107 if (cnt == 0 || (p->bpf.flags[type] & BPF_F_ALLOW_MULTI)) in compute_effective_progs() 108 cnt += prog_list_length(&p->bpf.progs[type]); in compute_effective_progs() 120 if (cnt > 0 && !(p->bpf.flags[type] & BPF_F_ALLOW_MULTI)) in compute_effective_progs() 123 list_for_each_entry(pl, &p->bpf.progs[type], node) { in compute_effective_progs() 143 old_array = xchg(&cgrp->bpf.effective[type], array); in activate_effective_progs() [all …]
|
/Linux-v4.19/net/xdp/ |
D | xdp_umem.c | 47 struct netdev_bpf bpf; in xdp_umem_query() local 51 memset(&bpf, 0, sizeof(bpf)); in xdp_umem_query() 52 bpf.command = XDP_QUERY_XSK_UMEM; in xdp_umem_query() 53 bpf.xsk.queue_id = queue_id; in xdp_umem_query() 57 return dev->netdev_ops->ndo_bpf(dev, &bpf) ?: !!bpf.xsk.umem; in xdp_umem_query() 64 struct netdev_bpf bpf; in xdp_umem_assign_dev() local 79 bpf.command = XDP_QUERY_XSK_UMEM; in xdp_umem_assign_dev() 88 bpf.command = XDP_SETUP_XSK_UMEM; in xdp_umem_assign_dev() 89 bpf.xsk.umem = umem; in xdp_umem_assign_dev() 90 bpf.xsk.queue_id = queue_id; in xdp_umem_assign_dev() [all …]
|
/Linux-v4.19/samples/seccomp/ |
D | Makefile | 3 hostprogs-$(CONFIG_SAMPLE_SECCOMP) := bpf-fancy dropper bpf-direct 9 bpf-fancy-objs := bpf-fancy.o bpf-helper.o 17 bpf-direct-objs := bpf-direct.o
|
D | .gitignore | 1 bpf-direct 2 bpf-fancy
|
/Linux-v4.19/samples/bpf/ |
D | Makefile | 58 LIBBPF = $(TOOLS_PATH)/lib/bpf/libbpf.a 60 CGROUP_HELPERS := ../../tools/testing/selftests/bpf/cgroup_helpers.o 61 TRACE_HELPERS := ../../tools/testing/selftests/bpf/trace_helpers.o 172 KBUILD_HOSTCFLAGS += -I$(srctree)/tools/testing/selftests/bpf/ 177 HOSTCFLAGS_trace_helpers.o += -I$(srctree)/tools/lib/bpf/ 179 HOSTCFLAGS_trace_output_user.o += -I$(srctree)/tools/lib/bpf/ 180 HOSTCFLAGS_offwaketime_user.o += -I$(srctree)/tools/lib/bpf/ 181 HOSTCFLAGS_spintest_user.o += -I$(srctree)/tools/lib/bpf/ 182 HOSTCFLAGS_trace_event_user.o += -I$(srctree)/tools/lib/bpf/ 183 HOSTCFLAGS_sampleip_user.o += -I$(srctree)/tools/lib/bpf/ [all …]
|
D | README.rst | 5 for using eBPF. The examples use libbpf from tools/lib/bpf. 14 Note that LLVM's tool 'llc' must support target 'bpf', list version 35 make samples/bpf/ 42 Manually compiling LLVM with 'bpf' support 48 By default llvm will build all non-experimental backends including bpf. 66 make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang 76 make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang
|
D | run_cookie_uid_helper_example.sh | 8 iptables -D OUTPUT -m bpf --object-pinned ${mnt_dir}/bpf_prog -j ACCEPT 14 mount -t bpf bpf ${mnt_dir}
|
D | tc_l2_redirect.sh | 45 $IP netns exec ns2 $TC filter add dev vens2 ingress bpf da obj $REDIRECT_BPF sec drop_non_tun_vip 63 $TC filter add dev ve2 ingress bpf da obj $REDIRECT_BPF sec l2_to_iptun_ingress_forward 80 rm -f /sys/fs/bpf/tc/globals/tun_iface 99 $TC filter add dev ve2 egress bpf da obj $REDIRECT_BPF sec l2_to_iptun_ingress_redirect 103 $TC filter add dev ve1 ingress bpf da obj $REDIRECT_BPF sec l2_to_iptun_ingress_redirect 106 $REDIRECT_USER -U /sys/fs/bpf/tc/globals/tun_iface -i $(< /sys/class/net/ipt/ifindex) 136 $TC filter add dev ve2 egress bpf da obj $REDIRECT_BPF sec l2_to_ip6tun_ingress_redirect 140 $TC filter add dev ve1 ingress bpf da obj $REDIRECT_BPF sec l2_to_ip6tun_ingress_redirect 143 $REDIRECT_USER -U /sys/fs/bpf/tc/globals/tun_iface -i $(< /sys/class/net/ip6t/ifindex)
|
/Linux-v4.19/arch/um/drivers/ |
D | vector_user.c | 545 int uml_vector_attach_bpf(int fd, void *bpf, int bpf_len) in uml_vector_attach_bpf() argument 547 int err = setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, bpf, bpf_len); in uml_vector_attach_bpf() 558 struct sock_filter *bpf; in uml_vector_default_bpf() local 566 bpf = uml_kmalloc( in uml_vector_default_bpf() 568 if (bpf != NULL) { in uml_vector_default_bpf() 569 bpf_prog.filter = bpf; in uml_vector_default_bpf() 571 bpf[0] = (struct sock_filter){ 0x20, 0, 0, 0x00000008 }; in uml_vector_default_bpf() 573 bpf[1] = (struct sock_filter){ 0x15, 0, 3, ntohl(*mac1)}; in uml_vector_default_bpf() 575 bpf[2] = (struct sock_filter){ 0x28, 0, 0, 0x00000006 }; in uml_vector_default_bpf() 577 bpf[3] = (struct sock_filter){ 0x15, 0, 1, ntohs(*mac2)}; in uml_vector_default_bpf() [all …]
|
/Linux-v4.19/Documentation/bpf/ |
D | bpf_devel_QA.rst | 70 Those patches which target BPF, are assigned to a 'bpf' delegate for 86 the 'bpf' delegate). 94 * https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git/ 95 * https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/ 97 The bpf tree itself is for fixes only, whereas bpf-next for features, 99 analogous to net and net-next trees for networking. Both bpf and 100 bpf-next will only have a master branch in order to simplify against 103 Accumulated BPF patches in the bpf tree will regularly get pulled 105 into the bpf-next tree will make their way into net-next tree. net and 122 pull-request: bpf yyyy-mm-dd [all …]
|
D | index.rst | 15 The primary info for the bpf syscall is available in the `man-pages`_ 16 for `bpf(2)`_. 35 .. _bpf(2): http://man7.org/linux/man-pages/man2/bpf.2.html 36 .. _BPF and XDP Reference Guide: http://cilium.readthedocs.io/en/latest/bpf/
|
/Linux-v4.19/tools/lib/bpf/ |
D | Makefile | 157 @(test -f ../../include/uapi/linux/bpf.h -a -f ../../../include/uapi/linux/bpf.h && ( \ 158 (diff -B ../../include/uapi/linux/bpf.h ../../../include/uapi/linux/bpf.h >/dev/null) || \ 190 $(call do_install,bpf.h,$(prefix)/include/bpf,644); \ 191 $(call do_install,libbpf.h,$(prefix)/include/bpf,644); 192 $(call do_install,btf.h,$(prefix)/include/bpf,644);
|
/Linux-v4.19/drivers/net/ethernet/netronome/nfp/ |
D | Makefile | 50 bpf/cmsg.o \ 51 bpf/main.o \ 52 bpf/offload.o \ 53 bpf/verifier.o \ 54 bpf/jit.o
|
/Linux-v4.19/tools/bpf/ |
D | Makefile | 26 FEATURE_USER = .bpf 50 $(OUTPUT)%.yacc.c: $(srctree)/tools/bpf/%.y 53 $(OUTPUT)%.lex.c: $(srctree)/tools/bpf/%.l 56 $(OUTPUT)%.o: $(srctree)/tools/bpf/%.c 83 $(call QUIET_CLEAN, bpf-progs) 87 $(Q)rm -f $(OUTPUT)FEATURE-DUMP.bpf
|
/Linux-v4.19/tools/bpf/bpftool/Documentation/ |
D | bpftool-prog.rst | 78 Load bpf program from binary *OBJ* and pin as *FILE*. 161 | **# mount -t bpf none /sys/fs/bpf/** 162 | **# bpftool prog pin id 10 /sys/fs/bpf/prog** 163 | **# bpftool prog load ./my_prog.o /sys/fs/bpf/prog2** 164 | **# ls -l /sys/fs/bpf/** 168 **# bpftool prog dum jited pinned /sys/fs/bpf/prog opcodes** 184 | **# bpftool prog load xdp1_kern.o /sys/fs/bpf/xdp1 type xdp map name rxcnt id 7** 185 | **# bpftool prog show pinned /sys/fs/bpf/xdp1** 189 | **# rm /sys/fs/bpf/xdp1**
|
/Linux-v4.19/net/ipv6/ |
D | seg6_local.c | 60 struct bpf_lwt_prog bpf; member 510 ret = bpf_prog_run_save_cb(slwt->bpf.prog, skb); in input_action_end_bpf() 834 slwt->bpf.name = nla_memdup(tb[SEG6_LOCAL_BPF_PROG_NAME], GFP_KERNEL); in parse_nla_bpf() 835 if (!slwt->bpf.name) in parse_nla_bpf() 841 kfree(slwt->bpf.name); in parse_nla_bpf() 845 slwt->bpf.prog = p; in parse_nla_bpf() 853 if (!slwt->bpf.prog) in put_nla_bpf() 860 if (nla_put_u32(skb, SEG6_LOCAL_BPF_PROG, slwt->bpf.prog->aux->id)) in put_nla_bpf() 863 if (slwt->bpf.name && in put_nla_bpf() 864 nla_put_string(skb, SEG6_LOCAL_BPF_PROG_NAME, slwt->bpf.name)) in put_nla_bpf() [all …]
|
/Linux-v4.19/tools/testing/selftests/bpf/ |
D | Makefile | 4 BPFDIR := $(LIBDIR)/bpf 87 PROBE := $(shell $(LLC) -march=bpf -mcpu=probe -filetype=null /dev/null 2>&1) 113 BTF_LLC_PROBE := $(shell $(LLC) -march=bpf -mattr=help 2>&1 | grep dwarfris) 129 -O2 -target bpf -emit-llvm -c $< -o - | \ 130 $(LLC) -march=bpf -mcpu=$(CPU) $(LLC_FLAGS) -filetype=obj -o $@
|