Skip to contentSkip to conversation

tsec: do not print Speed: if using netconsole

RFC PATCH Superseded Ed Swarthout 4 participants 6 messages Jan 23, 2010 – Feb 1, 2010 Network drivers

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 tsec: do not print Speed: if using netconsole

CONFIG_NETCONSOLE on the p2020ds is functional with the tsec driver. But the printf in adjust_link() which is called by startup_tsec() called by tsec_init() in tsec.c is making it impossible to use.

For example typing 12345 on the netconsole causes the message to be printed for every character:

=> Speed: 1000, full duplex
1Speed: 1000, full duplex
2Speed: 1000, full duplex
3Speed: 1000, full duplex
4Speed: 1000, full duplex
5Speed: 1000, full duplex

Unknown command '12345' - try 'help'
=> Speed: 1000, full duplex

---

Since the Speed message is useful, I don't particularly like this fix.

 drivers/net/tsec.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/tsec.c +2 -2
index d8b6619..23e4622 100644
@@ -846,10 +846,10 @@ static void adjust_link(struct eth_device *dev)
 			printf("%s: Speed was bad\n", dev->name);
 			break;
 		}
-
+#ifndef CONFIG_NETCONSOLE
 		printf("Speed: %d, %s duplex\n", priv->speed,
 		       (priv->duplexity) ? "full" : "half");
-
+#endif
 	} else {
 		printf("%s: No link.\n", dev->name);
 	}
Signature · 1 line
1.5.6.5
#1 lore raw

RFC PATCH 1/1 tsec: do not print Speed: if using netconsole

Hi Ed,

Quoted 30 lines · Ed Swarthout

CONFIG_NETCONSOLE on the p2020ds is functional with the tsec driver. But the printf in adjust_link() which is called by startup_tsec() called by tsec_init() in tsec.c is making it impossible to use.

For example typing 12345 on the netconsole causes the message to be printed for every character:

=> Speed: 1000, full duplex
1Speed: 1000, full duplex
2Speed: 1000, full duplex
3Speed: 1000, full duplex
4Speed: 1000, full duplex
5Speed: 1000, full duplex

Unknown command '12345' - try 'help'
=> Speed: 1000, full duplex

---

Since the Speed message is useful, I don't particularly like this fix.

 drivers/net/tsec.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/tsec.c +0 -0
index d8b6619..23e4622 100644

drivers/net/tsec.c static void adjust_link(struct eth_device *dev) · line 852

Quoted 9 lines
drivers/net/tsec.c +2 -2
@@ -846,10 +846,10 @@ static void adjust_link(struct eth_device *dev)
 			printf("%s: Speed was bad\n", dev->name);
 			break;
 		}
-
+#ifndef CONFIG_NETCONSOLE
 		printf("Speed: %d, %s duplex\n", priv->speed,
 		       (priv->duplexity) ? "full" : "half");
-
+#endif

What if you changed the conditional to "strcmp(getenv("stdout"), nc)" so the message still gets printed when not using a netconsole?

On a similar note, doesn't it seem a bit crazy that an ethernet interface it brought up and down every time a packet is sent? I would have thought that the interface needed to be constantly enabled to support receiving incoming packets. If so, wouldn't the proper fix be to not bring the interface up/down during netconsole use?

Best,
Peter

#2 lore raw

PATCH v2 1/1 tsec: do not print Speed: if using netconsole

CONFIG_NETCONSOLE on the p2020ds is functional with the tsec driver. But the printf in adjust_link() which is called by startup_tsec() called by tsec_init() in tsec.c is making it impossible to use.

For example typing 12345 on the netconsole causes the message to be printed for every character:

=> Speed: 1000, full duplex
1Speed: 1000, full duplex
2Speed: 1000, full duplex
3Speed: 1000, full duplex
4Speed: 1000, full duplex
5Speed: 1000, full duplex

---

Based on a suggestion from Peter Tyser, check env and only disable if currently using netconsole.

 drivers/net/tsec.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/tsec.c +4 -2
index d8b6619..42083de 100644
@@ -847,8 +847,10 @@ static void adjust_link(struct eth_device *dev)
 			break;
 		}
 
