On 12/06/2026 01:36, David Lechner wrote:
> Background:
> 
> While testing [1], I found that it would take down my local network if
> I left the command prompt open for more than 30 seconds after running
> any network command. The network activity light on the board running
> U-Boot would go crazy and other network adapters on the network would
> start getting watchdog timeouts. So apparently, it is doing something
> quite low-level and I don't have any hardware to sniff that (Wireshark
> on another computer was no help since all network adapters on the
> network stopped working.) So I took a logical approach of looking at
> the code to see if I could find anything that would cause this. This
> seemed to only happen after I switched from the legacy network
> implementation to the lwIP implementation, so I looked for differences
> between the two implementations.
> 
> After some investigation, I found that the lwIP implementation was
> different from the legacy implementation in that it does not call
> eth_halt() after a network command. Since the problem happened only
> when at the command prompt with no command running, this seemed like a
> likely culprit. And indeed, it does seem to fix the issue for me.
> 
> For reference, the legacy implementation does something like this
> as documented in doc/develop/driver-model/ethernet.rst:
> 
>       (some net operation (ping / tftp / whatever...))
>       eth_init()
>               ops->start()
>       eth_send()
>               ops->send()
>       eth_rx()
>               ops->recv()
>               (process packet)
>               if (ops->free_pkt)
>                       ops->free_pkt()
>       eth_halt()
>               ops->stop()
> 
> After this patch, the lwIP implementation will do the same thing for
> all ethernet commands.
> 
> [1]: 
> https://lore.kernel.org/u-boot/20260429-add-ethernet-support-for-genio-520-720-v4-0-be54e1723...@baylibre.com/
> 
> During review of v1, we noticed some existing bugs in wget_handle_request()
> so two new patches were added to fix those first before attempting the
> primary objective.
> 
> Signed-off-by: David Lechner <[email protected]>
> ---
> Changes in v3:
> - Fix a few minor issues in first commit message.
> - Use reference counting in the final patch.
> - Rework do_ping() implementation to work with reference counting.
> - Link to v2: 
> https://patch.msgid.link/20260512-net-lwip-add-stop-function-v2-0-85146da31...@baylibre.com
> 
> Changes in v2:
> - Added two new patches to address existing bugs in the code.
> - Don't remove eth_halt() before eth_init().
> - Link to v1: 
> https://patch.msgid.link/20260509-net-lwip-add-stop-function-v1-1-62d854bfa...@baylibre.com
> 
> To: Jerome Forissier <[email protected]>
> To: Tom Rini <[email protected]>
> To: Ilias Apalodimas <[email protected]>
> Cc: Julien Stephan <[email protected]>
> Cc: [email protected]
> 
> ---
> David Lechner (3):
>       net: lwip: wget: fix error handling in wget_do_request()
>       net: lwip: wget: return errno codes from wget_do_request()
>       net: lwip: introduce net_lwip_eth_stop() function
> 
>  cmd/lwip/ping.c     |  19 ++++++----
>  cmd/lwip/sntp.c     |  10 ++++-
>  include/net-lwip.h  |   1 +
>  net/lwip/dhcp.c     |  15 ++++++--
>  net/lwip/dns.c      |   7 +++-
>  net/lwip/net-lwip.c |  16 ++++++++
>  net/lwip/nfs.c      |   4 ++
>  net/lwip/tftp.c     |   4 ++
>  net/lwip/wget.c     | 107 
> ++++++++++++++++++++++++++++++----------------------
>  9 files changed, 122 insertions(+), 61 deletions(-)
> ---
> base-commit: 3cdce049f90d77c3f9221f1eb73922384c8972c3
> change-id: 20260509-net-lwip-add-stop-function-7f7794074844
> 
> Best regards,
> --  
> David Lechner <[email protected]>


Series applied to my net queue for master, thanks!

-- 
Jerome


Reply via email to