Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1329516 > unrolled thread
| Started by | Amit Pundir <amit.pundir@linaro.org> |
|---|---|
| First post | 2016-02-08 21:10 +0100 |
| Last post | 2016-02-08 21:40 +0100 |
| Articles | 2 — 1 participant |
Back to article view | Back to linux.kernel
[RFC][PATCH] usb: gadget: rndis: Free the response queue during REMOTE_NDIS_RESET_MSG Amit Pundir <amit.pundir@linaro.org> - 2016-02-08 21:10 +0100
Re: [RFC][PATCH] usb: gadget: rndis: Free the response queue during REMOTE_NDIS_RESET_MSG Amit Pundir <amit.pundir@linaro.org> - 2016-02-08 21:40 +0100
| From | Amit Pundir <amit.pundir@linaro.org> |
|---|---|
| Date | 2016-02-08 21:10 +0100 |
| Subject | [RFC][PATCH] usb: gadget: rndis: Free the response queue during REMOTE_NDIS_RESET_MSG |
| Message-ID | <r00ie-1J1-9@gated-at.bofh.it> |
From: xerox_lin <xerox_lin@htc.com> When rndis data transfer is in progress, some Windows7 Host PC is not sending the GET_ENCAPSULATED_RESPONSE command for receiving the response for the previous SEND_ENCAPSULATED_COMMAND processed. The rndis function driver appends each response for the SEND_ENCAPSULATED_COMMAND in a queue. As the above process got corrupted, the Host sends a REMOTE_NDIS_RESET_MSG command to do a soft-reset. As the rndis response queue is not freed, the previous response is sent as a part of this REMOTE_NDIS_RESET_MSG's reset response and the Host blocks any more Rndis transfers. Hence free the rndis response queue as a part of this soft-reset so that the current response for REMOTE_NDIS_RESET_MSG is sent properly during the response command. Cc: Felipe Balbi <balbi@kernel.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Cc: Badhri Jagan Sridharan <badhri@google.com> Cc: Android Kernel Team <kernel-team@android.com> Cc: John Stultz <john.stultz@linaro.org> Cc: Sumit Semwal <sumit.semwal@linaro.org> Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org> Signed-off-by: Xerox Lin <xerox_lin@htc.com> [pundir: cherry-picked this patch from AOSP experimental/android-4.4 tree.] Signed-off-by: Amit Pundir <amit.pundir@linaro.org> --- Cherry-picked this patch from AOSP common/experimental/android-4.4 tree. I could not find upstream submission history for this patch, so my apologies in advance if this has already been NACKed before. drivers/usb/gadget/function/rndis.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/usb/gadget/function/rndis.c b/drivers/usb/gadget/function/rndis.c index 70d3917..27163e8 100644 --- a/drivers/usb/gadget/function/rndis.c +++ b/drivers/usb/gadget/function/rndis.c @@ -681,6 +681,13 @@ static int rndis_reset_response(struct rndis_params *params, rndis_reset_cmplt_type *resp; rndis_resp_t *r; + u32 length; + u8 *xbuf; + + /* drain the response queue */ + while ((xbuf = rndis_get_next_response(configNr, &length))) + rndis_free_response(configNr, xbuf); + r = rndis_add_response(params, sizeof(rndis_reset_cmplt_type)); if (!r) return -ENOMEM; -- 1.9.1
[toc] | [next] | [standalone]
| From | Amit Pundir <amit.pundir@linaro.org> |
|---|---|
| Date | 2016-02-08 21:40 +0100 |
| Message-ID | <r00Lh-1TO-33@gated-at.bofh.it> |
| In reply to | #1329516 |
Please ignore this one. I build tested these patches in series and turned out it can't be build independently because configNr is deprecated. I'll resend this patch. Nevertheless I'd like to get a feedback on the real problem this patch is trying to solve here. Thanks, Amit Pundir On 9 February 2016 at 01:37, Amit Pundir <amit.pundir@linaro.org> wrote: > From: xerox_lin <xerox_lin@htc.com> > > When rndis data transfer is in progress, some Windows7 Host PC is not > sending the GET_ENCAPSULATED_RESPONSE command for receiving the response > for the previous SEND_ENCAPSULATED_COMMAND processed. > > The rndis function driver appends each response for the > SEND_ENCAPSULATED_COMMAND in a queue. As the above process got corrupted, > the Host sends a REMOTE_NDIS_RESET_MSG command to do a soft-reset. > As the rndis response queue is not freed, the previous response is sent > as a part of this REMOTE_NDIS_RESET_MSG's reset response and the Host > blocks any more Rndis transfers. > > Hence free the rndis response queue as a part of this soft-reset so that > the current response for REMOTE_NDIS_RESET_MSG is sent properly during the > response command. > > Cc: Felipe Balbi <balbi@kernel.org> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Cc: Andrzej Pietrasiewicz <andrzej.p@samsung.com> > Cc: Badhri Jagan Sridharan <badhri@google.com> > Cc: Android Kernel Team <kernel-team@android.com> > Cc: John Stultz <john.stultz@linaro.org> > Cc: Sumit Semwal <sumit.semwal@linaro.org> > Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org> > Signed-off-by: Xerox Lin <xerox_lin@htc.com> > [pundir: cherry-picked this patch from AOSP experimental/android-4.4 tree.] > Signed-off-by: Amit Pundir <amit.pundir@linaro.org> > --- > Cherry-picked this patch from AOSP common/experimental/android-4.4 tree. > I could not find upstream submission history for this patch, so my > apologies in advance if this has already been NACKed before. > > drivers/usb/gadget/function/rndis.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/usb/gadget/function/rndis.c b/drivers/usb/gadget/function/rndis.c > index 70d3917..27163e8 100644 > --- a/drivers/usb/gadget/function/rndis.c > +++ b/drivers/usb/gadget/function/rndis.c > @@ -681,6 +681,13 @@ static int rndis_reset_response(struct rndis_params *params, > rndis_reset_cmplt_type *resp; > rndis_resp_t *r; > > + u32 length; > + u8 *xbuf; > + > + /* drain the response queue */ > + while ((xbuf = rndis_get_next_response(configNr, &length))) > + rndis_free_response(configNr, xbuf); > + > r = rndis_add_response(params, sizeof(rndis_reset_cmplt_type)); > if (!r) > return -ENOMEM; > -- > 1.9.1 >
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web