Commit b4d562e3 authored by Elina Pasheva's avatar Elina Pasheva Committed by David S. Miller

NET: usb: Adding URB_ZERO_PACKET flag to usbnet.c

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: default avatarElina Pasheva <epasheva@sierrawireless.com>
Signed-off-by: default avatarRory Filer <rfiler@sierrawireless.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 17a328ca
...@@ -1068,12 +1068,15 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb, ...@@ -1068,12 +1068,15 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
* NOTE: strictly conforming cdc-ether devices should expect * NOTE: strictly conforming cdc-ether devices should expect
* the ZLP here, but ignore the one-byte packet. * the ZLP here, but ignore the one-byte packet.
*/ */
if (!(info->flags & FLAG_SEND_ZLP) && (length % dev->maxpacket) == 0) { if (length % dev->maxpacket == 0) {
urb->transfer_buffer_length++; if (!(info->flags & FLAG_SEND_ZLP)) {
if (skb_tailroom(skb)) { urb->transfer_buffer_length++;
skb->data[skb->len] = 0; if (skb_tailroom(skb)) {
__skb_put(skb, 1); skb->data[skb->len] = 0;
} __skb_put(skb, 1);
}
} else
urb->transfer_flags |= URB_ZERO_PACKET;
} }
spin_lock_irqsave(&dev->txq.lock, flags); spin_lock_irqsave(&dev->txq.lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment