Commit 224bf7db authored by Matteo Croce's avatar Matteo Croce Committed by David S. Miller
Browse files

vhost_net: use XDP helpers



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: default avatarMatteo Croce <mcroce@microsoft.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 082294f2
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -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;