net: lwip: call sys_check_timeouts and schedule on rx

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>
This commit is contained in:
Tim Harvey
2025-05-30 08:38:22 -07:00
committed by Jerome Forissier
parent b379335f14
commit 08a8d1455a
6 changed files with 7 additions and 5 deletions

View 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;

View 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;

View File

@@ -14,8 +14,10 @@
#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;

View 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;

View 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;

View 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;
}