[WIP] net/lwip: [EXPERIMENTAL] Add auxiliary lwIP stack for sim. - #20160
elokuucadiaN wants to merge 1 commit into
Conversation
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 but why do we need integrate lwip? nuttx has the native tcp/ip support. |
| @@ -1,5 +1,5 @@ | |||
| /**************************************************************************** | |||
| * arch/arm/src/stm32h5/stm32_mpuinit.c | |||
| * net/lwip/arch/cc.h | |||
There was a problem hiding this comment.
nuttx normally doesn't add the 3rd party source code into git directly
| const uint8_t *buf, | ||
| unsigned int len); | ||
|
|
||
| int sim_netdriver_l2tap_register(int devidx, |
There was a problem hiding this comment.
why not reuse sim_tapdev_xxx
|
@elokuucadiaN I think the question that @xiaoxiang781216 raised is valid: you forgot to explain "why?" I know that Samsung used lwIP because they thought that the default stack was slow; but in fact they were using the default network stack parameters that is tailored to fit on small devices, so buffers were minimum, fragmentation were huge, etc. Configuring the network stack correctly it is so fast as lwIP or even faster than lwIP. That said, I think having an option to use lwIP on NuttX is fine, the only problem is this: probably you will add it and disappear, so it will be "another baby" for our small community to take care :-) |
|
@elokuucadiaN suggestion: instead of close an open PR you can use "git rebase -i ..." and later "git push -f" |
Supersedes #20159, which GitHub closed automatically when the source branch was renamed.
Summary
net/lwip/lwip-2.0.3/COPYING.sys_archport, Ethernet link adapter, and a raw L2 tap for the simulator network driver. Applications select the prefixedlwip_*API; native NuttX socket routing is unchanged.sim:lwipconfiguration and documentation, including the requirement to initialize lwIP from a long-lived context.nuttx-appsprograms that are not included in this NuttX PR; there is no dependent apps PR.Impact
CONFIG_NET_LWIP, currently limited toARCH_BOARD_SIM && NET_PKT.lwip_*API and initialize the auxiliary stack in a persistent context.sim:lwipconfiguration; no default configuration is changed.Documentation/components/net/lwip.rstis included.Testing
Build host: WSL2 Ubuntu 22.04, x86_64, GCC 11.4.0.
Target:
sim:lwip, NuttX master basebc116157329946d2f7e6c82eb4b2d82009a41ebb; fresh export from the staged Git tree,make olddefconfig && make -j8completed successfully.Local test setup:
BOARDCTL_FINALINITdisabled and the three local test programs enabled only in the isolated build configuration. The local NSH test harness callsnuttx_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:NuttX
nxstylecompleted with no diagnostics for the ten NuttX-written/modified C and header files. The complete vendored lwIP tree is preserved verbatim;git diff --checkreports 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