public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH] net: add 'ethtoggle' environment variable
@ 2008-01-09 16:56 Matthias Fuchs
  2008-01-09 17:45 ` Ben Warren
  2008-01-09 21:51 ` Wolfgang Denk
  0 siblings, 2 replies; 18+ messages in thread
From: Matthias Fuchs @ 2008-01-09 16:56 UTC (permalink / raw)
  To: u-boot

This patch replaces the buildtime configuration option
CONFIG_NET_DO_NOT_TRY_ANOTHER through the 'ethtoggle' runtime
configuration veriable. 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..9eac840 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
 
+  ethtoggle	- When set to "no" U-Boot does not go through all
+		  available network interfaces.
+		  It just stays at the default 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..48ccd96 100644
--- a/net/net.c
+++ b/net/net.c
@@ -581,6 +581,7 @@ void NetStartAgain (void)
 {
 	char *nretry;
 	int noretry = 0, once = 0;
+	char *ethtoggle;
 
 	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 toggle between network interfaces when
+	 * 'ethtoggle' variable is set to 'no'.
+	 */
+	if (((ethtoggle = getenv ("ethtoggle")) == NULL) ||
+	    (strcmp(ethtoggle, "no") != 0))
+		eth_try_another (!NetRestarted);
+
 	eth_init (gd->bd);
 	if (NetRestartWrap) {
 		NetRestartWrap = 0;
-- 
1.5.3

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

* [U-Boot-Users] [PATCH] net: add 'ethtoggle' environment variable
  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 21:51 ` Wolfgang Denk
  1 sibling, 2 replies; 18+ messages in thread
From: Ben Warren @ 2008-01-09 17:45 UTC (permalink / raw)
  To: u-boot

Matthias Fuchs wrote:
> This patch replaces the buildtime configuration option
> CONFIG_NET_DO_NOT_TRY_ANOTHER through the 'ethtoggle' runtime
> configuration veriable. See README.
>   
Good idea, but surely you can come up with a better word than 
'ethtoggle'... It sounds like something Elmo would show to Big Bird and 
doesn't have anything to do with automatically advancing devices. Of 
course, I don't have any useful suggestions, but will think about it.

cheers,
Ben

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

* [U-Boot-Users] [PATCH] net: add 'ethtoggle' environment variable
  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:51 ` Wolfgang Denk
  2008-01-10  9:03   ` [U-Boot-Users] [PATCH V2] net: add 'ethrotate' " Matthias Fuchs
  1 sibling, 1 reply; 18+ messages in thread
From: Wolfgang Denk @ 2008-01-09 21:51 UTC (permalink / raw)
  To: u-boot

Dear Ben,

in message <200801091756.48890.matthias.fuchs@esd-electronics.com>
Matthias Fuchs wrote:
> This patch replaces the buildtime configuration option
> CONFIG_NET_DO_NOT_TRY_ANOTHER through the 'ethtoggle' runtime
> configuration veriable. See README.
> 
> Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
Ack-by: Wolfgang Denk <wd@denx.de>


But please edit the doc:

> diff --git a/README b/README
> index 9a8b3b9..9eac840 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
>  
> +  ethtoggle	- When set to "no" U-Boot does not go through all
> +		  available network interfaces.
> +		  It just stays at the default interface.

... It just stays at the currently selected interface.


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
Abstainer: A weak person who yields to the temptation of denying him-
self a pleasure. A total abstainer is one who  abstains  from  every-
thing  but  abstention, and especially from inactivity in the affairs
of others.                                           - Ambrose Bierce

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

* [U-Boot-Users] [PATCH] net: add 'ethtoggle' environment variable
  2008-01-09 17:45 ` Ben Warren
@ 2008-01-09 21:55   ` Matthias Fuchs
  2008-01-09 21:58   ` Wolfgang Denk
  1 sibling, 0 replies; 18+ messages in thread
From: Matthias Fuchs @ 2008-01-09 21:55 UTC (permalink / raw)
  To: u-boot

Hi Ben,

'ethtoggle' is the result of a discussion on irc some hours ago.
Arguments have been: no 'eth' prefix and underscore (because 'ethprime' and 'ethact').
It was clear that the name of the variable would be most difficult site of
its implementation.

If you suggest a better name, I am willing to rename it:-)

Matthias

On Wednesday 09 January 2008 18:45, Ben Warren wrote:
> Matthias Fuchs wrote:
> > This patch replaces the buildtime configuration option
> > CONFIG_NET_DO_NOT_TRY_ANOTHER through the 'ethtoggle' runtime
> > configuration veriable. See README.
> >   
> Good idea, but surely you can come up with a better word than 
> 'ethtoggle'... It sounds like something Elmo would show to Big Bird and 
> doesn't have anything to do with automatically advancing devices. Of 
> course, I don't have any useful suggestions, but will think about it.
> 
> cheers,
> Ben

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

* [U-Boot-Users] [PATCH] net: add 'ethtoggle' environment variable
  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
  1 sibling, 2 replies; 18+ messages in thread
From: Wolfgang Denk @ 2008-01-09 21:58 UTC (permalink / raw)
  To: u-boot

In message <47850837.6020608@gmail.com> you wrote:
> Matthias Fuchs wrote:
> > This patch replaces the buildtime configuration option
> > CONFIG_NET_DO_NOT_TRY_ANOTHER through the 'ethtoggle' runtime
> > configuration veriable. See README.
> >   
> Good idea, but surely you can come up with a better word than 
> 'ethtoggle'... It sounds like something Elmo would show to Big Bird and 
> doesn't have anything to do with automatically advancing devices. Of 
> course, I don't have any useful suggestions, but will think about it.

We discussed this on IRC this afternoon. The name was agreed between
Matthias Fuchs, Stefan Roese, Jean-Christophe Plagniol-Villard, and
me...

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
HEALTH WARNING: Care Should Be Taken When Lifting This Product, Since
Its Mass, and Thus Its Weight, Is Dependent on Its Velocity  Relative
to the User.

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

* [U-Boot-Users] [PATCH] net: add 'ethtoggle' environment variable
  2008-01-09 21:58   ` Wolfgang Denk
@ 2008-01-09 22:10     ` Ben Warren
  2008-01-09 22:11     ` Kim Phillips
  1 sibling, 0 replies; 18+ messages in thread
From: Ben Warren @ 2008-01-09 22:10 UTC (permalink / raw)
  To: u-boot

Wolfgang Denk wrote:
> In message <47850837.6020608@gmail.com> you wrote:
>   
>> Matthias Fuchs wrote:
>>     
>>> This patch replaces the buildtime configuration option
>>> CONFIG_NET_DO_NOT_TRY_ANOTHER through the 'ethtoggle' runtime
>>> configuration veriable. See README.
>>>   
>>>       
>> Good idea, but surely you can come up with a better word than 
>> 'ethtoggle'... It sounds like something Elmo would show to Big Bird and 
>> doesn't have anything to do with automatically advancing devices. Of 
>> course, I don't have any useful suggestions, but will think about it.
>>     
>
> We discussed this on IRC this afternoon. The name was agreed between
> Matthias Fuchs, Stefan Roese, Jean-Christophe Plagniol-Villard, and
> me...
>
> Best regards,
>
> Wolfgang Denk
>
>   
Fair enough.  Lacking any creativity today, I'll shake my head and pull 
it in...

regards,
Ben

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

* [U-Boot-Users] [PATCH] net: add 'ethtoggle' environment variable
  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
  1 sibling, 1 reply; 18+ messages in thread
From: Kim Phillips @ 2008-01-09 22:11 UTC (permalink / raw)
  To: u-boot

On Wed, 09 Jan 2008 22:58:21 +0100
Wolfgang Denk <wd@denx.de> wrote:

> In message <47850837.6020608@gmail.com> you wrote:
> > Matthias Fuchs wrote:
> > > This patch replaces the buildtime configuration option
> > > CONFIG_NET_DO_NOT_TRY_ANOTHER through the 'ethtoggle' runtime
> > > configuration veriable. See README.
> > >   
> > Good idea, but surely you can come up with a better word than 
> > 'ethtoggle'... It sounds like something Elmo would show to Big Bird and 
> > doesn't have anything to do with automatically advancing devices. Of 
> > course, I don't have any useful suggestions, but will think about it.
> 
> We discussed this on IRC this afternoon. The name was agreed between
> Matthias Fuchs, Stefan Roese, Jean-Christophe Plagniol-Villard, and
> me...
> 
toggle to me implies a binary sense, e.g. toggling a switch on/off,
whereas this code doesn't turn eth on/off, it enables/disables the
round-robin polling of eth devices.  'ethpoll' isn't quite precise
enough either; what about 'ethcycle' ?

Kim

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

* [U-Boot-Users] [PATCH] net: add 'ethtoggle' environment variable
  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
  0 siblings, 2 replies; 18+ messages in thread
From: Ben Warren @ 2008-01-09 22:14 UTC (permalink / raw)
  To: u-boot

Kim Phillips wrote:
> On Wed, 09 Jan 2008 22:58:21 +0100
> Wolfgang Denk <wd@denx.de> wrote:
>
>   
>> In message <47850837.6020608@gmail.com> you wrote:
>>     
>>> Matthias Fuchs wrote:
>>>       
>>>> This patch replaces the buildtime configuration option
>>>> CONFIG_NET_DO_NOT_TRY_ANOTHER through the 'ethtoggle' runtime
>>>> configuration veriable. See README.
>>>>   
>>>>         
>>> Good idea, but surely you can come up with a better word than 
>>> 'ethtoggle'... It sounds like something Elmo would show to Big Bird and 
>>> doesn't have anything to do with automatically advancing devices. Of 
>>> course, I don't have any useful suggestions, but will think about it.
>>>       
>> We discussed this on IRC this afternoon. The name was agreed between
>> Matthias Fuchs, Stefan Roese, Jean-Christophe Plagniol-Villard, and
>> me...
>>
>>     
> toggle to me implies a binary sense, e.g. toggling a switch on/off,
> whereas this code doesn't turn eth on/off, it enables/disables the
> round-robin polling of eth devices.  'ethpoll' isn't quite precise
> enough either; what about 'ethcycle' ?
>
> Kim
>
>   
Getting better...

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

* [U-Boot-Users] [PATCH] net: add 'ethtoggle' environment variable
  2008-01-09 22:14       ` Ben Warren
@ 2008-01-09 22:51         ` Wolfgang Denk
  2008-01-09 23:09         ` Matthias Fuchs
  1 sibling, 0 replies; 18+ messages in thread
From: Wolfgang Denk @ 2008-01-09 22:51 UTC (permalink / raw)
  To: u-boot

In message <47854759.7020803@gmail.com> you wrote:
>
> > toggle to me implies a binary sense, e.g. toggling a switch on/off,
> > whereas this code doesn't turn eth on/off, it enables/disables the
> > round-robin polling of eth devices.  'ethpoll' isn't quite precise
> > enough either; what about 'ethcycle' ?
...
> Getting better...

Well, the function that get's called is "eth_try_another()", so maybe 
"ethtryanother" ;-)

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
Build a system that even a fool can use and only a fool will want  to
use it.

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

