All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] smsc95xx: fix transmission where ZLP is expected
@ 2009-09-22 14:00 Steve Glendinning
  2009-09-22 21:19 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Steve Glendinning @ 2009-09-22 14:00 UTC (permalink / raw)
  To: netdev; +Cc: Ian Saturley, David Miller, Vlad Lyalikov, Steve Glendinning

Usbnet framework assumes USB hardware doesn't handle zero length
packets, but SMSC LAN95xx requires these to be sent for correct
operation.

This patch fixes an easily reproducible tx lockup when sending a frame
that results in exactly 512 bytes in a USB transmission (e.g. a UDP
frame with 458 data bytes, due to IP headers and our USB headers).  It
adds an extra flag to usbnet for the hardware driver to indicate that
it can handle and requires the zero length packets.

This patch should not affect other usbnet users, please also consider
for -stable.

Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com>
---
 drivers/net/usb/smsc95xx.c |    2 +-
 drivers/net/usb/usbnet.c   |    2 +-
 include/linux/usb/usbnet.h |    1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 938fb35..6e9410f 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -1227,7 +1227,7 @@ static const struct driver_info smsc95xx_info = {
 	.rx_fixup	= smsc95xx_rx_fixup,
 	.tx_fixup	= smsc95xx_tx_fixup,
 	.status		= smsc95xx_status,
-	.flags		= FLAG_ETHER,
+	.flags		= FLAG_ETHER | FLAG_SEND_ZLP,
 };
 
 static const struct usb_device_id products[] = {
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 24b36f7..ca5ca5a 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1049,7 +1049,7 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
 	 * NOTE:  strictly conforming cdc-ether devices should expect
 	 * the ZLP here, but ignore the one-byte packet.
 	 */
-	if ((length % dev->maxpacket) == 0) {
+	if (!(info->flags & FLAG_SEND_ZLP) && (length % dev->maxpacket) == 0) {
 		urb->transfer_buffer_length++;
 		if (skb_tailroom(skb)) {
 			skb->data[skb->len] = 0;
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index bb69e25..f814730 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -89,6 +89,7 @@ struct driver_info {
 #define FLAG_FRAMING_AX 0x0040		/* AX88772/178 packets */
 #define FLAG_WLAN	0x0080		/* use "wlan%d" names */
 #define FLAG_AVOID_UNLINK_URBS 0x0100	/* don't unlink urbs at usbnet_stop() */
+#define FLAG_SEND_ZLP	0x0200		/* hw requires ZLPs are sent */
 
 
 	/* init device ... can sleep, or cause probe() failure */
-- 
1.6.2.5


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

* Re: [PATCH] smsc95xx: fix transmission where ZLP is expected
  2009-09-22 14:00 [PATCH] smsc95xx: fix transmission where ZLP is expected Steve Glendinning
@ 2009-09-22 21:19 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-09-22 21:19 UTC (permalink / raw)
  To: steve.glendinning; +Cc: netdev, ian.saturley, vlad.lyalikov

From: Steve Glendinning <steve.glendinning@smsc.com>
Date: Tue, 22 Sep 2009 15:00:27 +0100

> Usbnet framework assumes USB hardware doesn't handle zero length
> packets, but SMSC LAN95xx requires these to be sent for correct
> operation.
> 
> This patch fixes an easily reproducible tx lockup when sending a frame
> that results in exactly 512 bytes in a USB transmission (e.g. a UDP
> frame with 458 data bytes, due to IP headers and our USB headers).  It
> adds an extra flag to usbnet for the hardware driver to indicate that
> it can handle and requires the zero length packets.
> 
> This patch should not affect other usbnet users, please also consider
> for -stable.
> 
> Signed-off-by: Steve Glendinning <steve.glendinning@smsc.com>

Applied, thanks.

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

end of thread, other threads:[~2009-09-22 21:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-22 14:00 [PATCH] smsc95xx: fix transmission where ZLP is expected Steve Glendinning
2009-09-22 21:19 ` David Miller

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.