netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dcbw@redhat.com>
To: Greg KH <greg@kroah.com>
Cc: Elina Pasheva <epasheva@sierrawireless.com>,
	dbrownell@users.sourceforge.net, davem@davemloft.net,
	rfiler@sierrawireless.com, linux-usb@vger.kernel.org,
	netdev@vger.kernel.org
Subject: Re: Subject: re-submit4 [ANNOUNCEMENT] NET: usb: sierra_net.c driver
Date: Thu, 22 Apr 2010 14:15:06 -0700	[thread overview]
Message-ID: <1271970906.26097.72.camel@localhost.localdomain> (raw)
In-Reply-To: <20100422194435.GA14544@kroah.com>

On Thu, 2010-04-22 at 12:44 -0700, Greg KH wrote:
> On Thu, Apr 22, 2010 at 12:19:33PM -0700, Elina Pasheva wrote:
> > +static void sierra_net_send_cmd(struct usbnet *dev,
> > +		u8 *cmd, int cmdlen, const char * cmd_name)
> > +{
> > +	struct sierra_net_data *priv = sierra_net_get_private(dev);
> > +	int  status;
> > +
> > +	status = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0),
> > +			USB_CDC_SEND_ENCAPSULATED_COMMAND,
> > +			USB_DIR_OUT|USB_TYPE_CLASS|USB_RECIP_INTERFACE,	0,
> > +			priv->ifnum, cmd, cmdlen, 0);
> 
> No timeout?
> 
> > +		ifnum = priv->ifnum;
> > +		len = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
> > +				USB_CDC_GET_ENCAPSULATED_RESPONSE,
> > +				USB_DIR_IN|USB_TYPE_CLASS|USB_RECIP_INTERFACE,
> > +				0, ifnum, buf, SIERRA_NET_USBCTL_BUF_LEN, 0);
> 
> No timeout?
> 
> > +		if (unlikely(len < 0)) {
> > +			netdev_err(dev->net,
> > +				"usb_control_msg failed, status %d\n", len);
> 
> You don't need "unlikely", this is an extreemly slow path here.
> Also, what happens for a "short read"?  You don't handle that properly.

Is the code doc for usb_unlink_urb() in urb.c the best thing to look at
for how to handle short reads?  I assume that involves checking if the
returned error is -EREMOTEIO and if so, ignoring it?  I spent about an
hour googling and poking around in the kernel sources and couldn't find
much about how to handle short reads.  The only non-host-side driver
that cares about EREMOTEIO is misc/rio500.c, the rest is all under host/
or gadget/.

In the 3 places that this driver calls usb_control_msg(), the codepaths
don't need any special -EREMOTEIO handling.

Dan


  reply	other threads:[~2010-04-22 21:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-22 19:19 Subject: re-submit4 [ANNOUNCEMENT] NET: usb: sierra_net.c driver Elina Pasheva
2010-04-22 19:44 ` Greg KH
2010-04-22 21:15   ` Dan Williams [this message]
2010-04-22 22:27     ` Greg KH
     [not found]       ` <20100422222723.GB3187-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2010-04-22 23:16         ` Elina Pasheva

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=1271970906.26097.72.camel@localhost.localdomain \
    --to=dcbw@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dbrownell@users.sourceforge.net \
    --cc=epasheva@sierrawireless.com \
    --cc=greg@kroah.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rfiler@sierrawireless.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;
as well as URLs for NNTP newsgroup(s).