aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNisar Sayed <Nisar.Sayed@microchip.com>2017-05-19 10:00:25 -0400
committerDavid S. Miller <davem@davemloft.net>2017-05-21 13:31:48 -0400
commitfe0cd8ca1b82983db24b173bb8518ea646c02d25 (patch)
tree201cc3af146bf9787c003b72f2652426f3809a3a
parent776ee323ddf1167435f2cae0d7f8a6955383b5aa (diff)
smsc95xx: Support only IPv4 TCP/UDP csum offload
When TX checksum offload is used, if the computed checksum is 0 the LAN95xx device do not alter the checksum to 0xffff. In the case of ipv4 UDP checksum, it indicates to receiver that no checksum is calculated. Under ipv6, UDP checksum yields a result of zero must be changed to 0xffff. Hence disabling checksum offload for ipv6 packets. Signed-off-by: Nisar Sayed <Nisar.Sayed@microchip.com> Reported-by: popcorn mix <popcornmix@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/usb/smsc95xx.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 765400b62168..2dfca96a63b6 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -681,7 +681,7 @@ static int smsc95xx_set_features(struct net_device *netdev,
681 if (ret < 0) 681 if (ret < 0)
682 return ret; 682 return ret;
683 683
684 if (features & NETIF_F_HW_CSUM) 684 if (features & NETIF_F_IP_CSUM)
685 read_buf |= Tx_COE_EN_; 685 read_buf |= Tx_COE_EN_;
686 else 686 else
687 read_buf &= ~Tx_COE_EN_; 687 read_buf &= ~Tx_COE_EN_;
@@ -1279,12 +1279,19 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf)
1279 1279
1280 spin_lock_init(&pdata->mac_cr_lock); 1280 spin_lock_init(&pdata->mac_cr_lock);
1281 1281
1282 /* LAN95xx devices do not alter the computed checksum of 0 to 0xffff.
1283 * RFC 2460, ipv6 UDP calculated checksum yields a result of zero must
1284 * be changed to 0xffff. RFC 768, ipv4 UDP computed checksum is zero,
1285 * it is transmitted as all ones. The zero transmitted checksum means
1286 * transmitter generated no checksum. Hence, enable csum offload only
1287 * for ipv4 packets.
1288 */
1282 if (DEFAULT_TX_CSUM_ENABLE) 1289 if (DEFAULT_TX_CSUM_ENABLE)
1283 dev->net->features |= NETIF_F_HW_CSUM; 1290 dev->net->features |= NETIF_F_IP_CSUM;
1284 if (DEFAULT_RX_CSUM_ENABLE) 1291 if (DEFAULT_RX_CSUM_ENABLE)
1285 dev->net->features |= NETIF_F_RXCSUM; 1292 dev->net->features |= NETIF_F_RXCSUM;
1286 1293
1287 dev->net->hw_features = NETIF_F_HW_CSUM | NETIF_F_RXCSUM; 1294 dev->net->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
1288 1295
1289 smsc95xx_init_mac_address(dev); 1296 smsc95xx_init_mac_address(dev);
1290 1297