Patchwork [U-Boot] tsec.c bug: Every key typing in netconsole prints the Eth link mode

login
register
mail settings
Submitter Michael Zaidman
Date Feb. 15, 2010, 9:40 a.m.
Message ID <1266226835-29444-1-git-send-email-michael.zaidman@gmail.com>
Download mbox | patch
Permalink /patch/71727/
State RFC
Delegated to: Andy Fleming
Headers show

Comments

Michael Zaidman - Feb. 15, 2010, 9:40 a.m.
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"

Signed-off-by: Michael Zaidman <michael.zaidman@gmail.com>
---
 drivers/net/tsec.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
Michael Zaidman - Feb. 15, 2010, 12:14 p.m.
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.

On Mon, Feb 15, 2010 at 11:40 AM, Michael Zaidman
<michael.zaidman@gmail.com> wrote:
> 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"
>
> Signed-off-by: Michael Zaidman <michael.zaidman@gmail.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 3f74118..87093e6 100644
> --- a/drivers/net/tsec.c
> +++ b/drivers/net/tsec.c
> @@ -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
>
>

Patch

diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index 3f74118..87093e6 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -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);
 	}