Message ID | 1453486736-15358-5-git-send-email-dianders@chromium.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Doug, We are using the minimum FIFO size mode for TX now, which only equal to one max packet size. The addition FIFO size may help shorten the inter-packet data prepare latency when the bus/DRAM is busy. For the actual usage in TX, we have very little change to use the period TX FIFO with more than one max packet size in host mode. So far as I know, usb audio use the isochronous tx FIFO, but this king of device won't have much data payload and won't, I haven't see a usb audio have more data than 1024byte/ms. So I suggest we assign this 48 words to host_nperio_tx_fifi_size instead if we have to do this. Because we are using device base on bulk transaction like U-disk very frequently. Thanks, - Kever On 01/23/2016 02:18 AM, Douglas Anderson wrote: > Looking at rk3288, there are two dwc2 ports. One has 960 > total_fifo_size and the other 972. > > We're currently assigning 528 + 128 + 256 = 912. That means we're > wasting 48 words on one port and 60 words on the other. Since we have > one settings block for both ports, let's just eat the 48 words that we > know we have and assign them to what's probably the most > latency-senstive part of the system: periodic transfers. > > Presumably other rk3288 parts using the rk3066 settings also have these > extra 48 words as well. > > Note: ideally we'd adjust dwc2_calculate_dynamic_fifo() to handle this > more dynamically, but until that's done hardcoding things here seems OK. > > NOTE: no known use cases are improved by this patch, but in my stressful > USB tests I certainly see my periodic FIFO filling up both before and > after this change. Presumably there are some USB configurations where > the periodic FIFO would have been filled before where it no longer is. > > Signed-off-by: Douglas Anderson <dianders@chromium.org> > --- > Changes in v5: None > Changes in v4: > - Set host_perio_tx_fifo_size to 304 for rk3066 new for v4. > > Changes in v3: None > Changes in v2: None > > drivers/usb/dwc2/platform.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c > index b6d7666e715c..afdcdeee266d 100644 > --- a/drivers/usb/dwc2/platform.c > +++ b/drivers/usb/dwc2/platform.c > @@ -128,7 +128,7 @@ static const struct dwc2_core_params params_rk3066 = { > .en_multiple_tx_fifo = -1, > .host_rx_fifo_size = 528, /* 528 DWORDs */ > .host_nperio_tx_fifo_size = 128, /* 128 DWORDs */ > - .host_perio_tx_fifo_size = 256, /* 256 DWORDs */ > + .host_perio_tx_fifo_size = 304, /* 304 DWORDs */ > .max_transfer_size = -1, > .max_packet_count = -1, > .host_channels = -1,
Kever, On Wed, Jan 27, 2016 at 7:10 PM, Kever Yang <kever.yang@rock-chips.com> wrote: > Hi Doug, > > We are using the minimum FIFO size mode for TX now, which only > equal to one max packet size. > > The addition FIFO size may help shorten the inter-packet data > prepare latency when the bus/DRAM is busy. > > For the actual usage in TX, we have very little change to use the > period TX FIFO with more than one max packet size in host mode. > So far as I know, usb audio use the isochronous tx FIFO, but this > king of device won't have much data payload and won't, I haven't > see a usb audio have more data than 1024byte/ms. > > So I suggest we assign this 48 words to host_nperio_tx_fifi_size instead > if we have to do this. Because we are using device base on bulk transaction > like U-disk very frequently. Try using a USB webcam. With that plus a USB audio device it's easy to overwhelm the periodic TX FIFO. If we overwhelm the periodic TX FIFO we might actually fail to transmit ISO or INT packets at the scheduled time. That seems more serious of a problem to try to fix than eeking out a tiny bit performance on a USB disk. ...but of course, it all depends on what you consider important. ;) We could split the difference, I suppose and put half on each? -Doug
Hi Doug, We are in HOST mode, we only need to receive data from USB camera with RX FIFO, and no need to use TX FIFO for USB webcam, right? :) Any way, I think we need to NAK this patch after look into the design of dwc2 controller. Because all the dwc2 controller inside the Rockchip chips don't support the thresholding FIFO mode, in this case, there is no more transaction before a whole packet is send out and the dwc2 only care if the available FIFO is enough for next packet or not. So, the addition 48 words won't help to shorten the latency for data prepare in this case. Thanks, - Kever On 01/28/2016 11:28 AM, Doug Anderson wrote: > Kever, > > On Wed, Jan 27, 2016 at 7:10 PM, Kever Yang <kever.yang@rock-chips.com> wrote: >> Hi Doug, >> >> We are using the minimum FIFO size mode for TX now, which only >> equal to one max packet size. >> >> The addition FIFO size may help shorten the inter-packet data >> prepare latency when the bus/DRAM is busy. >> >> For the actual usage in TX, we have very little change to use the >> period TX FIFO with more than one max packet size in host mode. >> So far as I know, usb audio use the isochronous tx FIFO, but this >> king of device won't have much data payload and won't, I haven't >> see a usb audio have more data than 1024byte/ms. >> >> So I suggest we assign this 48 words to host_nperio_tx_fifi_size instead >> if we have to do this. Because we are using device base on bulk transaction >> like U-disk very frequently. > Try using a USB webcam. With that plus a USB audio device it's easy > to overwhelm the periodic TX FIFO. > > If we overwhelm the periodic TX FIFO we might actually fail to > transmit ISO or INT packets at the scheduled time. That seems more > serious of a problem to try to fix than eeking out a tiny bit > performance on a USB disk. ...but of course, it all depends on what > you consider important. ;) > > We could split the difference, I suppose and put half on each? > > -Doug >
Kever, On Wed, Jan 27, 2016 at 10:41 PM, Kever Yang <kever.yang@rock-chips.com> wrote: > Hi Doug, > > We are in HOST mode, we only need to receive data from USB camera > with RX FIFO, and no need to use TX FIFO for USB webcam, right? :) > > Any way, I think we need to NAK this patch after look into the design > of dwc2 controller. Because all the dwc2 controller inside the Rockchip > chips don't support the thresholding FIFO mode, in this case, there is > no more transaction before a whole packet is send out and the dwc2 only > care if the available FIFO is enough for next packet or not. > > So, the addition 48 words won't help to shorten the latency for data prepare > in this case. Ah ha! I see where I messed up. It wasn't lack of FIFO space that I was running into, it was lack of queue space. :-P I had conflated the two of them in my mind. We still use the TX queue to transmit small packets so that we can receive our data... OK, so it's pretty sane to assume that exhausting the periodic TX FIFO isn't terribly common, I think. Audio won't do it by itself and you probably won't have more than one audio device. I guess if you had a video _output_ device hooked over USB then it could possible exhaust things. ...but I think dwc2 still has a ways to do before I'd suggest anyone hooking that up. :-P At some point in time you could imagine the driver being more dynamic. OK, so the non periodic FIFO it is, then. -Doug
Hi, On Thu, Jan 28, 2016 at 10:16 AM, Doug Anderson <dianders@chromium.org> wrote: > Kever, > > > On Wed, Jan 27, 2016 at 10:41 PM, Kever Yang <kever.yang@rock-chips.com> wrote: >> Hi Doug, >> >> We are in HOST mode, we only need to receive data from USB camera >> with RX FIFO, and no need to use TX FIFO for USB webcam, right? :) >> >> Any way, I think we need to NAK this patch after look into the design >> of dwc2 controller. Because all the dwc2 controller inside the Rockchip >> chips don't support the thresholding FIFO mode, in this case, there is >> no more transaction before a whole packet is send out and the dwc2 only >> care if the available FIFO is enough for next packet or not. >> >> So, the addition 48 words won't help to shorten the latency for data prepare >> in this case. > > Ah ha! I see where I messed up. It wasn't lack of FIFO space that I > was running into, it was lack of queue space. :-P I had conflated > the two of them in my mind. We still use the TX queue to transmit > small packets so that we can receive our data... > > OK, so it's pretty sane to assume that exhausting the periodic TX FIFO > isn't terribly common, I think. Audio won't do it by itself and you > probably won't have more than one audio device. I guess if you had a > video _output_ device hooked over USB then it could possible exhaust > things. ...but I think dwc2 still has a ways to do before I'd suggest > anyone hooking that up. :-P At some point in time you could imagine > the driver being more dynamic. > > OK, so the non periodic FIFO it is, then. Actually, in my simple tests adding it to the non periodic FIFO didn't help at all. I'll just drop this patch. -Doug
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index b6d7666e715c..afdcdeee266d 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -128,7 +128,7 @@ static const struct dwc2_core_params params_rk3066 = { .en_multiple_tx_fifo = -1, .host_rx_fifo_size = 528, /* 528 DWORDs */ .host_nperio_tx_fifo_size = 128, /* 128 DWORDs */ - .host_perio_tx_fifo_size = 256, /* 256 DWORDs */ + .host_perio_tx_fifo_size = 304, /* 304 DWORDs */ .max_transfer_size = -1, .max_packet_count = -1, .host_channels = -1,
Looking at rk3288, there are two dwc2 ports. One has 960 total_fifo_size and the other 972. We're currently assigning 528 + 128 + 256 = 912. That means we're wasting 48 words on one port and 60 words on the other. Since we have one settings block for both ports, let's just eat the 48 words that we know we have and assign them to what's probably the most latency-senstive part of the system: periodic transfers. Presumably other rk3288 parts using the rk3066 settings also have these extra 48 words as well. Note: ideally we'd adjust dwc2_calculate_dynamic_fifo() to handle this more dynamically, but until that's done hardcoding things here seems OK. NOTE: no known use cases are improved by this patch, but in my stressful USB tests I certainly see my periodic FIFO filling up both before and after this change. Presumably there are some USB configurations where the periodic FIFO would have been filled before where it no longer is. Signed-off-by: Douglas Anderson <dianders@chromium.org> --- Changes in v5: None Changes in v4: - Set host_perio_tx_fifo_size to 304 for rk3066 new for v4. Changes in v3: None Changes in v2: None drivers/usb/dwc2/platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)