* [U-Boot-Users] [PATCH] net: add 'ethtoggle' environment variable
  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
  1 sibling, 1 reply; 18+ messages in thread
From: Matthias Fuchs @ 2008-01-09 23:09 UTC (permalink / raw)
  To: u-boot

What about 'ethrotate' or 'ethshift' ? 

Matthias

On Wednesday 09 January 2008 23:14, Ben Warren wrote:
> Kim Phillips wrote:
> > On Wed, 09 Jan 2008 22:58:21 +0100
> > Wolfgang Denk <wd@denx.de> wrote:
> >
> >   
> >> In message <47850837.6020608@gmail.com> you wrote:
> >>     
> >>> Matthias Fuchs wrote:
> >>>       
> >>>> This patch replaces the buildtime configuration option
> >>>> CONFIG_NET_DO_NOT_TRY_ANOTHER through the 'ethtoggle' runtime
> >>>> configuration veriable. See README.
> >>>>   
> >>>>         
> >>> Good idea, but surely you can come up with a better word than 
> >>> 'ethtoggle'... It sounds like something Elmo would show to Big Bird and 
> >>> doesn't have anything to do with automatically advancing devices. Of 
> >>> course, I don't have any useful suggestions, but will think about it.
> >>>       
> >> We discussed this on IRC this afternoon. The name was agreed between
> >> Matthias Fuchs, Stefan Roese, Jean-Christophe Plagniol-Villard, and
> >> me...
> >>
> >>     
> > toggle to me implies a binary sense, e.g. toggling a switch on/off,
> > whereas this code doesn't turn eth on/off, it enables/disables the
> > round-robin polling of eth devices.  'ethpoll' isn't quite precise
> > enough either; what about 'ethcycle' ?
> >
> > Kim
> >
> >   
> Getting better...
> 
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> _______________________________________________
> U-Boot-Users mailing list
> U-Boot-Users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/u-boot-users
> 

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

