Home
last modified time | relevance | path

Searched refs:bpf (Results 1 – 25 of 228) sorted by relevance

12345678910

/Linux-v5.15/drivers/net/ethernet/netronome/nfp/bpf/
Dmain.c27 struct nfp_app_bpf *bpf = nn->app->priv; in nfp_net_ebpf_capable() local
30 bpf->abi_version && in nfp_net_ebpf_capable()
31 nn_readb(nn, NFP_NET_CFG_BPF_ABI) == bpf->abi_version; in nfp_net_ebpf_capable()
206 nfp_bpf_parse_cap_adjust_head(struct nfp_app_bpf *bpf, void __iomem *value, in nfp_bpf_parse_cap_adjust_head() argument
210 struct nfp_cpp *cpp = bpf->app->pf->cpp; in nfp_bpf_parse_cap_adjust_head()
217 bpf->adjust_head.flags = readl(&cap->flags); in nfp_bpf_parse_cap_adjust_head()
218 bpf->adjust_head.off_min = readl(&cap->off_min); in nfp_bpf_parse_cap_adjust_head()
219 bpf->adjust_head.off_max = readl(&cap->off_max); in nfp_bpf_parse_cap_adjust_head()
220 bpf->adjust_head.guaranteed_sub = readl(&cap->guaranteed_sub); in nfp_bpf_parse_cap_adjust_head()
221 bpf->adjust_head.guaranteed_add = readl(&cap->guaranteed_add); in nfp_bpf_parse_cap_adjust_head()
[all …]
Dcmsg.c18 nfp_bpf_cmsg_alloc(struct nfp_app_bpf *bpf, unsigned int size) in nfp_bpf_cmsg_alloc() argument
22 skb = nfp_app_ctrl_msg_alloc(bpf->app, size, GFP_KERNEL); in nfp_bpf_cmsg_alloc()
29 nfp_bpf_cmsg_map_req_size(struct nfp_app_bpf *bpf, unsigned int n) in nfp_bpf_cmsg_map_req_size() argument
34 size += (bpf->cmsg_key_sz + bpf->cmsg_val_sz) * n; in nfp_bpf_cmsg_map_req_size()
40 nfp_bpf_cmsg_map_req_alloc(struct nfp_app_bpf *bpf, unsigned int n) in nfp_bpf_cmsg_map_req_alloc() argument
42 return nfp_bpf_cmsg_alloc(bpf, nfp_bpf_cmsg_map_req_size(bpf, n)); in nfp_bpf_cmsg_map_req_alloc()
46 nfp_bpf_cmsg_map_reply_size(struct nfp_app_bpf *bpf, unsigned int n) in nfp_bpf_cmsg_map_reply_size() argument
51 size += (bpf->cmsg_key_sz + bpf->cmsg_val_sz) * n; in nfp_bpf_cmsg_map_reply_size()
57 nfp_bpf_ctrl_rc_to_errno(struct nfp_app_bpf *bpf, in nfp_bpf_ctrl_rc_to_errno() argument
74 cmsg_warn(bpf, "FW responded with invalid status: %u\n", rc); in nfp_bpf_ctrl_rc_to_errno()
[all …]
Doffload.c31 nfp_map_ptr_record(struct nfp_app_bpf *bpf, struct nfp_prog *nfp_prog, in nfp_map_ptr_record() argument
38 record = rhashtable_lookup_fast(&bpf->maps_neutral, &map->id, in nfp_map_ptr_record()
61 err = rhashtable_insert_fast(&bpf->maps_neutral, &record->l, in nfp_map_ptr_record()
78 nfp_map_ptrs_forget(struct nfp_app_bpf *bpf, struct nfp_prog *nfp_prog) in nfp_map_ptrs_forget() argument
89 WARN_ON(rhashtable_remove_fast(&bpf->maps_neutral, in nfp_map_ptrs_forget()
111 nfp_map_ptrs_record(struct nfp_app_bpf *bpf, struct nfp_prog *nfp_prog, in nfp_map_ptrs_record() argument
136 err = nfp_map_ptr_record(bpf, nfp_prog, in nfp_map_ptrs_record()
139 nfp_map_ptrs_forget(bpf, nfp_prog); in nfp_map_ptrs_record()
203 nfp_prog->bpf = bpf_offload_dev_priv(prog->aux->offload->offdev); in nfp_bpf_verifier_prep()
244 return nfp_map_ptrs_record(nfp_prog->bpf, nfp_prog, prog); in nfp_bpf_translate()
[all …]
Dmain.h21 #define cmsg_warn(bpf, msg...) nn_dp_warn(&(bpf)->app->ctrl->dp, msg) argument
211 struct nfp_app_bpf *bpf; member
514 struct nfp_app_bpf *bpf; member
581 struct netdev_bpf *bpf);
591 unsigned int nfp_bpf_ctrl_cmsg_min_mtu(struct nfp_app_bpf *bpf);
592 unsigned int nfp_bpf_ctrl_cmsg_mtu(struct nfp_app_bpf *bpf);
593 unsigned int nfp_bpf_ctrl_cmsg_cache_cnt(struct nfp_app_bpf *bpf);
595 nfp_bpf_ctrl_alloc_map(struct nfp_app_bpf *bpf, struct bpf_map *map);
597 nfp_bpf_ctrl_free_map(struct nfp_app_bpf *bpf, struct nfp_bpf_map *nfp_map);
608 int nfp_bpf_event_output(struct nfp_app_bpf *bpf, const void *data,
/Linux-v5.15/samples/bpf/
DMakefile62 LIBBPF = $(TOOLS_PATH)/lib/bpf/libbpf.a
64 CGROUP_HELPERS := ../../tools/testing/selftests/bpf/cgroup_helpers.o
65 TRACE_HELPERS := ../../tools/testing/selftests/bpf/trace_helpers.o
200 TPROGS_CFLAGS += -I$(srctree)/tools/testing/selftests/bpf/
244 BTF_LLC_PROBE := $(shell $(LLC) -march=bpf -mattr=help 2>&1 | grep dwarfris)
248 $(CLANG) -target bpf -O2 -g -c -x c - -o ./llvm_btf_verify.o; \
277 BPFTOOLDIR := $(TOOLS_PATH)/bpf/bpftool
303 @if ! (${LLC} -march=bpf -mattr=help > /dev/null 2>&1); then \
358 $(obj)/xdp_redirect_cpu.bpf.o: $(obj)/xdp_sample.bpf.o
359 $(obj)/xdp_redirect_map_multi.bpf.o: $(obj)/xdp_sample.bpf.o
[all …]
DREADME.rst5 for using eBPF. The examples use libbpf from tools/lib/bpf.
14 Note that LLVM's tool 'llc' must support target 'bpf', list version
24 make -C samples/bpf clean
49 make M=samples/bpf
54 Manually compiling LLVM with 'bpf' support
60 By default llvm will build all non-experimental backends including bpf.
84 …make M=samples/bpf LLC=~/git/llvm-project/llvm/build/bin/llc CLANG=~/git/llvm-project/llvm/build/b…
105 make M=samples/bpf
111 make M=samples/bpf SYSROOT=~/some_sysroot
/Linux-v5.15/tools/bpf/bpftool/Documentation/
Dbpftool-iter.rst31 A bpf iterator combines a kernel iterating of
33 and a bpf program called for each kernel data object
37 The *pin* command creates a bpf iterator from *OBJ*,
43 Map element bpf iterator requires an additional parameter
44 *MAP* so bpf program can iterate over map elements for
45 that map. User can have a bpf program in kernel to run
49 User can then *cat PATH* to see the bpf iterator output.
60 **# bpftool iter pin bpf_iter_netlink.o /sys/fs/bpf/my_netlink**
64 Create a file-based bpf iterator from bpf_iter_netlink.o and pin it
65 to /sys/fs/bpf/my_netlink
[all …]
Dbpftool-net.rst5 tool for inspection of netdev/tc related bpf prog attachments
34 List bpf program attachments in the kernel networking subsystem.
45 bpf programs, users should consult other tools, e.g., iproute2.
48 all tc class/qdisc bpf program attachments. Both xdp programs and
49 tc programs are ordered based on ifindex number. If multiple bpf
51 the order will be first all bpf programs attached to tc classes, then
52 all bpf programs attached to non clsact qdiscs, and finally all
53 bpf programs attached to root and clsact qdisc.
56 Attach bpf program *PROG* to network interface *NAME* with
57 type specified by *ATTACH_TYPE*. Previously attached bpf program
[all …]
Dbpftool-gen.rst164 **$ cat example1.bpf.c**
170 #include <linux/bpf.h>
171 #include <bpf/bpf_helpers.h>
188 **$ cat example2.bpf.c**
193 #include <linux/bpf.h>
194 #include <bpf/bpf_helpers.h>
214 **$ clang -target bpf -g example1.bpf.c -o example1.bpf.o**
215 **$ clang -target bpf -g example2.bpf.c -o example2.bpf.o**
216 **$ bpftool gen object example.bpf.o example1.bpf.o example2.bpf.o**
218 This set of commands compiles *example1.bpf.c* and *example2.bpf.c*
[all …]
/Linux-v5.15/tools/testing/selftests/bpf/
Dtest_bpftool_build.sh23 if [ ! -e tools/bpf/bpftool/Makefile ]; then
92 make_and_clean tools/bpf
100 make_with_tmpdir tools/bpf O
109 make_and_clean -C tools/bpf/bpftool
111 make_with_tmpdir -C tools/bpf/bpftool OUTPUT
113 make_with_tmpdir -C tools/bpf/bpftool O
118 make_and_clean bpf
138 make_with_tmpdir bpf O
141 cd bpf/bpftool
Dtest_flow_dissector.sh25 $bpftool prog loadall ./bpf_flow.o /sys/fs/bpf/flow \
29 /sys/fs/bpf/flow/flow_dissector flow_dissector; then
34 $bpftool prog attach pinned /sys/fs/bpf/flow/flow_dissector \
38 /sys/fs/bpf/flow/flow_dissector flow_dissector; then
44 /sys/fs/bpf/flow/flow_dissector flow_dissector; then
49 rm -rf /sys/fs/bpf/flow
89 if /bin/mount | grep /sys/fs/bpf > /dev/null; then
94 /bin/mount bpffs /sys/fs/bpf -t bpf
/Linux-v5.15/drivers/net/netdevsim/
Dbpf.c180 static int nsim_xdp_offload_prog(struct netdevsim *ns, struct netdev_bpf *bpf) in nsim_xdp_offload_prog() argument
182 if (!nsim_xdp_offload_active(ns) && !bpf->prog) in nsim_xdp_offload_prog()
184 if (!nsim_xdp_offload_active(ns) && bpf->prog && ns->bpf_offloaded) { in nsim_xdp_offload_prog()
185 NSIM_EA(bpf->extack, "TC program is already loaded"); in nsim_xdp_offload_prog()
189 return nsim_bpf_offload(ns, bpf->prog, nsim_xdp_offload_active(ns)); in nsim_xdp_offload_prog()
193 nsim_xdp_set_prog(struct netdevsim *ns, struct netdev_bpf *bpf, in nsim_xdp_set_prog() argument
198 if (bpf->command == XDP_SETUP_PROG && !ns->bpf_xdpdrv_accept) { in nsim_xdp_set_prog()
199 NSIM_EA(bpf->extack, "driver XDP disabled in DebugFS"); in nsim_xdp_set_prog()
202 if (bpf->command == XDP_SETUP_PROG_HW && !ns->bpf_xdpoffload_accept) { in nsim_xdp_set_prog()
203 NSIM_EA(bpf->extack, "XDP offload disabled in DebugFS"); in nsim_xdp_set_prog()
[all …]
/Linux-v5.15/net/core/
Dlwt_bpf.c118 struct bpf_lwt *bpf; in bpf_input() local
121 bpf = bpf_lwt_lwtunnel(dst->lwtstate); in bpf_input()
122 if (bpf->in.prog) { in bpf_input()
123 ret = run_lwt_bpf(skb, &bpf->in, dst, NO_REDIRECT); in bpf_input()
141 struct bpf_lwt *bpf; in bpf_output() local
144 bpf = bpf_lwt_lwtunnel(dst->lwtstate); in bpf_output()
145 if (bpf->out.prog) { in bpf_output()
146 ret = run_lwt_bpf(skb, &bpf->out, dst, NO_REDIRECT); in bpf_output()
153 bpf->out.name); in bpf_output()
272 struct bpf_lwt *bpf; in bpf_xmit() local
[all …]
/Linux-v5.15/kernel/bpf/
Dnet_namespace.c60 run_array = rcu_replace_pointer(net->bpf.run_array[type], NULL, in netns_bpf_run_array_detach()
71 list_for_each_entry(pos, &net->bpf.links[type], node) { in link_index()
84 list_for_each(pos, &net->bpf.links[type]) in link_count()
95 list_for_each_entry(pos, &net->bpf.links[type], node) { in fill_prog_array()
133 old_array = rcu_dereference_protected(net->bpf.run_array[type], in bpf_netns_link_release()
141 rcu_assign_pointer(net->bpf.run_array[type], new_array); in bpf_netns_link_release()
188 run_array = rcu_dereference_protected(net->bpf.run_array[type], in bpf_netns_link_update_prog()
254 run_array = rcu_dereference_protected(net->bpf.run_array[type], in __netns_bpf_prog_query()
315 if (!list_empty(&net->bpf.links[type])) { in netns_bpf_prog_attach()
331 attached = net->bpf.progs[type]; in netns_bpf_prog_attach()
[all …]
Dcgroup.c28 percpu_ref_kill(&cgrp->bpf.refcnt); in cgroup_bpf_offline()
111 bpf.release_work); in cgroup_bpf_release()
113 struct list_head *storages = &cgrp->bpf.storages; in cgroup_bpf_release()
120 for (atype = 0; atype < ARRAY_SIZE(cgrp->bpf.progs); atype++) { in cgroup_bpf_release()
121 struct list_head *progs = &cgrp->bpf.progs[atype]; in cgroup_bpf_release()
134 cgrp->bpf.effective[atype], in cgroup_bpf_release()
149 percpu_ref_exit(&cgrp->bpf.refcnt); in cgroup_bpf_release()
160 struct cgroup *cgrp = container_of(ref, struct cgroup, bpf.refcnt); in cgroup_bpf_release_fn()
162 INIT_WORK(&cgrp->bpf.release_work, cgroup_bpf_release); in cgroup_bpf_release_fn()
163 queue_work(system_wq, &cgrp->bpf.release_work); in cgroup_bpf_release_fn()
[all …]
/Linux-v5.15/samples/seccomp/
DMakefile2 userprogs-always-y += bpf-fancy dropper bpf-direct user-trap
4 bpf-fancy-objs := bpf-fancy.o bpf-helper.o
/Linux-v5.15/Documentation/userspace-api/ebpf/
Dsyscall.rst10 The primary info for the bpf syscall is available in the `man-pages`_
11 for `bpf(2)`_.
13 bpf() subcommand reference
16 .. kernel-doc:: include/uapi/linux/bpf.h
19 .. kernel-doc:: include/uapi/linux/bpf.h
24 .. _bpf(2): https://man7.org/linux/man-pages/man2/bpf.2.html
/Linux-v5.15/Documentation/bpf/
Dindex.rst18 Documentation/bpf/libbpf/libbpf.rst is a userspace library for loading and interacting with bpf pro…
43 The primary info for the bpf syscall is available in the `man-pages`_
44 for `bpf(2)`_. For more information about the userspace API, see
50 * `bpf-helpers(7)`_ maintains a list of helpers available to eBPF programs.
97 .. _bpf(2): https://man7.org/linux/man-pages/man2/bpf.2.html
98 .. _bpf-helpers(7): https://man7.org/linux/man-pages/man7/bpf-helpers.7.html
99 .. _BPF and XDP Reference Guide: https://docs.cilium.io/en/latest/bpf/
Dbpf_devel_QA.rst23 loader development happens through the bpf kernel mailing list,
27 bpf@vger.kernel.org
49 A: Please submit your BPF patches to the bpf kernel mailing list:
51 bpf@vger.kernel.org
65 Those patches which target BPF, are assigned to a 'bpf' delegate for
81 the 'bpf' delegate).
89 * https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git/
90 * https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/
92 The bpf tree itself is for fixes only, whereas bpf-next for features,
94 analogous to net and net-next trees for networking. Both bpf and
[all …]
Dbpf_lsm.rst23 eBPF programs that use Documentation/bpf/btf.rst do not need to include kernel
58 macros defined in `tools/lib/bpf/bpf_tracing.h`_. In this
91 Documentation/bpf/btf.rst information. Since the BPF verifier is aware of the
98 eBPF programs can be loaded with the :manpage:`bpf(2)` syscall's
120 The LSM allows attachment of eBPF programs as LSM hooks using :manpage:`bpf(2)`
134 `tools/testing/selftests/bpf/progs/lsm.c`_ and the corresponding
135 userspace code in `tools/testing/selftests/bpf/prog_tests/test_lsm.c`_
138 .. _tools/lib/bpf/bpf_tracing.h:
139 https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/tools/lib/bpf/bpf_tracing.h
140 .. _tools/testing/selftests/bpf/progs/lsm.c:
[all …]
/Linux-v5.15/kernel/bpf/preload/iterators/
DMakefile8 LIBBPF_SRC := $(abspath ../../../../tools/lib/bpf)
36 iterators.skel.h: $(OUTPUT)/iterators.bpf.o | $(BPFTOOL)
41 $(OUTPUT)/iterators.bpf.o: iterators.bpf.c $(BPFOBJ) | $(OUTPUT)
43 $(Q)$(CLANG) -g -O2 -target bpf $(INCLUDES) \
56 $(Q)$(MAKE) $(submake_extras) -C ../../../../tools/bpf/bpftool \
/Linux-v5.15/tools/bpf/runqslower/
DMakefile9 LIBBPF_SRC := $(abspath ../../lib/bpf)
53 $(OUTPUT)/runqslower.bpf.o
55 $(OUTPUT)/runqslower.bpf.o: $(OUTPUT)/vmlinux.h runqslower.h
57 $(OUTPUT)/%.skel.h: $(OUTPUT)/%.bpf.o | $(BPFTOOL)
60 $(OUTPUT)/%.bpf.o: %.bpf.c $(BPFOBJ) | $(OUTPUT)
61 $(QUIET_GEN)$(CLANG) -g -O2 -target bpf $(INCLUDES) \
/Linux-v5.15/arch/um/drivers/
Dvector_user.c754 int uml_vector_attach_bpf(int fd, void *bpf) in uml_vector_attach_bpf() argument
756 struct sock_fprog *prog = bpf; in uml_vector_attach_bpf()
758 int err = setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, bpf, sizeof(struct sock_fprog)); in uml_vector_attach_bpf()
765 int uml_vector_detach_bpf(int fd, void *bpf) in uml_vector_detach_bpf() argument
767 struct sock_fprog *prog = bpf; in uml_vector_detach_bpf()
769 int err = setsockopt(fd, SOL_SOCKET, SO_DETACH_FILTER, bpf, sizeof(struct sock_fprog)); in uml_vector_detach_bpf()
776 struct sock_filter *bpf; in uml_vector_default_bpf() local
788 bpf = uml_kmalloc( in uml_vector_default_bpf()
790 if (bpf) { in uml_vector_default_bpf()
791 bpf_prog->filter = bpf; in uml_vector_default_bpf()
[all …]
/Linux-v5.15/drivers/net/ethernet/netronome/nfp/
DMakefile60 bpf/cmsg.o \
61 bpf/main.o \
62 bpf/offload.o \
63 bpf/verifier.o \
64 bpf/jit.o
/Linux-v5.15/tools/bpf/bpftool/
DMakefile17 BPF_DIR = $(srctree)/tools/lib/bpf/
63 -I$(srctree)/kernel/bpf/ \
81 clang-bpf-co-re
83 clang-bpf-co-re
152 ifeq ($(feature-clang-bpf-co-re),1)
163 $(OUTPUT)%.bpf.o: skeleton/%.bpf.c $(OUTPUT)vmlinux.h $(LIBBPF)
169 -g -O2 -Wall -target bpf -c $< -o $@ && $(LLVM_STRIP) -g $@
171 $(OUTPUT)%.skel.h: $(OUTPUT)%.bpf.o $(BPFTOOL_BOOTSTRAP)
183 $(BOOTSTRAP_OUTPUT)disasm.o: $(srctree)/kernel/bpf/disasm.c
186 $(OUTPUT)disasm.o: $(srctree)/kernel/bpf/disasm.c

12345678910