summaryrefslogtreecommitdiff
path: root/net/lwip/tftp.c
diff options
context:
space:
mode:
authorJerome Forissier <jerome.forissier@linaro.org>2025-01-30 09:22:20 +0100
committerTom Rini <trini@konsulko.com>2025-02-12 12:36:57 -0600
commit9f6b9f57fefa391018083c42bc3de9f33ea3bd90 (patch)
tree2d04510bcb9554b3a51026e4657a7964c84a8e05 /net/lwip/tftp.c
parent3da1864b1f2fc3cf2b4eaa1849bcafa669ff674c (diff)
net: lwip: move eth_init() out of new_netif()
Move the initialization of the ethernet devices out of the new_netif() function. Indeed, new_netif() accepts a struct device argument, which is expected to be valid and active. The activation and selection of this device are achieved by eth_init() (on first time the network stack is used) and eth_set_current(). This is what takes care of the ethrotate and ethact environment variables. Therefore, move these calls to a new function: net_lwip_set_current(), and use it whenever a net-lwip command is run. This patch hopefully fixes the incorrect net-lwip behavior observed on boards with multiple ethernet interfaces [1]. Tested on an i.MX8MPlus EVK equipped wih two ethernet ports. The dhcp command succeeds whether the cable is plugged into the first or second port. [1] https://lists.denx.de/pipermail/u-boot/2025-January/576326.html Reported-by: E Shattow <e@freeshell.de> Tested-by: E Shattow <e@freeshell.de> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Diffstat (limited to 'net/lwip/tftp.c')
-rw-r--r--net/lwip/tftp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/lwip/tftp.c b/net/lwip/tftp.c
index fc4aff5f2ba..123d66b5dba 100644
--- a/net/lwip/tftp.c
+++ b/net/lwip/tftp.c
@@ -280,7 +280,7 @@ int do_tftpb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
goto out;
}
- eth_set_current();
+ net_lwip_set_current();
if (tftp_loop(eth_get_dev(), laddr, fname, srvip, port) < 0)
ret = CMD_RET_FAILURE;