Patchwork [U-Boot,V4,03/17] usb: gadget: ether set wMaxPacketSize

login
register
mail settings
Submitter Troy Kisky
Date Sept. 20, 2013, 3:29 a.m.
Message ID <1379647780-2623-4-git-send-email-troy.kisky@boundarydevices.com>
Download mbox | patch
Permalink /patch/276200/
State Superseded
Delegated to: Marek Vasut
Headers show

Comments

Troy Kisky - Sept. 20, 2013, 3:29 a.m.
set wMaxPacketSize for full speed descriptors
fs_source_desc, fs_sink_desc to 64.

Full-speed bulk endpoint can have a maximum packet size of
8, 16, 32, or 64 bytes, so choice 64.

The hs_source_desc, hs_sink_desc, already have their wMaxPacketSize
set to 512. That is the only legal value for high speed bulk endpoints.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>

---
v4: expanded commit message
---
 drivers/usb/gadget/ether.c | 2 ++
 1 file changed, 2 insertions(+)
Marek Vasut - Sept. 20, 2013, 10:52 a.m.
Dear Troy Kisky,

> set wMaxPacketSize for full speed descriptors
> fs_source_desc, fs_sink_desc to 64.
> 
> Full-speed bulk endpoint can have a maximum packet size of
> 8, 16, 32, or 64 bytes, so choice 64.
> 
> The hs_source_desc, hs_sink_desc, already have their wMaxPacketSize
> set to 512. That is the only legal value for high speed bulk endpoints.
> 
> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>

Why do we need this patch? What issue does this fix ?

Best regards,
Marek Vasut
Troy Kisky - Sept. 20, 2013, 6:34 p.m.
On 9/20/2013 3:52 AM, Marek Vasut wrote:
> Dear Troy Kisky,
>
>> set wMaxPacketSize for full speed descriptors
>> fs_source_desc, fs_sink_desc to 64.
>>
>> Full-speed bulk endpoint can have a maximum packet size of
>> 8, 16, 32, or 64 bytes, so choice 64.
>>
>> The hs_source_desc, hs_sink_desc, already have their wMaxPacketSize
>> set to 512. That is the only legal value for high speed bulk endpoints.
>>
>> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
> Why do we need this patch? What issue does this fix ?
>
> Best regards,
> Marek Vasut
>
I could try full speed mode without this and see how linux behaves when 
given bad data,
but that would not says anything about other O.S.es. It seems safer just 
not to give out
bad data.

Troy
Marek Vasut - Sept. 23, 2013, 12:04 a.m.
Dear Troy Kisky,

> On 9/20/2013 3:52 AM, Marek Vasut wrote:
> > Dear Troy Kisky,
> > 
> >> set wMaxPacketSize for full speed descriptors
> >> fs_source_desc, fs_sink_desc to 64.
> >> 
> >> Full-speed bulk endpoint can have a maximum packet size of
> >> 8, 16, 32, or 64 bytes, so choice 64.
> >> 
> >> The hs_source_desc, hs_sink_desc, already have their wMaxPacketSize
> >> set to 512. That is the only legal value for high speed bulk endpoints.
> >> 
> >> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
> > 
> > Why do we need this patch? What issue does this fix ?
> > 
> > Best regards,
> > Marek Vasut
> 
> I could try full speed mode without this and see how linux behaves when
> given bad data,
> but that would not says anything about other O.S.es. It seems safer just
> not to give out
> bad data.

Certainly. Will this not cause issues with the MPC8xx controller and OMAP1510 
controller?

