Skip to contentSkip to conversation

front: Fix features on resume when csum is off

NET Herbert Xu 2 participants 4 messages Aug 16, 2006

lore
Share & tools
lore

Herbert Xu

author
#0 lore raw

Hi Keir:

[NET] front: Fix features on resume when csum is off

When the netfront driver is resumed the features are renegotiated with the backend. However, I forgot take into account the status of the TX checksum setting. When TX checksum is disabled by the user, we cannot enable SG or TSO since both require checksum offload. This patch makes xennet check the checksum setting before renegotiating SG or TSO.

This bug was fixed thanks to a report from Anton Burtsev.

Cheers,

Signature · 18 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
diff -r ec03b24a2d83 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Tue Aug 15 19:53:55 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Wed Aug 16 11:07:11 2006 +1000
@@ -1369,6 +1369,9 @@ static void xennet_set_features(struct n
 	dev->features |= NETIF_F_GSO_ROBUST;
 	xennet_set_sg(dev, 0);
 
+	if (!(dev->features & NETIF_F_IP_CSUM))
+		return;
+
 	if (!xennet_set_sg(dev, 1))
 		xennet_set_tso(dev, 1);
 }
#1 lore raw
Quoted 7 lines · Herbert Xu

[NET] front: Fix features on resume when csum is off

When the netfront driver is resumed the features are renegotiated with the backend. However, I forgot take into account the status of the TX checksum setting. When TX checksum is disabled by the user, we cannot enable SG or TSO since both require checksum offload. This patch makes xennet check the checksum setting before renegotiating SG or TSO.

This seems a bit odd. Shouldn't it be up to the network stack to not use SG/TSO if it can't use them with a non-checksumming interface? What is the failure mode currently?

-- Keir

author
#2 lore raw
Quoted 4 lines · Keir Fraser

This seems a bit odd. Shouldn't it be up to the network stack to not use SG/TSO if it can't use them with a non-checksumming interface? What is the failure mode currently?

As it is it's the partly the responsibility of the drivers to maintain the consistency of the features set. The network stack assists this task by turning off SG/TSO when TX checksum is turned off through ethtool. It also ensures that when the user tries to enable SG/TSO that TX checksum must be enabled.

In this case, SG/TSO is being turned on by the driver (as opposed to the user) so the driver needs to ensure that TX checksum is supported.

Cheers,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
author
#3 lore raw
Quoted 5 lines · herbert
Quoted 4 lines · Keir Fraser

This seems a bit odd. Shouldn't it be up to the network stack to not use SG/TSO if it can't use them with a non-checksumming interface? What is the failure mode currently?

I forgot to answer the second part of your question :)

1) Turn off TX checksum with ethtool in domU.
2) Suspend domU.
3) Resume domU.

If you run ethtool now you'll see that TX checksum is off while SG/TSO is on. If you send anything out bigger than one MTU through TCP it'll get dropped.

Cheers,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt