-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[RFC] Introduce the lwIP (lightweight IP) TCP/IP stack (branch: lwip4) #531
Open
jforissier
wants to merge
15
commits into
u-boot:master
Choose a base branch
from
jforissier:lwip4
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
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.
Conversation
This file contains 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
Prepare the introduction of the lwIP (lightweight IP) TCP/IP stack by adding a new net-lwip/ directory and the CONFIG_NET_LWIP symbol. At this point, enabling CONFIG_NET_LWIP simply disables CONFIG_NET. Subsequent commits will introduce the lwIP code, re-work the NETDEVICE integration and port some of the NET commands and features to lwIP. CONFIG_SPL_NET cannot be enabled when CONFIG_NET_LWIP=y. SPL_NET pulls some symbols that are part of NET (such as arp_init(), arp_timeout_check(), arp_receive(), net_arp_wait_packet_ip()). lwIP support in SPL may be added later. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Import the Lightweight IP (lwIP) library as lib/lwip. The code is built when CONFIG_NET_LWIP=y. The lwIP code was imported with the following commands: (cd /tmp && git clone https://git.savannah.gnu.org/git/lwip.git -b STABLE-2_2_0_RELEASE) mkdir -p lib/lwip cp -R /tmp/lwip/src/{api,core,include} lib/lwip/ mkdir -p lib/lwip/netif && cp /tmp/lwip/src/netif/ethernet.c lib/lwip/netif/ mkdir -p lib/lwip/apps/tftp && cp /tmp/lwip/src/apps/tftp/tftp.c lib/lwip/apps/tftp/ mkdir -p lib/lwip/apps/http && cp /tmp/lwip/src/apps/http/http_client.c lib/lwip/apps/http/ The list of object files added to lib/liwip/Makefile was given by: (cd lib/lwip && find . -name \*.c | sort | sed 's@\./@\t@' | sed 's/\.c$/.o \\/') >>lib/liwip/Makefile These files are adaptation layers written specially for U-Boot: lib/lwip/u-boot/arch/cc.h lib/lwip/u-boot/arch/sys_arch.h (empty) lib/lwip/u-boot/limits.h (empty) lib/lwip/u-boot/lwipopts.h They were initially contributed by Maxim in a previous RFC patch series. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Co-developed-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Add what it takes to enable CONFIG_NETDEVICES with CONFIG_NET_LWIP and enable DHCP as well as the dhcp command (CONFIG_CMD_DHCP_LWIP). - net-lwip/net-lwip.c is mostly empty for now. It will provide functions similar to net/net.c except based on the lwIP stack - include/net-lwip.h is a replacement for include/net.h which is unused when CONFIG_NET_LWIP is enabled. Declarations from the latter will be transferred to the former as needed when new network commands are ported on top of lwIP. - CONFIG_CMD_TFTPBOOT_LWIP is introduced due to CONFIG_BOOTMETH_EFI having an implicit dependency on do_tftpb(). Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Implement do_tftpb(). Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Add CONFIG_CMD_PING_LWIP depending on CONFIG_NET_LWIP to provide the ping command using lwIP. The implementation is derived from lwIP's contrib/apps/ping/ping.c. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Add CONFIG_CMD_DNS_LWIP depending on CONFIG_NET_LWIP to provide the dns command using lwIP. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Add CONFIG_CMD_WGET_LWIP depending on CONFIG_NET_LWIP to provide the wget command using the lightweight IP stack. About the small change in cmd/efidebug.c: when the wget command based on the lwIP stack is used (CONFIG_CMD_WGET_LWIP=y) the wget command has a built-in URL validation function since it needs to parse it anyways (in parse_url()). Therefore wget_validate_uri() doesn't exist. So, guard the call in efidebug.c with CONFIG_CMD_WGET. Based on code initially developed by Maxim U. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Co-developed-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Add support for "net list" and "net stats" to net-lwip/ by copying the code from cmd/net.c. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Implement the wget_with_dns() function which is needed by CONFIG_EFI_HTTP_BOOT=y. Note that there is no dependency added on CONFIG_CMD_DNS_LWIP because CONFIG_CMD_WGET_LWIP natively supports hostname resolution. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Some sandbox tests make strong assumptions on how the network stack is implemented. For example, the ping tests assume that ARP resolution occurs upon sending out the ICMP packet. This is not always the case with the lwIP stack which can cache ARP information. Therefore, disable these tests when CONFIG_NET_LWIP is enabled. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Support "bdinfo -e" when lwIP is selected. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
jforissier
force-pushed
the
lwip4
branch
3 times, most recently
from
May 7, 2024 22:32
9a19425
to
e5b64b8
Compare
Add qemu_arm64_lwip_defconfig which was created from qemu_arm64_defconfig with CONFIG_NET_LWIP enabled. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
jforissier
force-pushed
the
lwip4
branch
9 times, most recently
from
May 8, 2024 00:23
fb69837
to
70964ce
Compare
WHen NET_LWIP is enabled, the dhcp/ping/tftpboot commands are enabled via CMD_DHCP_LWIP, CMD_PING_LWIP and CMD_TFTPBOOT_LWIP, respectively; therefore the config annotations in the Python test scripts need to be cmd_dhcp_lwip, cmd_ping_lwip and cmd_tftpboot_lwip. The console output of the tftpboot command with lwIP is slightly different from the non-lwIP implementation. This is taken care of in test_net_tftpboot(). Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Add myself as a maintainer for the lwIP network stack integration code and network commands. The library code itself (i.e., most files under lib/lwip/ except README, Makefile and integration files in u-boot) is unmodified from upstream and therefore does not need a maintainer. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Build and run qemu_arm64_lwip_defconfig in CI. This tests the lightweight IP (lwIP) implementation of the dhcp, tftpboot and ping commands. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Supersedes #529.