Skip to contentSkip to conversation

tsec.c bug: Every key typing in netconsole prints the Eth link mode

PATCH New Michael Zaidman 1 participant 2 messages Feb 15, 2010 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tsec.c bug: Every key typing in netconsole prints the Eth link mode

The problem description:
The Ethernet link operation mode printing (such as "Speed: 1000, full duplex") accomplishes every key typing when communicating via netconsole to the mpc834x based board. The string is printed by adjust_link() routine of tsec.c, which in turn is part of the eth_init routine called at every netloop entry.

The solution:
Do not print the string when compiled with CONFIG_NETCONSOLE and stdin or stdout is set to "nc"

---
 drivers/net/tsec.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
drivers/net/tsec.c +6 -4
index 3f74118..87093e6 100644
@@ -847,10 +847,12 @@ static void adjust_link(struct eth_device *dev)
 			printf("%s: Speed was bad\n", dev->name);
 			break;
 		}
-
-		printf("Speed: %d, %s duplex\n", priv->speed,
-		       (priv->duplexity) ? "full" : "half");
-
+#ifdef CONFIG_NETCONSOLE
+		if ((strcmp(getenv("stdin"),"nc") != 0) && 
+			(strcmp(getenv("stdout"),"nc") != 0))
+#endif
+			printf("Speed: %d, %s duplex\n", priv->speed,
+				   (priv->duplexity) ? "full" : "half");
 	} else {
 		printf("%s: No link.\n", dev->name);
 	}
Signature · 1 line
1.6.3.3
#1 lore raw

PATCH 1/1 tsec.c bug: Every key typing in netconsole prints the Eth link mode

Sorry for submitting of this patch. I proposed here similar to the
http://lists.denx.de/pipermail/u-boot/2010-January/067259.html patch solution about which I was not aware. The only difference is that I also added CONFIG_NETCONSOLE conditional compilation for the cases when no netconsole is used at all.

Quoted 41 lines · Michael Zaidman

The problem description:
The Ethernet link operation mode printing (such as "Speed: 1000, full duplex") accomplishes every key typing when communicating via netconsole to the mpc834x based board. The string is printed by adjust_link() routine of tsec.c, which in turn is part of the eth_init routine called at every netloop entry.

The solution:
Do not print the string when compiled with CONFIG_NETCONSOLE and stdin or stdout is set to "nc"

---
?drivers/net/tsec.c | ? 10 ++++++----
?1 files changed, 6 insertions(+), 4 deletions(-)

drivers/net/tsec.c +6 -5
index 3f74118..87093e6 100644
@@ -847,10 +847,12 @@ static void adjust_link(struct eth_device *dev)
 ? ? ? ? ? ? ? ? ? ? ? ?printf("%s: Speed was bad\n", dev->name);
 ? ? ? ? ? ? ? ? ? ? ? ?break;
 ? ? ? ? ? ? ? ?}
-
- ? ? ? ? ? ? ? printf("Speed: %d, %s duplex\n", priv->speed,
- ? ? ? ? ? ? ? ? ? ? ?(priv->duplexity) ? "full" : "half");
-
+#ifdef CONFIG_NETCONSOLE
+ ? ? ? ? ? ? ? if ((strcmp(getenv("stdin"),"nc") != 0) &&
+ ? ? ? ? ? ? ? ? ? ? ? (strcmp(getenv("stdout"),"nc") != 0))
+#endif
+ ? ? ? ? ? ? ? ? ? ? ? printf("Speed: %d, %s duplex\n", priv->speed,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(priv->duplexity) ? "full" : "half");
 ? ? ? ?} else {
 ? ? ? ? ? ? ? ?printf("%s: No link.\n", dev->name);
 ? ? ? ?}
--

1.6.3.3