netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bpf-next 00/10] samples/bpf: modernize BPF functionality test programs
@ 2023-01-15  7:16 Daniel T. Lee
  2023-01-15  7:16 ` [bpf-next 01/10] samples/bpf: ensure ipv6 is enabled before running tests Daniel T. Lee
                   ` (10 more replies)
  0 siblings, 11 replies; 16+ messages in thread
From: Daniel T. Lee @ 2023-01-15  7:16 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko,
	Yonghong Song, Martin KaFai Lau, Song Liu, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Andrii Nakryiko
  Cc: bpf, netdev

Currently, there are many programs under samples/bpf to test the
various functionality of BPF that have been developed for a long time.
However, the kernel (BPF) has changed a lot compared to the 2016 when
some of these test programs were first introduced.

Therefore, some of these programs use the deprecated function of BPF,
and some programs no longer work normally due to changes in the API.

To list some of the kernel changes that this patch set is focusing on,
- legacy BPF map declaration syntax support had been dropped [1]
- bpf_trace_printk() always append newline at the end [2]
- deprecated styled BPF section header (bpf_load style) [3] 
- urandom_read tracepoint is removed (used for testing overhead) [4]
- ping sends packet with SOCK_DGRAM instead of SOCK_RAW [5]*
- use "vmlinux.h" instead of including individual headers

In addition to this, this patchset tries to modernize the existing
testing scripts a bit. And for network-related testing programs,
a separate header file was created and applied. (To use the 
Endianness conversion function from xdp_sample and bunch of constants)

[1]: https://github.com/libbpf/libbpf/issues/282
[2]: commit ac5a72ea5c89 ("bpf: Use dedicated bpf_trace_printk event instead of trace_printk()")
[3]: commit ceb5dea56543 ("samples: bpf: Remove bpf_load loader completely")
[4]: commit 14c174633f34 ("random: remove unused tracepoints")
[5]: https://lwn.net/Articles/422330/

*: This is quite old, but I'm not sure why the code was initially
   developed to filter only SOCK_RAW.

Daniel T. Lee (10):
  samples/bpf: ensure ipv6 is enabled before running tests
  samples/bpf: refactor BPF functionality testing scripts
  samples/bpf: fix broken lightweight tunnel testing
  samples/bpf: fix broken cgroup socket testing
  samples/bpf: replace broken overhead microbenchmark with
    fib_table_lookup
  samples/bpf: replace legacy map with the BTF-defined map
  samples/bpf: split common macros to net_shared.h
  samples/bpf: replace BPF programs header with net_shared.h
  samples/bpf: use vmlinux.h instead of implicit headers in BPF test
    program
  samples/bpf: change _kern suffix to .bpf with BPF test programs

 samples/bpf/Makefile                          | 14 +++---
 ...lwt_len_hist_kern.c => lwt_len_hist.bpf.c} | 29 +++--------
 samples/bpf/lwt_len_hist.sh                   |  4 +-
 samples/bpf/net_shared.h                      | 32 ++++++++++++
 .../{sock_flags_kern.c => sock_flags.bpf.c}   | 24 ++++-----
 samples/bpf/tc_l2_redirect.sh                 |  3 ++
 samples/bpf/test_cgrp2_sock.sh                | 16 +++---
 samples/bpf/test_cgrp2_sock2.sh               |  9 +++-
 ...st_cgrp2_tc_kern.c => test_cgrp2_tc.bpf.c} | 34 ++++---------
 samples/bpf/test_cgrp2_tc.sh                  |  8 +--
 samples/bpf/test_lwt_bpf.c                    | 50 ++++++++-----------
 samples/bpf/test_lwt_bpf.sh                   | 19 ++++---
 ...ap_in_map_kern.c => test_map_in_map.bpf.c} |  7 +--
 samples/bpf/test_map_in_map_user.c            |  2 +-
 ...robe_kern.c => test_overhead_kprobe.bpf.c} |  6 +--
 ...w_tp_kern.c => test_overhead_raw_tp.bpf.c} |  4 +-
 ...rhead_tp_kern.c => test_overhead_tp.bpf.c} | 29 +++++++----
 samples/bpf/test_overhead_user.c              | 34 ++++++++-----
 samples/bpf/xdp_sample.bpf.h                  | 22 +-------
 19 files changed, 179 insertions(+), 167 deletions(-)
 rename samples/bpf/{lwt_len_hist_kern.c => lwt_len_hist.bpf.c} (75%)
 create mode 100644 samples/bpf/net_shared.h
 rename samples/bpf/{sock_flags_kern.c => sock_flags.bpf.c} (66%)
 rename samples/bpf/{test_cgrp2_tc_kern.c => test_cgrp2_tc.bpf.c} (70%)
 rename samples/bpf/{test_map_in_map_kern.c => test_map_in_map.bpf.c} (97%)
 rename samples/bpf/{test_overhead_kprobe_kern.c => test_overhead_kprobe.bpf.c} (92%)
 rename samples/bpf/{test_overhead_raw_tp_kern.c => test_overhead_raw_tp.bpf.c} (82%)
 rename samples/bpf/{test_overhead_tp_kern.c => test_overhead_tp.bpf.c} (61%)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [bpf-next 01/10] samples/bpf: ensure ipv6 is enabled before running tests
  2023-01-15  7:16 [bpf-next 00/10] samples/bpf: modernize BPF functionality test programs Daniel T. Lee
@ 2023-01-15  7:16 ` Daniel T. Lee
  2023-01-15  7:16 ` [bpf-next 02/10] samples/bpf: refactor BPF functionality testing scripts Daniel T. Lee
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Daniel T. Lee @ 2023-01-15  7:16 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko,
	Yonghong Song, Martin KaFai Lau, Song Liu, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Andrii Nakryiko
  Cc: bpf, netdev

Currently, a few of BPF tests use ipv6 functionality. The problem here
is that if ipv6 is disabled, these tests will fail, and even if the
test fails, it will not tell you why it failed.

    $ sudo ./test_cgrp2_sock2.sh
    RTNETLINK answers: Permission denied

In order to fix this, this commit ensures ipv6 is enabled prior to
running tests.

Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
---
 samples/bpf/tc_l2_redirect.sh   | 3 +++
 samples/bpf/test_cgrp2_sock2.sh | 4 +++-
 samples/bpf/test_cgrp2_tc.sh    | 2 ++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/samples/bpf/tc_l2_redirect.sh b/samples/bpf/tc_l2_redirect.sh
index 37d95ef3c20f..a28a8fc99dbe 100755
--- a/samples/bpf/tc_l2_redirect.sh
+++ b/samples/bpf/tc_l2_redirect.sh
@@ -8,6 +8,7 @@ REDIRECT_USER='./tc_l2_redirect'
 REDIRECT_BPF='./tc_l2_redirect_kern.o'
 
 RP_FILTER=$(< /proc/sys/net/ipv4/conf/all/rp_filter)
