Skip to contentSkip to conversation

net: add 'ethtoggle' environment variable

PATCH New Matthias Fuchs 4 participants 16 messages Jan 9, 2008 – Jan 16, 2008 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: add 'ethtoggle' environment variable

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

---
 README    |    4 ++++
 net/net.c |   13 ++++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)
README +4 -0
index 9a8b3b9..9eac840 100644
@@ -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
net/net.c +10 -3
index 44feee2..48ccd96 100644
@@ -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;
Signature · 1 line
1.5.3
#1 lore raw

PATCH 1/1 net: add 'ethtoggle' environment variable

Quoted 4 lines · Matthias Fuchs

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

#2 lore raw

PATCH 1/1 net: add 'ethtoggle' environment variable

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

Quoted 12 lines · Ben Warren
Quoted 4 lines · Matthias Fuchs

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

#3 lore raw

PATCH 1/1 net: add 'ethtoggle' environment variable

In reply to Ben Warren
Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 4 lines · Matthias Fuchs

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

Signature · 6 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
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.
#4 lore raw

PATCH 1/1 net: add 'ethtoggle' environment variable

Quoted 15 lines · Wolfgang Denk
Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 5 lines · Matthias Fuchs

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

Quoted 5 lines

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.

Quoted 9 lines

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

#5 lore raw

PATCH 1/1 net: add 'ethtoggle' environment variable

In reply to Wolfgang Denk
Quoted 6 lines · On Wed, 09 Jan 2008 22:58:21 +0100 Wolfgang Denk <[email protected]> wrote:
Quoted 5 lines · In message <[email protected]> you wrote:
Quoted 4 lines · Matthias Fuchs

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

Quoted 9 lines
Quoted 4 lines

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

#6 lore raw

PATCH 1/1 net: add 'ethtoggle' environment variable

Quoted 23 lines · Kim Phillips
Quoted 9 lines · On Wed, 09 Jan 2008 22:58:21 +0100 Wolfgang Denk <[email protected]> wrote:
Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 5 lines · Matthias Fuchs

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

Quoted 10 lines
Quoted 5 lines

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

Quoted 8 lines

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

#7 lore raw

PATCH 1/1 net: add 'ethtoggle' environment variable

Quoted 5 lines · In message <[email protected]> you wrote:
Quoted 5 lines

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

...

Quoted 1 line

Getting better...

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

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

PATCH 1/1 net: add 'ethtoggle' environment variable

In reply to Ben Warren

What about 'ethrotate' or 'ethshift' ?

Matthias

Quoted 44 lines · Ben Warren
Quoted 23 lines · Kim Phillips
Quoted 9 lines · On Wed, 09 Jan 2008 22:58:21 +0100 Wolfgang Denk <[email protected]> wrote:
Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 5 lines · Matthias Fuchs

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

Quoted 10 lines
Quoted 5 lines

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

Quoted 8 lines

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

#9 lore raw

PATCH 1/1 net: add 'ethtoggle' environment variable

Quoted 4 lines · Matthias Fuchs

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

#10 lore raw

PATCH 1/1 net: add 'ethtoggle' environment variable

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

Matthias

#11 lore raw

PATCH 1/1 net: add 'ethtoggle' environment variable

In reply to Matthias Fuchs

Dear Ben,

in message <[email protected]>

Quoted 5 lines · Matthias Fuchs

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

But please edit the doc:

README Some configuration options can be set using Environment Variables: · line 2692

Quoted 11 lines
README +3 -0
index 9a8b3b9..9eac840 100644
@@ -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

Signature · 7 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
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
#12 lore raw

PATCH v2 1/1 net: add 'ethrotate' environment variable

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

---
 README    |    4 ++++
 net/net.c |   13 ++++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)
README +4 -0
index 9a8b3b9..9ca512d 100644
@@ -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
net/net.c +10 -3
index 44feee2..e1b71a9 100644
@@ -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;
Signature · 1 line
1.5.3
#13 lore raw

PATCH v2 1/1 net: add 'ethrotate' environment variable

Quoted 47 lines · Matthias Fuchs

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

---
 README    |    4 ++++
 net/net.c |   13 ++++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)
README +4 -0
index 9a8b3b9..9ca512d 100644
@@ -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
net/net.c +3 -3
index 44feee2..e1b71a9 100644
@@ -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
+
+	/*

net/net.c void NetStartAgain (void) · line 611

Quoted 10 lines
net/net.c +7 -0
+	 * 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

#14 lore raw

PATCH v2 1/1 net: add 'ethrotate' environment variable

In reply to Matthias Fuchs

Hi Matthias,

Quoted 47 lines · Matthias Fuchs

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

---
 README    |    4 ++++
 net/net.c |   13 ++++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)
README +4 -0
index 9a8b3b9..9ca512d 100644
@@ -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
net/net.c +3 -3
index 44feee2..e1b71a9 100644
@@ -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
+
+	/*

net/net.c void NetStartAgain (void) · line 611

Quoted 10 lines
net/net.c +7 -0
+	 * 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

#15 lore raw

PATCH v2 1/1 net: add 'ethrotate' environment variable

Hi Ben,

Quoted 11 lines · Ben Warren

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