LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Tanya Brokhman <tlinder@codeaurora.org>
Cc: gregkh@suse.de, <linux-arm-msm@vger.kernel.org>,
	"'open list:USB GADGET/PERIPH...'" <linux-usb@vger.kernel.org>,
	"'open list'" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v7 1/5] usb: Adding SuperSpeed support to dummy_hcd
Date: Mon, 31 Jan 2011 10:41:34 -0500 (EST)	[thread overview]
Message-ID: <Pine.LNX.4.44L0.1101311036220.1931-100000@iolanthe.rowland.org> (raw)
In-Reply-To: <000301cbc158$df3bc470$9db34d50$@org>

On Mon, 31 Jan 2011, Tanya Brokhman wrote:

> > > This patch adds SS support to the dummy hcd module. It may be used to
> > test
> > > SS device when no (SS) HW is available.
> > > USB 3.0 hub includes 2 hubs - HS and SS ones.
> > > This patch adds support for a SS hub in the dummy_hcd module. Thus,
> > when
> > > dummy_hcd enabled it will register 2 root hubs (SS and HS).
> > 
> > Getting there.  A few spots could still use some attention.
> > 
> 
> Could you please elaborate? 

I _did_ elaborate in the original email message.  Here's a repeat of
what I said:

------------------------------------------------------------------------

> @@ -343,7 +431,13 @@ dummy_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc)
>  	dum = ep_to_dummy (ep);
>  	if (!dum->driver || !is_enabled (dum))
>  		return -ESHUTDOWN;
> -	max = le16_to_cpu(desc->wMaxPacketSize) & 0x3ff;
> +	max = le16_to_cpu(desc->wMaxPacketSize) ;
> +	/*
> +	 * For HS/FS devices only bits 0..9 of the wMaxPacketSize 
represent the
> +	 * maximum packet size
> +	 */
> +	if (dum->gadget.speed < USB_SPEED_SUPER)
> +		max &= 0x3ff;

Strictly speaking, both the old and the new code are wrong.  For all
devices, regardless of speed, we should say:

	max = le16_to_cpu(desc->wMaxPacketSize) & 0x7ff;

In other words, the speed is contained in bits 0..10 (not 0..9).


> @@ -1352,6 +1559,10 @@ static void dummy_timer (unsigned long _dum)
>  	case USB_SPEED_HIGH:
>  		total = 512/*bytes*/ * 13/*packets*/ * 8/*uframes*/;
>  		break;
> +	case USB_SPEED_SUPER:
> +		/* 400MBps = 400*(2^20)/1000 bytes per milisec */
> +		total = (400 << 20) / 1000;
> +		break;

Ugh.  For one thing, SuperSpeed runs at 500 million bytes/s, not 400
million.  For another, 400 << 20 isn't equal to 400 million.

Don't try to be too clever.  Realizing that this is only an 
approximation anyway, just say:

		/* Bus speed is 500000 bytes/ms, so use a little less */
		total = 490000;

------------------------------------------------------------------------


> > Also, you might try running this patch through checkpatch.pl and fixing
> > any complaints it makes.
> >
> 
> Actually I always do that. It came out clean. If you see something wrong
> with the coding style please let me know.

There are a few places where a terminating ';' is preceded by an
unnecessary ' ' character.

Alan Stern


  reply	other threads:[~2011-01-31 15:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-27 13:11 Tatyana Brokhman
2011-01-27 16:27 ` Alan Stern
2011-01-31 15:09   ` Tanya Brokhman
2011-01-31 15:41     ` Alan Stern [this message]
2011-01-31 16:33       ` Tanya Brokhman
2011-02-10 13:01   ` Tanya Brokhman
2011-02-10 15:13     ` Alan Stern

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=Pine.LNX.4.44L0.1101311036220.1931-100000@iolanthe.rowland.org \
    --to=stern@rowland.harvard.edu \
    --cc=gregkh@suse.de \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=tlinder@codeaurora.org \
    --subject='RE: [PATCH v7 1/5] usb: Adding SuperSpeed support to dummy_hcd' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).