vhost_net: use XDP helpers
authorMatteo Croce <mcroce@microsoft.com>
Fri, 14 May 2021 18:39:54 +0000 (20:39 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 14 May 2021 22:20:10 +0000 (15:20 -0700)
Make use of the xdp_{init,prepare}_buff() helpers instead of
an open-coded version.

Also, the field xdp->rxq was never set, so pass NULL to xdp_init_buff()
to clear it.

Signed-off-by: Matteo Croce <mcroce@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/vhost/net.c

index df82b12..6414bd5 100644 (file)
@@ -744,11 +744,9 @@ static int vhost_net_build_xdp(struct vhost_net_virtqueue *nvq,
        if (copied != len)
                return -EFAULT;
 
-       xdp->data_hard_start = buf;
-       xdp->data = buf + pad;
-       xdp->data_end = xdp->data + len;
+       xdp_init_buff(xdp, buflen, NULL);
+       xdp_prepare_buff(xdp, buf, pad, len, true);
        hdr->buflen = buflen;
-       xdp->frame_sz = buflen;
 
        --net->refcnt_bias;
        alloc_frag->offset += buflen;