Message ID | 1424822552-4366-11-git-send-email-joe.hershberger@ni.com |
---|---|
State | RFC |
Delegated to: | Simon Glass |
Headers | show |
Hi Joe, On 24 February 2015 at 17:02, Joe Hershberger <joe.hershberger@ni.com> wrote: > netretry previously would only retry in one specific case (your MAC > address is not set) and no other. This is basically useless. In the DM > implementation for eth it turns this into a completely useless case > since an un-configured MAC address results in not even entering the > NetLoop. The behavior is now changed to retry any failed command > (rotating through the eth adapters if ethrotate != no). > > It also defaulted to retry forever. It is now changed to default to not > retry That last bit seems like a big change. Does it mean that if I forget to plug in the Ethernet it might not recover? Regards, Simon
Hi Simon, On Sun, Mar 1, 2015 at 12:07 PM, Simon Glass <sjg@chromium.org> wrote: > > Hi Joe, > > On 24 February 2015 at 17:02, Joe Hershberger <joe.hershberger@ni.com> wrote: > > netretry previously would only retry in one specific case (your MAC > > address is not set) and no other. This is basically useless. In the DM > > implementation for eth it turns this into a completely useless case > > since an un-configured MAC address results in not even entering the > > NetLoop. The behavior is now changed to retry any failed command > > (rotating through the eth adapters if ethrotate != no). > > > > It also defaulted to retry forever. It is now changed to default to not > > retry > > That last bit seems like a big change. Does it mean that if I forget > to plug in the Ethernet it might not recover? It seems like it at face value, but this actually is far closer to maintaining existing behavior. As described in the first paragraph, only a missing MAC address would be retried. all other forms of failure (unplugged Ethernet, for instance) would just error out. This provides a way to retry if that is a behavior you want. Most times if you ping an address, for instance, you would expect your script to get a failure code, not for the ping to be attempted on a different interface (which would become the new default behavior without this env var default also changing).
Hi Joe, On 1 March 2015 at 14:53, Joe Hershberger <joe.hershberger@gmail.com> wrote: > Hi Simon, > > > On Sun, Mar 1, 2015 at 12:07 PM, Simon Glass <sjg@chromium.org> wrote: >> >> Hi Joe, >> >> On 24 February 2015 at 17:02, Joe Hershberger <joe.hershberger@ni.com> >> wrote: >> > netretry previously would only retry in one specific case (your MAC >> > address is not set) and no other. This is basically useless. In the DM >> > implementation for eth it turns this into a completely useless case >> > since an un-configured MAC address results in not even entering the >> > NetLoop. The behavior is now changed to retry any failed command >> > (rotating through the eth adapters if ethrotate != no). >> > >> > It also defaulted to retry forever. It is now changed to default to not >> > retry >> >> That last bit seems like a big change. Does it mean that if I forget >> to plug in the Ethernet it might not recover? > > It seems like it at face value, but this actually is far closer to > maintaining existing behavior. > > As described in the first paragraph, only a missing MAC address would be > retried. all other forms of failure (unplugged Ethernet, for instance) would > just error out. This provides a way to retry if that is a behavior you want. > Most times if you ping an address, for instance, you would expect your > script to get a failure code, not for the ping to be attempted on a > different interface (which would become the new default behavior without > this env var default also changing). Thanks for explaining this. Reviewed-by: Simon Glass <sjg@chromium.org> Regards, Simon
diff --git a/net/net.c b/net/net.c index e5ab07c..37b4aab 100644 --- a/net/net.c +++ b/net/net.c @@ -527,6 +527,8 @@ restart: (*x)(); } + if (net_state == NETLOOP_FAIL) + NetStartAgain(); switch (net_state) { @@ -602,8 +604,10 @@ void NetStartAgain(void) retrycnt = 1; else retrycnt = simple_strtoul(nretry, NULL, 0); - } else - retry_forever = 1; + } else { + retrycnt = 0; + retry_forever = 0; + } if ((!retry_forever) && (NetTryCount >= retrycnt)) { eth_halt();
netretry previously would only retry in one specific case (your MAC address is not set) and no other. This is basically useless. In the DM implementation for eth it turns this into a completely useless case since an un-configured MAC address results in not even entering the NetLoop. The behavior is now changed to retry any failed command (rotating through the eth adapters if ethrotate != no). It also defaulted to retry forever. It is now changed to default to not retry Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> --- Changes in v4: -New to v4 Changes in v3: None Changes in v2: None net/net.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)