diff options
author | Nico Erfurth <ne@erfurth.eu> | 2011-11-08 02:30:40 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-11-08 12:37:07 -0500 |
commit | ea1649dea95fb270af94f75e842402c4cfbfc15f (patch) | |
tree | 89ae265b530926e13d6ea26bf34e5a03544c4d93 /drivers/net/usb/smsc75xx.c | |
parent | c457338d7acd3823e765b684a62294cfda9d2f55 (diff) |
Fix incorrect usage of NET_IP_ALIGN
The driver used NET_IP_ALIGN to remove some additional padding inside of
the rx_fixup function. On many architectures NET_IP_ALIGN defaults to 2
which removed the correct amount of bytes.
On MCORE2-machines commit ea812ca1b06113597adcd8e70c0f84a413d97544
introduces a change which sets NET_IP_ALIGN to 0 by default. Which
triggered the bug on these machines.
This fix introduces a new RXW_PADDING define and uses this instead of
NET_IP_ALIGN. The name was taken from the original SMSC7500 driver which
is provided by SMSC.
Signed-off-by: Nico Erfurth <ne@erfurth.eu>
Tested-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb/smsc75xx.c')
-rw-r--r-- | drivers/net/usb/smsc75xx.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index 22a7cf951e72..a5b9b12ef268 100644 --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #define USB_VENDOR_ID_SMSC (0x0424) | 51 | #define USB_VENDOR_ID_SMSC (0x0424) |
52 | #define USB_PRODUCT_ID_LAN7500 (0x7500) | 52 | #define USB_PRODUCT_ID_LAN7500 (0x7500) |
53 | #define USB_PRODUCT_ID_LAN7505 (0x7505) | 53 | #define USB_PRODUCT_ID_LAN7505 (0x7505) |
54 | #define RXW_PADDING 2 | ||
54 | 55 | ||
55 | #define check_warn(ret, fmt, args...) \ | 56 | #define check_warn(ret, fmt, args...) \ |
56 | ({ if (ret < 0) netdev_warn(dev->net, fmt, ##args); }) | 57 | ({ if (ret < 0) netdev_warn(dev->net, fmt, ##args); }) |
@@ -1088,13 +1089,13 @@ static int smsc75xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
1088 | 1089 | ||
1089 | memcpy(&rx_cmd_b, skb->data, sizeof(rx_cmd_b)); | 1090 | memcpy(&rx_cmd_b, skb->data, sizeof(rx_cmd_b)); |
1090 | le32_to_cpus(&rx_cmd_b); | 1091 | le32_to_cpus(&rx_cmd_b); |
1091 | skb_pull(skb, 4 + NET_IP_ALIGN); | 1092 | skb_pull(skb, 4 + RXW_PADDING); |
1092 | 1093 | ||
1093 | packet = skb->data; | 1094 | packet = skb->data; |
1094 | 1095 | ||
1095 | /* get the packet length */ | 1096 | /* get the packet length */ |
1096 | size = (rx_cmd_a & RX_CMD_A_LEN) - NET_IP_ALIGN; | 1097 | size = (rx_cmd_a & RX_CMD_A_LEN) - RXW_PADDING; |
1097 | align_count = (4 - ((size + NET_IP_ALIGN) % 4)) % 4; | 1098 | align_count = (4 - ((size + RXW_PADDING) % 4)) % 4; |
1098 | 1099 | ||
1099 | if (unlikely(rx_cmd_a & RX_CMD_A_RED)) { | 1100 | if (unlikely(rx_cmd_a & RX_CMD_A_RED)) { |
1100 | netif_dbg(dev, rx_err, dev->net, | 1101 | netif_dbg(dev, rx_err, dev->net, |