Skip to content

[WIP] net/lwip: [EXPERIMENTAL] Add auxiliary lwIP stack for sim. - #20159

Closed
elokuucadiaN wants to merge 1 commit into
apache:masterfrom
elokuucadiaN:codex/lwip-gennuttx
Closed

elokuucadiaN wants to merge 1 commit into
apache:masterfrom
elokuucadiaN:codex/lwip-gennuttx

Conversation

@elokuucadiaN

Copy link
Copy Markdown

Summary

  • Add the complete lwIP 2.0.3 source tree as an optional auxiliary stack. Its BSD license is retained in net/lwip/lwip-2.0.3/COPYING.
  • Add the NuttX sys_arch port, Ethernet link adapter, and a raw L2 tap for the simulator network driver. Applications select the prefixed lwip_* API; native NuttX socket routing is unchanged.
  • Add sim:lwip configuration and documentation, including the requirement to initialize lwIP from a long-lived context.
  • This initial integration is simulator-only and experimental. The tests use three local nuttx-apps programs that are not included in this NuttX PR; there is no dependent apps PR.

Impact

  • New feature: Yes, behind CONFIG_NET_LWIP, currently limited to ARCH_BOARD_SIM && NET_PKT.
  • Existing users and compatibility: No change when the option is disabled. With the option enabled, applications must explicitly use the lwip_* API and initialize the auxiliary stack in a persistent context.
  • Build: Adds the optional lwIP sources and sim:lwip configuration; no default configuration is changed.
  • Hardware: Simulator Ethernet only. No physical board or hardware driver is changed.
  • Documentation: Documentation/components/net/lwip.rst is included.
  • Security: A second TCP/IP stack and raw link-layer tap increase the enabled build's network attack surface; this experimental option is disabled by default.

Testing

  • Build host: WSL2 Ubuntu 22.04, x86_64, GCC 11.4.0.

  • Target: sim:lwip, NuttX master base bc116157329946d2f7e6c82eb4b2d82009a41ebb; fresh export from the staged Git tree, make olddefconfig && make -j8 completed successfully.

  • Local test setup: BOARDCTL_FINALINIT disabled and the three local test programs enabled only in the isolated build configuration. The local NSH test harness calls nuttx_lwip_initialize() from its persistent context. These test-only apps and configuration changes are not included in this PR.

  • Runtime: Within one NSH session over a TAP interface (10.0.1.1/24), the host receiver logged:

    UDP ('10.0.1.3', 49153): 16 bytes, b'hello from lwip\n'
    TCP ('10.0.1.3', 49153): b'hello from lwip tcp\n'
    TCP ('10.0.1.3', 49153): received 20 bytes in 1.009 s
    TCP ('10.0.1.3', 49154): received 67108864 bytes in 4.697 s
    tcpbench: total=67108864 bytes time=4.696763 sec throughput=114.307 Mbps
    
  • NuttX nxstyle completed with no diagnostics for the ten NuttX-written/modified C and header files. The complete vendored lwIP tree is preserved verbatim; git diff --check reports pre-existing trailing whitespace in third-party files.

  • No physical hardware runtime result is available: the current link adapter only supports sim. This is a draft for architecture and scope discussion, not a request to merge without meeting the project's testing requirements.

PR verification self-check

  • One functional change: optional auxiliary lwIP integration.
  • Required scope, impact, testing limitations, and documentation described.
  • All contribution requirements are satisfied; hardware testing and third-party lint disposition remain open.
  • Work in progress; keep this PR as a draft.
  • Ready for review and merge.

Integrate the complete lwIP 2.0.3 source tree as an optional stack alongside
NuttX networking. Add a NuttX sys_arch port, an Ethernet adapter, and a
simulator L2 tap so applications can explicitly use the lwip_* socket API
without replacing native NuttX socket routing.

Provide sim:lwip configuration and documentation for setup and the required
long-lived initialization context. The implementation is currently limited
to the simulator Ethernet driver and remains experimental.

Verified with a clean WSL2 Ubuntu 22.04 / GCC 11.4.0 sim:lwip build. In one
simulator session, UDP delivered 16 bytes, TCP delivered 20 bytes, and a
TCP transfer delivered 67108864 bytes in 4.697 seconds. Test applications
are maintained outside this NuttX change.

Assisted-by: Codex:gpt-5
Assisted-by: Codex:gpt-5.6-sol
Signed-off-by: 21c <2022685682@qq.com>
@elokuucadiaN

Copy link
Copy Markdown
Author

Superseded by #20160 after renaming the source branch. The signed commit and test scope are unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant