Re: [v4] usb: UHCI: fix pkt size in TD for a sg element

2013-06-25 Thread Ming Lei
On Tue, Jun 25, 2013 at 12:26 AM, Alan Stern wrote: > > Other than usbtest, the only driver using SG that I know of is > usb-storage, and it does make that assumption. It works because the Another example is usbfs driver, which sets the SG size as 16KB and also makes the assumption. > block lay

Re: [v4] usb: UHCI: fix pkt size in TD for a sg element

2013-06-24 Thread Alan Stern
On Mon, 24 Jun 2013, Felipe Balbi wrote: > > MUSB shouldn't be copying data to and from bounce buffers just to be > > able to handle SG tranfers. > > well, if we can assume all SG elements to be wMaxPacketSize aligned, we > could just break it up into smaller URBs and avoid the copy, but I > wasn

Re: [v4] usb: UHCI: fix pkt size in TD for a sg element

2013-06-24 Thread Felipe Balbi
On Tue, Jun 25, 2013 at 12:09:38AM +0800, Ming Lei wrote: > On Mon, Jun 24, 2013 at 11:44 PM, Felipe Balbi wrote: > > > > BTW, EHCI can handle "short" SGs in the first page. See page 97 of EHCI > > 1.0 spec. > > That isn't enough, EHCI requires that size of the 3 middle buffers are 4K. right, I

Re: [v4] usb: UHCI: fix pkt size in TD for a sg element

2013-06-24 Thread Alan Stern
On Mon, 24 Jun 2013, Felipe Balbi wrote: > BTW, EHCI can handle "short" SGs in the first page. See page 97 of EHCI > 1.0 spec. I'm not sure what you're talking about. SG is used for bulk transfers, whereas p. 97 is about interrupt transfers. It's true that the hardware's abilities aren't fully

Re: [v4] usb: UHCI: fix pkt size in TD for a sg element

2013-06-24 Thread Felipe Balbi
Hi, On Mon, Jun 24, 2013 at 12:04:19PM -0400, Alan Stern wrote: > On Mon, 24 Jun 2013, Felipe Balbi wrote: > > > > you wouldn't notice the difference. The DMA engine is the one which > > > > would read the sgtable to figure where the data is scattered, at the end > > > > of the day, SW only knows

Re: [v4] usb: UHCI: fix pkt size in TD for a sg element

2013-06-24 Thread Ming Lei
On Mon, Jun 24, 2013 at 11:44 PM, Felipe Balbi wrote: > > BTW, EHCI can handle "short" SGs in the first page. See page 97 of EHCI > 1.0 spec. That isn't enough, EHCI requires that size of the 3 middle buffers are 4K. Thanks, -- Ming Lei -- To unsubscribe from this list: send the line "unsubscr

Re: [v4] usb: UHCI: fix pkt size in TD for a sg element

2013-06-24 Thread Alan Stern
On Mon, 24 Jun 2013, Felipe Balbi wrote: > > > you wouldn't notice the difference. The DMA engine is the one which > > > would read the sgtable to figure where the data is scattered, at the end > > > of the day, SW only knows of a single 1044bytes URB and controller is > > > required to generate p

Re: [v4] usb: UHCI: fix pkt size in TD for a sg element

2013-06-24 Thread Felipe Balbi
Hi, On Mon, Jun 24, 2013 at 05:53:25PM +0200, Sebastian Andrzej Siewior wrote: > On 06/24/2013 05:46 PM, Felipe Balbi wrote: > >> The DMA engines (intern or extern) do not merge transfers. Some > >> of them are clever enough to transfer a single 1024 as two 512 > >> requests. But two 256 bytes r

Re: [v4] usb: UHCI: fix pkt size in TD for a sg element

2013-06-24 Thread Sebastian Andrzej Siewior
On 06/24/2013 05:46 PM, Felipe Balbi wrote: >> The DMA engines (intern or extern) do not merge transfers. Some >> of them are clever enough to transfer a single 1024 as two 512 >> requests. But two 256 bytes requests are not merged into one 512 >> request. I believe the device side of dwc3 is ab

Re: [v4] usb: UHCI: fix pkt size in TD for a sg element

2013-06-24 Thread Felipe Balbi
On Mon, Jun 24, 2013 at 05:35:42PM +0200, Sebastian Andrzej Siewior wrote: > On 06/24/2013 05:18 PM, Felipe Balbi wrote: > >> It is a little. The first USB packet has 512 vs 502 bytes on the > >> wire. > > > > you wouldn't notice the difference. The DMA engine is the one > > which would read the s

Re: [v4] usb: UHCI: fix pkt size in TD for a sg element

2013-06-24 Thread Felipe Balbi
On Mon, Jun 24, 2013 at 06:42:05PM +0300, Felipe Balbi wrote: > On Mon, Jun 24, 2013 at 11:32:16AM -0400, Alan Stern wrote: > > > > >> - the change violates USB spec(1.1/2.0/3.0) > > > > > > > > > > I can't see how this would violate USB spec. USB specifications > > > > > have no knowledge of scat