* [U-Boot-Users] [PATCH] net: add 'ethtoggle' environment variable
  2008-01-09 23:09         ` Matthias Fuchs
@ 2008-01-10  0:33           ` Ben Warren
  2008-01-10  9:02             ` Matthias Fuchs
  0 siblings, 1 reply; 18+ messages in thread
From: Ben Warren @ 2008-01-10  0:33 UTC (permalink / raw)
  To: u-boot

Matthias Fuchs wrote:
> What about 'ethrotate' or 'ethshift' ? 
>
> Matthias
>   
See, that's 10x better already!  Personally, I like 'ethautorotate', but 
if that's too long 'ethrotate' will do.

regards,
Ben

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

* [U-Boot-Users] [PATCH] net: add 'ethtoggle' environment variable
  2008-01-10  0:33           ` Ben Warren
@ 2008-01-10  9:02             ` Matthias Fuchs
  0 siblings, 0 replies; 18+ messages in thread
From: Matthias Fuchs @ 2008-01-10  9:02 UTC (permalink / raw)
  To: u-boot

Ok, let's call the baby 'ethrotate'.

Matthias

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

* [U-Boot-Users] [PATCH V2] net: add 'ethrotate' environment variable
  2008-01-09 21:51 ` Wolfgang Denk
@ 2008-01-10  9:03   ` Matthias Fuchs
  2008-01-10 16:21     ` Ben Warren
  2008-01-12  2:49     ` Ben Warren
  0 siblings, 2 replies; 18+ messages in thread
From: Matthias Fuchs @ 2008-01-10  9:03 UTC (permalink / raw)
  To: u-boot

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

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

* [U-Boot-Users] [PATCH V2] net: add 'ethrotate' environment variable
  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
  1 sibling, 0 replies; 18+ messages in thread
From: Ben Warren @ 2008-01-10 16:21 UTC (permalink / raw)
  To: u-boot

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

Thanks - applied.

regards,
Ben

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

* [U-Boot-Users] [PATCH V2] net: add 'ethrotate' environment variable
  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
  2008-01-16 11:31       ` Matthias Fuchs
  1 sibling, 1 reply; 18+ messages in thread
