From: Puranjay Mohan <puranjay@kernel.org>
To: bpf@vger.kernel.org
Cc: Puranjay Mohan <puranjay@kernel.org>,
Puranjay Mohan <puranjay12@gmail.com>,
Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <martin.lau@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Mykyta Yatsenko <mykyta.yatsenko5@gmail.com>,
Fei Chen <feichen@meta.com>, Taruna Agrawal <taragrawal@meta.com>,
Nikhil Dixit Limaye <ndixit@meta.com>,
"Nikita V. Shirokov" <tehnerd@tehnerd.com>,
kernel-team@meta.com
Subject: [RFC PATCH bpf-next 6/6] selftests/bpf: Add XDP load-balancer benchmark run script
Date: Mon, 20 Apr 2026 04:17:06 -0700 [thread overview]
Message-ID: <20260420111726.2118636-7-puranjay@kernel.org> (raw)
In-Reply-To: <20260420111726.2118636-1-puranjay@kernel.org>
Add a convenience script that runs all 24 XDP load-balancer scenarios
and formats the results as a table with median, stddev, CV, and
percentile columns.
./benchs/run_bench_xdp_lb.sh
Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
---
.../selftests/bpf/benchs/run_bench_xdp_lb.sh | 84 +++++++++++++++++++
1 file changed, 84 insertions(+)
create mode 100755 tools/testing/selftests/bpf/benchs/run_bench_xdp_lb.sh
diff --git a/tools/testing/selftests/bpf/benchs/run_bench_xdp_lb.sh b/tools/testing/selftests/bpf/benchs/run_bench_xdp_lb.sh
new file mode 100755
index 000000000000..1bde3898dfb6
--- /dev/null
+++ b/tools/testing/selftests/bpf/benchs/run_bench_xdp_lb.sh
@@ -0,0 +1,84 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+source ./benchs/run_common.sh
+
+set -eufo pipefail
+
+WARMUP=${WARMUP:-3}
+
+RUN="sudo ./bench -q -w${WARMUP} -a xdp-lb --machine-readable"
+
+SEP=" +----------------------------------+------+----------+---------+--------+----------+----------+----------+----------+"
+HDR=" | %-32s | %4s | %8s | %7s | %6s | %8s | %8s | %8s | %8s |\n"
+ROW=" | %-32s | %4s | %8s | %7s | %6s | %8s | %8s | %8s | %8s |\n"
+
+function group_header()
+{
+ printf "%s\n" "$SEP"
+ printf "$HDR" "$1" "n" "p50" "stddev" "CV" "min" "p90" "p99" "max"
+ printf "%s\n" "$SEP"
+}
+
+function rval()
+{
+ echo "$1" | sed -nE "s/.*$2=([^ ]+).*/\1/p"
+}
+
+function run_scenario()
+{
+ local sc="$1"
+ shift
+ local output rline
+
+ output=$($RUN --scenario "$sc" "$@" 2>&1)
+ rline=$(echo "$output" | grep '^RESULT ' || true)
+
+ if [ -z "$rline" ]; then
+ printf "$ROW" "$sc" "ERR" "-" "-" "-" "-" "-" "-" "-"
+ return
+ fi
+
+ printf "$ROW" "$sc" \
+ "$(rval "$rline" samples)" \
+ "$(rval "$rline" median)" \
+ "$(rval "$rline" stddev)" \
+ "$(rval "$rline" cv)%" \
+ "$(rval "$rline" min)" \
+ "$(rval "$rline" p90)" \
+ "$(rval "$rline" p99)" \
+ "$(rval "$rline" max)"
+}
+
+header "XDP load-balancer benchmark"
+
+group_header "Single-flow baseline"
+for sc in tcp-v4-lru-hit tcp-v4-ch \
+ tcp-v6-lru-hit tcp-v6-ch \
+ udp-v4-lru-hit udp-v6-lru-hit \
+ tcp-v4v6-lru-hit; do
+ run_scenario "$sc"
+done
+
+group_header "Diverse flows (4K src addrs)"
+for sc in tcp-v4-lru-diverse tcp-v4-ch-diverse \
+ tcp-v6-lru-diverse tcp-v6-ch-diverse \
+ udp-v4-lru-diverse; do
+ run_scenario "$sc"
+done
+
+group_header "TCP flags"
+run_scenario tcp-v4-syn
+run_scenario tcp-v4-rst-miss
+
+group_header "LRU stress"
+run_scenario tcp-v4-lru-miss
+run_scenario udp-v4-lru-miss
+run_scenario tcp-v4-lru-warmup
+
+group_header "Early exits"
+for sc in pass-v4-no-vip pass-v6-no-vip pass-v4-icmp pass-non-ip \
+ drop-v4-frag drop-v4-options drop-v6-frag; do
+ run_scenario "$sc"
+done
+printf "%s\n" "$SEP"
--
2.52.0
next prev parent reply other threads:[~2026-04-20 11:18 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-20 11:17 [RFC PATCH bpf-next 0/6] selftests/bpf: Add XDP load-balancer benchmark Puranjay Mohan
2026-04-20 11:17 ` [RFC PATCH bpf-next 1/6] selftests/bpf: Add bench_force_done() for early benchmark completion Puranjay Mohan
2026-04-20 12:41 ` sashiko-bot
2026-04-20 15:32 ` Mykyta Yatsenko
2026-04-20 11:17 ` [RFC PATCH bpf-next 2/6] selftests/bpf: Add BPF batch-timing library Puranjay Mohan
2026-04-20 13:18 ` sashiko-bot
2026-04-22 1:10 ` Alexei Starovoitov
2026-04-20 11:17 ` [RFC PATCH bpf-next 3/6] selftests/bpf: Add XDP load-balancer common definitions Puranjay Mohan
2026-04-20 13:26 ` sashiko-bot
2026-04-20 11:17 ` [RFC PATCH bpf-next 4/6] selftests/bpf: Add XDP load-balancer BPF program Puranjay Mohan
2026-04-20 13:57 ` sashiko-bot
2026-04-20 11:17 ` [RFC PATCH bpf-next 5/6] selftests/bpf: Add XDP load-balancer benchmark driver Puranjay Mohan
2026-04-20 17:11 ` sashiko-bot
2026-04-20 11:17 ` Puranjay Mohan [this message]
2026-04-20 17:36 ` [RFC PATCH bpf-next 6/6] selftests/bpf: Add XDP load-balancer benchmark run script sashiko-bot
2026-04-22 1:16 ` [RFC PATCH bpf-next 0/6] selftests/bpf: Add XDP load-balancer benchmark Alexei Starovoitov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260420111726.2118636-7-puranjay@kernel.org \
--to=puranjay@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=feichen@meta.com \
--cc=kernel-team@meta.com \
--cc=martin.lau@kernel.org \
--cc=memxor@gmail.com \
--cc=mykyta.yatsenko5@gmail.com \
--cc=ndixit@meta.com \
--cc=puranjay12@gmail.com \
--cc=taragrawal@meta.com \
--cc=tehnerd@tehnerd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox