[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZjiBGLVN6GteWvti@Sun>
Date: Mon, 6 May 2024 15:04:56 +0800
From: Hongren Zheng <i@...ithal.me>
To: Simon Holesch <simon@...esch.de>
Cc: Valentina Manea <valentina.manea.m@...il.com>,
Shuah Khan <shuah@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Shuah Khan <skhan@...uxfoundation.org>, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4] usbip: Don't submit special requests twice
On Sun, May 05, 2024 at 07:54:36PM +0200, Simon Holesch wrote:
> On Sun May 5, 2024 at 5:31 PM CEST, Hongren Zheng wrote:
> > On Sun, Dec 17, 2023 at 08:30:40PM +0100, Simon Holesch wrote:
> > > Skip submitting URBs, when identical requests were already sent in
> > > tweak_special_requests(). Instead call the completion handler directly
> > > to return the result of the URB.
> >
> > Reproduced the behavior and this patch fixed the bahavior
>
> Thank you for testing.
>
> > > @@ -468,6 +477,7 @@ static void stub_recv_cmd_submit(struct stub_device *sdev,
> > > int support_sg = 1;
> > > int np = 0;
> > > int ret, i;
> > > + int is_tweaked;
> > >
> > > if (pipe == -1)
> > > return;
> > > @@ -580,8 +590,7 @@ static void stub_recv_cmd_submit(struct stub_device *sdev,
> > > priv->urbs[i]->pipe = pipe;
> > > priv->urbs[i]->complete = stub_complete;
> > >
> > > - /* no need to submit an intercepted request, but harmless? */
> > > - tweak_special_requests(priv->urbs[i]);
> > > + is_tweaked = tweak_special_requests(priv->urbs[i]);
> >
> > One question though, if there are mutiple urbs and one of them is
> > SET CONFIGURATION, then all of them would not be submitted,
> > as is_tweaked is a *global* flag instead of a per-urb flag.
> >
> > Now it is assumed that when the urb is SET CONFIGURATION then
> > num_urbs is 1. I assume it just happens to be the case and I do
> > not know if it holds for all scenario.
>
> To be honest, I didn't fully understand the num_urbs > 1 case. I assumed
> this is for drivers not supporting SG and a long URB is just broken up
> into multiple ones.
I misunderstood that code path. It is indeed multiple URBs for
one PDU when the host controller for the physical device does not support SG.
And one global is_tweaked flag is enough. I think adding a comment here
would make it easier to understand.
Reviewed-By: Hongren Zheng <i@...ithal.me>
Tested-By: Hongren Zheng <i@...ithal.me>
Powered by blists - more mailing lists