All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] NET: usb: Adding URB_ZERO_PACKET flag to usbnet.c
@ 2010-04-07  0:23 Elina Pasheva
  2010-04-07  2:50 ` David Miller
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Elina Pasheva @ 2010-04-07  0:23 UTC (permalink / raw)
  To: dbrownell; +Cc: epasheva, rfiler, netdev, linux-usb

Subject: [PATCH 1/1] NET: usb: Adding URB_ZERO_PACKET flag to usbnet.c
From: Elina Pasheva <epasheva@sierrawireless.com>
This patch adds setting of the urb transfer flag URB_ZERO_PACKET  before
submitting an urb for drivers that have requested it (by advertising flag
FLAG_SEND_ZLP).
The modification is in usbnet.c function usbnet_start_xmit().
This patch only adds the zero length flag.
A subsequent patch will address the buggy code we found when devices do not
advertise FLAG_SEND_ZLP in which case there is a possibility of transferring
packets with non-deterministic length.

This patch has been tested on kernel-2.6.34-rc3.
This patch has been checked against net-2.6 tree.
Signed-off-by: Elina Pasheva <epasheva@sierrawireless.com>
Signed-off-by: Rory Filer <rfiler@sierrawireless.com>
---

 drivers/net/usb/usbnet.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

--- a/drivers/net/usb/usbnet.c	2010-04-06 10:52:54.000000000 -0700
+++ b/drivers/net/usb/usbnet.c	2010-04-06 16:54:44.000000000 -0700
@@ -1068,12 +1068,15 @@ netdev_tx_t usbnet_start_xmit (struct sk
 	 * NOTE:  strictly conforming cdc-ether devices should expect
 	 * the ZLP here, but ignore the one-byte packet.
 	 */
-	if (!(info->flags & FLAG_SEND_ZLP) && (length % dev->maxpacket) == 0) {
-		urb->transfer_buffer_length++;
-		if (skb_tailroom(skb)) {
-			skb->data[skb->len] = 0;
-			__skb_put(skb, 1);
-		}
+	if (length % dev->maxpacket == 0) {
+		if (!(info->flags & FLAG_SEND_ZLP)) {
+			urb->transfer_buffer_length++;
+			if (skb_tailroom(skb)) {
+				skb->data[skb->len] = 0;
+				__skb_put(skb, 1);
+			}
+		} else
+			urb->transfer_flags |= URB_ZERO_PACKET;
 	}
 
 	spin_lock_irqsave(&dev->txq.lock, flags);




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] NET: usb: Adding URB_ZERO_PACKET flag to usbnet.c
  2010-04-07  0:23 [PATCH 1/1] NET: usb: Adding URB_ZERO_PACKET flag to usbnet.c Elina Pasheva
@ 2010-04-07  2:50 ` David Miller
  2010-04-07  5:46 ` Maulik
  2010-04-07 21:14 ` David Brownell
  2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2010-04-07  2:50 UTC (permalink / raw)
  To: epasheva; +Cc: dbrownell, rfiler, netdev, linux-usb

From: Elina Pasheva <epasheva@sierrawireless.com>
Date: Tue, 6 Apr 2010 17:23:07 -0700

> Subject: [PATCH 1/1] NET: usb: Adding URB_ZERO_PACKET flag to usbnet.c
> From: Elina Pasheva <epasheva@sierrawireless.com>
> This patch adds setting of the urb transfer flag URB_ZERO_PACKET  before
> submitting an urb for drivers that have requested it (by advertising flag
> FLAG_SEND_ZLP).
> The modification is in usbnet.c function usbnet_start_xmit().
> This patch only adds the zero length flag.
> A subsequent patch will address the buggy code we found when devices do not
> advertise FLAG_SEND_ZLP in which case there is a possibility of transferring
> packets with non-deterministic length.
> 
> This patch has been tested on kernel-2.6.34-rc3.
> This patch has been checked against net-2.6 tree.
> Signed-off-by: Elina Pasheva <epasheva@sierrawireless.com>
> Signed-off-by: Rory Filer <rfiler@sierrawireless.com>

Applied to net-next-2.6, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 1/1] NET: usb: Adding URB_ZERO_PACKET flag to usbnet.c
  2010-04-07  0:23 [PATCH 1/1] NET: usb: Adding URB_ZERO_PACKET flag to usbnet.c Elina Pasheva
  2010-04-07  2:50 ` David Miller
@ 2010-04-07  5:46 ` Maulik
       [not found]   ` <002801cad615$a352f2a0$808918ac-wD+IZp/g4/2mHdYHvhjUOg@public.gmane.org>
  2010-04-07 21:14 ` David Brownell
  2 siblings, 1 reply; 6+ messages in thread
From: Maulik @ 2010-04-07  5:46 UTC (permalink / raw)
  To: 'Elina Pasheva', dbrownell; +Cc: rfiler, netdev, linux-usb



