diff options
author | Ingo van Lil <inguin@gmx.de> | 2012-04-23 18:05:38 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-05-21 12:39:59 -0400 |
commit | 5d34eea4758c4946c171bd29a835a0e9a4bcb7ab (patch) | |
tree | 76975f76f9406dc3fbaf735232ab9c304f8aef0f /drivers/net | |
parent | 78d09e08e97051b3824dca8aa5ceaf15d1295ba2 (diff) |
asix: Fix tx transfer padding for full-speed USB
[ Upstream commit 2a5809499e35b53a6044fd34e72b242688b7a862 ]
The asix.c USB Ethernet driver avoids ending a tx transfer with a zero-
length packet by appending a four-byte padding to transfers whose length
is a multiple of maxpacket. However, the hard-coded 512 byte maxpacket
length is valid for high-speed USB only; full-speed USB uses 64 byte
packets.
Signed-off-by: Ingo van Lil <inguin@gmx.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/usb/asix.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index 3e33573a249..c44e0e489ba 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c | |||
@@ -398,7 +398,7 @@ static struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb, | |||
398 | u32 packet_len; | 398 | u32 packet_len; |
399 | u32 padbytes = 0xffff0000; | 399 | u32 padbytes = 0xffff0000; |
400 | 400 | ||
401 | padlen = ((skb->len + 4) % 512) ? 0 : 4; | 401 | padlen = ((skb->len + 4) & (dev->maxpacket - 1)) ? 0 : 4; |
402 | 402 | ||
403 | if ((!skb_cloned(skb)) && | 403 | if ((!skb_cloned(skb)) && |
404 | ((headroom + tailroom) >= (4 + padlen))) { | 404 | ((headroom + tailroom) >= (4 + padlen))) { |
@@ -420,7 +420,7 @@ static struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb, | |||
420 | cpu_to_le32s(&packet_len); | 420 | cpu_to_le32s(&packet_len); |
421 | skb_copy_to_linear_data(skb, &packet_len, sizeof(packet_len)); | 421 | skb_copy_to_linear_data(skb, &packet_len, sizeof(packet_len)); |
422 | 422 | ||
423 | if ((skb->len % 512) == 0) { | 423 | if (padlen) { |
424 | cpu_to_le32s(&padbytes); | 424 | cpu_to_le32s(&padbytes); |
425 | memcpy(skb_tail_pointer(skb), &padbytes, sizeof(padbytes)); | 425 | memcpy(skb_tail_pointer(skb), &padbytes, sizeof(padbytes)); |
426 | skb_put(skb, sizeof(padbytes)); | 426 | skb_put(skb, sizeof(padbytes)); |