Re: [PATCH bpf-next v3 6/8] bpf: Add XDP_REDIRECT support to XDP for bpf_prog_run()
flat view
From: Alexei Starovoitov <hidden>
Date: 2021-12-12 02:44:10
Also in:
bpf
On Sat, Dec 11, 2021 at 10:43 AM Toke Høiland-Jørgensen [off-list ref] wrote:
quoted hunk ↗ jump to hunk
+ +static void bpf_test_run_xdp_teardown(struct bpf_test_timer *t) +{ + struct xdp_mem_info mem = { + .id = t->xdp.pp->xdp_mem_id, + .type = MEM_TYPE_PAGE_POOL, + };
pls add a new line.
quoted hunk ↗ jump to hunk
+ xdp_unreg_mem_model(&mem); +} + +static bool ctx_was_changed(struct xdp_page_head *head) +{ + return (head->orig_ctx.data != head->ctx.data || + head->orig_ctx.data_meta != head->ctx.data_meta || + head->orig_ctx.data_end != head->ctx.data_end);
redundant ()
quoted hunk ↗ jump to hunk
bpf_test_timer_enter(&t); old_ctx = bpf_set_run_ctx(&run_ctx.run_ctx); do { run_ctx.prog_item = &item; - if (xdp) + if (xdp && xdp_redirect) { + ret = bpf_test_run_xdp_redirect(&t, prog, ctx); + if (unlikely(ret < 0)) + break; + *retval = ret; + } else if (xdp) { *retval = bpf_prog_run_xdp(prog, ctx);
Can we do this unconditionally without introducing a new uapi flag? I mean "return bpf_redirect()" was a nop under test_run. What kind of tests might break if it stops being a nop?