From: Ben Warren @ 2008-01-12  2:49 UTC (permalink / raw)
  To: u-boot

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

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

* [U-Boot-Users] [PATCH V2] net: add 'ethrotate' environment variable
  2008-01-12  2:49     ` Ben Warren
@ 2008-01-16 11:31       ` Matthias Fuchs
  0 siblings, 0 replies; 18+ messages in thread
From: Matthias Fuchs @ 2008-01-16 11:31 UTC (permalink / raw)
  To: u-boot

Hi Ben,

On Saturday 12 January 2008 03:49, Ben Warren wrote:
> 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
> 
I will post a fixing patch in a minute.

Matthias

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

* [U-Boot-Users] [PATCH V2] net: add 'ethrotate' environment variable
  2008-01-16 22:35 ` Ben Warren
@ 2008-01-17  6:45   ` Matthias Fuchs
  2008-01-17 14:48     ` Ben Warren
  0 siblings, 1 reply; 18+ messages in thread
From: Matthias Fuchs @ 2008-01-17  6:45 UTC (permalink / raw)
  To: u-boot

[PATCH] net: add 'ethrotate' environment variable

This patch replaces the buildtime configuration option
CONFIG_NET_DO_NOT_TRY_ANOTHER through the 'ethrotate' runtime
configuration veriable. See README.

Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
---
 README    |    4 ++++
 net/eth.c |    9 +++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/README b/README
index f2a4914..d9c2ee2 100644
--- a/README
+++ b/README
@@ -2691,6 +2691,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/eth.c b/net/eth.c
index 5d9e9c1..d55fd7e 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -522,6 +522,15 @@ int eth_receive(volatile void *packet, int length)
 void eth_try_another(int first_restart)
 {
 	static struct eth_device *first_failed = NULL;
+	char *ethrotate;
+
+	/*
+	 * Do not rotate between network interfaces when
+	 * 'ethrotate' variable is set to 'no'.
+	 */
+	if (((ethrotate = getenv ("ethrotate")) != NULL) &&
+	    (strcmp(ethrotate, "no") == 0))
+		return;
 
 	if (!eth_current)
 		return;
-- 
1.5.3

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

* [U-Boot-Users] [PATCH V2] net: add 'ethrotate' environment variable
  2008-01-17  6:45   ` [U-Boot-Users] [PATCH V2] net: add " Matthias Fuchs
