[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220415170523.GB97823@anparri>
Date: Fri, 15 Apr 2022 19:05:23 +0200
From: Andrea Parri <parri.andrea@...il.com>
To: "Michael Kelley (LINUX)" <mikelley@...rosoft.com>
Cc: KY Srinivasan <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
Wei Liu <wei.liu@...nel.org>, Dexuan Cui <decui@...rosoft.com>,
Stefano Garzarella <sgarzare@...hat.com>,
David Miller <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
"virtualization@...ts.linux-foundation.org"
<virtualization@...ts.linux-foundation.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH 6/6] Drivers: hv: vmbus: Refactor the ring-buffer
iterator functions
On Fri, Apr 15, 2022 at 04:44:50PM +0000, Michael Kelley (LINUX) wrote:
> From: Andrea Parri <parri.andrea@...il.com> Sent: Friday, April 15, 2022 9:28 AM
> >
> > On Fri, Apr 15, 2022 at 09:00:31AM +0200, Andrea Parri wrote:
> > > > > @@ -470,7 +471,6 @@ struct vmpacket_descriptor *hv_pkt_iter_first_raw(struct
> > > > > vmbus_channel *channel)
> > > > >
> > > > > return (struct vmpacket_descriptor *)(hv_get_ring_buffer(rbi) + rbi-
> > > > > >priv_read_index);
> > > > > }
> > > > > -EXPORT_SYMBOL_GPL(hv_pkt_iter_first_raw);
> > > >
> > > > Does hv_pkt_iter_first_raw() need to be retained at all as a
> > > > separate function? I think after these changes, the only caller
> > > > is hv_pkt_iter_first(), in which case the code could just go
> > > > inline in hv_pkt_iter_first(). Doing that combining would
> > > > also allow the elimination of the duplicate call to
> > > > hv_pkt_iter_avail().
> >
> > Back to this, can you clarify what you mean by "the elimination of..."?
> > After moving the function "inline", hv_pkt_iter_avail() would be called
> > in to check for a non-NULL descriptor (in the inline function) and later
> > in the computation of bytes_avail.
>
> I was thinking something like this:
>
> bytes_avail = hv_pkt_iter_avail(rbi);
> if (bytes_avail < sizeof(struct vmpacket_descriptor))
> return NULL;
> bytes_avail = min(rbi->pkt_buffer_size, bytes_avail);
>
> desc = (struct vmpacket_descriptor *)(hv_get_ring_buffer(rbi) + rbi->priv_read_index);
Thanks for the clarification, I've applied it.
Andrea
> And for that matter, hv_pkt_iter_avail() is now only called in one place.
> It's a judgment call whether to keep it as a separate helper function vs.
> inlining it in hv_pkt_iter_first() as well. I'm OK either way.
>
>
> Michael
>
>
Powered by blists - more mailing lists