On Tue, Jan 17, 2023 at 4:27 AM Parav Pandit <parav@xxxxxxxxxx> wrote: > > virtnet_rq_free_unused_buf() helper function to free the buffer > already exists. Avoid code duplication by reusing existing function. > > Reviewed-by: Alexander Duyck <alexanderduyck@xxxxxx> > Reviewed-by: Xuan Zhuo <xuanzhuo@xxxxxxxxxxxxxxxxx> > Signed-off-by: Parav Pandit <parav@xxxxxxxxxx> Acked-by: Jason Wang <jasowang@xxxxxxxxxx> Thanks > --- > drivers/net/virtio_net.c | 8 +------- > 1 file changed, 1 insertion(+), 7 deletions(-) > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index 7723b2a49d8e..31d037df514f 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c > @@ -1251,13 +1251,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; > } > > -- > 2.26.2 > _______________________________________________ Virtualization mailing list Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linuxfoundation.org/mailman/listinfo/virtualization