Re: [PATCH v3 6/7] net: qrtr: Add MHI transport layer

From: Bjorn Andersson
Date: Mon Mar 30 2020 - 18:19:40 EST


On Mon 30 Mar 02:49 PDT 2020, Manivannan Sadhasivam wrote:

> Hi Chris,
>
> On Thu, Mar 26, 2020 at 03:54:42PM -0700, Chris Lew wrote:
> >
> >
> > On 3/25/2020 3:37 AM, Manivannan Sadhasivam wrote:
> > > Hi Bjorn,
> > >
> > > + Chris Lew
> > >
> > > On Tue, Mar 24, 2020 at 01:39:52PM -0700, Bjorn Andersson wrote:
> > > > On Mon 23 Mar 23:10 PDT 2020, Manivannan Sadhasivam wrote:
[..]
> > > > > + spin_lock_irqsave(&qdev->ul_lock, flags);
> > > > > + list_for_each_entry(pkt, &qdev->ul_pkts, node)
> > > > > + complete_all(&pkt->done);
> > >
> > > Chris, shouldn't we require list_del(&pkt->node) here?
> > >
> >
> > No this isn't a full cleanup, with the "early notifier" we just unblocked
> > any threads waiting for the ul_callback. Those threads will wake, check
> > in_reset, return an error back to the caller. Any list cleanup will be done
> > in the ul_callbacks that the mhi bus will do for each queued packet right
> > before device remove.
> >
> > Again to simplify the code, we can probable remove the in_reset handling
> > since it's not required with the current feature set.
> >
>
> So since we are not getting status_cb for fatal errors, I think we should just
> remove status_cb, in_reset and timeout code.
>

Looks reasonable.

[..]
> > I thought having the client get an error on timeout and resend the packet
> > would be better than silently dropping it. In practice, we've really only
> > seen the timeout or ul_callback errors on unrecoverable errors so I think
> > the timeout handling can definitely be redone.
> >
>
> You mean we can just remove the timeout handling part and return after
> kref_put()?
>

If all messages are "generated" by qcom_mhi_qrtr_send() and "released"
in qcom_mhi_qrtr_ul_callback() I don't think you need the refcounting at
all.


Presumably though, it would have been nice to not have to carry a
separate list of packets (and hope that it's in sync with the mhi core)
and instead have the ul callback somehow allow us to derive the skb to
be freed.

Regards,
Bjorn