aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJesper Dangaard Brouer <brouer@redhat.com>2020-05-14 12:50:39 +0200
committerAlexei Starovoitov <ast@kernel.org>2020-05-14 21:21:55 -0700
commit05afee298afc2f2497b7400b53e9d60fcc24d525 (patch)
treedcda0b333a72b6af22edd6bd36a9e65914aef529
parenttun: Add XDP frame size (diff)
downloadwireguard-linux-05afee298afc2f2497b7400b53e9d60fcc24d525.tar.xz
wireguard-linux-05afee298afc2f2497b7400b53e9d60fcc24d525.zip
vhost_net: Also populate XDP frame size
In vhost_net_build_xdp() the 'buf' that gets queued via an xdp_buff have embedded a struct tun_xdp_hdr (located at xdp->data_hard_start) which contains the buffer length 'buflen' (with tailroom for skb_shared_info). Also storing this buflen in xdp->frame_sz, does not obsolete struct tun_xdp_hdr, as it also contains a struct virtio_net_hdr with other information. Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Link: https://lore.kernel.org/bpf/158945343928.97035.4620233649151726289.stgit@firesoul
-rw-r--r--drivers/vhost/net.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 2927f02cc7e1..516519dcc8ff 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -747,6 +747,7 @@ static int vhost_net_build_xdp(struct vhost_net_virtqueue *nvq,
xdp->data = buf + pad;
xdp->data_end = xdp->data + len;
hdr->buflen = buflen;
+ xdp->frame_sz = buflen;
--net->refcnt_bias;
alloc_frag->offset += buflen;