diff mbox series

[U-Boot] net: explicitly assign errno to return code in case of network failure

Message ID 20181121145607.11469-1-thomas.rienoessl@bachmann.info
State Accepted
Commit a735e6e
Delegated to: Joe Hershberger
Headers show
Series [U-Boot] net: explicitly assign errno to return code in case of network failure | expand

Commit Message

Thomas RIENOESSL Nov. 21, 2018, 2:56 p.m. UTC
When dealing with two ethernet ports and having "netretry" set
to "once", it could occur that the connection (e.g. an ARP
request) failed, hence the status of the netloop was
"NETLOOP_FAIL". Due to the setting of "netretry", the network
logic would then switch to the other network interface,
assigning "ret" with the return value of "net_start_again()".
If this call succeeded we would return 0 (i.e. success) to
the caller when in reality the network action failed.

Change-Id: I58b935b0f6c7a300d1dd0058803f7d3c9455b0dc
Signed-off-by: Thomas RIENOESSL <thomas.rienoessl@bachmann.info>
---
 net/net.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Christian Gmeiner Nov. 27, 2018, 8:06 p.m. UTC | #1
Am Mi., 21. Nov. 2018 um 15:57 Uhr schrieb Thomas RIENOESSL
<thomas.rienoessl@bachmann.info>:
>
> When dealing with two ethernet ports and having "netretry" set
> to "once", it could occur that the connection (e.g. an ARP
> request) failed, hence the status of the netloop was
> "NETLOOP_FAIL". Due to the setting of "netretry", the network
> logic would then switch to the other network interface,
> assigning "ret" with the return value of "net_start_again()".
> If this call succeeded we would return 0 (i.e. success) to
> the caller when in reality the network action failed.
>
> Change-Id: I58b935b0f6c7a300d1dd0058803f7d3c9455b0dc
> Signed-off-by: Thomas RIENOESSL <thomas.rienoessl@bachmann.info>

Looks good - Gerrit change id should be removed before pushing this
patch.

Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>

> ---
>  net/net.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/net/net.c b/net/net.c
> index 31cf306ae7..568ba74f78 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -657,6 +657,7 @@ restart:
>                         /* Invalidate the last protocol */
>                         eth_set_last_protocol(BOOTP);
>                         debug_cond(DEBUG_INT_STATE, "--- net_loop Fail!\n");
> +                       ret = -ENONET;
>                         goto done;
>
>                 case NETLOOP_CONTINUE:
> --
> 2.19.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
Christian Gmeiner Dec. 12, 2018, 9:23 a.m. UTC | #2
Am Di., 27. Nov. 2018 um 21:06 Uhr schrieb Christian Gmeiner
<christian.gmeiner@gmail.com>:
>
> Am Mi., 21. Nov. 2018 um 15:57 Uhr schrieb Thomas RIENOESSL
> <thomas.rienoessl@bachmann.info>:
> >
> > When dealing with two ethernet ports and having "netretry" set
> > to "once", it could occur that the connection (e.g. an ARP
> > request) failed, hence the status of the netloop was
> > "NETLOOP_FAIL". Due to the setting of "netretry", the network
> > logic would then switch to the other network interface,
> > assigning "ret" with the return value of "net_start_again()".
> > If this call succeeded we would return 0 (i.e. success) to
> > the caller when in reality the network action failed.
> >
> > Change-Id: I58b935b0f6c7a300d1dd0058803f7d3c9455b0dc
> > Signed-off-by: Thomas RIENOESSL <thomas.rienoessl@bachmann.info>
>
> Looks good - Gerrit change id should be removed before pushing this
> patch.
>
> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
>

ping
Joe Hershberger Jan. 22, 2019, 9:42 p.m. UTC | #3
On Wed, Nov 21, 2018 at 8:57 AM Thomas RIENOESSL
<thomas.rienoessl@bachmann.info> wrote:
>
> When dealing with two ethernet ports and having "netretry" set
> to "once", it could occur that the connection (e.g. an ARP
> request) failed, hence the status of the netloop was
> "NETLOOP_FAIL". Due to the setting of "netretry", the network
> logic would then switch to the other network interface,
> assigning "ret" with the return value of "net_start_again()".
> If this call succeeded we would return 0 (i.e. success) to
> the caller when in reality the network action failed.
>
> Change-Id: I58b935b0f6c7a300d1dd0058803f7d3c9455b0dc
> Signed-off-by: Thomas RIENOESSL <thomas.rienoessl@bachmann.info>
> ---
>  net/net.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/net/net.c b/net/net.c
> index 31cf306ae7..568ba74f78 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -657,6 +657,7 @@ restart:
>                         /* Invalidate the last protocol */
>                         eth_set_last_protocol(BOOTP);
>                         debug_cond(DEBUG_INT_STATE, "--- net_loop Fail!\n");
> +                       ret = -ENONET;
>                         goto done;
>
>                 case NETLOOP_CONTINUE:

Apologies for the delay.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Joe Hershberger Jan. 24, 2019, 5:38 p.m. UTC | #4
Hi Thomas,

https://patchwork.ozlabs.org/patch/1001188/ 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 31cf306ae7..568ba74f78 100644
--- a/net/net.c
+++ b/net/net.c
@@ -657,6 +657,7 @@  restart:
 			/* Invalidate the last protocol */
 			eth_set_last_protocol(BOOTP);
 			debug_cond(DEBUG_INT_STATE, "--- net_loop Fail!\n");
+			ret = -ENONET;
 			goto done;
 
 		case NETLOOP_CONTINUE: