Skip to contentSkip to conversation

net: Disable all TSO features when SG is disabled

PATCH Applied Ben Hutchings 2 participants 4 messages Apr 13, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 net: Disable all TSO features when SG is disabled

The feature flags NETIF_F_TSO and NETIF_F_TSO6 independently enable TSO for IPv4 and IPv6 respectively. However, the test in netdev_fix_features() and its predecessor functions was never updated to check for NETIF_F_TSO6, possibly because it was originally proposed that TSO for IPv6 would be dependent on both feature flags.

Now that these feature flags can be changed independently from user-space and we depend on netdev_fix_features() to fix invalid feature combinations, it's important to disable them both if scatter-gather is disabled. Also disable NETIF_F_TSO_ECN so user-space sees all TSO features as disabled.

---
 net/core/dev.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
net/core/dev.c +3 -3
index 956d3b0..6401fb5 100644
@@ -5203,9 +5203,9 @@ u32 netdev_fix_features(struct net_device *dev, u32 features)
 	}
 
 	/* TSO requires that SG is present as well. */
-	if ((features & NETIF_F_TSO) && !(features & NETIF_F_SG)) {
-		netdev_info(dev, "Dropping NETIF_F_TSO since no SG feature.\n");
-		features &= ~NETIF_F_TSO;
+	if ((features & NETIF_F_ALL_TSO) && !(features & NETIF_F_SG)) {
+		netdev_info(dev, "Dropping TSO features since no SG feature.\n");
+		features &= ~NETIF_F_ALL_TSO;
 	}
 
 	/* Software GSO depends on SG. */
Signature · 8 lines
1.7.4



-- 
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
#1 lore raw

PATCH 2/2 net: Disable NETIF_F_TSO_ECN when TSO is disabled

NETIF_F_TSO_ECN has no effect when TSO is disabled; this just means that feature state will be accurately reported to user-space.

---
This one is silent; I'm not sure that it's worth mentioning as the feature flag previously had no effect on its own anyway.

Ben.

 net/core/dev.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
net/core/dev.c +4 -0
index 6401fb5..c2ac599 100644
@@ -5208,6 +5208,10 @@ u32 netdev_fix_features(struct net_device *dev, u32 features)
 		features &= ~NETIF_F_ALL_TSO;
 	}
 
+	/* TSO ECN requires that TSO is present as well. */
+	if ((features & NETIF_F_ALL_TSO) == NETIF_F_TSO_ECN)
+		features &= ~NETIF_F_TSO_ECN;
+
 	/* Software GSO depends on SG. */
 	if ((features & NETIF_F_GSO) && !(features & NETIF_F_SG)) {
 		netdev_info(dev, "Dropping NETIF_F_GSO since no SG feature.\n");
Signature · 7 lines
1.7.4


-- 
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
maintainer Applied
#2 lore raw

Re: [PATCH net-2.6 2/2] net: Disable NETIF_F_TSO_ECN when TSO is disabled

From: Ben Hutchings <[email protected]>
Date: Wed, 13 Apr 2011 01:47:15 +0100

Quoted 4 lines

NETIF_F_TSO_ECN has no effect when TSO is disabled; this just means that feature state will be accurately reported to user-space.

Applied.

maintainer Applied
#3 lore raw
In reply to Ben Hutchings

From: Ben Hutchings <[email protected]>
Date: Wed, 13 Apr 2011 01:38:37 +0100

Quoted 6 lines

The feature flags NETIF_F_TSO and NETIF_F_TSO6 independently enable TSO for IPv4 and IPv6 respectively. However, the test in netdev_fix_features() and its predecessor functions was never updated to check for NETIF_F_TSO6, possibly because it was originally proposed that TSO for IPv6 would be dependent on both feature flags.

Quoted 7 lines

Now that these feature flags can be changed independently from user-space and we depend on netdev_fix_features() to fix invalid feature combinations, it's important to disable them both if scatter-gather is disabled. Also disable NETIF_F_TSO_ECN so user-space sees all TSO features as disabled.

Applied.