From eb1d929f1551f226f59e38465c542df9071166d6 Mon Sep 17 00:00:00 2001 From: Parav Pandit Date: Mon, 16 Jan 2023 22:27:08 +0200 Subject: virtio_net: Reuse buffer free function virtnet_rq_free_unused_buf() helper function to free the buffer already exists. Avoid code duplication by reusing existing function. Reviewed-by: Alexander Duyck Reviewed-by: Xuan Zhuo Signed-off-by: Parav Pandit Acked-by: Michael S. Tsirkin Acked-by: Jason Wang Signed-off-by: David S. Miller --- drivers/net/virtio_net.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'drivers/net/virtio_net.c') diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 68804528f129..c0e59d660600 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -1375,13 +1375,7 @@ static void receive_buf(struct virtnet_info *vi, struct receive_queue *rq, if (unlikely(len < vi->hdr_len + ETH_HLEN)) { pr_debug("%s: short packet %i\n", dev->name, len); dev->stats.rx_length_errors++; - if (vi->mergeable_rx_bufs) { - put_page(virt_to_head_page(buf)); - } else if (vi->big_packets) { - give_pages(rq, buf); - } else { - put_page(virt_to_head_page(buf)); - } + virtnet_rq_free_unused_buf(rq->vq, buf); return; } -- cgit v1.2.3