|
|
@@ -1346,9 +1346,19 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
|
|
|
} else
|
|
|
urb->transfer_flags |= URB_ZERO_PACKET;
|
|
|
}
|
|
|
- entry->length = urb->transfer_buffer_length = length;
|
|
|
- if (!(info->flags & FLAG_MULTI_PACKET))
|
|
|
- usbnet_set_skb_tx_stats(skb, 1);
|
|
|
+ urb->transfer_buffer_length = length;
|
|
|
+
|
|
|
+ if (info->flags & FLAG_MULTI_PACKET) {
|
|
|
+ /* Driver has set number of packets and a length delta.
|
|
|
+ * Calculate the complete length and ensure that it's
|
|
|
+ * positive.
|
|
|
+ */
|
|
|
+ entry->length += length;
|
|
|
+ if (WARN_ON_ONCE(entry->length <= 0))
|
|
|
+ entry->length = length;
|
|
|
+ } else {
|
|
|
+ usbnet_set_skb_tx_stats(skb, 1, length);
|
|
|
+ }
|
|
|
|
|
|
spin_lock_irqsave(&dev->txq.lock, flags);
|
|
|
retval = usb_autopm_get_interface_async(dev->intf);
|