All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 net] smsc95xx: Support only IPv4 TCP/UDP csum offload
@ 2017-05-19 14:00 Nisar.Sayed
  2017-05-21 17:32 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Nisar.Sayed @ 2017-05-19 14:00 UTC (permalink / raw)
  To: netdev, davem; +Cc: UNGLinuxDriver, steve.glendinning, popcornmix

From: Nisar Sayed <Nisar.Sayed@microchip.com>

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>
---
Changes
V2
- Updated e-mail alias
- Updated commit message and comments

 drivers/net/usb/smsc95xx.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 765400b..2dfca96 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,
 	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_;
@@ -1279,12 +1279,19 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf)
 
 	spin_lock_init(&pdata->mac_cr_lock);
 
+	/* LAN95xx devices do not alter the computed checksum of 0 to 0xffff.
+	 * RFC 2460, ipv6 UDP calculated checksum yields a result of zero must
+	 * be changed to 0xffff. RFC 768, ipv4 UDP computed checksum is zero,
+	 * it is transmitted as all ones. The zero transmitted checksum means
+	 * transmitter generated no checksum. Hence, enable csum offload only
+	 * for ipv4 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);
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 net] smsc95xx: Support only IPv4 TCP/UDP csum offload
  2017-05-19 14:00 [PATCH v2 net] smsc95xx: Support only IPv4 TCP/UDP csum offload Nisar.Sayed
@ 2017-05-21 17:32 ` David Miller
  2017-05-23 12:06   ` Nisar.Sayed
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2017-05-21 17:32 UTC (permalink / raw)
  To: Nisar.Sayed; +Cc: netdev, UNGLinuxDriver, steve.glendinning, popcornmix

From: <Nisar.Sayed@microchip.com>
Date: Fri, 19 May 2017 14:00:25 +0000

> From: Nisar Sayed <Nisar.Sayed@microchip.com>
> 
> 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>

Appied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH v2 net] smsc95xx: Support only IPv4 TCP/UDP csum offload
  2017-05-21 17:32 ` David Miller
@ 2017-05-23 12:06   ` Nisar.Sayed
  0 siblings, 0 replies; 3+ messages in thread
From: Nisar.Sayed @ 2017-05-23 12:06 UTC (permalink / raw)
  To: davem; +Cc: netdev, UNGLinuxDriver, steve.glendinning, popcornmix

> > 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>
> 
> Appied, thanks.

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-23 12:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-19 14:00 [PATCH v2 net] smsc95xx: Support only IPv4 TCP/UDP csum offload Nisar.Sayed
2017-05-21 17:32 ` David Miller
2017-05-23 12:06   ` Nisar.Sayed

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.