public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ben Warren <biggerbadderben@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH V2] net: add 'ethrotate' environment variable
Date: Fri, 11 Jan 2008 21:49:32 -0500	[thread overview]
Message-ID: <47882ABC.7030304@gmail.com> (raw)
In-Reply-To: <200801101003.55140.matthias.fuchs@esd-electronics.com>

Hi Matthias,

Matthias Fuchs wrote:
> This patch replaces the buildtime configuration option
> CONFIG_NET_DO_NOT_TRY_ANOTHER through the 'ethrotate' runtime
> configuration variable. See README.
>
> Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
> ---
>  README    |    4 ++++
>  net/net.c |   13 ++++++++++---
>  2 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/README b/README
> index 9a8b3b9..9ca512d 100644
> --- a/README
> +++ b/README
> @@ -2687,6 +2687,10 @@ Some configuration options can be set using Environment Variables:
>  		  => setenv ethact SCC ETHERNET
>  		  => ping 10.0.0.1 # traffic sent on SCC ETHERNET
>  
> +  ethrotate	- When set to "no" U-Boot does not go through all
> +		  available network interfaces.
> +		  It just stays at the currently selected interface.
> +
>     netretry	- When set to "no" each network operation will
>  		  either succeed or fail without retrying.
>  		  When set to "once" the network operation will
> diff --git a/net/net.c b/net/net.c
> index 44feee2..e1b71a9 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -581,6 +581,7 @@ void NetStartAgain (void)
>  {
>  	char *nretry;
>  	int noretry = 0, once = 0;
> +	char *ethrotate;
>  
>  	if ((nretry = getenv ("netretry")) != NULL) {
>  		noretry = (strcmp (nretry, "no") == 0);
> @@ -596,9 +597,15 @@ void NetStartAgain (void)
>  	NetSetHandler (startAgainHandler);
>  #else	/* !CONFIG_NET_MULTI*/
>  	eth_halt ();
> -#if !defined(CONFIG_NET_DO_NOT_TRY_ANOTHER)
> -	eth_try_another (!NetRestarted);
> -#endif
> +
> +	/*
> +	 * Do not rotate between network interfaces when
> +	 * 'ethrotate' variable is set to 'no'.
> +	 */
> +	if (((ethrotate = getenv ("ethrotate")) == NULL) ||
> +	    (strcmp(ethrotate, "no") != 0))
> +		eth_try_another (!NetRestarted);
> +
>  	eth_init (gd->bd);
>  	if (NetRestartWrap) {
>  		NetRestartWrap = 0;
>   
I'm a little curious about what it is you're trying to do.  If you want 
to prevent Ethernet devices from ever rotating, this doesn't work.  For 
example, if you set 'ethact' to an interface that isn't connected, 
eth_init() will rotate the interfaces until it reaches a valid link or 
the end of the chain, never reaching your change.  If you really want to 
prevent rotation, I'd move your logic into the 'eth_try_another()' 
function itself, returning quickly if "ethrotate=no".

regards,
Ben

  parent reply	other threads:[~2008-01-12  2:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-09 16:56 [U-Boot-Users] [PATCH] net: add 'ethtoggle' environment variable Matthias Fuchs
2008-01-09 17:45 ` Ben Warren
2008-01-09 21:55   ` Matthias Fuchs
2008-01-09 21:58   ` Wolfgang Denk
2008-01-09 22:10     ` Ben Warren
2008-01-09 22:11     ` Kim Phillips
2008-01-09 22:14       ` Ben Warren
2008-01-09 22:51         ` Wolfgang Denk
2008-01-09 23:09         ` Matthias Fuchs
2008-01-10  0:33           ` Ben Warren
2008-01-10  9:02             ` Matthias Fuchs
2008-01-09 21:51 ` Wolfgang Denk
2008-01-10  9:03   ` [U-Boot-Users] [PATCH V2] net: add 'ethrotate' " Matthias Fuchs
2008-01-10 16:21     ` Ben Warren
2008-01-12  2:49     ` Ben Warren [this message]
2008-01-16 11:31       ` Matthias Fuchs
  -- strict thread matches above, loose matches on Subject: below --
2008-01-16 11:32 [U-Boot-Users] [PATCH] net: fix handling of " Matthias Fuchs
2008-01-16 22:35 ` Ben Warren
2008-01-17  6:45   ` [U-Boot-Users] [PATCH V2] net: add " Matthias Fuchs
2008-01-17 14:48     ` Ben Warren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47882ABC.7030304@gmail.com \
    --to=biggerbadderben@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox