public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH V2] net: add 'ethrotate' environment variable
  2008-01-09 21:51 [U-Boot-Users] [PATCH] net: add 'ethtoggle' " 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; 8+ 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] 8+ 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; 8+ 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] 8+ 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; 8+ 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] 8+ 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; 8+ 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] 8+ messages in thread

* [U-Boot-Users] [PATCH] net: fix handling of 'ethrotate' environment variable
@ 2008-01-16 11:32 Matthias Fuchs
  2008-01-16 22:35 ` Ben Warren
  0 siblings, 1 reply; 8+ messages in thread
From: Matthias Fuchs @ 2008-01-16 11:32 UTC (permalink / raw)
  To: u-boot

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

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;
diff --git a/net/net.c b/net/net.c
index e1b71a9..522c54d 100644
--- a/net/net.c
+++ b/net/net.c
@@ -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) {
-- 
1.5.3

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

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

Hi Matthias,

Matthias Fuchs wrote:
> Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
> ---
>  net/eth.c |    9 +++++++++
>  net/net.c |    9 +--------
>  2 files changed, 10 insertions(+), 8 deletions(-)
>
> 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;
> diff --git a/net/net.c b/net/net.c
> index e1b71a9..522c54d 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -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) {
>   
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

^ permalink raw reply	[flat|nested] 8+ 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; 8+ 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] 8+ 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; 8+ 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] 8+ messages in thread

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

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-16 11:32 [U-Boot-Users] [PATCH] net: fix handling of 'ethrotate' environment variable 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
  -- strict thread matches above, loose matches on Subject: below --
2008-01-09 21:51 [U-Boot-Users] [PATCH] net: add 'ethtoggle' " 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

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