RE: [PATCH] usb: dwc3: gadget: skip Set/Clear Halt when invalid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Thinh,

Thinh Nguyen <Thinh.Nguyen@xxxxxxxxxxxx> writes:
>>  drivers/usb/dwc3/gadget.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>> 
>> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
>> index 6faf484e5dfc..0a664d8eba3f 100644
>> --- a/drivers/usb/dwc3/gadget.c
>> +++ b/drivers/usb/dwc3/gadget.c
>> @@ -1379,6 +1379,9 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep
>> *dep, int value, int protocol)
>>  		unsigned transfer_in_flight;
>>  		unsigned started;
>> 
>> +		if (dep->flags & DWC3_EP_STALL)
>> +			return 0;
>> +
>>  		if (dep->number > 1)
>>  			trb = dwc3_ep_prev_trb(dep, dep->trb_enqueue);
>>  		else
>> @@ -1400,6 +1403,8 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep
>> *dep, int value, int protocol)
>>  		else
>>  			dep->flags |= DWC3_EP_STALL;
>>  	} else {
>> +		if (!(dep->flags & DWC3_EP_STALL))
>> +			return 0;
>> 
>>  		ret = dwc3_send_clear_stall_ep_cmd(dep);
>>  		if (ret)
>> --
>> 2.11.0.295.gd7dffce1ce
>> 
>> --
>
> I encounter an issue when I test mainline with USB 3 CV MSC test and
> bisected to this patch.
>
> Tester: USB 3 CV test (v2.1.3.0).
> Function Driver: f_mass_storage
> Reproducibility: always 
>
> The failure occurs under MSC Error Recovery Test (TD 1.4).
>
> Failure from the test sequence as follow (MSC compliance test spec) :
> 1. Place the device in the desired starting state.
> 2. Issue a Case 9 CBW (see Table 2) but with invalid signature of 0xDEADBEEF.
> 3. Issue several In requests to the Bulk-Only Data Interface Bulk In endpoint. Verify a
> STALL handshake is returned. If STALL handshake is not returned, skip to step 11.
> 4. Issue a Get_Status(endpoint) request targeting the Bulk-Only Data Interface bulk In
> endpoint. Verify that it completes normally, reports endpoint halt status.
>
>  ***After this point the device idles for 10 seconds and resets. ***
>
> Test fails.

I've been looking at this and based on sniffer and dwc3 tracepoints, it
seems like dwc3 is behaving properly. The real issue seems to be that
g_mass_storage isn't queueing a new request to IN endpoint.

I'll continue debugging this and try to find a solution that doesn't
involve reverting $subject.

-- 
balbi

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]