summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/rt2x00/rt2x00usb.c
diff options
context:
space:
mode:
authorJakub KiciƄski <kubakici@wp.pl>2011-12-28 01:53:22 +0100
committerJohn W. Linville <linville@tuxdriver.com>2012-01-04 14:31:46 -0500
commitd823a50e55fade0eda3708b00dbf49c5476c82e2 (patch)
tree3c759f414cc6dbfa6b7ede2f095d7ac2a5c877d0 /drivers/net/wireless/rt2x00/rt2x00usb.c
parent4bcafac8c64e015775fcb844f643c2c70115bf46 (diff)
rt2x00usb: Zero USB padding before sending URB
When USB driver requires padding at the end of frame or URB it will report this need by increasing return value of get_tx_data_len callback. Common USB code uses that return value as desired URB length. Ensure that appropriate part of skb's tailroom exists and is zeroed. Signed-off-by: Jakub Kicinski <kubakici@wp.pl> Acked-by: Ivo van Doorn <IvDoorn@gmail.com> -- drivers/net/wireless/rt2x00/rt2x00usb.c | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00usb.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 1e31050dafc9..2eea3866504d 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -298,12 +298,22 @@ static bool rt2x00usb_kick_tx_entry(struct queue_entry *entry, void* data)
return false;
/*
- * USB devices cannot blindly pass the skb->len as the
- * length of the data to usb_fill_bulk_urb. Pass the skb
- * to the driver to determine what the length should be.
+ * USB devices require certain padding at the end of each frame
+ * and urb. Those paddings are not included in skbs. Pass entry
+ * to the driver to determine what the overall length should be.
*/
length = rt2x00dev->ops->lib->get_tx_data_len(entry);
+ status = skb_padto(entry->skb, length);
+ if (unlikely(status)) {
+ /* TODO: report something more appropriate than IO_FAILED. */
+ WARNING(rt2x00dev, "TX SKB padding error, out of memory\n");
+ set_bit(ENTRY_DATA_IO_FAILED, &entry->flags);
+ rt2x00lib_dmadone(entry);
+
+ return false;
+ }
+
usb_fill_bulk_urb(entry_priv->urb, usb_dev,
usb_sndbulkpipe(usb_dev, entry->queue->usb_endpoint),
entry->skb->data, length,