+IPV6_DISABLED=$(< /proc/sys/net/ipv6/conf/all/disable_ipv6)
 IPV6_FORWARDING=$(< /proc/sys/net/ipv6/conf/all/forwarding)
 
 function config_common {
@@ -64,6 +65,7 @@ function config_common {
 
 	sysctl -q -w net.ipv4.conf.all.rp_filter=0
 	sysctl -q -w net.ipv6.conf.all.forwarding=1
+	sysctl -q -w net.ipv6.conf.all.disable_ipv6=0
 }
 
 function cleanup {
@@ -77,6 +79,7 @@ function cleanup {
 	$IP link del ip6t >& /dev/null
 	sysctl -q -w net.ipv4.conf.all.rp_filter=$RP_FILTER
 	sysctl -q -w net.ipv6.conf.all.forwarding=$IPV6_FORWARDING
+	sysctl -q -w net.ipv6.conf.all.disable_ipv6=$IPV6_DISABLED
 	rm -f /sys/fs/bpf/tc/globals/tun_iface
 	[[ -z $DEBUG ]] || set -x
 	set -e
diff --git a/samples/bpf/test_cgrp2_sock2.sh b/samples/bpf/test_cgrp2_sock2.sh
index 6a3dbe642b2b..ac45828ed2bd 100755
--- a/samples/bpf/test_cgrp2_sock2.sh
+++ b/samples/bpf/test_cgrp2_sock2.sh
@@ -7,13 +7,15 @@ LINK_PIN=$BPFFS/test_cgrp2_sock2
 function config_device {
 	ip netns add at_ns0
 	ip link add veth0 type veth peer name veth0b
-	ip link set veth0b up
 	ip link set veth0 netns at_ns0
+	ip netns exec at_ns0 sysctl -q net.ipv6.conf.veth0.disable_ipv6=0
 	ip netns exec at_ns0 ip addr add 172.16.1.100/24 dev veth0
 	ip netns exec at_ns0 ip addr add 2401:db00::1/64 dev veth0 nodad
 	ip netns exec at_ns0 ip link set dev veth0 up
+	sysctl -q net.ipv6.conf.veth0b.disable_ipv6=0
 	ip addr add 172.16.1.101/24 dev veth0b
 	ip addr add 2401:db00::2/64 dev veth0b nodad
+	ip link set veth0b up
 }
 
 function config_cgroup {
diff --git a/samples/bpf/test_cgrp2_tc.sh b/samples/bpf/test_cgrp2_tc.sh
index 395573be6ae8..a6f1ed03ddf6 100755
--- a/samples/bpf/test_cgrp2_tc.sh
+++ b/samples/bpf/test_cgrp2_tc.sh
@@ -73,11 +73,13 @@ setup_net() {
 	start)
 	    $IP link add $HOST_IFC type veth peer name $NS_IFC || return $?
 	    $IP link set dev $HOST_IFC up || return $?
+	    sysctl -q net.ipv6.conf.$HOST_IFC.disable_ipv6=0
 	    sysctl -q net.ipv6.conf.$HOST_IFC.accept_dad=0
 
 	    $IP netns add ns || return $?
 	    $IP link set dev $NS_IFC netns ns || return $?
 	    $IP -n $NS link set dev $NS_IFC up || return $?
+	    $IP netns exec $NS sysctl -q net.ipv6.conf.$NS_IFC.disable_ipv6=0
 	    $IP netns exec $NS sysctl -q net.ipv6.conf.$NS_IFC.accept_dad=0
 	    $TC qdisc add dev $HOST_IFC clsact || return $?
 	    $TC filter add dev $HOST_IFC egress bpf da obj $BPF_PROG sec $BPF_SECTION || return $?
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [bpf-next 02/10] samples/bpf: refactor BPF functionality testing scripts
  2023-01-15  7:16 [bpf-next 00/10] samples/bpf: modernize BPF functionality test programs Daniel T. Lee
  2023-01-15  7:16 ` [bpf-next 01/10] samples/bpf: ensure ipv6 is enabled before running tests Daniel T. Lee
@ 2023-01-15  7:16 ` Daniel T. Lee
  2023-01-15  7:16 ` [bpf-next 03/10] samples/bpf: fix broken lightweight tunnel testing Daniel T. Lee
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Daniel T. Lee @ 2023-01-15  7:16 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko,
	Yonghong Song, Martin KaFai Lau, Song Liu, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Andrii Nakryiko
  Cc: bpf, netdev

Currently, some test scripts are experiencing minor errors related to
executing tests.

    $ sudo ./test_cgrp2_sock.sh
    ./test_cgrp2_sock.sh: 22: test_cgrp2_sock: not found

This problem occurs because the path to the execution target is not
properly specified. Therefore, this commit solves this problem by
specifying a relative path to its executables. This commit also makes
a concise refactoring of hard-coded BPF program names.

Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
---
 samples/bpf/lwt_len_hist.sh     |  4 ++--
 samples/bpf/test_cgrp2_sock.sh  | 16 +++++++++-------
 samples/bpf/test_cgrp2_sock2.sh |  5 ++++-
 samples/bpf/test_cgrp2_tc.sh    |  4 ++--
 samples/bpf/test_lwt_bpf.sh     |  8 +++++---
 5 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/samples/bpf/lwt_len_hist.sh b/samples/bpf/lwt_len_hist.sh
index 0eda9754f50b..ff7d1ba0f7ed 100755
--- a/samples/bpf/lwt_len_hist.sh
+++ b/samples/bpf/lwt_len_hist.sh
@@ -4,7 +4,7 @@
 NS1=lwt_ns1
 VETH0=tst_lwt1a
 VETH1=tst_lwt1b
-
+BPF_PROG=lwt_len_hist_kern.o
 TRACE_ROOT=/sys/kernel/debug/tracing
 
 function cleanup {
@@ -30,7 +30,7 @@ ip netns exec $NS1 netserver
 
 echo 1 > ${TRACE_ROOT}/tracing_on
 cp /dev/null ${TRACE_ROOT}/trace
-ip route add 192.168.253.2/32 encap bpf out obj lwt_len_hist_kern.o section len_hist dev $VETH0
+ip route add 192.168.253.2/32 encap bpf out obj $BPF_PROG section len_hist dev $VETH0
 netperf -H 192.168.253.2 -t TCP_STREAM
 cat ${TRACE_ROOT}/trace | grep -v '^#'
 ./lwt_len_hist
diff --git a/samples/bpf/test_cgrp2_sock.sh b/samples/bpf/test_cgrp2_sock.sh
index 9f6174236856..36bd7cb46f06 100755
--- a/samples/bpf/test_cgrp2_sock.sh
+++ b/samples/bpf/test_cgrp2_sock.sh
@@ -3,6 +3,8 @@
 
 # Test various socket options that can be set by attaching programs to cgroups.
 
+MY_DIR=$(dirname $0)
+TEST=$MY_DIR/test_cgrp2_sock
 CGRP_MNT="/tmp/cgroupv2-test_cgrp2_sock"
 
 ################################################################################
@@ -19,7 +21,7 @@ print_result()
 
 check_sock()
 {
-	out=$(test_cgrp2_sock)
+	out=$($TEST)
 	echo $out | grep -q "$1"
 	if [ $? -ne 0 ]; then
 		print_result 1 "IPv4: $2"
@@ -33,7 +35,7 @@ check_sock()
 
 check_sock6()
 {
-	out=$(test_cgrp2_sock -6)
+	out=$($TEST -6)
 	echo $out | grep -q "$1"
 	if [ $? -ne 0 ]; then
 		print_result 1 "IPv6: $2"
@@ -61,7 +63,7 @@ cleanup_and_exit()
 
 	[ -n "$msg" ] && echo "ERROR: $msg"
 
-	test_cgrp2_sock -d ${CGRP_MNT}/sockopts
+	$TEST -d ${CGRP_MNT}/sockopts
 	ip li del cgrp2_sock
 	umount ${CGRP_MNT}
 
@@ -98,7 +100,7 @@ check_sock6 "dev , mark 0, priority 0" "No programs attached"
 
 # verify device is set
 #
-test_cgrp2_sock -b cgrp2_sock ${CGRP_MNT}/sockopts
+$TEST -b cgrp2_sock ${CGRP_MNT}/sockopts
 if [ $? -ne 0 ]; then
 	cleanup_and_exit 1 "Failed to install program to set device"
 fi
@@ -107,7 +109,7 @@ check_sock6 "dev cgrp2_sock, mark 0, priority 0" "Device set"
 
 # verify mark is set
 #
-test_cgrp2_sock -m 666 ${CGRP_MNT}/sockopts
+$TEST -m 666 ${CGRP_MNT}/sockopts
 if [ $? -ne 0 ]; then
 	cleanup_and_exit 1 "Failed to install program to set mark"
 fi
@@ -116,7 +118,7 @@ check_sock6 "dev , mark 666, priority 0" "Mark set"
 
 # verify priority is set
 #
-test_cgrp2_sock -p 123 ${CGRP_MNT}/sockopts
+$TEST -p 123 ${CGRP_MNT}/sockopts
 if [ $? -ne 0 ]; then
 	cleanup_and_exit 1 "Failed to install program to set priority"
 fi
@@ -125,7 +127,7 @@ check_sock6 "dev , mark 0, priority 123" "Priority set"
 
 # all 3 at once
 #
-test_cgrp2_sock -b cgrp2_sock -m 666 -p 123 ${CGRP_MNT}/sockopts
+$TEST -b cgrp2_sock -m 666 -p 123 ${CGRP_MNT}/sockopts
 if [ $? -ne 0 ]; then
 	cleanup_and_exit 1 "Failed to install program to set device, mark and priority"
 fi
diff --git a/samples/bpf/test_cgrp2_sock2.sh b/samples/bpf/test_cgrp2_sock2.sh
index ac45828ed2bd..00cc8d15373c 100755
--- a/samples/bpf/test_cgrp2_sock2.sh
+++ b/samples/bpf/test_cgrp2_sock2.sh
@@ -2,7 +2,10 @@
 # SPDX-License-Identifier: GPL-2.0
 
 BPFFS=/sys/fs/bpf
+MY_DIR=$(dirname $0)
+TEST=$MY_DIR/test_cgrp2_sock2
 LINK_PIN=$BPFFS/test_cgrp2_sock2
+BPF_PROG=$MY_DIR/sock_flags_kern.o
 
 function config_device {
 	ip netns add at_ns0
@@ -36,7 +39,7 @@ function config_bpffs {
 }
 
 function attach_bpf {
-	./test_cgrp2_sock2 /tmp/cgroupv2/foo sock_flags_kern.o $1
+	$TEST /tmp/cgroupv2/foo $BPF_PROG $1
 	[ $? -ne 0 ] && exit 1
 }
 
diff --git a/samples/bpf/test_cgrp2_tc.sh b/samples/bpf/test_cgrp2_tc.sh
index a6f1ed03ddf6..37a2c9cba6d0 100755
--- a/samples/bpf/test_cgrp2_tc.sh
+++ b/samples/bpf/test_cgrp2_tc.sh
@@ -76,8 +76,8 @@ setup_net() {
 	    sysctl -q net.ipv6.conf.$HOST_IFC.disable_ipv6=0
 	    sysctl -q net.ipv6.conf.$HOST_IFC.accept_dad=0
 
-	    $IP netns add ns || return $?
-	    $IP link set dev $NS_IFC netns ns || return $?
+	    $IP netns add $NS || return $?
+	    $IP link set dev $NS_IFC netns $NS || return $?
 	    $IP -n $NS link set dev $NS_IFC up || return $?
 	    $IP netns exec $NS sysctl -q net.ipv6.conf.$NS_IFC.disable_ipv6=0
 	    $IP netns exec $NS sysctl -q net.ipv6.conf.$NS_IFC.accept_dad=0
diff --git a/samples/bpf/test_lwt_bpf.sh b/samples/bpf/test_lwt_bpf.sh
index 65a976058dd3..8fc9356545d8 100755
--- a/samples/bpf/test_lwt_bpf.sh
+++ b/samples/bpf/test_lwt_bpf.sh
@@ -19,6 +19,8 @@ IPVETH3="192.168.111.2"
 
 IP_LOCAL="192.168.99.1"
 
+PROG_SRC="test_lwt_bpf.c"
+BPF_PROG="test_lwt_bpf.o"
 TRACE_ROOT=/sys/kernel/debug/tracing
 
 function lookup_mac()
@@ -36,7 +38,7 @@ function lookup_mac()
 
 function cleanup {
 	set +ex
-	rm test_lwt_bpf.o 2> /dev/null
+	rm $BPF_PROG 2> /dev/null
 	ip link del $VETH0 2> /dev/null
 	ip link del $VETH1 2> /dev/null
 	ip link del $VETH2 2> /dev/null
@@ -76,7 +78,7 @@ function install_test {
 	cleanup_routes
 	cp /dev/null ${TRACE_ROOT}/trace
 
-	OPTS="encap bpf headroom 14 $1 obj test_lwt_bpf.o section $2 $VERBOSE"
+	OPTS="encap bpf headroom 14 $1 obj $BPF_PROG section $2 $VERBOSE"
 
 	if [ "$1" == "in" ];  then
 		ip route add table local local ${IP_LOCAL}/32 $OPTS dev lo
@@ -374,7 +376,7 @@ DST_IFINDEX=$(cat /sys/class/net/$VETH0/ifindex)
 
 CLANG_OPTS="-O2 -target bpf -I ../include/"
 CLANG_OPTS+=" -DSRC_MAC=$SRC_MAC -DDST_MAC=$DST_MAC -DDST_IFINDEX=$DST_IFINDEX"
-clang $CLANG_OPTS -c test_lwt_bpf.c -o test_lwt_bpf.o
+clang $CLANG_OPTS -c $PROG_SRC -o $BPF_PROG
 
 test_ctx_xmit
 test_ctx_out
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [bpf-next 03/10] samples/bpf: fix broken lightweight tunnel testing
  2023-01-15  7:16 [bpf-next 00/10] samples/bpf: modernize BPF functionality test programs Daniel T. Lee
  2023-01-15  7:16 ` [bpf-next 01/10] samples/bpf: ensure ipv6 is enabled before running tests Daniel T. Lee
  2023-01-15  7:16 ` [bpf-next 02/10] samples/bpf: refactor BPF functionality testing scripts Daniel T. Lee
@ 2023-01-15  7:16 ` Daniel T. Lee
  2023-01-15  7:16 ` [bpf-next 04/10] samples/bpf: fix broken cgroup socket testing Daniel T. Lee
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Daniel T. Lee @ 2023-01-15  7:16 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko,
	Yonghong Song, Martin KaFai Lau, Song Liu, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Andrii Nakryiko
  Cc: bpf, netdev

The test_lwt_bpf is a script that tests the functionality of BPF through
the output of the ftrace with bpf_trace_printk. Currently, this program
is not operating normally for several reasons.

First of all, this test script can't parse the ftrace results properly.
GNU sed tries to be as greedy as possible when attempting pattern
matching. Due to this, cutting metadata (such as timestamp) from the
log entry of ftrace doesn't work properly, and also desired log isn't
extracted properly. To make sed stripping clearer, 'nocontext-info'
option with the ftrace has been used to remove metadata from the log.
Also, instead of using unclear pattern matching, this commit specifies
an explicit parse pattern.

Also, unlike before when this test was introduced, the way
bpf_trace_printk behaves has changed[1]. The previous bpf_trace_printk
had to always have '\n' in order to print newline, but now that the
bpf_trace_printk call includes newline by default, so '\n' is no longer
needed.

Lastly with the lwt ENCAP_BPF out, the context information with the
sk_buff protocol is preserved. Therefore, this commit changes the
previous test result from 'protocol 0' to 'protocol 8', which means
ETH_P_IP.

[1]: commit ac5a72ea5c89 ("bpf: Use dedicated bpf_trace_printk event instead of trace_printk()")
Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
---
 samples/bpf/test_lwt_bpf.c  | 36 ++++++++++++++++++------------------
 samples/bpf/test_lwt_bpf.sh | 11 +++++++----
 2 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/samples/bpf/test_lwt_bpf.c b/samples/bpf/test_lwt_bpf.c
index 1b568575ad11..f53dab88d231 100644
--- a/samples/bpf/test_lwt_bpf.c
+++ b/samples/bpf/test_lwt_bpf.c
@@ -44,9 +44,9 @@ SEC("test_ctx")
 int do_test_ctx(struct __sk_buff *skb)
 {
 	skb->cb[0] = CB_MAGIC;
-	printk("len %d hash %d protocol %d\n", skb->len, skb->hash,
+	printk("len %d hash %d protocol %d", skb->len, skb->hash,
 	       skb->protocol);
-	printk("cb %d ingress_ifindex %d ifindex %d\n", skb->cb[0],
+	printk("cb %d ingress_ifindex %d ifindex %d", skb->cb[0],
 	       skb->ingress_ifindex, skb->ifindex);
 
 	return BPF_OK;
@@ -56,9 +56,9 @@ int do_test_ctx(struct __sk_buff *skb)
 SEC("test_cb")
 int do_test_cb(struct __sk_buff *skb)
 {
-	printk("cb0: %x cb1: %x cb2: %x\n", skb->cb[0], skb->cb[1],
+	printk("cb0: %x cb1: %x cb2: %x", skb->cb[0], skb->cb[1],
 	       skb->cb[2]);
-	printk("cb3: %x cb4: %x\n", skb->cb[3], skb->cb[4]);
+	printk("cb3: %x cb4: %x", skb->cb[3], skb->cb[4]);
 
 	return BPF_OK;
 }
@@ -72,11 +72,11 @@ int do_test_data(struct __sk_buff *skb)
 	struct iphdr *iph = data;
 
 	if (data + sizeof(*iph) > data_end) {
-		printk("packet truncated\n");
+		printk("packet truncated");
 		return BPF_DROP;
 	}
 
-	printk("src: %x dst: %x\n", iph->saddr, iph->daddr);
+	printk("src: %x dst: %x", iph->saddr, iph->daddr);
 
 	return BPF_OK;
 }
@@ -97,7 +97,7 @@ static inline int rewrite(struct __sk_buff *skb, uint32_t old_ip,
 
 	ret = bpf_skb_load_bytes(skb, IP_PROTO_OFF, &proto, 1);
 	if (ret < 0) {
-		printk("bpf_l4_csum_replace failed: %d\n", ret);
+		printk("bpf_l4_csum_replace failed: %d", ret);
 		return BPF_DROP;
 	}
 
@@ -120,14 +120,14 @@ static inline int rewrite(struct __sk_buff *skb, uint32_t old_ip,
 		ret = bpf_l4_csum_replace(skb, off, old_ip, new_ip,
 					  flags | sizeof(new_ip));
 		if (ret < 0) {
-			printk("bpf_l4_csum_replace failed: %d\n");
+			printk("bpf_l4_csum_replace failed: %d");
 			return BPF_DROP;
 		}
 	}
 
 	ret = bpf_l3_csum_replace(skb, IP_CSUM_OFF, old_ip, new_ip, sizeof(new_ip));
 	if (ret < 0) {
-		printk("bpf_l3_csum_replace failed: %d\n", ret);
+		printk("bpf_l3_csum_replace failed: %d", ret);
 		return BPF_DROP;
 	}
 
@@ -137,7 +137,7 @@ static inline int rewrite(struct __sk_buff *skb, uint32_t old_ip,
 		ret = bpf_skb_store_bytes(skb, IP_SRC_OFF, &new_ip, sizeof(new_ip), 0);
 
 	if (ret < 0) {
-		printk("bpf_skb_store_bytes() failed: %d\n", ret);
+		printk("bpf_skb_store_bytes() failed: %d", ret);
 		return BPF_DROP;
 	}
 
@@ -153,12 +153,12 @@ int do_test_rewrite(struct __sk_buff *skb)
 
 	ret = bpf_skb_load_bytes(skb, IP_DST_OFF, &old_ip, 4);
 	if (ret < 0) {
-		printk("bpf_skb_load_bytes failed: %d\n", ret);
+		printk("bpf_skb_load_bytes failed: %d", ret);
 		return BPF_DROP;
 	}
 
 	if (old_ip == 0x2fea8c0) {
-		printk("out: rewriting from %x to %x\n", old_ip, new_ip);
+		printk("out: rewriting from %x to %x", old_ip, new_ip);
 		return rewrite(skb, old_ip, new_ip, 1);
 	}
 
@@ -173,7 +173,7 @@ static inline int __do_push_ll_and_redirect(struct __sk_buff *skb)
 
 	ret = bpf_skb_change_head(skb, 14, 0);
 	if (ret < 0) {
-		printk("skb_change_head() failed: %d\n", ret);
+		printk("skb_change_head() failed: %d", ret);
 	}
 
 	ehdr.h_proto = __constant_htons(ETH_P_IP);
@@ -182,7 +182,7 @@ static inline int __do_push_ll_and_redirect(struct __sk_buff *skb)
 
 	ret = bpf_skb_store_bytes(skb, 0, &ehdr, sizeof(ehdr), 0);
 	if (ret < 0) {
-		printk("skb_store_bytes() failed: %d\n", ret);
+		printk("skb_store_bytes() failed: %d", ret);
 		return BPF_DROP;
 	}
 
@@ -202,7 +202,7 @@ int do_push_ll_and_redirect(struct __sk_buff *skb)
 
 	ret = __do_push_ll_and_redirect(skb);
 	if (ret >= 0)
-		printk("redirected to %d\n", ifindex);
+		printk("redirected to %d", ifindex);
 
 	return ret;
 }
@@ -229,7 +229,7 @@ SEC("fill_garbage")
 int do_fill_garbage(struct __sk_buff *skb)
 {
 	__fill_garbage(skb);
-	printk("Set initial 96 bytes of header to FF\n");
+	printk("Set initial 96 bytes of header to FF");
 	return BPF_OK;
 }
 
@@ -238,7 +238,7 @@ int do_fill_garbage_and_redirect(struct __sk_buff *skb)
 {
 	int ifindex = DST_IFINDEX;
 	__fill_garbage(skb);
-	printk("redirected to %d\n", ifindex);
+	printk("redirected to %d", ifindex);
 	return bpf_redirect(ifindex, 0);
 }
 
@@ -246,7 +246,7 @@ int do_fill_garbage_and_redirect(struct __sk_buff *skb)
 SEC("drop_all")
 int do_drop_all(struct __sk_buff *skb)
 {
-	printk("dropping with: %d\n", BPF_DROP);
+	printk("dropping with: %d", BPF_DROP);
 	return BPF_DROP;
 }
 
diff --git a/samples/bpf/test_lwt_bpf.sh b/samples/bpf/test_lwt_bpf.sh
index 8fc9356545d8..2e9f5126963b 100755
--- a/samples/bpf/test_lwt_bpf.sh
+++ b/samples/bpf/test_lwt_bpf.sh
@@ -22,6 +22,7 @@ IP_LOCAL="192.168.99.1"
 PROG_SRC="test_lwt_bpf.c"
 BPF_PROG="test_lwt_bpf.o"
 TRACE_ROOT=/sys/kernel/debug/tracing
+CONTEXT_INFO=$(cat ${TRACE_ROOT}/trace_options | grep context)
 
 function lookup_mac()
 {
@@ -98,7 +99,7 @@ function remove_prog {
 function filter_trace {
 	# Add newline to allow starting EXPECT= variables on newline
 	NL=$'\n'
-	echo "${NL}$*" | sed -e 's/^.*: : //g'
+	echo "${NL}$*" | sed -e 's/bpf_trace_printk: //g'
 }
 
 function expect_fail {
@@ -162,11 +163,11 @@ function test_ctx_out {
 		failure "test_ctx out: packets are dropped"
 	}
 	match_trace "$(get_trace)" "
-len 84 hash 0 protocol 0
+len 84 hash 0 protocol 8
 cb 1234 ingress_ifindex 0 ifindex 0
-len 84 hash 0 protocol 0
+len 84 hash 0 protocol 8
 cb 1234 ingress_ifindex 0 ifindex 0
-len 84 hash 0 protocol 0
+len 84 hash 0 protocol 8
 cb 1234 ingress_ifindex 0 ifindex 0" || exit 1
 	remove_prog out
 }
@@ -369,6 +370,7 @@ setup_one_veth $NS1 $VETH0 $VETH1 $IPVETH0 $IPVETH1 $IPVETH1b
 setup_one_veth $NS2 $VETH2 $VETH3 $IPVETH2 $IPVETH3
 ip netns exec $NS1 netserver
 echo 1 > ${TRACE_ROOT}/tracing_on
+echo nocontext-info > ${TRACE_ROOT}/trace_options
 
 DST_MAC=$(lookup_mac $VETH1 $NS1)
 SRC_MAC=$(lookup_mac $VETH0)
@@ -399,4 +401,5 @@ test_netperf_redirect
 
 cleanup
 echo 0 > ${TRACE_ROOT}/tracing_on
+echo $CONTEXT_INFO > ${TRACE_ROOT}/trace_options
 exit 0
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [bpf-next 04/10] samples/bpf: fix broken cgroup socket testing
  2023-01-15  7:16 [bpf-next 00/10] samples/bpf: modernize BPF functionality test programs Daniel T. Lee
                   ` (2 preceding siblings ...)
  2023-01-15  7:16 ` [bpf-next 03/10] samples/bpf: fix broken lightweight tunnel testing Daniel T. Lee
@ 2023-01-15  7:16 ` Daniel T. Lee
  2023-01-15  7:16 ` [bpf-next 05/10] samples/bpf: replace broken overhead microbenchmark with fib_table_lookup Daniel T. Lee
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Daniel T. Lee @ 2023-01-15  7:16 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko,
	Yonghong Song, Martin KaFai Lau, Song Liu, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Andrii Nakryiko
  Cc: bpf, netdev

Currently, executing test_cgrp2_sock2 fails due to wrong section
header. This 'cgroup/sock1' style section is previously used at
'samples/bpf_load' (deprecated) BPF loader. Because this style isn't
supported in libbpf, this commit fixes this problem by correcting the
section header.

    $ sudo ./test_cgrp2_sock2.sh
    libbpf: prog 'bpf_prog1': missing BPF prog type, check ELF section name 'cgroup/sock1'
    libbpf: prog 'bpf_prog1': failed to load: -22
    libbpf: failed to load object './sock_flags_kern.o'
    ERROR: loading BPF object file failed

In addition, this BPF program filters ping packets by comparing whether
the socket type uses SOCK_RAW. However, after the ICMP socket[1] was
developed, ping sends ICMP packets using SOCK_DGRAM. Therefore, in this
commit, the packet filtering is changed to use SOCK_DGRAM instead of
SOCK_RAW.

    $ strace --trace socket ping -6 -c1 -w1 ::1
    socket(AF_INET6, SOCK_DGRAM, IPPROTO_ICMPV6) = 3

[1]: https://lwn.net/Articles/422330/

Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
---
 samples/bpf/sock_flags_kern.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/samples/bpf/sock_flags_kern.c b/samples/bpf/sock_flags_kern.c
index 6d0ac7569d6f..1d58cb9b6fa4 100644
--- a/samples/bpf/sock_flags_kern.c
+++ b/samples/bpf/sock_flags_kern.c
@@ -5,7 +5,7 @@
 #include <uapi/linux/in6.h>
 #include <bpf/bpf_helpers.h>
 
-SEC("cgroup/sock1")
+SEC("cgroup/sock")
 int bpf_prog1(struct bpf_sock *sk)
 {
 	char fmt[] = "socket: family %d type %d protocol %d\n";
@@ -17,29 +17,29 @@ int bpf_prog1(struct bpf_sock *sk)
 	bpf_trace_printk(fmt, sizeof(fmt), sk->family, sk->type, sk->protocol);
 	bpf_trace_printk(fmt2, sizeof(fmt2), uid, gid);
 
-	/* block PF_INET6, SOCK_RAW, IPPROTO_ICMPV6 sockets
+	/* block PF_INET6, SOCK_DGRAM, IPPROTO_ICMPV6 sockets
 	 * ie., make ping6 fail
 	 */
 	if (sk->family == PF_INET6 &&
-	    sk->type == SOCK_RAW   &&
+	    sk->type == SOCK_DGRAM   &&
 	    sk->protocol == IPPROTO_ICMPV6)
 		return 0;
 
 	return 1;
 }
 
-SEC("cgroup/sock2")
+SEC("cgroup/sock")
 int bpf_prog2(struct bpf_sock *sk)
 {
 	char fmt[] = "socket: family %d type %d protocol %d\n";
 
 	bpf_trace_printk(fmt, sizeof(fmt), sk->family, sk->type, sk->protocol);
 
-	/* block PF_INET, SOCK_RAW, IPPROTO_ICMP sockets
+	/* block PF_INET, SOCK_DGRAM, IPPROTO_ICMP sockets
 	 * ie., make ping fail
 	 */
 	if (sk->family == PF_INET &&
-	    sk->type == SOCK_RAW  &&
+	    sk->type == SOCK_DGRAM  &&
 	    sk->protocol == IPPROTO_ICMP)
 		return 0;
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [bpf-next 05/10] samples/bpf: replace broken overhead microbenchmark with fib_table_lookup
  2023-01-15  7:16 [bpf-next 00/10] samples/bpf: modernize BPF functionality test programs Daniel T. Lee
                   ` (3 preceding siblings ...)
  2023-01-15  7:16 ` [bpf-next 04/10] samples/bpf: fix broken cgroup socket testing Daniel T. Lee
@ 2023-01-15  7:16 ` Daniel T. Lee
  2023-01-15  7:16 ` [bpf-next 06/10] samples/bpf: replace legacy map with the BTF-defined map Daniel T. Lee
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Daniel T. Lee @ 2023-01-15  7:16 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko,
	Yonghong Song, Martin KaFai Lau, Song Liu, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Andrii Nakryiko
  Cc: bpf, netdev

The test_overhead bpf program is designed to compare performance
between tracepoint and kprobe. Initially it used task_rename and
urandom_read tracepoint.

However, commit 14c174633f34 ("random: remove unused tracepoints")
removed urandom_read tracepoint, and for this reason the test_overhead
got broken.

This commit introduces new microbenchmark using fib_table_lookup.
This microbenchmark sends UDP packets to localhost in order to invoke
fib_table_lookup.

In a nutshell:
fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
addr.sin_addr.s_addr = inet_addr(DUMMY_IP);
addr.sin_port = htons(DUMMY_PORT);
for() {
    sendto(fd, buf, strlen(buf), 0,
            (struct sockaddr *)&addr, sizeof(addr));
}

on 4 cpus in parallel:
                                            lookup per sec
base (no tracepoints, no kprobes)               381k
with kprobe at fib_table_lookup()               325k
with tracepoint at fib:fib_table_lookup         330k
with raw_tracepoint at fib:fib_table_lookup     365k

Fixes: 14c174633f34 ("random: remove unused tracepoints")

Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
---
 samples/bpf/test_overhead_kprobe_kern.c |  2 +-
 samples/bpf/test_overhead_raw_tp_kern.c |  2 +-
 samples/bpf/test_overhead_tp_kern.c     | 26 ++++++++++++++++-------
 samples/bpf/test_overhead_user.c        | 28 +++++++++++++++++--------
 4 files changed, 40 insertions(+), 18 deletions(-)

diff --git a/samples/bpf/test_overhead_kprobe_kern.c b/samples/bpf/test_overhead_kprobe_kern.c
index 8fdd2c9c56b2..ba82949338c2 100644
--- a/samples/bpf/test_overhead_kprobe_kern.c
+++ b/samples/bpf/test_overhead_kprobe_kern.c
@@ -39,7 +39,7 @@ int prog(struct pt_regs *ctx)
 	return 0;
 }
 
-SEC("kprobe/urandom_read")
+SEC("kprobe/fib_table_lookup")
 int prog2(struct pt_regs *ctx)
 {
 	return 0;
diff --git a/samples/bpf/test_overhead_raw_tp_kern.c b/samples/bpf/test_overhead_raw_tp_kern.c
index 8763181a32f3..3e29de0eca98 100644
--- a/samples/bpf/test_overhead_raw_tp_kern.c
+++ b/samples/bpf/test_overhead_raw_tp_kern.c
@@ -9,7 +9,7 @@ int prog(struct bpf_raw_tracepoint_args *ctx)
 	return 0;
 }
 
-SEC("raw_tracepoint/urandom_read")
+SEC("raw_tracepoint/fib_table_lookup")
 int prog2(struct bpf_raw_tracepoint_args *ctx)
 {
 	return 0;
diff --git a/samples/bpf/test_overhead_tp_kern.c b/samples/bpf/test_overhead_tp_kern.c
index 80edadacb692..f170e9b1ea21 100644
--- a/samples/bpf/test_overhead_tp_kern.c
+++ b/samples/bpf/test_overhead_tp_kern.c
@@ -22,15 +22,27 @@ int prog(struct task_rename *ctx)
 	return 0;
 }
 
-/* from /sys/kernel/debug/tracing/events/random/urandom_read/format */
-struct urandom_read {
+/* from /sys/kernel/debug/tracing/events/fib/fib_table_lookup/format */
+struct fib_table_lookup {
 	__u64 pad;
-	int got_bits;
-	int pool_left;
-	int input_left;
+	__u32 tb_id;
+	int err;
+	int oif;
+	int iif;
+	__u8 proto;
+	__u8 tos;
+	__u8 scope;
+	__u8 flags;
+	__u8 src[4];
+	__u8 dst[4];
+	__u8 gw4[4];
+	__u8 gw6[16];
+	__u16 sport;
+	__u16 dport;
+	char name[16];
 };
-SEC("tracepoint/random/urandom_read")
-int prog2(struct urandom_read *ctx)
+SEC("tracepoint/fib/fib_table_lookup")
+int prog2(struct fib_table_lookup *ctx)
 {
 	return 0;
 }
diff --git a/samples/bpf/test_overhead_user.c b/samples/bpf/test_overhead_user.c
index 88717f8ec6ac..ce28d30f852e 100644
--- a/samples/bpf/test_overhead_user.c
+++ b/samples/bpf/test_overhead_user.c
@@ -11,6 +11,8 @@
 #include <unistd.h>
 #include <assert.h>
 #include <sys/wait.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
 #include <stdlib.h>
 #include <signal.h>
 #include <linux/bpf.h>
@@ -20,6 +22,8 @@
 #include <bpf/libbpf.h>
 
 #define MAX_CNT 1000000
+#define DUMMY_IP "127.0.0.1"
+#define DUMMY_PORT 80
 
 static struct bpf_link *links[2];
 static struct bpf_object *obj;
@@ -35,8 +39,8 @@ static __u64 time_get_ns(void)
 
 static void test_task_rename(int cpu)
 {
-	__u64 start_time;
 	char buf[] = "test\n";
+	__u64 start_time;
 	int i, fd;
 
 	fd = open("/proc/self/comm", O_WRONLY|O_TRUNC);
@@ -57,26 +61,32 @@ static void test_task_rename(int cpu)
 	close(fd);
 }
 
-static void test_urandom_read(int cpu)
+static void test_fib_table_lookup(int cpu)
 {
+	struct sockaddr_in addr;
+	char buf[] = "test\n";
 	__u64 start_time;
-	char buf[4];
 	int i, fd;
 
-	fd = open("/dev/urandom", O_RDONLY);
+	fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
 	if (fd < 0) {
-		printf("couldn't open /dev/urandom\n");
+		printf("couldn't open socket\n");
 		exit(1);
 	}
+	memset((char *)&addr, 0, sizeof(addr));
+	addr.sin_addr.s_addr = inet_addr(DUMMY_IP);
+	addr.sin_port = htons(DUMMY_PORT);
+	addr.sin_family = AF_INET;
 	start_time = time_get_ns();
 	for (i = 0; i < MAX_CNT; i++) {
-		if (read(fd, buf, sizeof(buf)) < 0) {
-			printf("failed to read from /dev/urandom: %s\n", strerror(errno));
+		if (sendto(fd, buf, strlen(buf), 0,
+			   (struct sockaddr *)&addr, sizeof(addr)) < 0) {
+			printf("failed to start ping: %s\n", strerror(errno));
 			close(fd);
 			return;
 		}
 	}
-	printf("urandom_read:%d: %lld events per sec\n",
+	printf("fib_table_lookup:%d: %lld events per sec\n",
 	       cpu, MAX_CNT * 1000000000ll / (time_get_ns() - start_time));
 	close(fd);
 }
@@ -92,7 +102,7 @@ static void loop(int cpu, int flags)
 	if (flags & 1)
 		test_task_rename(cpu);
 	if (flags & 2)
-		test_urandom_read(cpu);
+		test_fib_table_lookup(cpu);
 }
 
 static void run_perf_test(int tasks, int flags)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [bpf-next 06/10] samples/bpf: replace legacy map with the BTF-defined map
  2023-01-15  7:16 [bpf-next 00/10] samples/bpf: modernize BPF functionality test programs Daniel T. Lee
                   ` (4 preceding siblings ...)
  2023-01-15  7:16 ` [bpf-next 05/10] samples/bpf: replace broken overhead microbenchmark with fib_table_lookup Daniel T. Lee
@ 2023-01-15  7:16 ` Daniel T. Lee
  2023-01-15  7:16 ` [bpf-next 07/10] samples/bpf: split common macros to net_shared.h Daniel T. Lee
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Daniel T. Lee @ 2023-01-15  7:16 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko,
	Yonghong Song, Martin KaFai Lau, Song Liu, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Andrii Nakryiko
  Cc: bpf, netdev

With libbpf 1.0 release, support for legacy BPF map declaration syntax
had been dropped. If you run a program using legacy BPF in the latest
libbpf, the following error will be output.

    libbpf: map 'lwt_len_hist_map' (legacy): legacy map definitions are deprecated, use BTF-defined maps instead
    libbpf: Use of BPF_ANNOTATE_KV_PAIR is deprecated, use BTF-defined maps in .maps section instead

This commit replaces legacy map with the BTF-defined map.

Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
---
 samples/bpf/lwt_len_hist_kern.c  | 24 +++++++-----------------
 samples/bpf/test_cgrp2_tc_kern.c | 25 +++++++------------------
 2 files changed, 14 insertions(+), 35 deletions(-)

diff --git a/samples/bpf/lwt_len_hist_kern.c b/samples/bpf/lwt_len_hist_kern.c
index 1fa14c54963a..44ea7b56760e 100644
--- a/samples/bpf/lwt_len_hist_kern.c
+++ b/samples/bpf/lwt_len_hist_kern.c
@@ -16,23 +16,13 @@
 #include <uapi/linux/in.h>
 #include <bpf/bpf_helpers.h>
 
-struct bpf_elf_map {
-	__u32 type;
-	__u32 size_key;
-	__u32 size_value;
-	__u32 max_elem;
-	__u32 flags;
-	__u32 id;
-	__u32 pinning;
-};
-
-struct bpf_elf_map SEC("maps") lwt_len_hist_map = {
-	.type = BPF_MAP_TYPE_PERCPU_HASH,
-	.size_key = sizeof(__u64),
-	.size_value = sizeof(__u64),
-	.pinning = 2,
-	.max_elem = 1024,
-};
+struct {
+	__uint(type, BPF_MAP_TYPE_PERCPU_HASH);
+	__type(key, u64);
+	__type(value, u64);
+	__uint(pinning, LIBBPF_PIN_BY_NAME);
+	__uint(max_entries, 1024);
+} lwt_len_hist_map SEC(".maps");
 
 static unsigned int log2(unsigned int v)
 {
diff --git a/samples/bpf/test_cgrp2_tc_kern.c b/samples/bpf/test_cgrp2_tc_kern.c
index 4dd532a312b9..737ce3eb8944 100644
--- a/samples/bpf/test_cgrp2_tc_kern.c
+++ b/samples/bpf/test_cgrp2_tc_kern.c
@@ -19,24 +19,13 @@ struct eth_hdr {
 	unsigned short  h_proto;
 };
 
-#define PIN_GLOBAL_NS		2
-struct bpf_elf_map {
-	__u32 type;
-	__u32 size_key;
-	__u32 size_value;
-	__u32 max_elem;
-	__u32 flags;
-	__u32 id;
-	__u32 pinning;
-};
-
-struct bpf_elf_map SEC("maps") test_cgrp2_array_pin = {
-	.type		= BPF_MAP_TYPE_CGROUP_ARRAY,
-	.size_key	= sizeof(uint32_t),
-	.size_value	= sizeof(uint32_t),
-	.pinning	= PIN_GLOBAL_NS,
-	.max_elem	= 1,
-};
+struct {
+	__uint(type, BPF_MAP_TYPE_CGROUP_ARRAY);
+	__type(key, u32);
+	__type(value, u32);
+	__uint(pinning, LIBBPF_PIN_BY_NAME);
+	__uint(max_entries, 1);
+} test_cgrp2_array_pin SEC(".maps");
 
 SEC("filter")
 int handle_egress(struct __sk_buff *skb)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [bpf-next 07/10] samples/bpf: split common macros to net_shared.h
  2023-01-15  7:16 [bpf-next 00/10] samples/bpf: modernize BPF functionality test programs Daniel T. Lee
                   ` (5 preceding siblings ...)
  2023-01-15  7:16 ` [bpf-next 06/10] samples/bpf: replace legacy map with the BTF-defined map Daniel T. Lee
@ 2023-01-15  7:16 ` Daniel T. Lee
  2023-01-15  7:16 ` [bpf-next 08/10] samples/bpf: replace BPF programs header with net_shared.h Daniel T. Lee
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Daniel T. Lee @ 2023-01-15  7:16 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko,
	Yonghong Song, Martin KaFai Lau, Song Liu, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Andrii Nakryiko
  Cc: bpf, netdev

Currently, many programs under sample/bpf often include individual
macros by directly including the header under "linux/" rather than
using the "vmlinux.h" header.

However, there are some problems with migrating to "vmlinux.h" because
there is no definition for utility functions such as endianness
conversion (ntohs/htons). Fortunately, the xdp_sample program already
has a function that can be replaced to solve this problem.

Therefore, this commit attempts to separate these functions into a file
called net_shared.h to make them universally available. Additionally,
this file includes network-related macros that are not defined in
"vmlinux.h". (inspired by 'selftests' bpf_tracing_net.h)

Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
---
 samples/bpf/net_shared.h     | 26 ++++++++++++++++++++++++++
 samples/bpf/xdp_sample.bpf.h | 22 +---------------------
 2 files changed, 27 insertions(+), 21 deletions(-)
 create mode 100644 samples/bpf/net_shared.h

diff --git a/samples/bpf/net_shared.h b/samples/bpf/net_shared.h
new file mode 100644
index 000000000000..04b29b217d25
--- /dev/null
+++ b/samples/bpf/net_shared.h
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0
+#ifndef _NET_SHARED_H
+#define _NET_SHARED_H
+
+#define ETH_ALEN 6
+#define ETH_P_802_3_MIN 0x0600
+#define ETH_P_8021Q 0x8100
+#define ETH_P_8021AD 0x88A8
+#define ETH_P_IP 0x0800
+#define ETH_P_IPV6 0x86DD
+#define ETH_P_ARP 0x0806
+#define IPPROTO_ICMPV6 58
+
+#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
+	__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+#define bpf_ntohs(x)		__builtin_bswap16(x)
+#define bpf_htons(x)		__builtin_bswap16(x)
+#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && \
+	__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+#define bpf_ntohs(x)		(x)
+#define bpf_htons(x)		(x)
+#else
+# error "Endianness detection needs to be set up for your compiler?!"
+#endif
+
+#endif
diff --git a/samples/bpf/xdp_sample.bpf.h b/samples/bpf/xdp_sample.bpf.h
index 25b1dbe9b37b..fecc41c5df04 100644
--- a/samples/bpf/xdp_sample.bpf.h
+++ b/samples/bpf/xdp_sample.bpf.h
@@ -7,17 +7,9 @@
 #include <bpf/bpf_core_read.h>
 #include <bpf/bpf_helpers.h>
 
+#include "net_shared.h"
 #include "xdp_sample_shared.h"
 
-#define ETH_ALEN 6
-#define ETH_P_802_3_MIN 0x0600
-#define ETH_P_8021Q 0x8100
-#define ETH_P_8021AD 0x88A8
-#define ETH_P_IP 0x0800
-#define ETH_P_IPV6 0x86DD
-#define ETH_P_ARP 0x0806
-#define IPPROTO_ICMPV6 58
-
 #define EINVAL 22
 #define ENETDOWN 100
 #define EMSGSIZE 90
@@ -55,18 +47,6 @@ static __always_inline void swap_src_dst_mac(void *data)
 	p[5] = dst[2];
 }
 
-#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
-	__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
-#define bpf_ntohs(x)		__builtin_bswap16(x)
-#define bpf_htons(x)		__builtin_bswap16(x)
-#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && \
-	__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
-#define bpf_ntohs(x)		(x)
-#define bpf_htons(x)		(x)
-#else
-# error "Endianness detection needs to be set up for your compiler?!"
-#endif
-
 /*
  * Note: including linux/compiler.h or linux/kernel.h for the macros below
  * conflicts with vmlinux.h include in BPF files, so we define them here.
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [bpf-next 08/10] samples/bpf: replace BPF programs header with net_shared.h
  2023-01-15  7:16 [bpf-next 00/10] samples/bpf: modernize BPF functionality test programs Daniel T. Lee
                   ` (6 preceding siblings ...)
  2023-01-15  7:16 ` [bpf-next 07/10] samples/bpf: split common macros to net_shared.h Daniel T. Lee
@ 2023-01-15  7:16 ` Daniel T. Lee
  2023-01-15  7:16 ` [bpf-next 09/10] samples/bpf: use vmlinux.h instead of implicit headers in BPF test program Daniel T. Lee
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Daniel T. Lee @ 2023-01-15  7:16 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko,
	Yonghong Song, Martin KaFai Lau, Song Liu, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Andrii Nakryiko
  Cc: bpf, netdev

This commit applies "net_shared.h" to BPF programs to remove existing
network related header dependencies. Also, this commit removes
unnecessary headers before applying "vmlinux.h" to the BPF programs.

Mostly, endianness conversion function has been applied to the source.
In addition, several macros have been defined to fulfill the INET,
TC-related constants.

Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
---
 samples/bpf/net_shared.h         |  6 ++++++
 samples/bpf/sock_flags_kern.c    | 10 +++++-----
 samples/bpf/test_cgrp2_tc_kern.c |  6 ++----
 samples/bpf/test_lwt_bpf.c       |  3 ++-
 4 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/samples/bpf/net_shared.h b/samples/bpf/net_shared.h
index 04b29b217d25..e9429af9aa44 100644
--- a/samples/bpf/net_shared.h
+++ b/samples/bpf/net_shared.h
@@ -2,6 +2,9 @@
 #ifndef _NET_SHARED_H
 #define _NET_SHARED_H
 
+#define AF_INET		2
+#define AF_INET6	10
+
 #define ETH_ALEN 6
 #define ETH_P_802_3_MIN 0x0600
 #define ETH_P_8021Q 0x8100
@@ -11,6 +14,9 @@
 #define ETH_P_ARP 0x0806
 #define IPPROTO_ICMPV6 58
 
+#define TC_ACT_OK		0
+#define TC_ACT_SHOT		2
+
 #if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
 	__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
 #define bpf_ntohs(x)		__builtin_bswap16(x)
diff --git a/samples/bpf/sock_flags_kern.c b/samples/bpf/sock_flags_kern.c
index 1d58cb9b6fa4..84837ed48eb3 100644
--- a/samples/bpf/sock_flags_kern.c
+++ b/samples/bpf/sock_flags_kern.c
@@ -1,5 +1,5 @@
+#include "net_shared.h"
 #include <uapi/linux/bpf.h>
-#include <linux/socket.h>
 #include <linux/net.h>
 #include <uapi/linux/in.h>
 #include <uapi/linux/in6.h>
@@ -17,10 +17,10 @@ int bpf_prog1(struct bpf_sock *sk)
 	bpf_trace_printk(fmt, sizeof(fmt), sk->family, sk->type, sk->protocol);
 	bpf_trace_printk(fmt2, sizeof(fmt2), uid, gid);
 
-	/* block PF_INET6, SOCK_DGRAM, IPPROTO_ICMPV6 sockets
+	/* block AF_INET6, SOCK_DGRAM, IPPROTO_ICMPV6 sockets
 	 * ie., make ping6 fail
 	 */
-	if (sk->family == PF_INET6 &&
+	if (sk->family == AF_INET6 &&
 	    sk->type == SOCK_DGRAM   &&
 	    sk->protocol == IPPROTO_ICMPV6)
 		return 0;
@@ -35,10 +35,10 @@ int bpf_prog2(struct bpf_sock *sk)
 
 	bpf_trace_printk(fmt, sizeof(fmt), sk->family, sk->type, sk->protocol);
 
-	/* block PF_INET, SOCK_DGRAM, IPPROTO_ICMP sockets
+	/* block AF_INET, SOCK_DGRAM, IPPROTO_ICMP sockets
 	 * ie., make ping fail
 	 */
-	if (sk->family == PF_INET &&
+	if (sk->family == AF_INET &&
 	    sk->type == SOCK_DGRAM  &&
 	    sk->protocol == IPPROTO_ICMP)
 		return 0;
diff --git a/samples/bpf/test_cgrp2_tc_kern.c b/samples/bpf/test_cgrp2_tc_kern.c
index 737ce3eb8944..45a2f01d2029 100644
--- a/samples/bpf/test_cgrp2_tc_kern.c
+++ b/samples/bpf/test_cgrp2_tc_kern.c
@@ -5,10 +5,8 @@
  * License as published by the Free Software Foundation.
  */
 #define KBUILD_MODNAME "foo"
-#include <uapi/linux/if_ether.h>
-#include <uapi/linux/in6.h>
+#include "net_shared.h"
 #include <uapi/linux/ipv6.h>
-#include <uapi/linux/pkt_cls.h>
 #include <uapi/linux/bpf.h>
 #include <bpf/bpf_helpers.h>
 
@@ -42,7 +40,7 @@ int handle_egress(struct __sk_buff *skb)
 	if (data + sizeof(*eth) + sizeof(*ip6h) > data_end)
 		return TC_ACT_OK;
 
-	if (eth->h_proto != htons(ETH_P_IPV6) ||
+	if (eth->h_proto != bpf_htons(ETH_P_IPV6) ||
 	    ip6h->nexthdr != IPPROTO_ICMPV6) {
 		bpf_trace_printk(dont_care_msg, sizeof(dont_care_msg),
 				 eth->h_proto, ip6h->nexthdr);
diff --git a/samples/bpf/test_lwt_bpf.c b/samples/bpf/test_lwt_bpf.c
index f53dab88d231..fc093fbc760a 100644
--- a/samples/bpf/test_lwt_bpf.c
+++ b/samples/bpf/test_lwt_bpf.c
@@ -10,6 +10,7 @@
  * General Public License for more details.
  */
 
+#include "net_shared.h"
 #include <stdint.h>
 #include <stddef.h>
 #include <linux/bpf.h>
@@ -176,7 +177,7 @@ static inline int __do_push_ll_and_redirect(struct __sk_buff *skb)
 		printk("skb_change_head() failed: %d", ret);
 	}
 
-	ehdr.h_proto = __constant_htons(ETH_P_IP);
+	ehdr.h_proto = bpf_htons(ETH_P_IP);
 	memcpy(&ehdr.h_source, &smac, 6);
 	memcpy(&ehdr.h_dest, &dmac, 6);
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [bpf-next 09/10] samples/bpf: use vmlinux.h instead of implicit headers in BPF test program
  2023-01-15  7:16 [bpf-next 00/10] samples/bpf: modernize BPF functionality test programs Daniel T. Lee
                   ` (7 preceding siblings ...)
  2023-01-15  7:16 ` [bpf-next 08/10] samples/bpf: replace BPF programs header with net_shared.h Daniel T. Lee
@ 2023-01-15  7:16 ` Daniel T. Lee
  2023-01-15  7:16 ` [bpf-next 10/10] samples/bpf: change _kern suffix to .bpf with BPF test programs Daniel T. Lee
  2023-01-15 21:38 ` [bpf-next 00/10] samples/bpf: modernize BPF functionality " Alexei Starovoitov
  10 siblings, 0 replies; 16+ messages in thread
From: Daniel T. Lee @ 2023-01-15  7:16 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko,
	Yonghong Song, Martin KaFai Lau, Song Liu, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Andrii Nakryiko
  Cc: bpf, netdev

This commit applies vmlinux.h to BPF functionality testing program.
Macros that were not defined despite migration to "vmlinux.h" were
defined separately in individual files.

Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
---
 samples/bpf/lwt_len_hist_kern.c         |  5 +----
 samples/bpf/sock_flags_kern.c           |  6 ++----
 samples/bpf/test_cgrp2_tc_kern.c        |  3 +--
 samples/bpf/test_lwt_bpf.c              | 11 +----------
 samples/bpf/test_map_in_map_kern.c      |  7 ++++---
 samples/bpf/test_overhead_kprobe_kern.c |  4 +---
 samples/bpf/test_overhead_raw_tp_kern.c |  2 +-
 samples/bpf/test_overhead_tp_kern.c     |  3 +--
 8 files changed, 12 insertions(+), 29 deletions(-)

diff --git a/samples/bpf/lwt_len_hist_kern.c b/samples/bpf/lwt_len_hist_kern.c
index 44ea7b56760e..dbab80e813fe 100644
--- a/samples/bpf/lwt_len_hist_kern.c
+++ b/samples/bpf/lwt_len_hist_kern.c
@@ -10,10 +10,7 @@
  * General Public License for more details.
  */
 
-#include <uapi/linux/bpf.h>
-#include <uapi/linux/if_ether.h>
-#include <uapi/linux/ip.h>
-#include <uapi/linux/in.h>
+#include "vmlinux.h"
 #include <bpf/bpf_helpers.h>
 
 struct {
diff --git a/samples/bpf/sock_flags_kern.c b/samples/bpf/sock_flags_kern.c
index 84837ed48eb3..0da749f6a9e1 100644
--- a/samples/bpf/sock_flags_kern.c
+++ b/samples/bpf/sock_flags_kern.c
@@ -1,8 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "vmlinux.h"
 #include "net_shared.h"
-#include <uapi/linux/bpf.h>
-#include <linux/net.h>
-#include <uapi/linux/in.h>
-#include <uapi/linux/in6.h>
 #include <bpf/bpf_helpers.h>
 
 SEC("cgroup/sock")
diff --git a/samples/bpf/test_cgrp2_tc_kern.c b/samples/bpf/test_cgrp2_tc_kern.c
index 45a2f01d2029..c7d2291d676f 100644
--- a/samples/bpf/test_cgrp2_tc_kern.c
+++ b/samples/bpf/test_cgrp2_tc_kern.c
@@ -5,9 +5,8 @@
  * License as published by the Free Software Foundation.
  */
 #define KBUILD_MODNAME "foo"
+#include "vmlinux.h"
 #include "net_shared.h"
-#include <uapi/linux/ipv6.h>
-#include <uapi/linux/bpf.h>
 #include <bpf/bpf_helpers.h>
 
 /* copy of 'struct ethhdr' without __packed */
diff --git a/samples/bpf/test_lwt_bpf.c b/samples/bpf/test_lwt_bpf.c
index fc093fbc760a..9a13dbb81847 100644
--- a/samples/bpf/test_lwt_bpf.c
+++ b/samples/bpf/test_lwt_bpf.c
@@ -10,17 +10,8 @@
  * General Public License for more details.
  */
 
+#include "vmlinux.h"
 #include "net_shared.h"
-#include <stdint.h>
-#include <stddef.h>
-#include <linux/bpf.h>
-#include <linux/ip.h>
-#include <linux/in.h>
-#include <linux/in6.h>
-#include <linux/tcp.h>
-#include <linux/udp.h>
-#include <linux/icmpv6.h>
-#include <linux/if_ether.h>
 #include <bpf/bpf_helpers.h>
 #include <string.h>
 
diff --git a/samples/bpf/test_map_in_map_kern.c b/samples/bpf/test_map_in_map_kern.c
index 0e17f9ade5c5..1883559e5977 100644
--- a/samples/bpf/test_map_in_map_kern.c
+++ b/samples/bpf/test_map_in_map_kern.c
@@ -6,16 +6,17 @@
  * License as published by the Free Software Foundation.
  */
 #define KBUILD_MODNAME "foo"
-#include <linux/ptrace.h>
+#include "vmlinux.h"
 #include <linux/version.h>
-#include <uapi/linux/bpf.h>
-#include <uapi/linux/in6.h>
 #include <bpf/bpf_helpers.h>
 #include <bpf/bpf_tracing.h>
 #include <bpf/bpf_core_read.h>
 
 #define MAX_NR_PORTS 65536
 
+#define EINVAL 22
+#define ENOENT 2
+
 /* map #0 */
 struct inner_a {
 	__uint(type, BPF_MAP_TYPE_ARRAY);
diff --git a/samples/bpf/test_overhead_kprobe_kern.c b/samples/bpf/test_overhead_kprobe_kern.c
index ba82949338c2..c3528731e0e1 100644
--- a/samples/bpf/test_overhead_kprobe_kern.c
+++ b/samples/bpf/test_overhead_kprobe_kern.c
@@ -4,10 +4,8 @@
  * modify it under the terms of version 2 of the GNU General Public
  * License as published by the Free Software Foundation.
  */
+#include "vmlinux.h"
 #include <linux/version.h>
-#include <linux/ptrace.h>
-#include <linux/sched.h>
-#include <uapi/linux/bpf.h>
 #include <bpf/bpf_helpers.h>
 #include <bpf/bpf_tracing.h>
 
diff --git a/samples/bpf/test_overhead_raw_tp_kern.c b/samples/bpf/test_overhead_raw_tp_kern.c
index 3e29de0eca98..6af39fe3f8dd 100644
--- a/samples/bpf/test_overhead_raw_tp_kern.c
+++ b/samples/bpf/test_overhead_raw_tp_kern.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 /* Copyright (c) 2018 Facebook */
-#include <uapi/linux/bpf.h>
+#include "vmlinux.h"
 #include <bpf/bpf_helpers.h>
 
 SEC("raw_tracepoint/task_rename")
diff --git a/samples/bpf/test_overhead_tp_kern.c b/samples/bpf/test_overhead_tp_kern.c
index f170e9b1ea21..67cab3881969 100644
--- a/samples/bpf/test_overhead_tp_kern.c
+++ b/samples/bpf/test_overhead_tp_kern.c
@@ -4,8 +4,7 @@
  * modify it under the terms of version 2 of the GNU General Public
  * License as published by the Free Software Foundation.
  */
-#include <linux/sched.h>
-#include <uapi/linux/bpf.h>
+#include "vmlinux.h"
 #include <bpf/bpf_helpers.h>
 
 /* from /sys/kernel/debug/tracing/events/task/task_rename/format */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [bpf-next 10/10] samples/bpf: change _kern suffix to .bpf with BPF test programs
  2023-01-15  7:16 [bpf-next 00/10] samples/bpf: modernize BPF functionality test programs Daniel T. Lee
                   ` (8 preceding siblings ...)
  2023-01-15  7:16 ` [bpf-next 09/10] samples/bpf: use vmlinux.h instead of implicit headers in BPF test program Daniel T. Lee
@ 2023-01-15  7:16 ` Daniel T. Lee
  2023-01-15 21:38 ` [bpf-next 00/10] samples/bpf: modernize BPF functionality " Alexei Starovoitov
  10 siblings, 0 replies; 16+ messages in thread
From: Daniel T. Lee @ 2023-01-15  7:16 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko,
	Yonghong Song, Martin KaFai Lau, Song Liu, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Andrii Nakryiko
  Cc: bpf, netdev

This commit changes the _kern suffix to .bpf with the BPF test programs.
With this modification, test programs will inherit the benefit of the
new CLANG-BPF compile target.

Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
---
 samples/bpf/Makefile                               | 14 +++++++-------
 .../{lwt_len_hist_kern.c => lwt_len_hist.bpf.c}    |  0
 samples/bpf/lwt_len_hist.sh                        |  2 +-
 .../bpf/{sock_flags_kern.c => sock_flags.bpf.c}    |  0
 samples/bpf/test_cgrp2_sock2.sh                    |  2 +-
 .../{test_cgrp2_tc_kern.c => test_cgrp2_tc.bpf.c}  |  0
 samples/bpf/test_cgrp2_tc.sh                       |  2 +-
 ...est_map_in_map_kern.c => test_map_in_map.bpf.c} |  0
 samples/bpf/test_map_in_map_user.c                 |  2 +-
 ...ad_kprobe_kern.c => test_overhead_kprobe.bpf.c} |  0
 ...ad_raw_tp_kern.c => test_overhead_raw_tp.bpf.c} |  0
 ...t_overhead_tp_kern.c => test_overhead_tp.bpf.c} |  0
 samples/bpf/test_overhead_user.c                   |  6 +++---
 13 files changed, 14 insertions(+), 14 deletions(-)
 rename samples/bpf/{lwt_len_hist_kern.c => lwt_len_hist.bpf.c} (100%)
 rename samples/bpf/{sock_flags_kern.c => sock_flags.bpf.c} (100%)
 rename samples/bpf/{test_cgrp2_tc_kern.c => test_cgrp2_tc.bpf.c} (100%)
 rename samples/bpf/{test_map_in_map_kern.c => test_map_in_map.bpf.c} (100%)
 rename samples/bpf/{test_overhead_kprobe_kern.c => test_overhead_kprobe.bpf.c} (100%)
 rename samples/bpf/{test_overhead_raw_tp_kern.c => test_overhead_raw_tp.bpf.c} (100%)
 rename samples/bpf/{test_overhead_tp_kern.c => test_overhead_tp.bpf.c} (100%)

diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 22039a0a5b35..615f24ebc49c 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -131,7 +131,7 @@ always-y += tracex4_kern.o
 always-y += tracex5_kern.o
 always-y += tracex6_kern.o
 always-y += tracex7_kern.o
-always-y += sock_flags_kern.o
+always-y += sock_flags.bpf.o
 always-y += test_probe_write_user.bpf.o
 always-y += trace_output.bpf.o
 always-y += tcbpf1_kern.o
@@ -140,19 +140,19 @@ always-y += lathist_kern.o
 always-y += offwaketime_kern.o
 always-y += spintest_kern.o
 always-y += map_perf_test.bpf.o
-always-y += test_overhead_tp_kern.o
-always-y += test_overhead_raw_tp_kern.o
-always-y += test_overhead_kprobe_kern.o
+always-y += test_overhead_tp.bpf.o
+always-y += test_overhead_raw_tp.bpf.o
+always-y += test_overhead_kprobe.bpf.o
 always-y += parse_varlen.o parse_simple.o parse_ldabs.o
-always-y += test_cgrp2_tc_kern.o
+always-y += test_cgrp2_tc.bpf.o
 always-y += xdp1_kern.o
 always-y += xdp2_kern.o
 always-y += test_current_task_under_cgroup.bpf.o
 always-y += trace_event_kern.o
 always-y += sampleip_kern.o
-always-y += lwt_len_hist_kern.o
+always-y += lwt_len_hist.bpf.o
 always-y += xdp_tx_iptunnel_kern.o
-always-y += test_map_in_map_kern.o
+always-y += test_map_in_map.bpf.o
 always-y += tcp_synrto_kern.o
 always-y += tcp_rwnd_kern.o
 always-y += tcp_bufs_kern.o
diff --git a/samples/bpf/lwt_len_hist_kern.c b/samples/bpf/lwt_len_hist.bpf.c
similarity index 100%
rename from samples/bpf/lwt_len_hist_kern.c
rename to samples/bpf/lwt_len_hist.bpf.c
diff --git a/samples/bpf/lwt_len_hist.sh b/samples/bpf/lwt_len_hist.sh
index ff7d1ba0f7ed..7078bfcc4f4d 100755
--- a/samples/bpf/lwt_len_hist.sh
+++ b/samples/bpf/lwt_len_hist.sh
@@ -4,7 +4,7 @@
 NS1=lwt_ns1
 VETH0=tst_lwt1a
 VETH1=tst_lwt1b
-BPF_PROG=lwt_len_hist_kern.o
+BPF_PROG=lwt_len_hist.bpf.o
 TRACE_ROOT=/sys/kernel/debug/tracing
 
 function cleanup {
diff --git a/samples/bpf/sock_flags_kern.c b/samples/bpf/sock_flags.bpf.c
similarity index 100%
rename from samples/bpf/sock_flags_kern.c
rename to samples/bpf/sock_flags.bpf.c
diff --git a/samples/bpf/test_cgrp2_sock2.sh b/samples/bpf/test_cgrp2_sock2.sh
index 00cc8d15373c..82acff93d739 100755
--- a/samples/bpf/test_cgrp2_sock2.sh
+++ b/samples/bpf/test_cgrp2_sock2.sh
@@ -5,7 +5,7 @@ BPFFS=/sys/fs/bpf
 MY_DIR=$(dirname $0)
 TEST=$MY_DIR/test_cgrp2_sock2
 LINK_PIN=$BPFFS/test_cgrp2_sock2
-BPF_PROG=$MY_DIR/sock_flags_kern.o
+BPF_PROG=$MY_DIR/sock_flags.bpf.o
 
 function config_device {
 	ip netns add at_ns0
diff --git a/samples/bpf/test_cgrp2_tc_kern.c b/samples/bpf/test_cgrp2_tc.bpf.c
similarity index 100%
rename from samples/bpf/test_cgrp2_tc_kern.c
rename to samples/bpf/test_cgrp2_tc.bpf.c
diff --git a/samples/bpf/test_cgrp2_tc.sh b/samples/bpf/test_cgrp2_tc.sh
index 37a2c9cba6d0..38e8dbc9d16e 100755
--- a/samples/bpf/test_cgrp2_tc.sh
+++ b/samples/bpf/test_cgrp2_tc.sh
@@ -4,7 +4,7 @@
 MY_DIR=$(dirname $0)
 # Details on the bpf prog
 BPF_CGRP2_ARRAY_NAME='test_cgrp2_array_pin'
-BPF_PROG="$MY_DIR/test_cgrp2_tc_kern.o"
+BPF_PROG="$MY_DIR/test_cgrp2_tc.bpf.o"
 BPF_SECTION='filter'
 
 [ -z "$TC" ] && TC='tc'
diff --git a/samples/bpf/test_map_in_map_kern.c b/samples/bpf/test_map_in_map.bpf.c
similarity index 100%
rename from samples/bpf/test_map_in_map_kern.c
rename to samples/bpf/test_map_in_map.bpf.c
diff --git a/samples/bpf/test_map_in_map_user.c b/samples/bpf/test_map_in_map_user.c
index 652ec720533d..9e79df4071f5 100644
--- a/samples/bpf/test_map_in_map_user.c
+++ b/samples/bpf/test_map_in_map_user.c
@@ -120,7 +120,7 @@ int main(int argc, char **argv)
 	struct bpf_object *obj;
 	char filename[256];
 
-	snprintf(filename, sizeof(filename), "%s_kern.o", argv[0]);
+	snprintf(filename, sizeof(filename), "%s.bpf.o", argv[0]);
 	obj = bpf_object__open_file(filename, NULL);
 	if (libbpf_get_error(obj)) {
 		fprintf(stderr, "ERROR: opening BPF object file failed\n");
diff --git a/samples/bpf/test_overhead_kprobe_kern.c b/samples/bpf/test_overhead_kprobe.bpf.c
similarity index 100%
rename from samples/bpf/test_overhead_kprobe_kern.c
rename to samples/bpf/test_overhead_kprobe.bpf.c
diff --git a/samples/bpf/test_overhead_raw_tp_kern.c b/samples/bpf/test_overhead_raw_tp.bpf.c
similarity index 100%
rename from samples/bpf/test_overhead_raw_tp_kern.c
rename to samples/bpf/test_overhead_raw_tp.bpf.c
diff --git a/samples/bpf/test_overhead_tp_kern.c b/samples/bpf/test_overhead_tp.bpf.c
similarity index 100%
rename from samples/bpf/test_overhead_tp_kern.c
rename to samples/bpf/test_overhead_tp.bpf.c
diff --git a/samples/bpf/test_overhead_user.c b/samples/bpf/test_overhead_user.c
index ce28d30f852e..dbd86f7b1473 100644
--- a/samples/bpf/test_overhead_user.c
+++ b/samples/bpf/test_overhead_user.c
@@ -189,7 +189,7 @@ int main(int argc, char **argv)
 
 	if (test_flags & 0xC) {
 		snprintf(filename, sizeof(filename),
-			 "%s_kprobe_kern.o", argv[0]);
+			 "%s_kprobe.bpf.o", argv[0]);
 
 		printf("w/KPROBE\n");
 		err = load_progs(filename);
@@ -201,7 +201,7 @@ int main(int argc, char **argv)
 
 	if (test_flags & 0x30) {
 		snprintf(filename, sizeof(filename),
-			 "%s_tp_kern.o", argv[0]);
+			 "%s_tp.bpf.o", argv[0]);
 		printf("w/TRACEPOINT\n");
 		err = load_progs(filename);
 		if (!err)
@@ -212,7 +212,7 @@ int main(int argc, char **argv)
 
 	if (test_flags & 0xC0) {
 		snprintf(filename, sizeof(filename),
-			 "%s_raw_tp_kern.o", argv[0]);
+			 "%s_raw_tp.bpf.o", argv[0]);
 		printf("w/RAW_TRACEPOINT\n");
 		err = load_progs(filename);
 		if (!err)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [bpf-next 00/10] samples/bpf: modernize BPF functionality test programs
  2023-01-15  7:16 [bpf-next 00/10] samples/bpf: modernize BPF functionality test programs Daniel T. Lee
                   ` (9 preceding siblings ...)
  2023-01-15  7:16 ` [bpf-next 10/10] samples/bpf: change _kern suffix to .bpf with BPF test programs Daniel T. Lee
@ 2023-01-15 21:38 ` Alexei Starovoitov
  2023-01-16 13:01   ` Daniel T. Lee
  10 siblings, 1 reply; 16+ messages in thread
From: Alexei Starovoitov @ 2023-01-15 21:38 UTC (permalink / raw)
  To: Daniel T. Lee
  Cc: Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko,
	Yonghong Song, Martin KaFai Lau, Song Liu, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Andrii Nakryiko, bpf, Network Development

On Sat, Jan 14, 2023 at 11:16 PM Daniel T. Lee <danieltimlee@gmail.com> wrote:
>
> Currently, there are many programs under samples/bpf to test the
> various functionality of BPF that have been developed for a long time.
> However, the kernel (BPF) has changed a lot compared to the 2016 when
> some of these test programs were first introduced.
>
> Therefore, some of these programs use the deprecated function of BPF,
> and some programs no longer work normally due to changes in the API.
>
> To list some of the kernel changes that this patch set is focusing on,
> - legacy BPF map declaration syntax support had been dropped [1]
> - bpf_trace_printk() always append newline at the end [2]
> - deprecated styled BPF section header (bpf_load style) [3]
> - urandom_read tracepoint is removed (used for testing overhead) [4]
> - ping sends packet with SOCK_DGRAM instead of SOCK_RAW [5]*
> - use "vmlinux.h" instead of including individual headers
>
> In addition to this, this patchset tries to modernize the existing
> testing scripts a bit. And for network-related testing programs,
> a separate header file was created and applied. (To use the
> Endianness conversion function from xdp_sample and bunch of constants)

Nice set of cleanups. Applied.
As a follow up could you convert some of them to proper selftests/bpf ?
Unfortunately samples/bpf will keep bit rotting despite your herculean efforts.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [bpf-next 00/10] samples/bpf: modernize BPF functionality test programs
  2023-01-15 21:38 ` [bpf-next 00/10] samples/bpf: modernize BPF functionality " Alexei Starovoitov
@ 2023-01-16 13:01   ` Daniel T. Lee
  2023-01-16 13:35     ` Toke Høiland-Jørgensen
  0 siblings, 1 reply; 16+ messages in thread
From: Daniel T. Lee @ 2023-01-16 13:01 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko,
	Yonghong Song, Martin KaFai Lau, Song Liu, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Andrii Nakryiko, bpf, Network Development

On Mon, Jan 16, 2023 at 6:38 AM Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
>
> On Sat, Jan 14, 2023 at 11:16 PM Daniel T. Lee <danieltimlee@gmail.com> wrote:
> >
> > Currently, there are many programs under samples/bpf to test the
> > various functionality of BPF that have been developed for a long time.
> > However, the kernel (BPF) has changed a lot compared to the 2016 when
> > some of these test programs were first introduced.
> >
> > Therefore, some of these programs use the deprecated function of BPF,
> > and some programs no longer work normally due to changes in the API.
> >
> > To list some of the kernel changes that this patch set is focusing on,
> > - legacy BPF map declaration syntax support had been dropped [1]
> > - bpf_trace_printk() always append newline at the end [2]
> > - deprecated styled BPF section header (bpf_load style) [3]
> > - urandom_read tracepoint is removed (used for testing overhead) [4]
> > - ping sends packet with SOCK_DGRAM instead of SOCK_RAW [5]*
> > - use "vmlinux.h" instead of including individual headers
> >
> > In addition to this, this patchset tries to modernize the existing
> > testing scripts a bit. And for network-related testing programs,
> > a separate header file was created and applied. (To use the
> > Endianness conversion function from xdp_sample and bunch of constants)
>
> Nice set of cleanups. Applied.
> As a follow up could you convert some of them to proper selftests/bpf ?
> Unfortunately samples/bpf will keep bit rotting despite your herculean efforts.

I really appreciate for your compliment!
I'll try to convert the existing sample to selftest in the next patch.

-- 
Best,
Daniel T. Lee

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [bpf-next 00/10] samples/bpf: modernize BPF functionality test programs
  2023-01-16 13:01   ` Daniel T. Lee
@ 2023-01-16 13:35     ` Toke Høiland-Jørgensen
  2023-01-16 15:23       ` Daniel Borkmann
  0 siblings, 1 reply; 16+ messages in thread
From: Toke Høiland-Jørgensen @ 2023-01-16 13:35 UTC (permalink / raw)
  To: Daniel T. Lee, Alexei Starovoitov
  Cc: Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko,
	Yonghong Song, Martin KaFai Lau, Song Liu, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Andrii Nakryiko, bpf, Network Development

"Daniel T. Lee" <danieltimlee@gmail.com> writes:

> On Mon, Jan 16, 2023 at 6:38 AM Alexei Starovoitov
> <alexei.starovoitov@gmail.com> wrote:
>>
>> On Sat, Jan 14, 2023 at 11:16 PM Daniel T. Lee <danieltimlee@gmail.com> wrote:
>> >
>> > Currently, there are many programs under samples/bpf to test the
>> > various functionality of BPF that have been developed for a long time.
>> > However, the kernel (BPF) has changed a lot compared to the 2016 when
>> > some of these test programs were first introduced.
>> >
>> > Therefore, some of these programs use the deprecated function of BPF,
>> > and some programs no longer work normally due to changes in the API.
>> >
>> > To list some of the kernel changes that this patch set is focusing on,
>> > - legacy BPF map declaration syntax support had been dropped [1]
>> > - bpf_trace_printk() always append newline at the end [2]
>> > - deprecated styled BPF section header (bpf_load style) [3]
>> > - urandom_read tracepoint is removed (used for testing overhead) [4]
>> > - ping sends packet with SOCK_DGRAM instead of SOCK_RAW [5]*
>> > - use "vmlinux.h" instead of including individual headers
>> >
>> > In addition to this, this patchset tries to modernize the existing
>> > testing scripts a bit. And for network-related testing programs,
>> > a separate header file was created and applied. (To use the
>> > Endianness conversion function from xdp_sample and bunch of constants)
>>
>> Nice set of cleanups. Applied.
>> As a follow up could you convert some of them to proper selftests/bpf ?
>> Unfortunately samples/bpf will keep bit rotting despite your herculean efforts.
>
> I really appreciate for your compliment!
> I'll try to convert the existing sample to selftest in the next patch.

Maybe this is a good time to mention that we recently ported some of the
XDP utilities from samples/bpf to xdp-tools, in the form of the
'xdp-bench' utility:
https://github.com/xdp-project/xdp-tools/tree/master/xdp-bench

It's basically a combination of all the xdp_redirect* samples, but also
includes the functionality from the xdp_rxq_info sample program (i.e.,
the ability to monitor RXQs and use other return codes).

I'm planning to submit a patch to remove those utilities from
samples/bpf after we tag the next release of xdp-tools (have one or two
outstanding issues to clear before we do that), but wanted to give you a
head's up so you don't spend any time on those particular utilities when
you're cleaning up samples :)

-Toke

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [bpf-next 00/10] samples/bpf: modernize BPF functionality test programs
  2023-01-16 13:35     ` Toke Høiland-Jørgensen
@ 2023-01-16 15:23       ` Daniel Borkmann
  2023-01-16 22:48         ` Toke Høiland-Jørgensen
  0 siblings, 1 reply; 16+ messages in thread
From: Daniel Borkmann @ 2023-01-16 15:23 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen, Daniel T. Lee, Alexei Starovoitov
  Cc: Alexei Starovoitov, Andrii Nakryiko, Yonghong Song,
	Martin KaFai Lau, Song Liu, John Fastabend, KP Singh,
	Stanislav Fomichev, Hao Luo, Jiri Olsa, Andrii Nakryiko, bpf,
	Network Development

On 1/16/23 2:35 PM, Toke Høiland-Jørgensen wrote:
> "Daniel T. Lee" <danieltimlee@gmail.com> writes:
>> On Mon, Jan 16, 2023 at 6:38 AM Alexei Starovoitov
>> <alexei.starovoitov@gmail.com> wrote:
>>> On Sat, Jan 14, 2023 at 11:16 PM Daniel T. Lee <danieltimlee@gmail.com> wrote:
>>>>
>>>> Currently, there are many programs under samples/bpf to test the
>>>> various functionality of BPF that have been developed for a long time.
>>>> However, the kernel (BPF) has changed a lot compared to the 2016 when
>>>> some of these test programs were first introduced.
>>>>
>>>> Therefore, some of these programs use the deprecated function of BPF,
>>>> and some programs no longer work normally due to changes in the API.
>>>>
>>>> To list some of the kernel changes that this patch set is focusing on,
>>>> - legacy BPF map declaration syntax support had been dropped [1]
>>>> - bpf_trace_printk() always append newline at the end [2]
>>>> - deprecated styled BPF section header (bpf_load style) [3]
>>>> - urandom_read tracepoint is removed (used for testing overhead) [4]
>>>> - ping sends packet with SOCK_DGRAM instead of SOCK_RAW [5]*
>>>> - use "vmlinux.h" instead of including individual headers
>>>>
>>>> In addition to this, this patchset tries to modernize the existing
>>>> testing scripts a bit. And for network-related testing programs,
>>>> a separate header file was created and applied. (To use the
>>>> Endianness conversion function from xdp_sample and bunch of constants)
>>>
>>> Nice set of cleanups. Applied.
>>> As a follow up could you convert some of them to proper selftests/bpf ?
>>> Unfortunately samples/bpf will keep bit rotting despite your herculean efforts.
>>
>> I really appreciate for your compliment!
>> I'll try to convert the existing sample to selftest in the next patch.

This would be awesome, thanks a lot Daniel!

> Maybe this is a good time to mention that we recently ported some of the
> XDP utilities from samples/bpf to xdp-tools, in the form of the
> 'xdp-bench' utility:
> https://github.com/xdp-project/xdp-tools/tree/master/xdp-bench
> 
> It's basically a combination of all the xdp_redirect* samples, but also
> includes the functionality from the xdp_rxq_info sample program (i.e.,
> the ability to monitor RXQs and use other return codes).
> 
> I'm planning to submit a patch to remove those utilities from
> samples/bpf after we tag the next release of xdp-tools (have one or two
> outstanding issues to clear before we do that), but wanted to give you a
> head's up so you don't spend any time on those particular utilities when
> you're cleaning up samples :)

Nice! Once we're through with most relevant ones from samples/bpf, it would
be great to only have a readme in that dir (and that's really all) with pointers
for developers on how to get started.. including BPF selftests, xdp tools, links
to ebpf.io/applications and ebpf.io/infrastructure, etc where more resources
can be found, essentially a small getting started doc for BPF devs.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [bpf-next 00/10] samples/bpf: modernize BPF functionality test programs
  2023-01-16 15:23       ` Daniel Borkmann
@ 2023-01-16 22:48         ` Toke Høiland-Jørgensen
  0 siblings, 0 replies; 16+ messages in thread
From: Toke Høiland-Jørgensen @ 2023-01-16 22:48 UTC (permalink / raw)
  To: Daniel Borkmann, Daniel T. Lee, Alexei Starovoitov
  Cc: Alexei Starovoitov, Andrii Nakryiko, Yonghong Song,
	Martin KaFai Lau, Song Liu, John Fastabend, KP Singh,
	Stanislav Fomichev, Hao Luo, Jiri Olsa, Andrii Nakryiko, bpf,
	Network Development

Daniel Borkmann <daniel@iogearbox.net> writes:

> On 1/16/23 2:35 PM, Toke Høiland-Jørgensen wrote:
>> "Daniel T. Lee" <danieltimlee@gmail.com> writes:
>>> On Mon, Jan 16, 2023 at 6:38 AM Alexei Starovoitov
>>> <alexei.starovoitov@gmail.com> wrote:
>>>> On Sat, Jan 14, 2023 at 11:16 PM Daniel T. Lee <danieltimlee@gmail.com> wrote:
>>>>>
>>>>> Currently, there are many programs under samples/bpf to test the
>>>>> various functionality of BPF that have been developed for a long time.
>>>>> However, the kernel (BPF) has changed a lot compared to the 2016 when
>>>>> some of these test programs were first introduced.
>>>>>
>>>>> Therefore, some of these programs use the deprecated function of BPF,
>>>>> and some programs no longer work normally due to changes in the API.
>>>>>
>>>>> To list some of the kernel changes that this patch set is focusing on,
>>>>> - legacy BPF map declaration syntax support had been dropped [1]
>>>>> - bpf_trace_printk() always append newline at the end [2]
>>>>> - deprecated styled BPF section header (bpf_load style) [3]
>>>>> - urandom_read tracepoint is removed (used for testing overhead) [4]
>>>>> - ping sends packet with SOCK_DGRAM instead of SOCK_RAW [5]*
>>>>> - use "vmlinux.h" instead of including individual headers
>>>>>
>>>>> In addition to this, this patchset tries to modernize the existing
>>>>> testing scripts a bit. And for network-related testing programs,
>>>>> a separate header file was created and applied. (To use the
>>>>> Endianness conversion function from xdp_sample and bunch of constants)
>>>>
>>>> Nice set of cleanups. Applied.
>>>> As a follow up could you convert some of them to proper selftests/bpf ?
>>>> Unfortunately samples/bpf will keep bit rotting despite your herculean efforts.
>>>
>>> I really appreciate for your compliment!
>>> I'll try to convert the existing sample to selftest in the next patch.
>
> This would be awesome, thanks a lot Daniel!
>
>> Maybe this is a good time to mention that we recently ported some of the
>> XDP utilities from samples/bpf to xdp-tools, in the form of the
>> 'xdp-bench' utility:
>> https://github.com/xdp-project/xdp-tools/tree/master/xdp-bench
>> 
>> It's basically a combination of all the xdp_redirect* samples, but also
>> includes the functionality from the xdp_rxq_info sample program (i.e.,
>> the ability to monitor RXQs and use other return codes).
>> 
>> I'm planning to submit a patch to remove those utilities from
>> samples/bpf after we tag the next release of xdp-tools (have one or two
>> outstanding issues to clear before we do that), but wanted to give you a
>> head's up so you don't spend any time on those particular utilities when
>> you're cleaning up samples :)
>
> Nice! Once we're through with most relevant ones from samples/bpf, it would
> be great to only have a readme in that dir (and that's really all) with pointers
> for developers on how to get started.. including BPF selftests, xdp tools, links
> to ebpf.io/applications and ebpf.io/infrastructure, etc where more resources
> can be found, essentially a small getting started doc for BPF devs.

Yeah, good point! Will keep that in mind :)

-Toke

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-01-16 22:48 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-15  7:16 [bpf-next 00/10] samples/bpf: modernize BPF functionality test programs Daniel T. Lee
2023-01-15  7:16 ` [bpf-next 01/10] samples/bpf: ensure ipv6 is enabled before running tests Daniel T. Lee
2023-01-15  7:16 ` [bpf-next 02/10] samples/bpf: refactor BPF functionality testing scripts Daniel T. Lee
2023-01-15  7:16 ` [bpf-next 03/10] samples/bpf: fix broken lightweight tunnel testing Daniel T. Lee
2023-01-15  7:16 ` [bpf-next 04/10] samples/bpf: fix broken cgroup socket testing Daniel T. Lee
2023-01-15  7:16 ` [bpf-next 05/10] samples/bpf: replace broken overhead microbenchmark with fib_table_lookup Daniel T. Lee
2023-01-15  7:16 ` [bpf-next 06/10] samples/bpf: replace legacy map with the BTF-defined map Daniel T. Lee
2023-01-15  7:16 ` [bpf-next 07/10] samples/bpf: split common macros to net_shared.h Daniel T. Lee
2023-01-15  7:16 ` [bpf-next 08/10] samples/bpf: replace BPF programs header with net_shared.h Daniel T. Lee
2023-01-15  7:16 ` [bpf-next 09/10] samples/bpf: use vmlinux.h instead of implicit headers in BPF test program Daniel T. Lee
2023-01-15  7:16 ` [bpf-next 10/10] samples/bpf: change _kern suffix to .bpf with BPF test programs Daniel T. Lee
2023-01-15 21:38 ` [bpf-next 00/10] samples/bpf: modernize BPF functionality " Alexei Starovoitov
2023-01-16 13:01   ` Daniel T. Lee
2023-01-16 13:35     ` Toke Høiland-Jørgensen
2023-01-16 15:23       ` Daniel Borkmann
2023-01-16 22:48         ` Toke Høiland-Jørgensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).