diff mbox series

[v2,1/2] bpf, test_run: Replace hardcoded page size with dynamic PAGE_SIZE in test_run

Message ID b6e7bbda97f45dcd0362ab99623d54db32742d9d.1741188826.git.skb99@linux.ibm.com (mailing list archive)
State New
Headers show
Series Fix xdp_adjust_frags_tail_grow selftest on powerpc | expand

Commit Message

Saket Kumar Bhaskar March 5, 2025, 5:13 p.m. UTC
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@linux.ibm.com>
---
 net/bpf/test_run.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

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)