All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC PATCH v3] usb: limit USB_MAX_XFER_BLK to 256
Date: Fri, 19 Apr 2019 11:50:41 +0200	[thread overview]
Message-ID: <245e9b28-e1fb-be60-0b89-1b5fbd8717bf@denx.de> (raw)
In-Reply-To: <20190417234558.11856-1-marcel@ziswiler.com>

On 4/18/19 1:45 AM, Marcel Ziswiler wrote:
> From: Peng Fan <peng.fan@nxp.com>
> 
> For Some USB mass storage devices, such as:
> "
>  - Kingston DataTraveler 2.0 001D7D06CF09B04199C7B3EA
>  - Class: (from Interface) Mass Storage
>  - PacketSize: 64  Configurations: 1
>  - Vendor: 0x0930  Product 0x6545 Version 1.16
> "
> When `usb read 0x80000000 0 0x2000`, we met
> "EHCI timed out on TD - token=0x80008d80".
> 
> The devices does not support scsi VPD page, we are not able
> to get the maximum transfer length for READ(10)/WRITE(10).
> 
> So we limit this to 256 blocks as READ(6).
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
> (cherry picked from commit df0052575b2bc9d66ae73584768e1a457ed5d914)
> 
> Signed-off-by: Marcel Ziswiler <marcel@ziswiler.com>
> 
> ---
> This comes from NXP's downstream and has proven to tremendously improve
> the situation with those odd USB mass storage aka memory sticks. This is
> why I post it here asking whether or not this may be something
> benefiting more people. Any feedback and suggestions are welcome.
> 
> Changes in v3:
> - Drop the reference to the NXP internal MLK-xxx tracking number as
>   suggested by Peng.
> 
> Changes in v2:
> - Fixed spelling in comment as suggested by Igor.
> 
>  common/usb_storage.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/common/usb_storage.c b/common/usb_storage.c
> index 8c889bb1a6..4e284645f5 100644
> --- a/common/usb_storage.c
> +++ b/common/usb_storage.c
> @@ -949,7 +949,11 @@ static void usb_stor_set_max_xfer_blk(struct usb_device *udev,
>  	 * there is enough free heap space left, but the SCSI READ(10) and
>  	 * WRITE(10) commands are limited to 65535 blocks.
>  	 */
> -	blk = USHRT_MAX;
> +	/*
> +	 * Some USB mass storage devices have issues, limiting this to 256
> +	 * fixes this.
> +	 */
> +	blk = 256;

Seems like the previous comment, right above this new one, contradicts
this claim. Please update the original comment.

That said, there was an attempt to fix this properly by using adaptive
block length implementation, which would not impact devices that are not
broken. This hack above will degrade performance of such good devices.
Maybe you can resuscitate that adaptive approach instead ?

>  #else
>  	blk = 20;
>  #endif
> 


-- 
Best regards,
Marek Vasut

  reply	other threads:[~2019-04-19  9:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-17 23:45 [U-Boot] [RFC PATCH v3] usb: limit USB_MAX_XFER_BLK to 256 Marcel Ziswiler
2019-04-19  9:50 ` Marek Vasut [this message]
2019-04-24  7:32 ` Sven Schwermer
2019-04-24  8:57   ` Peng Fan
2019-04-24  8:59     ` Peng Fan
2019-04-24 11:09       ` Sven Schwermer
2019-04-24 12:07         ` Peng Fan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=245e9b28-e1fb-be60-0b89-1b5fbd8717bf@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.