21 Jan, 2020
1 commit
-
Fix all files in samples/bpf to include libbpf header files with the bpf/
prefix, to be consistent with external users of the library. Also ensure
that all includes of exported libbpf header files (those that are exported
on 'make install' of the library) use bracketed includes instead of quoted.To make sure no new files are introduced that doesn't include the bpf/
prefix in its include, remove tools/lib/bpf from the include path entirely,
and use tools/lib instead.Fixes: 6910d7d3867a ("selftests/bpf: Ensure bpf_helper_defs.h are taken from selftests dir")
Signed-off-by: Toke Høiland-Jørgensen
Signed-off-by: Alexei Starovoitov
Acked-by: Jesper Dangaard Brouer
Acked-by: Andrii Nakryiko
Link: https://lore.kernel.org/bpf/157952560911.1683545.8795966751309534150.stgit@toke.dk
16 Dec, 2019
1 commit
-
When attaching XDP programs, userspace can set flags to request the attach
mode (generic/SKB mode, driver mode or hw offloaded mode). If no such flags
are requested, the kernel will attempt to attach in driver mode, and then
silently fall back to SKB mode if this fails.The silent fallback is a major source of user confusion, as users will try
to load a program on a device without XDP support, and instead of an error
they will get the silent fallback behaviour, not notice, and then wonder
why performance is not what they were expecting.In an attempt to combat this, let's switch all the samples to default to
explicitly requesting driver-mode attach. As part of this, ensure that all
the userspace utilities have a switch to enable SKB mode. For those that
have a switch to request driver mode, keep it but turn it into a no-op.Signed-off-by: Toke Høiland-Jørgensen
Signed-off-by: Alexei Starovoitov
Acked-by: Jesper Dangaard Brouer
Acked-by: David Ahern
Link: https://lore.kernel.org/bpf/20191216110742.364456-1-toke@redhat.com
20 Jun, 2019
1 commit
-
Alexei Starovoitov says:
====================
pull-request: bpf-next 2019-06-19The following pull-request contains BPF updates for your *net-next* tree.
The main changes are:
1) new SO_REUSEPORT_DETACH_BPF setsocktopt, from Martin.
2) BTF based map definition, from Andrii.
3) support bpf_map_lookup_elem for xskmap, from Jonathan.
4) bounded loops and scalar precision logic in the verifier, from Alexei.
====================Signed-off-by: David S. Miller
18 Jun, 2019
1 commit
-
Currently, header inclusion in each file is inconsistent.
For example, "libbpf.h" header is included as multiple ways.#include "bpf/libbpf.h"
#include "libbpf.h"Due to commit b552d33c80a9 ("samples/bpf: fix include path
in Makefile"), $(srctree)/tools/lib/bpf/ path had been included
during build, path "bpf/" in header isn't necessary anymore.This commit removes path "bpf/" in header inclusion.
Signed-off-by: Daniel T. Lee
Signed-off-by: Daniel Borkmann
31 May, 2019
1 commit
-
Based on 1 normalized pattern(s):
this program is free software you can redistribute it and or modify
it under the terms of version 2 of the gnu general public license as
published by the free software foundationextracted by the scancode license scanner the SPDX license identifier
GPL-2.0-only
has been chosen to replace the boilerplate/reference in 107 file(s).
Signed-off-by: Thomas Gleixner
Reviewed-by: Allison Randal
Reviewed-by: Richard Fontana
Reviewed-by: Steve Winslow
Reviewed-by: Alexios Zavras
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190528171438.615055994@linutronix.de
Signed-off-by: Greg Kroah-Hartman
02 Feb, 2019
4 commits
-
Check the program id within the signal handler on polling xdp samples
that were previously converted to libbpf usage. Avoid the situation of
unloading the program that was not attached by sample that is exiting.
Handle also the case where bpf_get_link_xdp_id didn't exit with an error
but the xdp program was not found on an interface.Reported-by: Michal Papaj
Reported-by: Jakub Spizewski
Signed-off-by: Maciej Fijalkowski
Reviewed-by: Jakub Kicinski
Signed-off-by: Daniel Borkmann -
Make xdp samples consistent with iproute2 behavior and set the
XDP_FLAGS_UPDATE_IF_NOEXIST by default when setting the xdp program on
interface. Provide an option for user to force the program loading,
which as a result will not include the mentioned flag in
bpf_set_link_xdp_fd call.Signed-off-by: Maciej Fijalkowski
Reviewed-by: Jakub Kicinski
Acked-by: John Fastabend
Signed-off-by: Daniel Borkmann -
There is a common problem with xdp samples that happens when user wants
to run a particular sample and some bpf program is already loaded. The
default 64kb RLIMIT_MEMLOCK resource limit will cause a following error
(assuming that xdp sample that is failing was converted to libbpf
usage):libbpf: Error in bpf_object__probe_name():Operation not permitted(1).
Couldn't load basic 'r0 = 0' BPF program.
libbpf: failed to load object './xdp_sample_pkts_kern.o'Fix it in xdp_sample_pkts and xdp_router_ipv4 by setting RLIMIT_MEMLOCK
to RLIM_INFINITY.Signed-off-by: Maciej Fijalkowski
Reviewed-by: Jakub Kicinski
Acked-by: Jesper Dangaard Brouer
Acked-by: John Fastabend
Signed-off-by: Daniel Borkmann -
Some of XDP samples that are attaching the bpf program to the interface
via libbpf's bpf_set_link_xdp_fd are still using the bpf_load.c for
loading and manipulating the ebpf program and maps. Convert them to do
this through libbpf usage and remove bpf_load from the picture.While at it remove what looks like debug leftover in
xdp_redirect_map_user.cIn xdp_redirect_cpu, change the way that the program to be loaded onto
interface is chosen - user now needs to pass the program's section name
instead of the relative number. In case of typo print out the section
names to choose from.Signed-off-by: Maciej Fijalkowski
Reviewed-by: Jakub Kicinski
Acked-by: Jesper Dangaard Brouer
Signed-off-by: Daniel Borkmann
15 May, 2018
1 commit
-
There are two files in the tree called libbpf.h which is becoming
problematic. Most samples don't actually need the local libbpf.h
they simply include it to get to bpf/bpf.h. Include bpf/bpf.h
directly instead.Signed-off-by: Jakub Kicinski
Acked-by: Jesper Dangaard Brouer
Signed-off-by: Alexei Starovoitov
03 Feb, 2018
1 commit
-
Use bpf_set_link_xdp_fd instead of set_link_xdp_fd to remove some
code duplication and benefit of netlink ext ack errors message.Signed-off-by: Eric Leblond
Signed-off-by: Alexei Starovoitov
14 Nov, 2017
1 commit
-
The assert statement is supposed to be part of the else branch but the
curly braces were accidentally left off.Fixes: 3e29cd0e6563 ("xdp: Sample xdp program implementing ip forward")
Signed-off-by: Dan Carpenter
Acked-by: Daniel Borkmann
Signed-off-by: David S. Miller
08 Nov, 2017
1 commit
-
Implements port to port forwarding with route table and arp table
lookup for ipv4 packets using bpf_redirect helper function and
lpm_trie map.Signed-off-by: Christina Jacob
Signed-off-by: David S. Miller