Commit a9ad627e authored by Nisar Sayed's avatar Nisar Sayed Committed by popcornmix
Browse files

According to RFC 2460, IPv6 UDP calculated checksum yields a result


of zero must be changed to 0xffff, however this feature is not
supported by smsc95xx family hence enable csum offload only for
IPv4 TCP/UDP packets.

Signed-off-by: default avatarNisar Sayed <Nisar.Sayed@microchip.com>

Reported-by: default avatarpopcorn mix <popcornmix@gmail.com>
parent 8df0ea81
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -694,7 +694,7 @@ static int smsc95xx_set_features(struct net_device *netdev,
	if (ret < 0)
		return ret;

	if (features & NETIF_F_HW_CSUM)
	if (features & NETIF_F_IP_CSUM)
		read_buf |= Tx_COE_EN_;
	else
		read_buf &= ~Tx_COE_EN_;
@@ -1342,12 +1342,16 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf)

	spin_lock_init(&pdata->mac_cr_lock);

	/* RFC 2460, IPv6 UDP calculated checksum yields a result of zero must be
	 * changed to 0xffff, this feature is not supported by smsc95xx family,
	 * hence enable csum offload only for IPv4 TCP/UDP packets.
	 */
	if (DEFAULT_TX_CSUM_ENABLE)
		dev->net->features |= NETIF_F_HW_CSUM;
		dev->net->features |= NETIF_F_IP_CSUM;
	if (DEFAULT_RX_CSUM_ENABLE)
		dev->net->features |= NETIF_F_RXCSUM;

	dev->net->hw_features = NETIF_F_HW_CSUM | NETIF_F_RXCSUM;
	dev->net->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM;

	smsc95xx_init_mac_address(dev);