| Message ID | 20260901-submit-lwip-runtime-netconsole-v1-v2-0-3e3d95627cf9@gmail.com |
|---|---|
| Headers | show |
| Series | net: share the lwIP runtime and support netconsole | expand |
Hi James, On 01/09/2026 19:08, James Hilliard wrote: > lwIP commands currently create and remove the stack's only network > interface for each operation. That model cannot support a persistent > client: starting another command replaces its interface, and either > client can stop Ethernet while the other still owns callbacks and PCBs. > > First correct wget's existing receive-error path to return ERR_ABRT after > it aborts and frees the TCP PCB. > > Introduce a reference-counted runtime which owns one Ethernet device and > one lwIP netif. Clients retain their own protocol callbacks and PCBs, > while one non-reentrant poll entry point services timers, scheduled work > and every attached client. Clients declare whether the IPv4 configuration > must remain stable. An address-less DHCP attachment can coexist only with > flexible clients such as netconsole; environment addressing is restored > when DHCP detaches. > > Migrate the existing lwIP commands to the runtime, then add an lwIP > netconsole transport. Netconsole remains attached while a foreground > network command runs, and that command's polling services both protocols. > > The runtime permits independent lwIP clients to attach their protocol > state and share the poll loop without creating another netif or Ethernet > owner. > > Sharing the stack makes asynchronous teardown significant. Add DNS > callback cancellation, HTTP client abort and DHCP stop-without-release > operations so clients can detach without leaving callbacks or protocol > state behind. The corresponding vendored lwIP changes are kept as > separate patches for upstream submission. > > Validation included: > > - sandbox W=1 builds and DM tests for runtime ownership, multiple UDP > PCBs, address handoff, callback cancellation, immediate abort of an > established HTTP connection, nested polling and netconsole > input/output; > - no-DNS, sandbox_spl, sandbox64_lwIP, qemu_arm64_lwIP and legacy-stack > builds; and > - H616 hardware tests of bidirectional netconsole, a TFTP download while > netconsole remained active, TFTP upload and HTTP wget, with matching > payload checksums and successful network use after netconsole detached. > > Assisted-by: Codex:gpt-5.6-sol > Signed-off-by: James Hilliard <james.hilliard1@gmail.com> > --- > checkpatch reports expected diagnostics for patches 5-7 because vendored > lwIP code follows upstream lwIP formatting. It also reports generic > MAINTAINERS prompts for files already covered by drivers/net/ and test/dm/, > and preprocessor guards required when optional APIs are not declared. > > --- > Changes in v2: > - Add strict and flexible address modes so DHCP cannot disrupt active > protocol clients (suggested by Jerome Forissier) > - Prevent environment refreshes from readdressing a strict client > - Test both ownership-conflict directions and strict address stability > - Link to v1: https://patch.msgid.link/20260825-submit-lwip-runtime-netconsole-v1-v1-0-0892966aa758@gmail.com > > To: Jerome Forissier <jerome.forissier@arm.com> > To: Sughosh Ganu <sughosh.ganu@arm.com> > To: u-boot@lists.u-boot-project.org > Cc: Tom Rini <trini@konsulko.com> > Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> > Cc: David Lechner <dlechner@baylibre.com> > Cc: James Hilliard <james.hilliard1@gmail.com> > Cc: Julien Stephan <jstephan@baylibre.com> > Cc: Naveen Kumar Chaudhary <naveen.osdev@gmail.com> > Cc: Luca Jones <ljones@t0.technology> > Cc: Weijie Gao <weijie.gao@mediatek.com> > Cc: Pranav Tilak <pranav.vinaytilak@amd.com> > Cc: Simon Glass <sjg@chromium.org> > Cc: Vincent Jardin <vjardin@free.fr> > Cc: Quentin Schulz <quentin.schulz@cherry.de> > Cc: "Lucien.Jheng" <lucienzx159@gmail.com> > Cc: Mateusz Furdyna <mateusz.furdyna@nokia.com> > > --- > James Hilliard (10): > net: lwip: return ERR_ABRT after aborting wget receive > net: split netconsole transport from stdio frontend > net: netconsole: use unsigned port numbers > net: netconsole: cache environment settings > net: lwip: allow DNS callbacks to be canceled > net: lwip: add an HTTP client abort operation > net: lwip: allow DHCP to stop without releasing its lease > net: lwip: share one network runtime between clients > test: dm: cover the shared lwIP runtime > net: netconsole: add an lwIP transport > > cmd/lwip/ping.c | 41 +-- > cmd/lwip/sntp.c | 19 +- > drivers/net/Makefile | 6 +- > drivers/net/netconsole-legacy.c | 156 +++++++++ > drivers/net/netconsole-lwip.c | 200 ++++++++++++ > drivers/net/netconsole.c | 201 +++--------- > drivers/net/netconsole.h | 29 ++ > include/net-lwip.h | 48 ++- > lib/lwip/lwip/src/apps/http/http_client.c | 71 +++- > lib/lwip/lwip/src/apps/sntp/sntp.c | 3 + > lib/lwip/lwip/src/core/dns.c | 26 ++ > lib/lwip/lwip/src/core/ipv4/dhcp.c | 39 ++- > lib/lwip/lwip/src/include/lwip/apps/http_client.h | 1 + > lib/lwip/lwip/src/include/lwip/dhcp.h | 1 + > lib/lwip/lwip/src/include/lwip/dns.h | 1 + > net/Kconfig | 13 +- > net/lwip/dhcp.c | 57 ++-- > net/lwip/dns.c | 24 +- > net/lwip/net-lwip.c | 270 +++++++++++++--- > net/lwip/nfs.c | 25 +- > net/lwip/tftp.c | 54 ++-- > net/lwip/wget.c | 72 +++-- > test/dm/Makefile | 6 + > test/dm/lwip.c | 375 ++++++++++++++++++++++ > test/dm/netconsole.c | 344 ++++++++++++++++++++ > 25 files changed, 1697 insertions(+), 385 deletions(-) > --- > base-commit: 3f19667468fb93bcb5702d23aa057b72639e3ac8 > change-id: 20260825-submit-lwip-runtime-netconsole-v1-9c08ed87e0fe > > Best regards, > -- > James Hilliard <james.hilliard1@gmail.com> For the series: Reviewed-by: Jerome Forissier <jerome.forissier@arm.com> I’ll apply this to for-next, likely tomorrow or on Monday. I’ve just moved house, and the machine I use for U-Boot work isn’t connected to the Internet yet ;-) Thanks,
On Tue, 01 Sep 2026 11:08:54 -0600, James Hilliard wrote: > lwIP commands currently create and remove the stack's only network > interface for each operation. That model cannot support a persistent > client: starting another command replaces its interface, and either > client can stop Ethernet while the other still owns callbacks and PCBs. > > First correct wget's existing receive-error path to return ERR_ABRT after > it aborts and frees the TCP PCB. > > [...] Applied to u-boot-net branch for-main, thanks! [01/10] net: lwip: return ERR_ABRT after aborting wget receive commit: 2f70f7c47d030f6e8d8960b725796e45a3915861 [02/10] net: split netconsole transport from stdio frontend commit: 6c0aebd461ac94988de4add5f2bcd498c911224c [03/10] net: netconsole: use unsigned port numbers commit: bcace2c606c6d8221f4b0f02d5ea2a14ec95a95f [04/10] net: netconsole: cache environment settings commit: 747a0df405deb14cab6c02be7c4493cd61d623c0 [05/10] net: lwip: allow DNS callbacks to be canceled commit: e1d4eb289f82a6438ac26992c5c037bee66b0fc0 [06/10] net: lwip: add an HTTP client abort operation commit: cc4309d0e4fcbacd7ed924d1fcfe61469a34622e [07/10] net: lwip: allow DHCP to stop without releasing its lease commit: 64edae73598573bf155a5d0272d0be6b105cee3f [08/10] net: lwip: share one network runtime between clients commit: 13743b71c7ac38f5797da255290beec4e262b5c0 [09/10] test: dm: cover the shared lwIP runtime commit: d91b7ed95315863cb68db071044dd6b6ada881e3 [10/10] net: netconsole: add an lwIP transport commit: 8e9f06c299ab84beff7b8232893aecffbb7e0905 Best regards,
lwIP commands currently create and remove the stack's only network interface for each operation. That model cannot support a persistent client: starting another command replaces its interface, and either client can stop Ethernet while the other still owns callbacks and PCBs. First correct wget's existing receive-error path to return ERR_ABRT after it aborts and frees the TCP PCB. Introduce a reference-counted runtime which owns one Ethernet device and one lwIP netif. Clients retain their own protocol callbacks and PCBs, while one non-reentrant poll entry point services timers, scheduled work and every attached client. Clients declare whether the IPv4 configuration must remain stable. An address-less DHCP attachment can coexist only with flexible clients such as netconsole; environment addressing is restored when DHCP detaches. Migrate the existing lwIP commands to the runtime, then add an lwIP netconsole transport. Netconsole remains attached while a foreground network command runs, and that command's polling services both protocols. The runtime permits independent lwIP clients to attach their protocol state and share the poll loop without creating another netif or Ethernet owner. Sharing the stack makes asynchronous teardown significant. Add DNS callback cancellation, HTTP client abort and DHCP stop-without-release operations so clients can detach without leaving callbacks or protocol state behind. The corresponding vendored lwIP changes are kept as separate patches for upstream submission. Validation included: - sandbox W=1 builds and DM tests for runtime ownership, multiple UDP PCBs, address handoff, callback cancellation, immediate abort of an established HTTP connection, nested polling and netconsole input/output; - no-DNS, sandbox_spl, sandbox64_lwIP, qemu_arm64_lwIP and legacy-stack builds; and - H616 hardware tests of bidirectional netconsole, a TFTP download while netconsole remained active, TFTP upload and HTTP wget, with matching payload checksums and successful network use after netconsole detached. Assisted-by: Codex:gpt-5.6-sol Signed-off-by: James Hilliard <james.hilliard1@gmail.com> --- checkpatch reports expected diagnostics for patches 5-7 because vendored lwIP code follows upstream lwIP formatting. It also reports generic MAINTAINERS prompts for files already covered by drivers/net/ and test/dm/, and preprocessor guards required when optional APIs are not declared. --- Changes in v2: - Add strict and flexible address modes so DHCP cannot disrupt active protocol clients (suggested by Jerome Forissier) - Prevent environment refreshes from readdressing a strict client - Test both ownership-conflict directions and strict address stability - Link to v1: https://patch.msgid.link/20260825-submit-lwip-runtime-netconsole-v1-v1-0-0892966aa758@gmail.com To: Jerome Forissier <jerome.forissier@arm.com> To: Sughosh Ganu <sughosh.ganu@arm.com> To: u-boot@lists.u-boot-project.org Cc: Tom Rini <trini@konsulko.com> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de> Cc: David Lechner <dlechner@baylibre.com> Cc: James Hilliard <james.hilliard1@gmail.com> Cc: Julien Stephan <jstephan@baylibre.com> Cc: Naveen Kumar Chaudhary <naveen.osdev@gmail.com> Cc: Luca Jones <ljones@t0.technology> Cc: Weijie Gao <weijie.gao@mediatek.com> Cc: Pranav Tilak <pranav.vinaytilak@amd.com> Cc: Simon Glass <sjg@chromium.org> Cc: Vincent Jardin <vjardin@free.fr> Cc: Quentin Schulz <quentin.schulz@cherry.de> Cc: "Lucien.Jheng" <lucienzx159@gmail.com> Cc: Mateusz Furdyna <mateusz.furdyna@nokia.com> --- James Hilliard (10): net: lwip: return ERR_ABRT after aborting wget receive net: split netconsole transport from stdio frontend net: netconsole: use unsigned port numbers net: netconsole: cache environment settings net: lwip: allow DNS callbacks to be canceled net: lwip: add an HTTP client abort operation net: lwip: allow DHCP to stop without releasing its lease net: lwip: share one network runtime between clients test: dm: cover the shared lwIP runtime net: netconsole: add an lwIP transport cmd/lwip/ping.c | 41 +-- cmd/lwip/sntp.c | 19 +- drivers/net/Makefile | 6 +- drivers/net/netconsole-legacy.c | 156 +++++++++ drivers/net/netconsole-lwip.c | 200 ++++++++++++ drivers/net/netconsole.c | 201 +++--------- drivers/net/netconsole.h | 29 ++ include/net-lwip.h | 48 ++- lib/lwip/lwip/src/apps/http/http_client.c | 71 +++- lib/lwip/lwip/src/apps/sntp/sntp.c | 3 + lib/lwip/lwip/src/core/dns.c | 26 ++ lib/lwip/lwip/src/core/ipv4/dhcp.c | 39 ++- lib/lwip/lwip/src/include/lwip/apps/http_client.h | 1 + lib/lwip/lwip/src/include/lwip/dhcp.h | 1 + lib/lwip/lwip/src/include/lwip/dns.h | 1 + net/Kconfig | 13 +- net/lwip/dhcp.c | 57 ++-- net/lwip/dns.c | 24 +- net/lwip/net-lwip.c | 270 +++++++++++++--- net/lwip/nfs.c | 25 +- net/lwip/tftp.c | 54 ++-- net/lwip/wget.c | 72 +++-- test/dm/Makefile | 6 + test/dm/lwip.c | 375 ++++++++++++++++++++++ test/dm/netconsole.c | 344 ++++++++++++++++++++ 25 files changed, 1697 insertions(+), 385 deletions(-) --- base-commit: 3f19667468fb93bcb5702d23aa057b72639e3ac8 change-id: 20260825-submit-lwip-runtime-netconsole-v1-9c08ed87e0fe Best regards, -- James Hilliard <james.hilliard1@gmail.com>