Re: [v4] usb: UHCI: fix pkt size in TD for a sg element

2013-06-24 Thread Felipe Balbi
Hi, On Mon, Jun 24, 2013 at 11:32:16AM -0400, Alan Stern wrote: > > > >> - the change violates USB spec(1.1/2.0/3.0) > > > > > > > > I can't see how this would violate USB spec. USB specifications > > > > have no knowledge of scatter-gather. > > > > > > > > It really doesn't matter how the data

Re: [v4] usb: UHCI: fix pkt size in TD for a sg element

2013-06-24 Thread Sebastian Andrzej Siewior
On 06/24/2013 05:18 PM, Felipe Balbi wrote: >> It is a little. The first USB packet has 512 vs 502 bytes on the >> wire. > > you wouldn't notice the difference. The DMA engine is the one > which would read the sgtable to figure where the data is scattered, > at the end of the day, SW only knows of

Re: [v4] usb: UHCI: fix pkt size in TD for a sg element

2013-06-24 Thread Felipe Balbi
Hi, On Mon, Jun 24, 2013 at 11:20:32PM +0800, Ming Lei wrote: > On Mon, Jun 24, 2013 at 11:04 PM, Felipe Balbi wrote: > > On Mon, Jun 24, 2013 at 10:56:30PM +0800, Ming Lei wrote: > >> On Mon, Jun 24, 2013 at 10:33 PM, Denis V. Lunev wrote: > >> > From: Konstantin Filatov > >> > > >> > This pat

Re: [v4] usb: UHCI: fix pkt size in TD for a sg element

2013-06-24 Thread Alan Stern
On Mon, 24 Jun 2013, Felipe Balbi wrote: > Hi, > > On Mon, Jun 24, 2013 at 05:12:50PM +0200, Sebastian Andrzej Siewior wrote: > > On 06/24/2013 05:04 PM, Felipe Balbi wrote: > > >> - the change violates USB spec(1.1/2.0/3.0) > > > > > > I can't see how this would violate USB spec. USB specificat

Re: [v4] usb: UHCI: fix pkt size in TD for a sg element

2013-06-24 Thread Alan Stern
On Mon, 24 Jun 2013, Sebastian Andrzej Siewior wrote: > On 06/24/2013 05:04 PM, Felipe Balbi wrote: > >> - the change violates USB spec(1.1/2.0/3.0) > > > > I can't see how this would violate USB spec. USB specifications > > have no knowledge of scatter-gather. > > > > It really doesn't matter h

Re: [v4] usb: UHCI: fix pkt size in TD for a sg element

2013-06-24 Thread Ming Lei
On Mon, Jun 24, 2013 at 11:04 PM, Felipe Balbi wrote: > On Mon, Jun 24, 2013 at 10:56:30PM +0800, Ming Lei wrote: >> On Mon, Jun 24, 2013 at 10:33 PM, Denis V. Lunev wrote: >> > From: Konstantin Filatov >> > >> > This patch shortens TD's packet not only for the last TD in sg list, >> > but also

Re: [v4] usb: UHCI: fix pkt size in TD for a sg element

2013-06-24 Thread Felipe Balbi
Hi, On Mon, Jun 24, 2013 at 05:12:50PM +0200, Sebastian Andrzej Siewior wrote: > On 06/24/2013 05:04 PM, Felipe Balbi wrote: > >> - the change violates USB spec(1.1/2.0/3.0) > > > > I can't see how this would violate USB spec. USB specifications > > have no knowledge of scatter-gather. > > > > I

Re: [v4] usb: UHCI: fix pkt size in TD for a sg element

2013-06-24 Thread Sebastian Andrzej Siewior
On 06/24/2013 05:04 PM, Felipe Balbi wrote: >> - the change violates USB spec(1.1/2.0/3.0) > > I can't see how this would violate USB spec. USB specifications > have no knowledge of scatter-gather. > > It really doesn't matter how the data gets into the HW's FIFO, as > long as it *does* get there

Re: [v4] usb: UHCI: fix pkt size in TD for a sg element

2013-06-24 Thread Felipe Balbi
On Mon, Jun 24, 2013 at 10:56:30PM +0800, Ming Lei wrote: > On Mon, Jun 24, 2013 at 10:33 PM, Denis V. Lunev wrote: > > From: Konstantin Filatov > > > > This patch shortens TD's packet not only for the last TD in sg list, > > but also for the last TD in sg element. > > > > Signed-off-by: Konstant

Re: [v4] usb: UHCI: fix pkt size in TD for a sg element

2013-06-24 Thread Ming Lei
On Mon, Jun 24, 2013 at 10:33 PM, Denis V. Lunev wrote: > From: Konstantin Filatov > > This patch shortens TD's packet not only for the last TD in sg list, > but also for the last TD in sg element. > > Signed-off-by: Konstantin Filatov > Signed-off-by: Denis V. Lunev Considered that: - the ch