diff mbox series

[U-Boot] net: Fix netretry condition

Message ID CAGdPep8uzTKiP55-j67e_6GbgRktFXvGf0HtFvrqQUPD6KTMOA@mail.gmail.com
State Accepted
Commit 17d413b
Delegated to: Joe Hershberger
Headers show
Series [U-Boot] net: Fix netretry condition | expand

Commit Message

Leonid Iziumtsev March 9, 2018, 2:29 p.m. UTC
The "net_try_count" counter starts from "1".
And the "retrycnt" contains requested amount of retries.

With current logic, that means that the actual retry amount
will be one time less then what we set in "netretry" env.
For example setting "netretry" to "once" will make "retrycnt"
equal "1", so no retries will be triggered at all.

Fix the logic by changing the statement of "if" condition.

Signed-off-by: Leonid Iziumtsev <leonid.iziumtsev@se.atlascopco.com>
---
 net/net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Joe Hershberger March 19, 2018, 9:01 p.m. UTC | #1
On Fri, Mar 9, 2018 at 8:29 AM, Leonid Iziumtsev
<leonid.iziumtsev@gmail.com> wrote:
> The "net_try_count" counter starts from "1".
> And the "retrycnt" contains requested amount of retries.
>
> With current logic, that means that the actual retry amount
> will be one time less then what we set in "netretry" env.
> For example setting "netretry" to "once" will make "retrycnt"
> equal "1", so no retries will be triggered at all.
>
> Fix the logic by changing the statement of "if" condition.
>
> Signed-off-by: Leonid Iziumtsev <leonid.iziumtsev@se.atlascopco.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Joe Hershberger March 26, 2018, 7:26 p.m. UTC | #2
Hi Leonid,

https://patchwork.ozlabs.org/patch/883696/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe
diff mbox series

Patch

diff --git a/net/net.c b/net/net.c
index 4259c9e..8a9b69c 100644
--- a/net/net.c
+++ b/net/net.c
@@ -683,7 +683,7 @@  int net_start_again(void)
                retry_forever = 0;
        }

-       if ((!retry_forever) && (net_try_count >= retrycnt)) {
+       if ((!retry_forever) && (net_try_count > retrycnt)) {
                eth_halt();
                net_set_state(NETLOOP_FAIL);
                /*