-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[WIP] net/lwip: [EXPERIMENTAL] Add auxiliary lwIP stack for sim. #20160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
elokuucadiaN
wants to merge
1
commit into
apache:master
Choose a base branch
from
elokuucadiaN:lwip-sim-integration
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+125,349
−3
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| ==================== | ||
| Auxiliary lwIP Stack | ||
| ==================== | ||
|
|
||
| Overview | ||
| ======== | ||
|
|
||
| ``CONFIG_NET_LWIP`` builds lwIP 2.0.3 as an auxiliary TCP/IP stack alongside | ||
| the native NuttX network stack. It does not replace NuttX socket routing. | ||
| Applications select lwIP explicitly through its prefixed API, such as | ||
| ``lwip_socket()``, ``lwip_connect()``, and ``lwip_send()``. | ||
|
|
||
| The initial integration supports the simulator Ethernet driver. Both stacks | ||
| share the same simulated Ethernet device through an L2 tap. The lwIP | ||
| interface therefore uses ``10.0.1.3`` by default while the native NuttX | ||
| interface uses ``10.0.1.2``. | ||
|
|
||
| Configuration | ||
| ============= | ||
|
|
||
| Use the simulator configuration as a starting point:: | ||
|
|
||
| ./tools/configure.sh sim:lwip | ||
| make | ||
|
|
||
| The main options are under ``Networking Support -> lwIP Auxiliary Stack``. | ||
| DHCP is disabled by default because the native and auxiliary stacks share one | ||
| link. The static address, network mask, and gateway are derived from the | ||
| ``CONFIG_NETINIT_*`` values. | ||
|
|
||
| Initialization | ||
| ============== | ||
|
|
||
| Call ``nuttx_lwip_initialize()`` once from a long-lived initialization | ||
| context before using the lwIP API. The call is idempotent and creates the | ||
| lwIP TCP/IP and receive threads. In a protected or kernel build, place the | ||
| call in an equivalent persistent system service. | ||
|
|
||
| The lifetime requirement is important on NuttX: initializing from a | ||
| short-lived application associates the worker threads with that | ||
| application's task group, so they are reclaimed when the application exits. | ||
|
|
||
| Simulator Network | ||
| ================= | ||
|
|
||
| The simulator must have a TAP interface whose host address is | ||
| ``10.0.1.1/24``. Once the interface and a host receiver are ready, UDP and | ||
| TCP traffic can be sent from lwIP applications to the host. A continuous | ||
| test should run UDP, TCP, and throughput cases in the same NSH session; this | ||
| also verifies that the lwIP worker threads remain alive between application | ||
| invocations. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| # | ||
| # This file is autogenerated: PLEASE DO NOT EDIT IT. | ||
| # | ||
| CONFIG_ALLOW_BSD_COMPONENTS=y | ||
| CONFIG_ARCH="sim" | ||
| CONFIG_ARCH_BOARD="sim" | ||
| CONFIG_ARCH_BOARD_SIM=y | ||
| CONFIG_ARCH_CHIP="sim" | ||
| CONFIG_ARCH_SIM=y | ||
| CONFIG_BOARDCTL_POWEROFF=y | ||
| CONFIG_BUILTIN=y | ||
| CONFIG_DEBUG_FEATURES=y | ||
| CONFIG_DEBUG_NET=y | ||
| CONFIG_DEBUG_NET_ERROR=y | ||
| CONFIG_DEBUG_SYMBOLS=y | ||
| CONFIG_DEV_LOOP=y | ||
| CONFIG_DRIVERS_VIDEO=y | ||
| CONFIG_FS_BINFS=y | ||
| CONFIG_FS_HOSTFS=y | ||
| CONFIG_FS_PROCFS=y | ||
| CONFIG_FS_TMPFS=y | ||
| CONFIG_IDLETHREAD_STACKSIZE=2048 | ||
| CONFIG_INIT_ENTRYPOINT="nsh_main" | ||
| CONFIG_IOB_NBUFFERS=1024 | ||
| CONFIG_IOB_NCHAINS=128 | ||
| CONFIG_IOB_NOTIFIER=y | ||
| CONFIG_IOB_THROTTLE=16 | ||
| CONFIG_LIBC_EXECFUNCS=y | ||
| CONFIG_LIBC_FLOATINGPOINT=y | ||
| CONFIG_LIBC_LOCALE=y | ||
| CONFIG_LIBC_LOCALTIME=y | ||
| CONFIG_LIBC_MAX_EXITFUNS=1 | ||
| CONFIG_LIBM=y | ||
| CONFIG_MM_REGIONS=2 | ||
| CONFIG_MQ_MAXMSGSIZE=64 | ||
| CONFIG_NET=y | ||
| CONFIG_NETDEV_LATEINIT=y | ||
| CONFIG_NETDEV_PHY_IOCTL=y | ||
| CONFIG_NETDEV_STATISTICS=y | ||
| CONFIG_NETINIT_DRIPADDR=0x0a000101 | ||
| CONFIG_NETINIT_IPADDR=0x0a000102 | ||
| CONFIG_NET_BINDTODEVICE=y | ||
| CONFIG_NET_IPv6=y | ||
| CONFIG_NET_LOOPBACK=y | ||
| CONFIG_NET_LWIP=y | ||
| CONFIG_NET_PKT=y | ||
| CONFIG_NET_PKT_PREALLOC_CONNS=2 | ||
| CONFIG_NET_STATISTICS=y | ||
| CONFIG_NET_TCP_NO_STACK=y | ||
| CONFIG_NET_UDP_NO_STACK=y | ||
| CONFIG_NSH_ARCHINIT=y | ||
| CONFIG_NSH_BUILTIN_APPS=y | ||
| CONFIG_NSH_FILE_APPS=y | ||
| CONFIG_NSH_READLINE=y | ||
| CONFIG_PREALLOC_TIMERS=4 | ||
| CONFIG_PSEUDOFS_SOFTLINKS=y | ||
| CONFIG_PSEUDOTERM=y | ||
| CONFIG_PTHREAD_MUTEX_TYPES=y | ||
| CONFIG_READLINE_CMD_HISTORY=y | ||
| CONFIG_READLINE_TABCOMPLETION=y | ||
| CONFIG_SCHED_CHILD_STATUS=y | ||
| CONFIG_SCHED_HAVE_PARENT=y | ||
| CONFIG_SERIAL_TERMIOS=y | ||
| CONFIG_SIG_DEFAULT=y | ||
| CONFIG_SIG_EVTHREAD=y | ||
| CONFIG_SIM_NETDEV=y | ||
| CONFIG_STACK_COLORATION=y | ||
| CONFIG_SYSLOG_BUFFER=y | ||
| CONFIG_SYSLOG_CONSOLE=y | ||
| CONFIG_SYSLOG_TIMESTAMP=y | ||
| CONFIG_SYSTEM_NSH=y | ||
| CONFIG_SYSTEM_SYSTEM=y | ||
| CONFIG_SYSTEM_TIME64=y | ||
| CONFIG_TASK_NAME_SIZE=32 | ||
| CONFIG_TLS_NCLEANUP=2 | ||
| CONFIG_TTY_SIGINT=y | ||
| CONFIG_TTY_SIGINT_CHAR=0x3 | ||
| CONFIG_TTY_SIGTSTP=y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| if(CONFIG_NET_LWIP) | ||
| set(LWIP_BASE ${CMAKE_CURRENT_LIST_DIR}/lwip-2.0.3/src) | ||
|
|
||
| file(GLOB LWIP_CORE_SRCS | ||
| ${LWIP_BASE}/core/*.c | ||
| ${LWIP_BASE}/core/ipv4/*.c | ||
| ${LWIP_BASE}/api/*.c | ||
| ${LWIP_BASE}/netif/*.c) | ||
|
|
||
| if(CONFIG_NET_LWIP_IPV6) | ||
| file(GLOB LWIP_IPV6_SRCS ${LWIP_BASE}/core/ipv6/*.c) | ||
| list(APPEND LWIP_CORE_SRCS ${LWIP_IPV6_SRCS}) | ||
| endif() | ||
|
|
||
| target_sources(net PRIVATE | ||
| ${LWIP_CORE_SRCS} | ||
| ${CMAKE_CURRENT_LIST_DIR}/lwip_init.c | ||
| ${CMAKE_CURRENT_LIST_DIR}/sys_arch_nuttx.c | ||
| ${CMAKE_CURRENT_LIST_DIR}/ethernetif_nuttx.c | ||
| $<$<AND:$<BOOL:${CONFIG_ARCH_BOARD_SIM}>,$<BOOL:${CONFIG_NET_PKT}>>:${CMAKE_CURRENT_LIST_DIR}/lwip_pktif_sim.c>) | ||
|
|
||
| target_include_directories(net PRIVATE | ||
| ${CMAKE_CURRENT_LIST_DIR} | ||
| ${CMAKE_CURRENT_LIST_DIR}/lwip-2.0.3/src/include) | ||
| endif() |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not reuse sim_tapdev_xxx