Skip to contentSkip to conversation

net: fix handling of 'ethrotate' environment variable

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

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: fix handling of 'ethrotate' environment variable

---
 net/eth.c |    9 +++++++++
 net/net.c |    9 +--------
 2 files changed, 10 insertions(+), 8 deletions(-)
net/eth.c +9 -0
index 5d9e9c1..d55fd7e 100644
@@ -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;
net/net.c +1 -8
index e1b71a9..522c54d 100644
@@ -581,7 +581,6 @@ void NetStartAgain (void)
 {
 	char *nretry;
 	int noretry = 0, once = 0;
-	char *ethrotate;
 
 	if ((nretry = getenv ("netretry")) != NULL) {
 		noretry = (strcmp (nretry, "no") == 0);
@@ -598,13 +597,7 @@ void NetStartAgain (void)
 #else	/* !CONFIG_NET_MULTI*/
 	eth_halt ();
 
-	/*
-	 * 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_try_another (!NetRestarted);
 
 	eth_init (gd->bd);
 	if (NetRestartWrap) {
Signature · 1 line
1.5.3
#1 lore raw

PATCH 1/1 net: fix handling of 'ethrotate' environment variable

Hi Matthias,

Quoted 44 lines · Matthias Fuchs
---
 net/eth.c |    9 +++++++++
 net/net.c |    9 +--------
 2 files changed, 10 insertions(+), 8 deletions(-)
net/eth.c +9 -0
index 5d9e9c1..d55fd7e 100644
@@ -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;
net/net.c +0 -2
index e1b71a9..522c54d 100644
@@ -581,7 +581,6 @@ void NetStartAgain (void)
 {
 	char *nretry;
 	int noretry = 0, once = 0;
-	char *ethrotate;
 
 	if ((nretry = getenv ("netretry")) != NULL) {
 		noretry = (strcmp (nretry, "no") == 0);
@@ -598,13 +597,7 @@ void NetStartAgain (void)
 #else	/* !CONFIG_NET_MULTI*/
 	eth_halt ();
 
-	/*

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

Quoted 10 lines
net/net.c +1 -6
-	 * 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_try_another (!NetRestarted);
 
 	eth_init (gd->bd);
 	if (NetRestartWrap) {

Sorry, but this patch implies application of the previous patch, which was rejected. Please re-base against TOT. I tried to patch things manually but it wasn't cooperating and I have other things I need to do.

regards,
Ben

#2 lore raw

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

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

---
 README    |    4 ++++
 net/eth.c |    9 +++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)
README +4 -0
index f2a4914..d9c2ee2 100644
@@ -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
net/eth.c +9 -0
index 5d9e9c1..d55fd7e 100644
@@ -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;
Signature · 1 line
1.5.3
#3 lore raw

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

Quoted 38 lines · Matthias Fuchs

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

---
 README    |    4 ++++
 net/eth.c |    9 +++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)
README +4 -0
index f2a4914..d9c2ee2 100644
@@ -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
net/eth.c +2 -0
index 5d9e9c1..d55fd7e 100644
@@ -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;
+

net/eth.c int eth_receive(volatile void *packet, int length) · line 536

Quoted 10 lines
net/eth.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))
+		return;
 
 	if (!eth_current)
 		return;

Excellent! Applied.

thanks,
Ben