aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tun.c
diff options
context:
space:
mode:
authorLorenzo Bianconi <[email protected]>2020-12-22 21:09:29 +0000
committerAlexei Starovoitov <[email protected]>2021-01-08 21:39:24 +0000
commitbe9df4aff65f18caa79b35f88f42c3d5a43af14f (patch)
tree557249b78a79a93ec751c8bb8d56152641a1f874 /drivers/net/tun.c
parentnet, xdp: Introduce xdp_init_buff utility routine (diff)
downloadkernel-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 'drivers/net/tun.c')
-rw-r--r--drivers/net/tun.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 3b7728433a86..702215596889 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1600,10 +1600,7 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun,
u32 act;
xdp_init_buff(&xdp, buflen, &tfile->xdp_rxq);
- xdp.data_hard_start = buf;
- xdp.data = buf + pad;
- xdp_set_data_meta_invalid(&xdp);
- xdp.data_end = xdp.data + len;
+ xdp_prepare_buff(&xdp, buf, pad, len, false);
act = bpf_prog_run_xdp(xdp_prog, &xdp);
if (act == XDP_REDIRECT || act == XDP_TX) {