ChangeSet 1.1006.11.21, 2003/03/25 14:30:45-08:00, greg@kroah.com

[PATCH] USB: fix up zero packet issues with CDCEther driver


 drivers/usb/CDCEther.c |   21 +++++----------------
 1 files changed, 5 insertions(+), 16 deletions(-)


diff -Nru a/drivers/usb/CDCEther.c b/drivers/usb/CDCEther.c
--- a/drivers/usb/CDCEther.c	Thu Mar 27 16:01:29 2003
+++ b/drivers/usb/CDCEther.c	Thu Mar 27 16:01:29 2003
@@ -306,22 +306,8 @@
 static int CDCEther_start_xmit( struct sk_buff *skb, struct net_device *net )
 {
 	ether_dev_t	*ether_dev = net->priv;
-	int 	count;
 	int 	res;
 
-	// If we are told to transmit an ethernet frame that fits EXACTLY 
-	// into an integer number of USB packets, we force it to send one 
-	// more byte so the device will get a runt USB packet signalling the 
-	// end of the ethernet frame
-	if ( skb->len % ether_dev->data_ep_out_size) {
-		// It was not an exact multiple
-		// no need to add anything extra
-		count = skb->len;
-	} else {
-		// Add one to make it NOT an exact multiple
-		count = skb->len + 1;
-	}
-
 	// Tell the kernel, "No more frames 'til we are done
 	// with this one.'
 	netif_stop_queue( net );
@@ -336,8 +322,11 @@
 			write_bulk_callback, ether_dev );
 
 	// Tell the URB how much it will be transporting today
-	ether_dev->tx_urb.transfer_buffer_length = count;
-	
+	ether_dev->tx_urb.transfer_buffer_length = skb->len;
+
+	/* Deal with the Zero Length packet problem, I hope */
+	ether_dev->tx_urb.transfer_flags |= USB_ZERO_PACKET;
+
 	// Send the URB on its merry way.
 	if ((res = usb_submit_urb(&ether_dev->tx_urb)))  {
 		// Hmm...  It didn't go. Tell someone...
