[PATCH v2 00/14] Introduce the lwIP network stack
Jerome Forissier
jerome.forissier at linaro.org
Fri May 24 18:19:54 CEST 2024
This is a rework of a patch series by Maxim Uvarov: "net/lwip: add lwip
library for the network stack" [1]. The goal is to introduce the lwIP TCP/IP
stack [2] [3] as an alternative to the current implementation in net/,
selectable with Kconfig, and ultimately keep only lwIP if possible. Some
reasons for doing so are:
- Make the support of HTTPS in the wget command easier. Javier T. (CC'd)
has some additional lwIP and Mbed TLS patches to do so. With that it
becomes possible to fetch and launch a distro installer such as Debian
etc. directly from the U-Boot shell.
- Possibly benefit from additional features implemented in lwIP
- Less code to maintain in U-Boot
The first patch introduces a new Kconfig symbol: NET_LWIP, which selects
the lwIP implementation instead of the current one (NET). Contrary to the
approach chosen by Maxim in [1], NET_LWIP and NET cannot be enabled
simultaneously. The rationale is we want to start from a clean state and
not pull potentially duplicated functionality from both stacks. Note
however that a few files are still built in net/, they are the ones
related to ethernet device management and the ethernet bootflow.
The second patch imports the lwIP code as a Git subtree under
lib/lwip/lwip. Some glue code is added under lib/lwip/u-boot.
The third patch introduces the Makefile to build lwIP when
CONFIG_NET_LWIP=y.
The subsequent patches implement various network-oriented commands and
features: dhcp, dns, ping, tftpboot, wget.
NET_LWIP is not enabled by default because it lacks functionality compared
to NET and many CI tests would fail to run or even build.
Some tests (dm dsa/eth) are disabled when NET_LWIP is selected because
they make strong assumptions on how the network stack is implemented and
how the packet flow occurs. For example, an ARP exchange is expected
when an ICMP packet goes out, but with lwIP no exchange will occur if the
host IP is already in the the ARP cache.
Due to the above and in order to provide some level of testing, a new QEMU
configuration is introduced (qemu_arm64_lwip_defconfig) which is the same
as qemu_arm64_lwip_defconfig but with NET_LWIP and CMD_*_LWIP enabled.
Tests are added to test/py/tests/test_net.py for that configuration.
Changes in v2:
** Address comments from Ilias A.
- "net-lwip: add wget command"
Implement the wget_with_dns() function to do most of the wget work and
call it from do_wget(). This allows to simplify patch "net-lwip: add
support for EFI_HTTP_BOOT".
- "net-lwip: import net command from cmd/net.c"
Move a few functions from cmd/net.c to a new file cmd/net-common.c
rather than duplicating then in cmd/net-lwip.c.
- "net-lwip: add support for EFI_HTTP_BOOT"
Since wget_with_dns() is now implemented in "net-lwip: add wget command",
just enable the wget command when the lwIP stack is enabled and
EFI_HTTP_BOOT is requested.
** Address comments from Tom R.
- "net-lwip: add DHCP support and dhcp commmand",
"net-lwip: add TFTP support and tftpboot command",
"net-lwip: add ping command",
"net-lwip: add dns command",
"net-lwip: add wget command"
Do not introduce new CMD_XXX_LWIP symbols and use existing CMD_XXX
instead.
- "configs: add qemu_arm64_lwip_defconfig"
Use #include <configs/qemu_arm64_defconfig>.
- "net-lwip: import lwIP library under lib/lwip"
Patch removed and replaced by the introduction of a Git subtree:
"Squashed 'lib/lwip/lwip/' content from commit 0a0452b2c3".
Note that I have not yet addressed your comments on "test: dm: dsa,
eth: disable tests when CONFIG_NET_LWIP=y"). I need some more time
for that and I think running CI on this v2 will help better understand
what is needed for v3.
** Miscellaneous improvements
- "net: introduce alternative implementation as net-lwip/":
* Make DFU_OVER_TFTP not DFU_TFTP incompatible with NET_LWIP. It seems
quite natural to supplement "depends on NET" with "&& !NET_LWIP".
* Make PROT_*_LWIP not visible by removing the Kconfig prompt.
[1] https://lore.kernel.org/all/20231127125726.3735-1-maxim.uvarov@linaro.org/
[2] https://www.nongnu.org/lwip/
[3] https://en.wikipedia.org/wiki/LwIP
CC: Javier Tia <javier.tia at linaro.org>
Jerome Forissier (14):
net: introduce alternative implementation as net-lwip/
Squashed 'lib/lwip/lwip/' content from commit 0a0452b2c39
net-lwip: build lwIP
net-lwip: add DHCP support and dhcp commmand
net-lwip: add TFTP support and tftpboot command
net-lwip: add ping command
net-lwip: add dns command
net-lwip: add wget command
test: dm: dsa, eth: disable tests when CONFIG_NET_LWIP=y
cmd: bdinfo: enable -e when CONFIG_CMD_NET_LWIP=y
configs: add qemu_arm64_lwip_defconfig
test/py: net: add _lwip variants of dhcp, ping and tftpboot tests
MAINTAINERS: net-lwip: add myself as a maintainer
CI: add qemu_arm64_lwip to the test matrix
--
2.40.1
More information about the U-Boot
mailing list