[PATCH v2 1/2] bpf, test_run: Replace hardcoded page size with dynamic PAGE_SIZE in test_run
From: Saket Kumar Bhaskar
Date: Wed Mar 05 2025 - 12:15:29 EST
Replace fixed value 4096 with PAGE_SIZE for calculating the max_data_sz
in bpf_prog_test_run_xdp, which allows for a more accurate determination
of max_data_sz, considering different default page sizes across different
architectures.
Signed-off-by: Saket Kumar Bhaskar <skb99@xxxxxxxxxxxxx>
---
net/bpf/test_run.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
index 7cb192cbd65f..c0d5bbf20098 100644
--- a/net/bpf/test_run.c
+++ b/net/bpf/test_run.c
@@ -1249,7 +1249,7 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr,
headroom -= ctx->data;
}
- max_data_sz = 4096 - headroom - tailroom;
+ max_data_sz = PAGE_SIZE - headroom - tailroom;
if (size > max_data_sz) {
/* disallow live data mode for jumbo frames */
if (do_live)
--
2.43.5