@ 2008-01-17 14:48     ` Ben Warren
  0 siblings, 0 replies; 18+ messages in thread
From: Ben Warren @ 2008-01-17 14:48 UTC (permalink / raw)
  To: u-boot

Matthias Fuchs wrote:
> [PATCH] net: add 'ethrotate' environment variable
>
> This patch replaces the buildtime configuration option
> CONFIG_NET_DO_NOT_TRY_ANOTHER through the 'ethrotate' runtime
> configuration veriable. See README.
>
> Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
> ---
>  README    |    4 ++++
>  net/eth.c |    9 +++++++++
>  2 files changed, 13 insertions(+), 0 deletions(-)
>
> diff --git a/README b/README
> index f2a4914..d9c2ee2 100644
> --- a/README
> +++ b/README
> @@ -2691,6 +2691,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/eth.c b/net/eth.c
> index 5d9e9c1..d55fd7e 100644
> --- a/net/eth.c
> +++ b/net/eth.c
> @@ -522,6 +522,15 @@ int eth_receive(volatile void *packet, int length)
>  void eth_try_another(int first_restart)
>  {
>  	static struct eth_device *first_failed = NULL;
> +	char *ethrotate;
> +
> +	/*
> +	 * Do not rotate between network interfaces when
> +	 * 'ethrotate' variable is set to 'no'.
> +	 */
> +	if (((ethrotate = getenv ("ethrotate")) != NULL) &&
> +	    (strcmp(ethrotate, "no") == 0))
> +		return;
>  
>  	if (!eth_current)
>  		return;
>   
Excellent!  Applied.

thanks,
Ben

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

end of thread, other threads:[~2008-01-17 14:48 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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