Best regards,
Marek Vasut
Troy Kisky - Sept. 23, 2013, 7:51 p.m.
On 9/22/2013 5:04 PM, Marek Vasut wrote:
> Dear Troy Kisky,
>
>> On 9/20/2013 3:52 AM, Marek Vasut wrote:
>>> Dear Troy Kisky,
>>>
>>>> set wMaxPacketSize for full speed descriptors
>>>> fs_source_desc, fs_sink_desc to 64.
>>>>
>>>> Full-speed bulk endpoint can have a maximum packet size of
>>>> 8, 16, 32, or 64 bytes, so choice 64.
>>>>
>>>> The hs_source_desc, hs_sink_desc, already have their wMaxPacketSize
>>>> set to 512. That is the only legal value for high speed bulk endpoints.
>>>>
>>>> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
>>> Why do we need this patch? What issue does this fix ?
>>>
>>> Best regards,
>>> Marek Vasut
>> I could try full speed mode without this and see how linux behaves when
>> given bad data,
>> but that would not says anything about other O.S.es. It seems safer just
>> not to give out
>> bad data.
> Certainly. Will this not cause issues with the MPC8xx controller and OMAP1510
> controller?
>
> Best regards,
> Marek Vasut
>
Good point. ether.c is compiled when CONFIG_USB_ETHER is set.
And omap1510_udc.c, mpc8xx_udc.c will only be compiled when 
CONFIG_USB_ETHER is NOT set.


So, not a issue at present. I doubt anyone will upgrade these old boards 
to support CONFIG_USB_ETHER.

Thanks
Troy
Marek Vasut - Sept. 23, 2013, 9:22 p.m.
Dear Troy Kisky,

> On 9/22/2013 5:04 PM, Marek Vasut wrote:
> > Dear Troy Kisky,
> > 
> >> On 9/20/2013 3:52 AM, Marek Vasut wrote:
> >>> Dear Troy Kisky,
> >>> 
> >>>> set wMaxPacketSize for full speed descriptors
> >>>> fs_source_desc, fs_sink_desc to 64.
> >>>> 
> >>>> Full-speed bulk endpoint can have a maximum packet size of
> >>>> 8, 16, 32, or 64 bytes, so choice 64.
> >>>> 
> >>>> The hs_source_desc, hs_sink_desc, already have their wMaxPacketSize
> >>>> set to 512. That is the only legal value for high speed bulk
> >>>> endpoints.
> >>>> 
> >>>> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
> >>> 
> >>> Why do we need this patch? What issue does this fix ?
> >>> 
> >>> Best regards,
> >>> Marek Vasut
> >> 
> >> I could try full speed mode without this and see how linux behaves when
> >> given bad data,
> >> but that would not says anything about other O.S.es. It seems safer just
> >> not to give out
> >> bad data.
> > 
> > Certainly. Will this not cause issues with the MPC8xx controller and
> > OMAP1510 controller?
> > 
> > Best regards,
> > Marek Vasut
> 
> Good point. ether.c is compiled when CONFIG_USB_ETHER is set.
> And omap1510_udc.c, mpc8xx_udc.c will only be compiled when
> CONFIG_USB_ETHER is NOT set.
> 
> 
> So, not a issue at present. I doubt anyone will upgrade these old boards
> to support CONFIG_USB_ETHER.

Did you manage to get any feedback from the OMAP1 and MPC8xx guys on the USB 
topic?

btw. it might be actually better to split out the MX6 fixes and general USB 
fixes so the MX6 ones can go in before the rest.

Best regards,
Marek Vasut

Patch

diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 700d5fb..988cffb 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -635,6 +635,7 @@  fs_source_desc = {
 
 	.bEndpointAddress =	USB_DIR_IN,
 	.bmAttributes =		USB_ENDPOINT_XFER_BULK,
+	.wMaxPacketSize =	__constant_cpu_to_le16(64),
 };
 
 static struct usb_endpoint_descriptor
@@ -644,6 +645,7 @@  fs_sink_desc = {
 
 	.bEndpointAddress =	USB_DIR_OUT,
 	.bmAttributes =		USB_ENDPOINT_XFER_BULK,
+	.wMaxPacketSize =	__constant_cpu_to_le16(64),
 };
 
 static const struct usb_descriptor_header *fs_eth_function[11] = {