public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sarah Sharp <sarah.a.sharp@linux.intel.com>
To: Luben Tuikov <ltuikov@yahoo.com>
Cc: Greg KH <greg@kroah.com>,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH 2/4] [USB] UASP: Add MaxNumStreams module parameter
Date: Thu, 9 Dec 2010 12:58:20 -0800	[thread overview]
Message-ID: <20101209205820.GA6014@xanatos> (raw)
In-Reply-To: <531583.43961.qm@web31816.mail.mud.yahoo.com>

On Wed, Dec 08, 2010 at 03:55:27PM -0800, Luben Tuikov wrote:
> Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
> ---
>  The long story is that we see some host controllers misreport their
>  PSA as they solved 2^v = streams, instead of 2^(v+1) = streams. Thus
>  They report that they support 32 streams when in fact they support 16.
>  When the device attempts to return status for stream > 15, the host
>  says ACK(NumP=0), the device goes in flow control, blah, blah, this
>  module parameter allows you to set a max cap on the number of streams
>  the driver will ask XHCI HCD to allocate.

If this is an issue with a host then the work-around should be in the
xHCI driver instead.  It should be based on the vendor/device ID of the
offending host instead of being a module parameter in the UAS driver.
The only people who benefit from this patch are the people "in the know"
about which hosts are buggy, not normal Linux users.

Streams could be used for things other than UAS in the future, so the
fix should really be in the xHCI host controller driver.  And please put
the information about the host bug in the commit message, so your
private comments don't get lost in the bowels of the linux-usb mailing
list.

In the future, please Cc me on any patches that involve xHCI, or bulk
streams in general.  I'm not an enemy; I frankly don't care which UAS
driver gets in the kernel, I just want one good, well documented driver,
and for the xHCI driver to be as good as possible.

Sarah Sharp


>  drivers/usb/storage/uasp.c |   21 ++++++++++++++++++++-
>  1 files changed, 20 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/usb/storage/uasp.c b/drivers/usb/storage/uasp.c
> index 3b10efd..e5a26e9 100644
> --- a/drivers/usb/storage/uasp.c
> +++ b/drivers/usb/storage/uasp.c
> @@ -30,6 +30,19 @@
>  #include <scsi/scsi_host.h>
>  #include <scsi/scsi_tcq.h>
>  
> +int MaxNumStreams = -1;
> +
> +module_param(MaxNumStreams, int, 0444);
> +MODULE_PARM_DESC(MaxNumStreams, "\n"
> +	"\tSome host controllers and/or devices report a larger number of\n"
> +	"\tstreams that they in fact support. This parameter allows you\n"
> +	"\tto limit the number of streams this driver will request the XHCI\n"
> +	"\tHCD to allocate. If set to -1, the default value, then this driver\n"
> +	"\twill use the value reported by the attached device. Else the\n"
> +	"\tnumber of streams will be limited to the minimum reported by the\n"
> +	"\tattached device and this value. Valid values are -1, default,\n"
> +	"\tand 1 to 0xFFEF.");
> +
>  /* Information unit types
>   */
>  #define IU_CMD   1
> @@ -938,6 +951,8 @@ static int uasp_ep_conf(struct uasp_tport_info *tpinfo)
>  					 tpinfo->eps[3]->desc.bEndpointAddress);
>  
>  	if (udev->speed == USB_SPEED_SUPER) {
> +		int max_streams;
> +
>  		for (i = 1; i < 4; i++) {
>  			if (tpinfo->max_streams == 0)
>  				tpinfo->max_streams = USB_SS_MAX_STREAMS(tpinfo->eps[i]->ss_ep_comp.bmAttributes);
> @@ -952,9 +967,13 @@ static int uasp_ep_conf(struct uasp_tport_info *tpinfo)
>  		}
>  		
>  		tpinfo->use_streams = 1;
> +		if (1 <= MaxNumStreams && MaxNumStreams <= 0xFFEF)
> +			max_streams = min(MaxNumStreams, tpinfo->max_streams);
> +		else
> +			max_streams = tpinfo->max_streams;
>  		tpinfo->num_streams = usb_alloc_streams(iface,
>  							&tpinfo->eps[1], 3,
> -							tpinfo->max_streams,
> +							max_streams,
>  							GFP_KERNEL);
>  		if (tpinfo->num_streams <= 0) {
>  			dev_err(&udev->dev,
> -- 
> 1.7.0.1
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-12-09 20:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-08 23:55 [PATCH 2/4] [USB] UASP: Add MaxNumStreams module parameter Luben Tuikov
2010-12-09 20:58 ` Sarah Sharp [this message]
2010-12-09 22:54   ` Luben Tuikov
2010-12-10  0:11     ` Sarah Sharp
2010-12-10  0:25       ` Greg KH
2010-12-10  0:41         ` Luben Tuikov
2010-12-10  0:29     ` Alan Cox
2010-12-10 23:02   ` Luben Tuikov
2010-12-10 23:14     ` Greg KH
2010-12-10 23:19       ` Luben Tuikov

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=20101209205820.GA6014@xanatos \
    --to=sarah.a.sharp@linux.intel.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=ltuikov@yahoo.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox