Skip to contentSkip to conversation

net: ehea: fix wrongly-reported supported modes

PATCH In review Kleber Sacilotto de Souza 2 participants 4 messages May 3, 2011 – May 4, 2011

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

PATCH 1/1 net: ehea: fix wrongly-reported supported modes

Currently EHEA reports to ethtool as supporting 10000baseT_Full and FIBRE independent of the hardware configuration. However, these capabilities should be reported only if the physical port and the medium support them, which is the case where the physical port is connected at 10Gb.

---
 drivers/net/ehea/ehea_ethtool.c |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)
drivers/net/ehea/ehea_ethtool.c +14 -7
index 3e2e734..04716c2 100644
@@ -55,15 +55,22 @@ static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 		cmd->duplex = -1;
 	}
 
-	cmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_1000baseT_Full
-		       | SUPPORTED_100baseT_Full |  SUPPORTED_100baseT_Half
-		       | SUPPORTED_10baseT_Full | SUPPORTED_10baseT_Half
-		       | SUPPORTED_Autoneg | SUPPORTED_FIBRE);
+	cmd->supported = (SUPPORTED_1000baseT_Full | SUPPORTED_100baseT_Full
+		       | SUPPORTED_100baseT_Half | SUPPORTED_10baseT_Full
+		       | SUPPORTED_10baseT_Half | SUPPORTED_Autoneg);
 
-	cmd->advertising = (ADVERTISED_10000baseT_Full | ADVERTISED_Autoneg
-			 | ADVERTISED_FIBRE);
+	cmd->advertising = ADVERTISED_Autoneg;
+
+	if (cmd->speed == SPEED_10000) {
+		cmd->supported |= (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE);
+		cmd->advertising |= (ADVERTISED_10000baseT_Full | ADVERTISED_FIBRE);
+		cmd->port = PORT_FIBRE;
+	} else {
+		cmd->supported |= SUPPORTED_TP;
+		cmd->advertising |= (ADVERTISED_1000baseT_Full | ADVERTISED_TP);
+		cmd->port = PORT_TP;
+	}
 
-	cmd->port = PORT_FIBRE;
 	cmd->autoneg = port->autoneg == 1 ? AUTONEG_ENABLE : AUTONEG_DISABLE;
 
 	return 0;
Signature · 1 line
1.7.1
#1 lore raw
Quoted 30 lines · Kleber Sacilotto de Souza

Currently EHEA reports to ethtool as supporting 10000baseT_Full and FIBRE independent of the hardware configuration. However, these capabilities should be reported only if the physical port and the medium support them, which is the case where the physical port is connected at 10Gb.

---
 drivers/net/ehea/ehea_ethtool.c |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)
drivers/net/ehea/ehea_ethtool.c +4 -6
index 3e2e734..04716c2 100644
@@ -55,15 +55,22 @@ static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 		cmd->duplex = -1;
 	}
 
-	cmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_1000baseT_Full
-		       | SUPPORTED_100baseT_Full |  SUPPORTED_100baseT_Half
-		       | SUPPORTED_10baseT_Full | SUPPORTED_10baseT_Half
-		       | SUPPORTED_Autoneg | SUPPORTED_FIBRE);
+	cmd->supported = (SUPPORTED_1000baseT_Full | SUPPORTED_100baseT_Full
+		       | SUPPORTED_100baseT_Half | SUPPORTED_10baseT_Full
+		       | SUPPORTED_10baseT_Half | SUPPORTED_Autoneg);
 
-	cmd->advertising = (ADVERTISED_10000baseT_Full | ADVERTISED_Autoneg
-			 | ADVERTISED_FIBRE);
+	cmd->advertising = ADVERTISED_Autoneg;

drivers/net/ehea/ehea_ethtool.c static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) · line 72

Quoted 10 lines
drivers/net/ehea/ehea_ethtool.c +10 -0
+
+	if (cmd->speed == SPEED_10000) {
+		cmd->supported |= (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE);
+		cmd->advertising |= (ADVERTISED_10000baseT_Full | ADVERTISED_FIBRE);
+		cmd->port = PORT_FIBRE;
+	} else {
+		cmd->supported |= SUPPORTED_TP;
+		cmd->advertising |= (ADVERTISED_1000baseT_Full | ADVERTISED_TP);
+		cmd->port = PORT_TP;
+	}

This doesn't make any sense. If the current speed is 10G, then the driver also claims to support speeds of 10M, 100M, 1G and 10G. But then if the speed actually is <10G, the driver claims to support TP. What's going on here?

(Also, claiming to support BASE-T modes on non-TP media is bogus, though I understand why people are doing it.)

Ben.

Quoted 4 lines
drivers/net/ehea/ehea_ethtool.c +0 -1
-	cmd->port = PORT_FIBRE;
 	cmd->autoneg = port->autoneg == 1 ? AUTONEG_ENABLE : AUTONEG_DISABLE;
 
 	return 0;
Signature · 3 lines
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.
#2 lore raw
Quoted 28 lines · Ben Hutchings
Quoted 27 lines · Kleber Sacilotto de Souza

Currently EHEA reports to ethtool as supporting 10000baseT_Full and FIBRE independent of the hardware configuration. However, these capabilities should be reported only if the physical port and the medium support them, which is the case where the physical port is connected at 10Gb.

---
 drivers/net/ehea/ehea_ethtool.c |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)
drivers/net/ehea/ehea_ethtool.c +3 -4
index 3e2e734..04716c2 100644
@@ -55,15 +55,22 @@ static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 		cmd->duplex = -1;
 	}
 
-	cmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_1000baseT_Full
-		       | SUPPORTED_100baseT_Full |  SUPPORTED_100baseT_Half
-		       | SUPPORTED_10baseT_Full | SUPPORTED_10baseT_Half
-		       | SUPPORTED_Autoneg | SUPPORTED_FIBRE);
+	cmd->supported = (SUPPORTED_1000baseT_Full | SUPPORTED_100baseT_Full
+		       | SUPPORTED_100baseT_Half | SUPPORTED_10baseT_Full
+		       | SUPPORTED_10baseT_Half | SUPPORTED_Autoneg);
 
Quoted 16 lines

drivers/net/ehea/ehea_ethtool.c static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) · line 72

Quoted 13 lines
drivers/net/ehea/ehea_ethtool.c +11 -2
-	cmd->advertising = (ADVERTISED_10000baseT_Full | ADVERTISED_Autoneg
-			 | ADVERTISED_FIBRE);
+	cmd->advertising = ADVERTISED_Autoneg;
+
+	if (cmd->speed == SPEED_10000) {
+		cmd->supported |= (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE);
+		cmd->advertising |= (ADVERTISED_10000baseT_Full | ADVERTISED_FIBRE);
+		cmd->port = PORT_FIBRE;
+	} else {
+		cmd->supported |= SUPPORTED_TP;
+		cmd->advertising |= (ADVERTISED_1000baseT_Full | ADVERTISED_TP);
+		cmd->port = PORT_TP;
+	}

This doesn't make any sense. If the current speed is 10G, then the driver also claims to support speeds of 10M, 100M, 1G and 10G. But then

                                                               ^
                                                           on fibre
Quoted 13 lines

if the speed actually is <10G, the driver claims to support TP. What's going on here?

(Also, claiming to support BASE-T modes on non-TP media is bogus, though I understand why people are doing it.)

Ben.

Quoted 4 lines
drivers/net/ehea/ehea_ethtool.c +0 -1
-	cmd->port = PORT_FIBRE;
 	cmd->autoneg = port->autoneg == 1 ? AUTONEG_ENABLE : AUTONEG_DISABLE;
 
 	return 0;
Signature · 3 lines
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.
#3 lore raw
Quoted 45 lines · Ben Hutchings
Quoted 28 lines · Ben Hutchings
Quoted 27 lines · Kleber Sacilotto de Souza

Currently EHEA reports to ethtool as supporting 10000baseT_Full and FIBRE independent of the hardware configuration. However, these capabilities should be reported only if the physical port and the medium support them, which is the case where the physical port is connected at 10Gb.

---
 drivers/net/ehea/ehea_ethtool.c |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)
drivers/net/ehea/ehea_ethtool.c +3 -4
index 3e2e734..04716c2 100644
@@ -55,15 +55,22 @@ static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 		cmd->duplex = -1;
 	}
 
-	cmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_1000baseT_Full
-		       | SUPPORTED_100baseT_Full |  SUPPORTED_100baseT_Half
-		       | SUPPORTED_10baseT_Full | SUPPORTED_10baseT_Half
-		       | SUPPORTED_Autoneg | SUPPORTED_FIBRE);
+	cmd->supported = (SUPPORTED_1000baseT_Full | SUPPORTED_100baseT_Full
+		       | SUPPORTED_100baseT_Half | SUPPORTED_10baseT_Full
+		       | SUPPORTED_10baseT_Half | SUPPORTED_Autoneg);
 
Quoted 16 lines

drivers/net/ehea/ehea_ethtool.c static int ehea_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) · line 72

Quoted 13 lines
drivers/net/ehea/ehea_ethtool.c +11 -2
-	cmd->advertising = (ADVERTISED_10000baseT_Full | ADVERTISED_Autoneg
-			 | ADVERTISED_FIBRE);
+	cmd->advertising = ADVERTISED_Autoneg;
+
+	if (cmd->speed == SPEED_10000) {
+		cmd->supported |= (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE);
+		cmd->advertising |= (ADVERTISED_10000baseT_Full | ADVERTISED_FIBRE);
+		cmd->port = PORT_FIBRE;
+	} else {
+		cmd->supported |= SUPPORTED_TP;
+		cmd->advertising |= (ADVERTISED_1000baseT_Full | ADVERTISED_TP);
+		cmd->port = PORT_TP;
+	}

This doesn't make any sense. If the current speed is 10G, then the driver also claims to support speeds of 10M, 100M, 1G and 10G. But then

Quoted 5 lines
                                                               ^
                                                           on fibre
Quoted 2 lines

if the speed actually is <10G, the driver claims to support TP. What's going on here?

You are right. This patch was based on very vague hardware specs that wasn't making much sense. I have more details about the hardware now, I will send another patch soon.

Quoted 12 lines
Quoted 11 lines

(Also, claiming to support BASE-T modes on non-TP media is bogus, though I understand why people are doing it.)

Ben.

Quoted 4 lines
drivers/net/ehea/ehea_ethtool.c +0 -1
-	cmd->port = PORT_FIBRE;
 	cmd->autoneg = port->autoneg == 1 ? AUTONEG_ENABLE : AUTONEG_DISABLE;
 
 	return 0;
Signature · 2 lines
Kleber S. Souza
IBM Linux Technology Center