Skip to content

Commit

Permalink
vhost_net: use XDP helpers
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
teknoraver authored and davem330 committed May 14, 2021
1 parent 082294f commit 224bf7d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/vhost/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 224bf7d

Please sign in to comment.