提交 224bf7db 编写于 作者: M Matteo Croce 提交者: David S. Miller

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: NMatteo Croce <mcroce@microsoft.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 082294f2
...@@ -744,11 +744,9 @@ static int vhost_net_build_xdp(struct vhost_net_virtqueue *nvq, ...@@ -744,11 +744,9 @@ static int vhost_net_build_xdp(struct vhost_net_virtqueue *nvq,
if (copied != len) if (copied != len)
return -EFAULT; return -EFAULT;
xdp->data_hard_start = buf; xdp_init_buff(xdp, buflen, NULL);
xdp->data = buf + pad; xdp_prepare_buff(xdp, buf, pad, len, true);
xdp->data_end = xdp->data + len;
hdr->buflen = buflen; hdr->buflen = buflen;
xdp->frame_sz = buflen;
--net->refcnt_bias; --net->refcnt_bias;
alloc_frag->offset += buflen; alloc_frag->offset += buflen;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册