[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMZdPi8=SMGgXtD9Ne9HWd8JAb=c_PpKOrp-0dHOY-LHQNRc3g@mail.gmail.com>
Date: Fri, 11 Dec 2020 11:40:02 +0100
From: Loic Poulain <loic.poulain@...aro.org>
To: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
Cc: Jakub Kicinski <kuba@...nel.org>,
David Miller <davem@...emloft.net>,
linux-arm-msm <linux-arm-msm@...r.kernel.org>,
Network Development <netdev@...r.kernel.org>,
Jeffrey Hugo <jhugo@...eaurora.org>
Subject: Re: [PATCH v2 2/3] net: mhi: Get RX queue size from MHI core
On Fri, 11 Dec 2020 at 11:15, Manivannan Sadhasivam
<manivannan.sadhasivam@...aro.org> wrote:
>
> On Fri, Dec 11, 2020 at 10:40:13AM +0100, Loic Poulain wrote:
> > Hi Mani,
> >
> > On Fri, 11 Dec 2020 at 06:38, Manivannan Sadhasivam
> > <manivannan.sadhasivam@...aro.org> wrote:
> > >
> > > On Thu, Dec 10, 2020 at 12:15:50PM +0100, Loic Poulain wrote:
> > > > The RX queue size can be determined at runtime by retrieving the
> > > > number of available transfer descriptors.
> > > >
> > > > Signed-off-by: Loic Poulain <loic.poulain@...aro.org>
> > > > ---
> > > > v2: Fixed commit message typo
> > > >
> > > > drivers/net/mhi_net.c | 6 +++---
> > > > 1 file changed, 3 insertions(+), 3 deletions(-)
> > [...]
> > > > -
> > > > INIT_DELAYED_WORK(&mhi_netdev->rx_refill, mhi_net_rx_refill_work);
> > > > u64_stats_init(&mhi_netdev->stats.rx_syncp);
> > > > u64_stats_init(&mhi_netdev->stats.tx_syncp);
> > > > @@ -268,6 +265,9 @@ static int mhi_net_probe(struct mhi_device *mhi_dev,
> > > > if (err)
> > > > goto out_err;
> > > >
> > > > + /* Number of transfer descriptors determines size of the queue */
> > > > + mhi_netdev->rx_queue_sz = mhi_get_free_desc_count(mhi_dev, DMA_FROM_DEVICE);
> > > > +
> > >
> > > This value is not static right? You might need to fetch the count in
> > > mhi_net_rx_refill_work().
> >
> > It is, actually here driver is just looking for the total queue size,
> > which is the number of descriptors at init time. This total queue size
> > is used later to determine the level of MHI queue occupancy rate.
> >
>
> Right but what if the size got increased in runtime (recycled etc...), we won't
> be fully utilizing the ring.
The queue size can not be more than the initial size, which is the
number of elements in the rings (e.g. 128). At runtime, the driver
calls again mhi_get_free_desc_count() in DL callback to determine the
current number available slots (e.g. 32). If this value is higher than
a certain limit (e.g 128 /2), then we start refilling the MHI RX queue
with fresh buffers to prevent buffer starvation.
Regards,
Loic
Powered by blists - more mailing lists