Commit 2a5809499e35b53a6044fd34e72b242688b7a862

Authored by Ingo van Lil
Committed by David S. Miller
1 parent 1ab8be4a14

asix: Fix tx transfer padding for full-speed USB

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>

Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff

drivers/net/usb/asix.c
... ... @@ -355,7 +355,7 @@
355 355 u32 packet_len;
356 356 u32 padbytes = 0xffff0000;
357 357  
358   - padlen = ((skb->len + 4) % 512) ? 0 : 4;
  358 + padlen = ((skb->len + 4) & (dev->maxpacket - 1)) ? 0 : 4;
359 359  
360 360 if ((!skb_cloned(skb)) &&
361 361 ((headroom + tailroom) >= (4 + padlen))) {
... ... @@ -377,7 +377,7 @@
377 377 cpu_to_le32s(&packet_len);
378 378 skb_copy_to_linear_data(skb, &packet_len, sizeof(packet_len));
379 379  
380   - if ((skb->len % 512) == 0) {
  380 + if (padlen) {
381 381 cpu_to_le32s(&padbytes);
382 382 memcpy(skb_tail_pointer(skb), &padbytes, sizeof(padbytes));
383 383 skb_put(skb, sizeof(padbytes));