-		printf("Speed: %d, %s duplex\n", priv->speed,
-		       (priv->duplexity) ? "full" : "half");
+		if (strcmp(getenv("stdin"), "nc") != 0) {
+			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.5
#3 lore raw

PATCH v2 1/1 tsec: do not print Speed: if using netconsole

Hi Ed,

Quoted 14 lines · Ed Swarthout

CONFIG_NETCONSOLE on the p2020ds is functional with the tsec driver. But the printf in adjust_link() which is called by startup_tsec() called by tsec_init() in tsec.c is making it impossible to use.

For example typing 12345 on the netconsole causes the message to be printed for every character:

=> Speed: 1000, full duplex
1Speed: 1000, full duplex
2Speed: 1000, full duplex
3Speed: 1000, full duplex
4Speed: 1000, full duplex
5Speed: 1000, full duplex

Quoted 3 lines

---

This no longer applies because of other changes to the TSEC driver (in the net tree, anyway). Please rebase when you get a chance and I'll apply it.

regards,
Ben

#4 lore raw

PATCH v3 1/1 tsec: do not print Speed: if using netconsole

CONFIG_NETCONSOLE on the p2020ds is functional with the tsec driver. But the printf in adjust_link() which is called by startup_tsec() called by tsec_init() in tsec.c is making it impossible to use.

For example typing 12345 on the netconsole causes the message to be printed for every character:

=> Speed: 1000, full duplex
1Speed: 1000, full duplex
2Speed: 1000, full duplex
3Speed: 1000, full duplex
4Speed: 1000, full duplex
5Speed: 1000, full duplex

---
 drivers/net/tsec.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
drivers/net/tsec.c +6 -4
index fd49eff..392072f 100644
@@ -941,10 +941,12 @@ static void adjust_link(struct eth_device *dev)
 			break;
 		}
 
-		printf("Speed: %d, %s duplex%s\n", priv->speed,
-		       (priv->duplexity) ? "full" : "half",
-		       (priv->flags & TSEC_FIBER) ? ", fiber mode" : "");
-
+		if (strcmp(getenv("stdin"), "nc") != 0) {
+			printf("Speed: %d, %s duplex%s\n", priv->speed,
+				(priv->duplexity) ? "full" : "half",
+				(priv->flags & TSEC_FIBER) ?
+					", fiber mode" : "");
+		}
 	} else {
 		printf("%s: No link.\n", dev->name);
 	}
Signature · 1 line
1.6.5
#5 lore raw

PATCH v3 1/1 tsec: do not print Speed: if using netconsole

Dear Ed Swarthout,

Quoted 27 lines · In message <[email protected]> you…

CONFIG_NETCONSOLE on the p2020ds is functional with the tsec driver. But the printf in adjust_link() which is called by startup_tsec() called by tsec_init() in tsec.c is making it impossible to use.

For example typing 12345 on the netconsole causes the message to be printed for every character:

=> Speed: 1000, full duplex
1Speed: 1000, full duplex
2Speed: 1000, full duplex
3Speed: 1000, full duplex
4Speed: 1000, full duplex
5Speed: 1000, full duplex

---
 drivers/net/tsec.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
drivers/net/tsec.c +0 -0
index fd49eff..392072f 100644
@@ -941,10 +941,12 @@ static void adjust_link(struct eth_device *dev)
 			break;
 		}
 

drivers/net/tsec.c static void adjust_link(struct eth_device *dev) · line 949

Quoted 10 lines
drivers/net/tsec.c +6 -4
-		printf("Speed: %d, %s duplex%s\n", priv->speed,
-		       (priv->duplexity) ? "full" : "half",
-		       (priv->flags & TSEC_FIBER) ? ", fiber mode" : "");
-
+		if (strcmp(getenv("stdin"), "nc") != 0) {
+			printf("Speed: %d, %s duplex%s\n", priv->speed,
+				(priv->duplexity) ? "full" : "half",
+				(priv->flags & TSEC_FIBER) ?
+					", fiber mode" : "");
+		}

I think this status of the console connection should be latched into a variable (in tsec_init() ?) so we can avoid the (pretty expensive) scanning of the environment for every transmitted character.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Peace was the way.
	-- Kirk, "The City on the Edge of Forever", stardate unknown