public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH RFC] tsec: do not print Speed: if using netconsole
@ 2010-01-23 21:39 Ed Swarthout
  2010-01-26 16:53 ` Peter Tyser
  0 siblings, 1 reply; 6+ messages in thread
From: Ed Swarthout @ 2010-01-23 21:39 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Ed Swarthout <Ed.Swarthout@freescale.com>
---

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(-)

diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index d8b6619..23e4622 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -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);
 	}
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH RFC] tsec: do not print Speed: if using netconsole
  2010-01-23 21:39 [U-Boot] [PATCH RFC] tsec: do not print Speed: if using netconsole Ed Swarthout
@ 2010-01-26 16:53 ` Peter Tyser
  2010-01-28 22:38   ` [U-Boot] [PATCH v2] " Ed Swarthout
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Tyser @ 2010-01-26 16:53 UTC (permalink / raw)
  To: u-boot

Hi Ed,

On Sat, 2010-01-23 at 15:39 -0600, Ed Swarthout wrote:
> 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
> 
> Signed-off-by: Ed Swarthout <Ed.Swarthout@freescale.com>
> ---
> 
> 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(-)
> 
> diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
> index d8b6619..23e4622 100644
> --- a/drivers/net/tsec.c
> +++ b/drivers/net/tsec.c
> @@ -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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH v2] tsec: do not print Speed: if using netconsole
  2010-01-26 16:53 ` Peter Tyser
@ 2010-01-28 22:38   ` Ed Swarthout
  2010-02-01  6:49     ` Ben Warren
  0 siblings, 1 reply; 6+ messages in thread
From: Ed Swarthout @ 2010-01-28 22:38 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Ed Swarthout <Ed.Swarthout@freescale.com>
---

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(-)

diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index d8b6619..42083de 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -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);
-- 
1.6.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH v2] tsec: do not print Speed: if using netconsole
  2010-01-28 22:38   ` [U-Boot] [PATCH v2] " Ed Swarthout
@ 2010-02-01  6:49     ` Ben Warren
  2010-02-01 10:23       ` [U-Boot] [PATCH V3 for NET] " Ed Swarthout
  0 siblings, 1 reply; 6+ messages in thread
From: Ben Warren @ 2010-02-01  6:49 UTC (permalink / raw)
  To: u-boot

Hi Ed,

Ed Swarthout wrote:
> 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
>
> Signed-off-by: Ed Swarthout <Ed.Swarthout@freescale.com>
> ---
>   
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH V3 for NET] tsec: do not print Speed: if using netconsole
  2010-02-01  6:49     ` Ben Warren
@ 2010-02-01 10:23       ` Ed Swarthout
  2010-02-01 11:36         ` Wolfgang Denk
  0 siblings, 1 reply; 6+ messages in thread
From: Ed Swarthout @ 2010-02-01 10:23 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Ed Swarthout <Ed.Swarthout@freescale.com>
---
 drivers/net/tsec.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index fd49eff..392072f 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -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);
 	}
-- 
1.6.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH V3 for NET] tsec: do not print Speed: if using netconsole
  2010-02-01 10:23       ` [U-Boot] [PATCH V3 for NET] " Ed Swarthout
@ 2010-02-01 11:36         ` Wolfgang Denk
  0 siblings, 0 replies; 6+ messages in thread
From: Wolfgang Denk @ 2010-02-01 11:36 UTC (permalink / raw)
  To: u-boot

Dear Ed Swarthout,

In message <1265019802-32030-1-git-send-email-Ed.Swarthout@freescale.com> you wrote:
> 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
> 
> Signed-off-by: Ed Swarthout <Ed.Swarthout@freescale.com>
> ---
>  drivers/net/tsec.c |   10 ++++++----
>  1 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
> index fd49eff..392072f 100644
> --- a/drivers/net/tsec.c
> +++ b/drivers/net/tsec.c
> @@ -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" : "");
> +		}

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

-- 
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-02-01 11:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-23 21:39 [U-Boot] [PATCH RFC] tsec: do not print Speed: if using netconsole Ed Swarthout
2010-01-26 16:53 ` Peter Tyser
2010-01-28 22:38   ` [U-Boot] [PATCH v2] " Ed Swarthout
2010-02-01  6:49     ` Ben Warren
2010-02-01 10:23       ` [U-Boot] [PATCH V3 for NET] " Ed Swarthout
2010-02-01 11:36         ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox