virtio_net: virtnet_build_xdp_buff_mrg() auto release xdp shinfo
virtnet_build_xdp_buff_mrg() auto release xdp shinfo then the caller no need to careful the xdp shinfo. Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com> Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
80f50f918c
commit
4cb00b13c0
@@ -1194,7 +1194,7 @@ static int virtnet_build_xdp_buff_mrg(struct net_device *dev,
|
||||
dev->name, *num_buf,
|
||||
virtio16_to_cpu(vi->vdev, hdr->num_buffers));
|
||||
dev->stats.rx_length_errors++;
|
||||
return -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
stats->bytes += len;
|
||||
@@ -1213,7 +1213,7 @@ static int virtnet_build_xdp_buff_mrg(struct net_device *dev,
|
||||
pr_debug("%s: rx error: len %u exceeds truesize %lu\n",
|
||||
dev->name, len, (unsigned long)(truesize - room));
|
||||
dev->stats.rx_length_errors++;
|
||||
return -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
frag = &shinfo->frags[shinfo->nr_frags++];
|
||||
@@ -1228,6 +1228,10 @@ static int virtnet_build_xdp_buff_mrg(struct net_device *dev,
|
||||
|
||||
*xdp_frags_truesize = xdp_frags_truesz;
|
||||
return 0;
|
||||
|
||||
err:
|
||||
put_xdp_frags(xdp);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static void *mergeable_xdp_get_buf(struct virtnet_info *vi,
|
||||
@@ -1357,7 +1361,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
|
||||
err = virtnet_build_xdp_buff_mrg(dev, vi, rq, &xdp, data, len, frame_sz,
|
||||
&num_buf, &xdp_frags_truesz, stats);
|
||||
if (unlikely(err))
|
||||
goto err_xdp_frags;
|
||||
goto err_xdp;
|
||||
|
||||
act = virtnet_xdp_handler(xdp_prog, &xdp, dev, xdp_xmit, stats);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user