]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
bpf: Make variables in bpf_prog_test_run_xdp less confusing
authorAmery Hung <ameryhung@gmail.com>
Mon, 22 Sep 2025 23:33:53 +0000 (16:33 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 17 Jan 2026 15:31:27 +0000 (16:31 +0100)
commit0eb6e9d3b72496211b5e5cfb205bc73b07980e69
tree372aabb704c9ff93a07f72d953d91e77911864ab
parent202c5b915e22a24ea80ca2e4b2249081483ec2ab
bpf: Make variables in bpf_prog_test_run_xdp less confusing

[ Upstream commit 7eb83bff02ad5e82e8c456c58717ef181c220870 ]

Change the variable naming in bpf_prog_test_run_xdp() to make the
overall logic less confusing. As different modes were added to the
function over the time, some variables got overloaded, making
it hard to understand and changing the code becomes error-prone.

Replace "size" with "linear_sz" where it refers to the size of metadata
and data. If "size" refers to input data size, use test.data_size_in
directly.

Replace "max_data_sz" with "max_linear_sz" to better reflect the fact
that it is the maximum size of metadata and data (i.e., linear_sz). Also,
xdp_rxq.frags_size is always PAGE_SIZE, so just set it directly instead
of subtracting headroom and tailroom and adding them back.

Signed-off-by: Amery Hung <ameryhung@gmail.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://patch.msgid.link/20250922233356.3356453-6-ameryhung@gmail.com
Stable-dep-of: e558cca21779 ("bpf, test_run: Subtract size of xdp_frame from allowed metadata size")
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/bpf/test_run.c