]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
net: lwip: call sys_check_timeouts and schedule on rx
authorTim Harvey <tharvey@gateworks.com>
Fri, 30 May 2025 15:38:22 +0000 (08:38 -0700)
committerJerome Forissier <jerome.forissier@linaro.org>
Tue, 8 Jul 2025 07:53:59 +0000 (09:53 +0200)
Call schedule() in net_lwip_rx() to service U-Boot tasks and
actions during packet rx.

As a cleanup also move sys_check_timeouts() here and remove it from the
functions that call net_lwip_rx().

This resolves the issue of an active watchdog resetting the board on
long network activities.

Suggested-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
net/lwip/dhcp.c
net/lwip/dns.c
net/lwip/net-lwip.c
net/lwip/ping.c
net/lwip/tftp.c
net/lwip/wget.c

index 043d2ab6e946e15737a6c321c6d157cb9771efce..4c9cb0ecaa0743eeb8c85a520df381e8cbe757c3 100644 (file)
@@ -58,7 +58,6 @@ static int dhcp_loop(struct udevice *udev)
        /* Wait for DHCP to complete */
        do {
                net_lwip_rx(udev, netif);
-               sys_check_timeouts();
                bound = dhcp_supplied_address(netif);
                if (bound)
                        break;
index 6862869d9e30ce33bfc7c667c782c0f33788190a..3c9867902db953a239f086881bef84c1abf5bec1 100644 (file)
@@ -92,7 +92,6 @@ static int dns_loop(struct udevice *udev, const char *name, const char *var)
                        net_lwip_rx(udev, netif);
                        if (dns_cb_arg.done)
                                break;
-                       sys_check_timeouts();
                        if (ctrlc()) {
                                printf("\nAbort\n");
                                break;
index abc52b32049cdd186657b625f9d1b155dcdda520..ff4d634d1d14317db0aa79a0dd4b3d86db34d160 100644 (file)
 #include <lwip/etharp.h>
 #include <lwip/init.h>
 #include <lwip/prot/etharp.h>
+#include <lwip/timeouts.h>
 #include <net.h>
 #include <timer.h>
+#include <u-boot/schedule.h>
 
 /* xx:xx:xx:xx:xx:xx\0 */
 #define MAC_ADDR_STRLEN 18
@@ -285,6 +287,11 @@ int net_lwip_rx(struct udevice *udev, struct netif *netif)
        int len;
        int i;
 
+       /* lwIP timers */
+       sys_check_timeouts();
+       /* Other tasks and actions */
+       schedule();
+
        if (!eth_is_active(udev))
                return -EINVAL;
 
index d8042ceecf998cdf364a6ee43e6dba59785ebd8e..1390b914f7d8ad9d5a5e85131d05e214faa0d16c 100644 (file)
@@ -136,7 +136,6 @@ static int ping_loop(struct udevice *udev, const ip_addr_t *addr)
        ping_send(&ctx);
 
        do {
-               sys_check_timeouts();
                net_lwip_rx(udev, netif);
                if (ctx.alive)
                        break;
index b7eb486ef77cb10ef0fd1f326f6bf13a39b6b6e3..279145227224559255b4245cf1490485c6d69b39 100644 (file)
@@ -201,7 +201,6 @@ static int tftp_loop(struct udevice *udev, ulong addr, char *fname,
        sys_timeout(NO_RSP_TIMEOUT_MS, no_response, &ctx);
        while (!ctx.done) {
                net_lwip_rx(udev, netif);
-               sys_check_timeouts();
                if (ctrlc()) {
                        printf("\nAbort\n");
                        ctx.done = ABORTED;
index f4fd97182855aa3f018060ded9fdba0e8bef8fbe..3c39a1b59a695b36eefeff451982456d4f5a130f 100644 (file)
@@ -526,7 +526,6 @@ int wget_do_request(ulong dst_addr, char *uri)
 
        while (!ctx.done) {
                net_lwip_rx(udev, netif);
-               sys_check_timeouts();
                if (ctrlc())
                        break;
        }