[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <PH0PR12MB5481A0C501C79BF0B04EB537DCC19@PH0PR12MB5481.namprd12.prod.outlook.com>
Date: Mon, 16 Jan 2023 23:37:47 +0000
From: Parav Pandit <parav@...dia.com>
To: "Michael S. Tsirkin" <mst@...hat.com>
CC: "jasowang@...hat.com" <jasowang@...hat.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"davem@...emloft.net" <davem@...emloft.net>,
"kuba@...nel.org" <kuba@...nel.org>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"virtualization@...ts.linux-foundation.org"
<virtualization@...ts.linux-foundation.org>,
Alexander Duyck <alexanderduyck@...com>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
Subject: RE: [PATCH net-next v2] virtio_net: Reuse buffer free function
> From: Michael S. Tsirkin <mst@...hat.com>
> Sent: Monday, January 16, 2023 5:13 PM
>
> On Mon, Jan 16, 2023 at 10:27:08PM +0200, Parav Pandit 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@...com>
> > Reviewed-by: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
> > Signed-off-by: Parav Pandit <parav@...dia.com>
> > ---
> > 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;
> > }
>
> Sure.
>
> Acked-by: Michael S. Tsirkin <mst@...hat.com>
>
> while we are at it how about a patch moving virtnet_rq_free_unused_buf and
> virtnet_sq_free_unused_buf so we don't need forward declarations?
>
Yes. its in my list. Will do after this patch.
I am also going to add the comment for the history about not doing ZLEN around this area.
> E.g. a good place for virtnet_sq_free_unused_buf is likely after ptr_to_xdp
> group of functions.
>
> For virtnet_rq_free_unused_buf - after give_pages/get_a_page.
>
> >
> > --
> > 2.26.2
Powered by blists - more mailing lists