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 <[email protected]> > --- > 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-0892966aa...@gmail.com > > To: Jerome Forissier <[email protected]> > To: Sughosh Ganu <[email protected]> > To: [email protected] > Cc: Tom Rini <[email protected]> > Cc: Heinrich Schuchardt <[email protected]> > Cc: David Lechner <[email protected]> > Cc: James Hilliard <[email protected]> > Cc: Julien Stephan <[email protected]> > Cc: Naveen Kumar Chaudhary <[email protected]> > Cc: Luca Jones <[email protected]> > Cc: Weijie Gao <[email protected]> > Cc: Pranav Tilak <[email protected]> > Cc: Simon Glass <[email protected]> > Cc: Vincent Jardin <[email protected]> > Cc: Quentin Schulz <[email protected]> > Cc: "Lucien.Jheng" <[email protected]> > Cc: Mateusz Furdyna <[email protected]> > > --- > 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 <[email protected]>
For the series: Reviewed-by: Jerome Forissier <[email protected]> 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, -- Jerome