> -----Original Message-----
> From: linux-usb-owner@vger.kernel.org [mailto:linux-usb-
> owner@vger.kernel.org] On Behalf Of Elina Pasheva
> Sent: Wednesday, April 07, 2010 5:53 AM
> To: dbrownell@users.sourceforge.net
> Cc: epasheva@sierrawireless.com; rfiler@sierrawireless.com;
> netdev@vger.kernel.org; linux-usb@vger.kernel.org
> Subject: [PATCH 1/1] NET: usb: Adding URB_ZERO_PACKET flag to usbnet.c
> 
> Subject: [PATCH 1/1] NET: usb: Adding URB_ZERO_PACKET flag to usbnet.c
> From: Elina Pasheva <epasheva@sierrawireless.com>
> This patch adds setting of the urb transfer flag URB_ZERO_PACKET  before
> submitting an urb for drivers that have requested it (by advertising flag
> FLAG_SEND_ZLP).
> The modification is in usbnet.c function usbnet_start_xmit().
> This patch only adds the zero length flag.
> A subsequent patch will address the buggy code we found when devices do
> not
> advertise FLAG_SEND_ZLP in which case there is a possibility of
> transferring
> packets with non-deterministic length.
> 
> This patch has been tested on kernel-2.6.34-rc3.
> This patch has been checked against net-2.6 tree.
> Signed-off-by: Elina Pasheva <epasheva@sierrawireless.com>
> Signed-off-by: Rory Filer <rfiler@sierrawireless.com>
> ---
> 
>  drivers/net/usb/usbnet.c |   15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> --- a/drivers/net/usb/usbnet.c	2010-04-06 10:52:54.000000000 -0700
> +++ b/drivers/net/usb/usbnet.c	2010-04-06 16:54:44.000000000 -0700
> @@ -1068,12 +1068,15 @@ netdev_tx_t usbnet_start_xmit (struct sk
>  	 * NOTE:  strictly conforming cdc-ether devices should expect
>  	 * the ZLP here, but ignore the one-byte packet.
>  	 */
> -	if (!(info->flags & FLAG_SEND_ZLP) && (length % dev->maxpacket) ==
> 0) {
> -		urb->transfer_buffer_length++;
> -		if (skb_tailroom(skb)) {
> -			skb->data[skb->len] = 0;
> -			__skb_put(skb, 1);
> -		}
> +	if (length % dev->maxpacket == 0) {
> +		if (!(info->flags & FLAG_SEND_ZLP)) {
> +			urb->transfer_buffer_length++;
> +			if (skb_tailroom(skb)) {
> +				skb->data[skb->len] = 0;
> +				__skb_put(skb, 1);
> +			}
> +		} else
> +			urb->transfer_flags |= URB_ZERO_PACKET;

You should place braces for the else case as well. See
Documentation/CodingStyle.

It states to use braces in both the branches since the if() case 
contains multiple statements. 

Maulik


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 1/1] NET: usb: Adding URB_ZERO_PACKET flag to usbnet.c
       [not found]   ` <002801cad615$a352f2a0$808918ac-wD+IZp/g4/2mHdYHvhjUOg@public.gmane.org>
@ 2010-04-07 21:13     ` Elina Pasheva
  0 siblings, 0 replies; 6+ messages in thread
From: Elina Pasheva @ 2010-04-07 21:13 UTC (permalink / raw)
  To: Maulik
  Cc: dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f, Rory Filer,
	netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA

On Tue, 2010-04-06 at 22:46 -0700, Maulik wrote:
> 
> > -----Original Message-----
> > From: linux-usb-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [mailto:linux-usb-
> > owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] On Behalf Of Elina Pasheva
> > Sent: Wednesday, April 07, 2010 5:53 AM
> > To: dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> > Cc: epasheva-ywE8TTl5eJHWpu6QEFMNjNBPR1lH4CV8@public.gmane.org; rfiler-ywE8TTl5eJHWpu6QEFMNjNBPR1lH4CV8@public.gmane.org;
> > netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> > Subject: [PATCH 1/1] NET: usb: Adding URB_ZERO_PACKET flag to usbnet.c
> > 
> > Subject: [PATCH 1/1] NET: usb: Adding URB_ZERO_PACKET flag to usbnet.c
> > From: Elina Pasheva <epasheva-ywE8TTl5eJHWpu6QEFMNjNBPR1lH4CV8@public.gmane.org>
> > This patch adds setting of the urb transfer flag URB_ZERO_PACKET  before
> > submitting an urb for drivers that have requested it (by advertising flag
> > FLAG_SEND_ZLP).
> > The modification is in usbnet.c function usbnet_start_xmit().
> > This patch only adds the zero length flag.
> > A subsequent patch will address the buggy code we found when devices do
> > not
> > advertise FLAG_SEND_ZLP in which case there is a possibility of
> > transferring
> > packets with non-deterministic length.
> > 
> > This patch has been tested on kernel-2.6.34-rc3.
> > This patch has been checked against net-2.6 tree.
> > Signed-off-by: Elina Pasheva <epasheva-ywE8TTl5eJHWpu6QEFMNjNBPR1lH4CV8@public.gmane.org>
> > Signed-off-by: Rory Filer <rfiler-ywE8TTl5eJHWpu6QEFMNjNBPR1lH4CV8@public.gmane.org>
> > ---
> > 
> >  drivers/net/usb/usbnet.c |   15 +++++++++------
> >  1 file changed, 9 insertions(+), 6 deletions(-)
> > 
> > --- a/drivers/net/usb/usbnet.c	2010-04-06 10:52:54.000000000 -0700
> > +++ b/drivers/net/usb/usbnet.c	2010-04-06 16:54:44.000000000 -0700
> > @@ -1068,12 +1068,15 @@ netdev_tx_t usbnet_start_xmit (struct sk
> >  	 * NOTE:  strictly conforming cdc-ether devices should expect
> >  	 * the ZLP here, but ignore the one-byte packet.
> >  	 */
> > -	if (!(info->flags & FLAG_SEND_ZLP) && (length % dev->maxpacket) ==
> > 0) {
> > -		urb->transfer_buffer_length++;
> > -		if (skb_tailroom(skb)) {
> > -			skb->data[skb->len] = 0;
> > -			__skb_put(skb, 1);
> > -		}
> > +	if (length % dev->maxpacket == 0) {
> > +		if (!(info->flags & FLAG_SEND_ZLP)) {
> > +			urb->transfer_buffer_length++;
> > +			if (skb_tailroom(skb)) {
> > +				skb->data[skb->len] = 0;
> > +				__skb_put(skb, 1);
> > +			}
> > +		} else
> > +			urb->transfer_flags |= URB_ZERO_PACKET;
> 
> You should place braces for the else case as well. See
> Documentation/CodingStyle.
> 
> It states to use braces in both the branches since the if() case 
> contains multiple statements. 
> 
> Maulik

Thanks for your review.
The patch has been applied. 
We'll look at it next time.

Elina

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] NET: usb: Adding URB_ZERO_PACKET flag to usbnet.c
  2010-04-07  0:23 [PATCH 1/1] NET: usb: Adding URB_ZERO_PACKET flag to usbnet.c Elina Pasheva
  2010-04-07  2:50 ` David Miller
  2010-04-07  5:46 ` Maulik
@ 2010-04-07 21:14 ` David Brownell
       [not found]   ` <201004071414.33917.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
  2 siblings, 1 reply; 6+ messages in thread
From: David Brownell @ 2010-04-07 21:14 UTC (permalink / raw)
  To: Elina Pasheva
  Cc: rfiler-ywE8TTl5eJHWpu6QEFMNjNBPR1lH4CV8,
	netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	David Miller

On Tuesday 06 April 2010, you wrote:
Recall that the reason to avoid sending zero length packts
(ZLPs) is that many systems don't cope well with them...

The ""don't cope well" can be at the hardware level,
or drivers not limited to device firmware.  I've seen
the failures be very context-dependent .... as in, one
standalone ZLP might work, but mix it in with back-to-back
delivery of other packets and trouble ensues...
  
In short, it's hard to know which combinations of
hardware an firmware would need it .... versus which
ones it would break.

... and thus risky to try sending ZLPs through systems
shere for many years) we've carefully avoided doing that.


- Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] NET: usb: Adding URB_ZERO_PACKET flag to usbnet.c
       [not found]   ` <201004071414.33917.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
@ 2010-04-07 23:07     ` Elina Pasheva
  0 siblings, 0 replies; 6+ messages in thread
From: Elina Pasheva @ 2010-04-07 23:07 UTC (permalink / raw)
  To: David Brownell
  Cc: Rory Filer, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, David Miller

On Wed, 2010-04-07 at 14:14 -0700, David Brownell wrote:
> On Tuesday 06 April 2010, you wrote:
> Recall that the reason to avoid sending zero length packts
> (ZLPs) is that many systems don't cope well with them...
> 
> The ""don't cope well" can be at the hardware level,
> or drivers not limited to device firmware.  I've seen
> the failures be very context-dependent .... as in, one
> standalone ZLP might work, but mix it in with back-to-back
> delivery of other packets and trouble ensues...
>   
> In short, it's hard to know which combinations of
> hardware an firmware would need it .... versus which
> ones it would break.
> 
> ... and thus risky to try sending ZLPs through systems
> shere for many years) we've carefully avoided doing that.
> 
> 
> - Dave
> 
Hi Dave, 
Nice to hear your opinion on this matter. Are you recommending our patch
be retracted? If so, we can look at other ways to fix the problem when a
zero length packet is missing. 

Regards, 
Elina


 

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-04-07 23:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-07  0:23 [PATCH 1/1] NET: usb: Adding URB_ZERO_PACKET flag to usbnet.c Elina Pasheva
2010-04-07  2:50 ` David Miller
2010-04-07  5:46 ` Maulik
     [not found]   ` <002801cad615$a352f2a0$808918ac-wD+IZp/g4/2mHdYHvhjUOg@public.gmane.org>
2010-04-07 21:13     ` Elina Pasheva
2010-04-07 21:14 ` David Brownell
     [not found]   ` <201004071414.33917.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2010-04-07 23:07     ` Elina Pasheva

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.