diff options
| author | Lorenzo Bianconi <[email protected]> | 2020-12-22 21:09:29 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2021-01-08 21:39:24 +0000 |
| commit | be9df4aff65f18caa79b35f88f42c3d5a43af14f (patch) | |
| tree | 557249b78a79a93ec751c8bb8d56152641a1f874 /net/bpf/test_run.c | |
| parent | net, xdp: Introduce xdp_init_buff utility routine (diff) | |
| download | kernel-be9df4aff65f18caa79b35f88f42c3d5a43af14f.tar.gz kernel-be9df4aff65f18caa79b35f88f42c3d5a43af14f.zip | |
net, xdp: Introduce xdp_prepare_buff utility routine
Introduce xdp_prepare_buff utility routine to initialize per-descriptor
xdp_buff fields (e.g. xdp_buff pointers). Rely on xdp_prepare_buff() in
all XDP capable drivers.
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Reviewed-by: Alexander Duyck <[email protected]>
Acked-by: Jesper Dangaard Brouer <[email protected]>
Acked-by: John Fastabend <[email protected]>
Acked-by: Shay Agroskin <[email protected]>
Acked-by: Martin Habets <[email protected]>
Acked-by: Camelia Groza <[email protected]>
Acked-by: Marcin Wojtas <[email protected]>
Link: https://lore.kernel.org/bpf/45f46f12295972a97da8ca01990b3e71501e9d89.1608670965.git.lorenzo@kernel.org
Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'net/bpf/test_run.c')
| -rw-r--r-- | net/bpf/test_run.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c index a8fa5a9e4137..23dfb2010ba6 100644 --- a/net/bpf/test_run.c +++ b/net/bpf/test_run.c @@ -636,14 +636,11 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr, if (IS_ERR(data)) return PTR_ERR(data); - xdp.data_hard_start = data; - xdp.data = data + headroom; - xdp.data_meta = xdp.data; - xdp.data_end = xdp.data + size; - rxqueue = __netif_get_rx_queue(current->nsproxy->net_ns->loopback_dev, 0); xdp_init_buff(&xdp, headroom + max_data_sz + tailroom, &rxqueue->xdp_rxq); + xdp_prepare_buff(&xdp, data, headroom, size, true); + bpf_prog_change_xdp(NULL, prog); ret = bpf_test_run(prog, &xdp, repeat, &retval, &duration, true); if (ret) |
