Introduce the lwIP network stack
Subsystems (11)
v11 cover Introduce the lwIP network stack
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. and Raymond M. (CC'd) have 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. using a secure, authenticated connection directly from the U-Boot shell. Several use cases:
* Authentication: prevent MITM attack (third party replacing the
binary with a different one)
* Confidentiality: prevent third parties from grabbing a copy of the
image as it is being downloaded
* Allow connection to servers that do not support plain HTTP anymore
(this is becoming more and more common on the Internet these days)
- Possibly benefit from additional features implemented in lwIP
- Less code to maintain in U-Boot
Prior to applying this series, the lwIP stack needs to be added as a Git subtree with the following command:
$ git subtree add --squash --prefix lib/lwip/lwip \ https://github.com/lwip-tcpip/lwip.git STABLE-2_2_0_RELEASE
Notes
1. A number of features are currently incompatible with NET_LWIP:DFU_TFTP, FASTBOOT, SPL_NET, ETH_SANDBOX, ETH_SANDBOX_RAW, DM_ETH. They all make assumptions on how the network stack is implemented and/or pull sybols that are not trivially exported from lwIP. Some interface rework may be needed.
2. Due to the above, and in order to provide some level of testing of the lwIP code in CI even when the legacy NET is the default, a new QEMU configuration is introduced (qemu_arm64_lwip_defconfig) which is based on qemu_arm64_defconfig with NET_LWIP and CMD_*_LWIP enabled. In addition to that, this series has some [TESTING] patches which make NET_LWIP the default.
[1] https://lore.kernel.org/all/[email protected]/
[2] https://www.nongnu.org/lwip/
[3] https://en.wikipedia.org/wiki/LwIP
Changes in v11:
- Rebased onto next
- "Miscellaneous fixes" removed (patches were merged in next). The
series still begins with small fixes posted separately [1] [2] [3].
- Add (some) support for CMD_PXE and therefore drop patch "[TESTING]
configs: set CONFIG_NET=y when PXE is enabled". This is build-tested
only and it is very likely that some work is needed to make it useful.
For example, adding the code for DHCP option 209 to lwIP so that BOOTP_PXE_DHCP_OPTION can be supported.
- SANDBOX is now supported, but with the dm eth and wget tests
disabled.
- Move eth_set_enable_bootdevs() declaration to net-common.h
Fixes warning with snow_defconfig:test/test-main.c:310:17: warning: implicit declaration of function ‘eth_set_enable_bootdevs’ [....]
- Do eth_init() and eth_init_rings() only once, and do not forgetlwip_init()! Fixes TFTP stalls on TI K3 (reported by Tom R. and
tested by Ilias A.)
- Set MEM_ALIGNMENT to 8 in lib/lwip/u-boot/lwipopts.h. Fixes TFTP
random crashes on TI K3 (Ilias A.)
- net_lwip_rx(): call free_pkt() even when recv() has returned 0,
as required by the driver model documentation (and imx8mp_evk). Fixes
a regression introduced in v9. Goes together with patch [2].
- Add "lwip: tftp: bind to TFTP port only when in server mode" to
fix an issue with interrupted tftp commands (the tftp command hangs
if it is interrupted with Ctrl-C and started again).
- TFTP: fix uninitialized "ret" variable in do_tftpb(); print "Abort"
on Ctrl-C.
- MAINTAINERS: remove README and add sandbox ethernet driver to the
list of maintained files.
- AFAICT, CI should be all good except qemu_xtensa_dc233c which is
broken when NET_LWIP=y (QEMU just hangs with no output). I could
not find or build a suitable GDB binary to debug that.
[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
[2] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
[3] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Changes in v10:
- Rebase onto next
- URL for lwIP changed in cover letter: using GitHub now since all tags have suddenly disappeared from the repository on gnu.org.
- Post fixes as a separate series [1] or individual patches [2] [3]
- Add "if NET_LWIP" to net/lwip/Kconfig to fix a kconfig warning when doing the full branch build with buildman ("[NEW]")
- net/ is added to libs-y only when NET or NET_LWIP, not NO_NET
- Apply review tags
[1] http://patchwork.ozlabs.org/project/uboot/list/?series=422079
https://lists.denx.de/pipermail/u-boot/2024-September/563904.html
[2] http://patchwork.ozlabs.org/project/uboot/list/?series=421962
[3] http://patchwork.ozlabs.org/project/uboot/list/?series=421959
Changes in v9:
- Rebased onto master, reordered commits to put some fixes that are not strictly related to lwIP first.
- New commit "test/py: test_efi_loader: add missing dependency on cmd_tftpboot" (Tom R.)
- test_efi_loader.py: add missing dependency on cmd_wget (Tom R.)
- wget: fix divide by zero when transfer takes less than 1ms (Tom R.)
- New commit "configs: use syntax CONFIG_FOO=n in tools-only_defconfig" (Tom R.)
- Make TCP_WND configurable (via CONFIG_LWIP_TCP_WND) because a large value is needed for good performance especially with latency but transfers stall in QEMU (-net user) when the value is larger than a few KB (Anton A., offlist)
- Added [TESTING] commits to run CI with NET_LWIP enabled by default except for SANDBOX and platforms that enable PXE, and fixed a number of issues:
* coreboot_defconfig: 'implicit declaration' warnings on ip_checksum_ok() and compute_ip_checksum()
* Fix EFI net tests (bootefi selftest) by adding missing push_packed() call to net_process_received_packet()
* qemu_arm64: fix test_efi_loader.py failures (skip HTTP test by default since it needs a HTTP server; fix a bug in the dhcp command which would not set the "serverip" variable)
* QEMU CI tests for r2dplus_i82557c, r2dplus_rtl8139:
Fixed receive errors due to calling free_pkt() with a length of zero. r2dplus_tulip: fixed "dm_pci_phys_to_bus:
invalid physical address" caused by too late eth_init_rings().
With that the CI status is all GREEN:
https://dev.azure.com/u-boot/u-boot/_build/results?buildId=9225&view=results
Changes in v8:
- Fix bootefi with tftp and wget. It would previously fail with an error message: "No UEFI binary known at 200000". Tested on Raspberry 3B+. Also fix the legacy wget. (Tom R.)
- wget: add "Bytes transferred =" message and accept legacy syntax for better compatibility which also makes it easier to add a test to the test suite
- wget: When no server name or address is supplied, use ${httpserverip} then ${serverip}.
- wget: start the timer used for measuring throughput when the first data block is received. In other words: do not include DNS resolution and TCP connection time in measurement. It gives better numbers ;) but more importantly is how the legacy code works.
- wget: handle non-200 result codes from the server as errors.
- tftp: when no server name or ip is supplied, use ${tftpserverip} then fall back to ${serverip}.
- New commit: "test/py: add HTTP (wget) test"
- New commit: "net: wget: removed unused function wget_success()"
- Change back all !CONFIG_IS_ENABLED(NO_NET) tests to (CONFIG_IS_ENABLED(NET) || CONFIG_IS_ENABLED(NET_LWIP)) since the NO_NET case is wrong when CONFIG_SPL_BUILD or CONFIG_TPL_BUILD is defined (Tom R.)
Changes in v7:
- Rebased onto master
- Updated binary size comparisons in this cover letter. Note that the increase for imx8mp_evk_defconfig was wrong due to a configuration error.
Changes in v6:
- Rebased on next
- "flash: prefix error codes with FL_"
Update drivers/mtd/altera_qspi.c too (Tom R.)
- "net: introduce alternative implementation as net-lwip/" Introduce a "Networking" top-level menu in the main Kconfig. Avoids having a lot of network-related symbols on the first screen of menuconfig. The "Networking stack" choice as well as the applicable symbols (depending on the selected choice) are now all inside this "Networking" menu. (Michal S.)
For PROT_DHCP_LWIP and PROT_DNS_LWIP, use "select" PROT_UDP_LWIP rather than "depends on".
Move NET_RANDOM_ETHADDR to the common ('if NET || NET_LWIP') block. Move SYS_RX_ETH_BUFFER out of 'if NET || NET_LWIP' since it is used unguarded in some code (e.g., am62x_beagleplay_r5) (Tom R.).
- "net: split include/net.h into net{,-common,-legacy,-lwip}.h" Move net_random_ethaddr() to net-common.h.
- "net: eth-uclass: add function eth_start_udev()"
Fix typo and apply Tom R.'s R-b.
- "net-lwip: add DHCP support and dhcp commmand"
Convert !CONFIG_IS_ENABLED(NET) to CONFIG_IS_ENABLED(NO_NET) in board/xilinx/common/board.c to fix an issue with device having no MAC address (thanks Michal S.). Do the same at other places (icore_mx8mp.c, imx8mp_debix_model_a.c, board/ti/am335x/board.c, tiny-printf.c).
Move CMD_MII and CMD_MDIO into 'if NET || NET_LWIP'.
- "net-lwip: add TFTP support and tftpboot command":
Fix help string.
- "net: split cmd/net.c into cmd/net.c and cmd/net-common.c":
Apply Ilias' R-b.
- "net-lwip: add TFTP_BLOCKSIZE"
Apply Ilias' R-b. I moved the TFTP_BLOCKSIZE Kconfig into this commit where it belongs (it was previously in "net" split ... net.h").
Changes in v5:
- Rebased on next
- Refactor Kconfig options to avoid duplicates
- Library functions use a more consistent naming (dhcp_loop(), ping_loop() etc.) and take a struct udevice * parameter (Heinrich S.)
- Do not use net_process_receive_packet() for input anymore. Instead of calling eth_rx() which would invoke net_process_receive_packet(), we call a new net_lwip_rx(udev) function which invokes the device recv() and pushes the packets up the lwIP stack. Thus everything is tied to a udevice now. (Heinrich S.)
- Add "configs: replace '# CONFIG_NET is not set' with CONFIG_NO_NET=y" (Tom R.)
- tftp: unify display with legacy command: add throughput, 65 hashes per line, one every 10 blocks received (Tom R.)
- Moved net-lwip/* to net/lwip/* (Simon G.)
- Rename static function low_level_output() to linkoutput() since it is the name used in the lwIP netif struct.
- Fixed off-by-one in parse_url() which could cause wget to fail when passed a URL with a host name (as opposed to a URL with an IP address).
- Improved TFTP performance by adding support for the blksize option (patches "lwip: tftp: add support of blksize option to client" and "net-lwip: add TFTP_BLOCKSIZE) (Tom R.)
- Add an optional port number to the tftp command for easier testing (syntax: tftp [[ip:[port:]]filename])
- wget: display an "unsupported URI" error if uri is not http://
(Jon H.)
- Adjusted the lwIP TCP options in lib/lwip/u-boot/lwipopts.h for better performance, in particular TCP_WND.
- Add "net: fec_mxc_init(): do not ignore return status of fec_open()"
- Set the proper environment variables when DHCP succeeds (ipaddr%d etc.) and read the proper ones for the given device in new_netif(), allowing correct behavior when several adapters are available (tested on i.MX8M Plus).
- Fix an alignment issue with outgoing packets (see the linkoutput() function). With that the i.MX8M Plus ENET1 interface works properly. (reported by Tim H.).
- Add review tags
Changes in v4:
- Fixed the DHCP algorithm which was missing a sys_timeout() call in the "fine timer" callback. This should close the issue that Tom R. reported with his Raspberry Pi 3 (it does fix it on mine).
- The DHCP exchange timeout is increased from 2 to 10 seconds
- The DHCP exchange can be interrupted with Ctrl-C.
- "net: introduce alternative implementation as net-lwip/": rework dependencies. A few symbols have 'depends on !NET_LWIP' and in addition 'NET_LWIP depends on !SANDBOX'. Sandbox, DSA and fastboot are unsupported, because they are deeply welded to the current stack.
- All network commands (dns, ping, tftp and wget):
* Get rid of global variables (Ilias A.)
* Use printf() rather than log_info()
- "net-lwip: add ping command": use packet count instead of timeout, fix code style (Ilias A.)
- Add "net: split cmd/net.c into cmd/net.c and cmd/net-common.c" extracted from the wget patch (Ilias A.).
- Add "net: split include/net.h into net{,-common,-legacy,-lwip}.h" (Ilias A.)
- Add "flash: prefix error codes with FL_" which is required to avoid name clashes when splitting net.h
- Reworked the initialization of the lwIP stack. One and only one network interface (struct netif) is added for the duration of the command that uses that interface. That's commit "net-lwip:
add DHCP support and dhcp commmand".
- Drop "test: dm: dsa, eth: disable tests when CONFIG_NET_LWIP=y", not needed now that NET_LWIP depend on !SANDBOX.
- qemu_arm64_lwip_defconfig now enables CMD_DNS and CMD_WGET (so that all the supported network commands are available).
Changes in v3:
- Make NET_LWIP a Kconfig choice in patch "net: introduce alternative implementation as net-lwip/" (Tom R.)
- Drop the patch introducing lwIP as a Git subtree and document the git command in the cover letter instead (Tom R.)
- "net-lwip: add TFTP support and tftpboot command": use the same "Bytes transferred =" message as in the legacy implementation (Tom R., Maxim U.)
- Drop "test/py: net: add _lwip variants of dhcp, ping and tftpboot tests" which is not needed anymore.
- Add missing kfree() calls in cmd/net-common.c and fix the parsing of decimal address in net-lwip/wget.c (patch "net-lwip: add wget command") (Maxim U.)
- "net-lwip: add ping command": drop the ICMP payload (Ilias A.). Set the sequence number to zero when entering ping_loop().
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.
Jerome Forissier (28):
net: recv(): return -EAGAIN instead of 0 when no cleanup is expected Make AVB_VERIFY depend on FASTBOOT
linker_lists: set LINKER_LIST_ALIGN to 8 for CPU_MIPS64
sandbox: add dummy driver ETH_SANDBOX_LWIP
test: boot: fix bootdev_test_any for when DSA_SANDBOX is disabled
test: boot: fix bootflow_cmd_label for when DSA_SANDBOX is disabled
net: introduce alternative implementation as net-lwip/
configs: replace '# CONFIG_NET is not set' with CONFIG_NO_NET=y
net: split include/net.h into net{,-common,-legacy,-lwip}.h
net: move copy_filename() to new file net/net-common.c
net: eth-uclass: add function eth_start_udev()
net-lwip: build lwIP
net-lwip: add DHCP support and dhcp commmand
lwip: tftp: bind to TFTP port only when in server mode
net-lwip: add TFTP support and tftpboot command
net-lwip: add ping command
net-lwip: add dns command
net: split cmd/net.c into cmd/net.c and cmd/net-common.c
net-lwip: add wget command
cmd: bdinfo: enable -e when CONFIG_CMD_NET_LWIP=y
configs: add qemu_arm64_lwip_defconfig
lwip: tftp: add support of blksize option to client
net-lwip: add TFTP_BLOCKSIZE
CI: add qemu_arm64_lwip to the test matrix
MAINTAINERS: net-lwip: add myself as a maintainer
configs: use syntax CONFIG_FOO=n in tools-only_defconfig [TESTING] configs: set CONFIG_NET=y for FTGMAC100 [TESTING] Kconfig: enable NET_LWIP by default
Jonathan Humphreys (1):
net-lwip: lwIP wget supports user defined port in the uri, so allow
it.
.azure-pipelines.yml | 7 + Kconfig | 29 + MAINTAINERS | 11 + Makefile | 6 +- arch/Kconfig | 2 +- board/engicam/imx8mp/icore_mx8mp.c | 2 +- .../imx8mp_debix_model_a.c | 2 +- board/ti/am335x/board.c | 3 +- board/xilinx/common/board.c | 3 +- boot/Kconfig | 4 +- cmd/Kconfig | 140 +-- cmd/Makefile | 9 +- cmd/bdinfo.c | 5 +- cmd/elf.c | 2 +- cmd/net-common.c | 109 ++ cmd/net-lwip.c | 45 + cmd/net.c | 115 --- common/Kconfig | 3 +- common/board_r.c | 4 +- common/spl/Kconfig | 1 + common/usb_kbd.c | 2 +- configs/LicheePi_Zero_defconfig | 2 +- configs/M5249EVB_defconfig | 2 +- configs/am335x_pdu001_defconfig | 2 +- configs/am62ax_evm_r5_defconfig | 2 +- configs/am62px_evm_r5_defconfig | 2 +- configs/am62x_beagleplay_r5_defconfig | 2 +- configs/amcore_defconfig | 2 +- configs/amd_versal2_mini_defconfig | 2 +- configs/amd_versal2_mini_emmc_defconfig | 2 +- configs/amd_versal2_mini_ospi_defconfig | 2 +- configs/amd_versal2_mini_qspi_defconfig | 2 +- configs/anbernic-rgxx3-rk3566_defconfig | 2 +- configs/ap143_defconfig | 2 +- configs/ap152_defconfig | 2 +- configs/apple_m1_defconfig | 2 +- configs/astro_mcf5373l_defconfig | 2 +- configs/at91sam9rlek_dataflash_defconfig | 2 +- configs/at91sam9rlek_mmc_defconfig | 2 +- configs/at91sam9rlek_nandflash_defconfig | 2 +- configs/bcm7260_defconfig | 2 +- configs/bcm7445_defconfig | 2 +- configs/bcm968380gerg_ram_defconfig | 2 +- configs/bcmns_defconfig | 2 +- configs/chromebook_samus_tpl_defconfig | 2 +- configs/cortina_presidio-asic-base_defconfig | 2 +- configs/cortina_presidio-asic-pnand_defconfig | 2 +- configs/durian_defconfig | 2 +- configs/e850-96_defconfig | 2 +- configs/ea-lpc3250devkitv2_defconfig | 2 +- configs/efi-x86_app32_defconfig | 2 +- configs/efi-x86_app64_defconfig | 2 +- configs/emsdp_defconfig | 2 +- configs/evb-ast2500_defconfig | 1 + configs/evb-ast2600_defconfig | 1 + configs/evb-px5_defconfig | 2 +- configs/generic-rk3568_defconfig | 2 +- configs/generic-rk3588_defconfig | 2 +- configs/hc2910_2aghd05_defconfig | 2 +- configs/igep00x0_defconfig | 2 +- configs/imx6q_bosch_acc_defconfig | 2 +- configs/imx6ulz_smm_m2_defconfig | 2 +- configs/iot_devkit_defconfig | 2 +- configs/j722s_evm_r5_defconfig | 2 +- configs/legoev3_defconfig | 2 +- configs/mk808_defconfig | 2 +- configs/mx23evk_defconfig | 2 +- configs/mx28evk_defconfig | 2 +- configs/mx6memcal_defconfig | 2 +- configs/mx6ulz_14x14_evk_defconfig | 2 +- configs/mx7ulp_com_defconfig | 2 +- configs/mx7ulp_evk_defconfig | 2 +- configs/mx7ulp_evk_plugin_defconfig | 2 +- configs/netgear_cg3100d_ram_defconfig | 2 +- configs/nsim_700_defconfig | 2 +- configs/nsim_700be_defconfig | 2 +- configs/nsim_hs38be_defconfig | 2 +- configs/openpiton_riscv64_defconfig | 2 +- configs/openpiton_riscv64_spl_defconfig | 2 +- configs/origen_defconfig | 2 +- configs/pe2201_defconfig | 2 +- configs/pinecube_defconfig | 2 +- configs/pm9261_defconfig | 2 +- configs/qemu_arm64_lwip_defconfig | 9 + configs/s5p4418_nanopi2_defconfig | 2 +- configs/s5p_goni_defconfig | 2 +- configs/s5pc210_universal_defconfig | 2 +- configs/sama5d27_giantboard_defconfig | 2 +- configs/sama5d29_curiosity_mmc1_defconfig | 2 +- configs/sama5d29_curiosity_mmc_defconfig | 2 +- .../sama5d29_curiosity_qspiflash_defconfig | 2 +- configs/sama7g54_curiosity_mmc_defconfig | 2 +- .../sama7g54_curiosity_nandflash_defconfig | 2 +- .../sama7g54_curiosity_qspiflash_defconfig | 2 +- configs/sipeed_maix_bitm_defconfig | 2 +- configs/sipeed_maix_smode_defconfig | 2 +- configs/stemmy_defconfig | 2 +- configs/stm32f429-discovery_defconfig | 2 +- configs/stm32f429-evaluation_defconfig | 2 +- configs/stm32f469-discovery_defconfig | 2 +- configs/stm32h743-disco_defconfig | 2 +- configs/stm32h743-eval_defconfig | 2 +- configs/stm32h750-art-pi_defconfig | 2 +- configs/stm32mp25_defconfig | 2 +- configs/stmark2_defconfig | 2 +- configs/th1520_lpi4a_defconfig | 2 +- configs/thunderx_88xx_defconfig | 2 +- configs/tools-only_defconfig | 34 +- configs/topic_miami_defconfig | 2 +- configs/topic_miamilite_defconfig | 2 +- configs/topic_miamiplus_defconfig | 2 +- configs/total_compute_defconfig | 2 +- configs/trats2_defconfig | 2 +- configs/trats_defconfig | 2 +- configs/xenguest_arm64_defconfig | 2 +- configs/xenguest_arm64_virtio_defconfig | 2 +- configs/xilinx_versal_mini_defconfig | 2 +- configs/xilinx_versal_mini_emmc0_defconfig | 2 +- configs/xilinx_versal_mini_emmc1_defconfig | 2 +- configs/xilinx_versal_mini_ospi_defconfig | 2 +- configs/xilinx_versal_mini_qspi_defconfig | 2 +- configs/xilinx_versal_net_mini_defconfig | 2 +- configs/xilinx_versal_net_mini_emmc_defconfig | 2 +- configs/xilinx_versal_net_mini_ospi_defconfig | 2 +- configs/xilinx_versal_net_mini_qspi_defconfig | 2 +- configs/xilinx_zynqmp_mini_defconfig | 2 +- configs/xilinx_zynqmp_mini_emmc0_defconfig | 2 +- configs/xilinx_zynqmp_mini_emmc1_defconfig | 2 +- configs/xilinx_zynqmp_mini_nand_defconfig | 2 +- .../xilinx_zynqmp_mini_nand_single_defconfig | 2 +- configs/xilinx_zynqmp_mini_qspi_defconfig | 2 +- configs/zynq_cse_nand_defconfig | 2 +- configs/zynq_cse_nor_defconfig | 2 +- configs/zynq_cse_qspi_defconfig | 2 +- drivers/dfu/Kconfig | 1 + drivers/fastboot/Kconfig | 1 + drivers/net/Kconfig | 16 +- drivers/net/Makefile | 1 + drivers/net/eepro100.c | 2 +- drivers/net/phy/Kconfig | 2 +- drivers/net/rtl8139.c | 2 +- drivers/net/sandbox-lwip.c | 85 ++ drivers/usb/gadget/Kconfig | 2 +- include/net-common.h | 509 ++++++++++ include/net-legacy.h | 541 ++++++++++ include/net-lwip.h | 41 + include/net.h | 943 +----------------- lib/Makefile | 2 + lib/binman.c | 1 + lib/lwip/Makefile | 55 + lib/lwip/lwip/src/apps/tftp/tftp.c | 104 +- .../lwip/src/include/lwip/apps/tftp_client.h | 1 + lib/lwip/u-boot/arch/cc.h | 45 + lib/lwip/u-boot/arch/sys_arch.h | 0 lib/lwip/u-boot/limits.h | 0 lib/lwip/u-boot/lwipopts.h | 157 +++ lib/tiny-printf.c | 3 +- net/Kconfig | 81 +- net/Makefile | 20 +- net/eth-uclass.c | 38 +- net/lwip/Kconfig | 49 + net/lwip/Makefile | 8 + net/lwip/dhcp.c | 136 +++ net/lwip/dns.c | 127 +++ net/lwip/eth_internal.h | 35 + net/lwip/net-lwip.c | 307 ++++++ net/lwip/ping.c | 177 ++++ net/lwip/tftp.c | 290 ++++++ net/lwip/wget.c | 357 +++++++ net/net-common.c | 13 + net/net.c | 12 - test/boot/bootdev.c | 11 +- test/boot/bootflow.c | 7 +- test/cmd/Makefile | 2 + test/dm/Makefile | 2 + 175 files changed, 3607 insertions(+), 1346 deletions(-) create mode 100644 cmd/net-common.c create mode 100644 cmd/net-lwip.c create mode 100644 configs/qemu_arm64_lwip_defconfig create mode 100644 drivers/net/sandbox-lwip.c create mode 100644 include/net-common.h create mode 100644 include/net-legacy.h create mode 100644 include/net-lwip.h create mode 100644 lib/lwip/Makefile create mode 100644 lib/lwip/u-boot/arch/cc.h create mode 100644 lib/lwip/u-boot/arch/sys_arch.h create mode 100644 lib/lwip/u-boot/limits.h create mode 100644 lib/lwip/u-boot/lwipopts.h create mode 100644 net/lwip/Kconfig create mode 100644 net/lwip/Makefile create mode 100644 net/lwip/dhcp.c create mode 100644 net/lwip/dns.c create mode 100644 net/lwip/eth_internal.h create mode 100644 net/lwip/net-lwip.c create mode 100644 net/lwip/ping.c create mode 100644 net/lwip/tftp.c create mode 100644 net/lwip/wget.c create mode 100644 net/net-common.c
Signature · 1 line
2.40.1
PATCH v11 1/29 net: recv(): return -EAGAIN instead of 0 when no cleanup is expected
Note: patch posted separately [0].
[0] http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Some drivers do not behave properly when free_pkt() is called with a length of zero. It is an issue I observed when developing the lwIP series [1] (see "QEMU CI tests for r2dplus_i82557c, r2dplus_rtl8139" in the change log) and which I fixed incorrectly by not calling free_pkt() when recv() returns 0. That turned out to be wrong for two reasons:
1. The DM documentation [2] clearly requires it:
"The **recv** function polls for availability of a new packet. [...]
If there is an error [...], return 0 if you require the packet to be cleaned up normally, or a negative error code otherwise (cleanup not necessary or already done).
If **free_pkt** is defined, U-Boot will call it after a received packet has been processed [...]. free_pkt() will be called after recv(), for the same packet [...]"
2. The imx8mp_evk platform will fail with OOM errors if free_pkt() is not called after recv() returns 0:
u-boot=> tftp 192.168.0.16:50M
Using ethernet@30be0000 device
TFTP from server 192.168.0.16; our IP address is 192.168.0.48 Filename '50M'.
Load address: 0x40480000
Loading: #######################fecmxc_recv: error allocating packetp
fecmxc_recv: error allocating packetp
fecmxc_recv: error allocating packetp
...
Therefore, make recv() return -EINVAL instead of 0 when no packet is available and the driver doesn't expect free_pkt() to be called subsequently.
[1] https://lists.denx.de/pipermail/u-boot/2024-August/562861.html
[2] doc/develop/driver-model/ethernet.rst
--- drivers/net/eepro100.c | 2 +- drivers/net/rtl8139.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/eepro100.c +1 -1
@@ -678,7 +678,7 @@ static int eepro100_recv_common(struct eepro100_priv *priv, uchar **packetp) status =le16_to_cpu (desc->status);if (!(status &RFD_STATUS_C )) -return 0 ; +return -EAGAIN ;/* Valid frame status. */ if (status &RFD_STATUS_OK ) {
drivers/net/rtl8139.c +1 -1
@@ -433,7 +433,7 @@ static int rtl8139_recv_common(struct rtl8139_priv *priv, unsigned char *rxdata,int length =0 ;if (inb (priv->ioaddr +RTL_REG_CHIPCMD ) &RTL_REG_CHIPCMD_RXBUFEMPTY ) -return 0 ; +return -EAGAIN ; priv->rxstatus =inw (priv->ioaddr +RTL_REG_INTRSTATUS );/* See below for the rest of the interrupt acknowledges. */
Signature · 1 line
2.40.1
Re: [PATCH v11 01/29] net: recv(): return -EAGAIN instead of 0 when no cleanup is expected
Quoted 36 lines · Jerome Forissier
Note: patch posted separately [0].
[0] http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Some drivers do not behave properly when
free_pkt()is called with a length of zero. It is an issue I observed when developing the lwIP series [1] (see "QEMU CI tests forr2dplus_i82557c,r2dplus_rtl8139" in the change log) and which I fixed incorrectly by not callingfree_pkt()whenrecv()returns 0. That turned out to be wrong for two reasons:1. The DM documentation [2] clearly requires it:
"The **recv** function polls for availability of a new packet. [...]
If there is an error [...], return 0 if you require the packet to be cleaned up normally, or a negative error code otherwise (cleanup not necessary or already done).If **free_pkt** is defined, U-Boot will call it after a received packet has been processed [...].
free_pkt()will be called afterrecv(), for the same packet [...]"2. The
imx8mp_evkplatform will fail with OOM errors iffree_pkt()is not called afterrecv()returns 0:u-boot=> tftp 192.168.0.16:50M Using ethernet@30be0000 device TFTP from server 192.168.0.16; our IP address is 192.168.0.48 Filename '50M'. Load address: 0x40480000 Loading: #######################fecmxc_recv: error allocating packetp fecmxc_recv: error allocating packetp fecmxc_recv: error allocating packetp ...
Quoted 3 lines
Therefore, make
recv()return-EINVALinstead of 0 when no packet is available and the driver doesn't expectfree_pkt()to be called subsequently.
Do you mean -EAGAIN ? Otherwise, it seems like this comment relates to a different patch.
Quoted 10 lines
[1] https://lists.denx.de/pipermail/u-boot/2024-August/562861.html
[2]doc/develop/driver-model/ethernet.rstSigned-off-by Jerome Forissier <[email protected]>--- drivers/net/eepro100.c | 2 +- drivers/net/rtl8139.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Quoted 29 lines
drivers/net/eepro100.c +1
-1@@ -678,7 +678,7 @@ static int eepro100_recv_common(struct eepro100_priv *priv, uchar **packetp) status =le16_to_cpu (desc->status);if (!(status &RFD_STATUS_C )) -return 0 ; +return -EAGAIN ;/* Valid frame status. */ if (status &RFD_STATUS_OK ) {drivers/net/rtl8139.c +1
-2@@ -433,7 +433,7 @@ static int rtl8139_recv_common(struct rtl8139_priv *priv, unsigned char *rxdata,int length =0 ;if (inb (priv->ioaddr +RTL_REG_CHIPCMD ) &RTL_REG_CHIPCMD_RXBUFEMPTY ) -return 0 ; +return -EAGAIN ; priv->rxstatus =inw (priv->ioaddr +RTL_REG_INTRSTATUS );/* See below for the rest of the interrupt acknowledges. */ --2.40.1
Re: [PATCH v11 01/29] net: recv(): return -EAGAIN instead of 0 when no cleanup is expected
Quoted 38 lines · Simon Glass
Quoted 36 lines · Jerome Forissier
Note: patch posted separately [0].
[0] http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Some drivers do not behave properly when
free_pkt()is called with a length of zero. It is an issue I observed when developing the lwIP series [1] (see "QEMU CI tests forr2dplus_i82557c,r2dplus_rtl8139" in the change log) and which I fixed incorrectly by not callingfree_pkt()whenrecv()returns 0. That turned out to be wrong for two reasons:1. The DM documentation [2] clearly requires it:
"The **recv** function polls for availability of a new packet. [...]
If there is an error [...], return 0 if you require the packet to be cleaned up normally, or a negative error code otherwise (cleanup not necessary or already done).If **free_pkt** is defined, U-Boot will call it after a received packet has been processed [...].
free_pkt()will be called afterrecv(), for the same packet [...]"2. The
imx8mp_evkplatform will fail with OOM errors iffree_pkt()is not called afterrecv()returns 0:u-boot=> tftp 192.168.0.16:50M Using ethernet@30be0000 device TFTP from server 192.168.0.16; our IP address is 192.168.0.48 Filename '50M'. Load address: 0x40480000 Loading: #######################fecmxc_recv: error allocating packetp fecmxc_recv: error allocating packetp fecmxc_recv: error allocating packetp ...
Quoted 6 lines
Quoted 3 lines
Therefore, make
recv()return-EINVALinstead of 0 when no packet is available and the driver doesn't expectfree_pkt()to be called subsequently.Do you mean
-EAGAIN? Otherwise, it seems like this comment relates to a different patch.
Yes, good catch. I will fix the description and resend patch [1] as v2.
[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Quoted 5 lines
Quoted 5 lines
[1] https://lists.denx.de/pipermail/u-boot/2024-August/562861.html
[2]doc/develop/driver-model/ethernet.rst
Quoted 8 lines
Quoted 6 lines
Signed-off-by Jerome Forissier <[email protected]>--- drivers/net/eepro100.c | 2 +- drivers/net/rtl8139.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)Reviewed-by Simon Glass <[email protected]>
Thanks,
Signature · 1 line
Jerome
Quoted 30 lines
Quoted 30 lines
drivers/net/eepro100.c +1
-1@@ -678,7 +678,7 @@ static int eepro100_recv_common(struct eepro100_priv *priv, uchar **packetp) status =le16_to_cpu (desc->status);if (!(status &RFD_STATUS_C )) -return 0 ; +return -EAGAIN ;/* Valid frame status. */ if (status &RFD_STATUS_OK ) {drivers/net/rtl8139.c +1
-2@@ -433,7 +433,7 @@ static int rtl8139_recv_common(struct rtl8139_priv *priv, unsigned char *rxdata,int length =0 ;if (inb (priv->ioaddr +RTL_REG_CHIPCMD ) &RTL_REG_CHIPCMD_RXBUFEMPTY ) -return 0 ; +return -EAGAIN ; priv->rxstatus =inw (priv->ioaddr +RTL_REG_INTRSTATUS );/* See below for the rest of the interrupt acknowledges. */ --2.40.1
PATCH v11 2/29 Make AVB_VERIFY depend on FASTBOOT
In reply to Jerome ForissierNote: Patch posted separately [0].
[0] http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
AVB_BUF_ADDR, which is under "if AVB_VERIFY", defaults to FASTBOOT_BUF_ADDR. Therefore AVB_VERIFY should depend on FASTBOOT.
--- common/Kconfig | 1 + 1 file changed, 1 insertion(+)
common/Kconfig +1 -0
@@ -850,6 +850,7 @@ config AVB_VERIFY depends on LIBAVB depends on MMC depends on PARTITION_UUIDS + depends on FASTBOOT help This option enables compilation of bootloader-dependent operations, used by Android Verified Boot 2.0 library (libavb). Includes:
Signature · 1 line
2.40.1
Re: [PATCH v11 02/29] Make AVB_VERIFY depend on FASTBOOT
Quoted 5 lines · Jerome Forissier
Note: Patch posted separately [0].
[0] http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Quoted 8 lines
AVB_BUF_ADDR, which is under "ifAVB_VERIFY", defaults toFASTBOOT_BUF_ADDR. ThereforeAVB_VERIFYshould depend on FASTBOOT.Signed-off-by Jerome Forissier <[email protected]>--- common/Kconfig | 1 + 1 file changed, 1 insertion(+)
Quoted 15 lines
common/Kconfig +1
-1@@ -850,6 +850,7 @@ config AVB_VERIFY depends on LIBAVB depends on MMC depends on PARTITION_UUIDS + depends on FASTBOOT help This option enables compilation of bootloader-dependent operations, used by Android Verified Boot 2.0 library (libavb). Includes: --2.40.1
Re: [PATCH v11 02/29] Make AVB_VERIFY depend on FASTBOOT
Quoted 10 lines · Simon Glass
Quoted 8 lines · Jerome Forissier
Note: Patch posted separately [0].
[0] http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
AVB_BUF_ADDR, which is under "ifAVB_VERIFY", defaults toFASTBOOT_BUF_ADDR. ThereforeAVB_VERIFYshould depend on FASTBOOT.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Jerome Forissier <[email protected]>--- common/Kconfig | 1 + 1 file changed, 1 insertion(+)Reviewed-by Simon Glass <[email protected]>
Thanks. Would you mind replying to the patch linked in the description? As I will be removing that one from lwIP v12.
Regards,
Signature · 1 line
Jerome
Quoted 15 lines
Quoted 15 lines
common/Kconfig +1
-1@@ -850,6 +850,7 @@ config AVB_VERIFY depends on LIBAVB depends on MMC depends on PARTITION_UUIDS + depends on FASTBOOT help This option enables compilation of bootloader-dependent operations, used by Android Verified Boot 2.0 library (libavb). Includes: --2.40.1
PATCH v11 3/29 linker_lists: set LINKER_LIST_ALIGN to 8 for CPU_MIPS64
In reply to Jerome ForissierNote: Patch posted separately [0].
[0] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
CPU_MIPS64 needs 8-byte alignment on the linker lists, otherwise an exception may occur. Fixes an issue found on malta64 with QEMU:
Breakpoint 1, lists_driver_lookup_name (name=0xffffffffbe043578 "root_driver") at /home/uboot/u-boot/drivers/core/lists.c:31
31 if (!strcmp(name, entry->name))
[...]
ld a1,0(s0)
(gdb) p/x &entry->name
0xffffffffbe04b0d4
(gdb) p/x $s0
0xffffffffbe04b0d4
$ grep __u_boot_list /tmp/malta64/u-boot.objdump 4 __u_boot_list 000018e0 ffffffffbe04a4d4 ffffffffbe04a4d4 0004a584 2**2
--- arch/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/Kconfig +1 -1
@@ -45,7 +45,7 @@ config SYS_CACHELINE_SIZE config LINKER_LIST_ALIGN int default 32 if SANDBOX - default 8 if ARM64 || X86 + default 8 if ARM64 || X86 || CPU_MIPS64 default 4 help Force the each linker list to be aligned to this boundary. This
Signature · 1 line
2.40.1
Re: [PATCH v11 03/29] linker_lists: set LINKER_LIST_ALIGN to 8 for CPU_MIPS64
Quoted 40 lines · Jerome Forissier
Note: Patch posted separately [0].
[0] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
CPU_MIPS64needs 8-byte alignment on the linker lists, otherwise an exception may occur. Fixes an issue found on malta64 with QEMU:Breakpoint 1,
lists_driver_lookup_name(name=0xffffffffbe043578 "root_driver") at/home/uboot/u-boot/drivers/core/lists.c:31
31 if (!strcmp(name,entry->name))
[...]
ld a1,0(s0)(gdb) p/x
&entry->name
0xffffffffbe04b0d4
(gdb) p/x $s0
0xffffffffbe04b0d4$ grep __u_boot_list /tmp/malta64/u-boot.objdump 4 __u_boot_list 000018e0 ffffffffbe04a4d4 ffffffffbe04a4d4 0004a584 2**2Signed-off-by Jerome Forissier <[email protected]>--- arch/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/Kconfig +1
-2@@ -45,7 +45,7 @@ config SYS_CACHELINE_SIZE config LINKER_LIST_ALIGN int default 32 if SANDBOX - default 8 if ARM64 || X86 + default 8 if ARM64 || X86 || CPU_MIPS64 default 4 help Force the each linker list to be aligned to this boundary. This --
Quoted 2 lines
2.40.1
Re: [PATCH v11 03/29] linker_lists: set LINKER_LIST_ALIGN to 8 for CPU_MIPS64
In reply to Jerome ForissierQuoted 30 lines · Jerome Forissier
Note: Patch posted separately [0].
[0] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
CPU_MIPS64needs 8-byte alignment on the linker lists, otherwise an exception may occur. Fixes an issue found on malta64 with QEMU:Breakpoint 1,
lists_driver_lookup_name(name=0xffffffffbe043578 "root_driver") at/home/uboot/u-boot/drivers/core/lists.c:31
31 if (!strcmp(name,entry->name))
[...]
ld a1,0(s0)(gdb) p/x
&entry->name
0xffffffffbe04b0d4
(gdb) p/x $s0
0xffffffffbe04b0d4$ grep __u_boot_list /tmp/malta64/u-boot.objdump 4 __u_boot_list 000018e0 ffffffffbe04a4d4 ffffffffbe04a4d4 0004a584 2**2Signed-off-by Jerome Forissier <[email protected]>--- arch/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/Kconfig +0
-0
arch/Kconfig config SYS_CACHELINE_SIZE · line 48
Quoted 5 lines
arch/Kconfig +1
-1@@ -45,7 +45,7 @@ config SYS_CACHELINE_SIZE config LINKER_LIST_ALIGN int default 32 if SANDBOX - default 8 if ARM64 || X86 + default 8 if ARM64 || X86 || CPU_MIPS64
Shouldn't we set 8 byte alignment on all 64bit architectures including riscv64?
default 8 if 64BIT
@Simon
I would not know why 32bit X86 should need 8 byte alignment. I am a bit astonished that you chose 32 byte alignment for the Sandbox. Is there any justification to use more than 4 on the 32bit Sandbox and more than 8 on the 64bit Sandbox? If yes, we should document it via a comment.
Best regards
Heinrich
Quoted 3 lines
arch/Kconfig +0
-0default 4 help Force the each linker list to be aligned to this boundary. This
Re: [PATCH v11 03/29] linker_lists: set LINKER_LIST_ALIGN to 8 for CPU_MIPS64
Quoted 40 lines · Heinrich Schuchardt
Quoted 33 lines · Jerome Forissier
Note: Patch posted separately [0].
[0] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
CPU_MIPS64needs 8-byte alignment on the linker lists, otherwise an exception may occur. Fixes an issue found on malta64 with QEMU:Breakpoint 1,
lists_driver_lookup_name(name=0xffffffffbe043578 "root_driver") at/home/uboot/u-boot/drivers/core/lists.c:3131 if (!strcmp(name,entry->name))
[...]
ld a1,0(s0)(gdb) p/x
&entry->name
0xffffffffbe04b0d4
(gdb) p/x $s0
0xffffffffbe04b0d4$ grep __u_boot_list /tmp/malta64/u-boot.objdump 4 __u_boot_list 000018e0 ffffffffbe04a4d4 ffffffffbe04a4d4 0004a584 2**2Signed-off-by Jerome Forissier <[email protected]>---
arch/Kconfig| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)arch/Kconfig +0
-0@@ -45,7 +45,7 @@ config SYS_CACHELINE_SIZEconfig
LINKER_LIST_ALIGN
int
default 32 if SANDBOXQuoted 2 lines
- default 8 if ARM64 || X86 + default 8 if ARM64 || X86 || CPU_MIPS64Shouldn't we set 8 byte alignment on all 64bit architectures including riscv64?
Quoted 1 line
default 8 if 64BIT
Makes sense.
Quoted 7 lines
@Simon
I would not know why 32bit X86 should need 8 byte alignment. I am a bit astonished that you chose 32 byte alignment for the Sandbox. Is there any justification to use more than 4 on the 32bit Sandbox and more than 8 on the 64bit Sandbox? If yes, we should document it via a comment.
I tried running what CI does manually (.azure_pipelines.yml) with "default 32 if SANDBOX" removed, and I got SIGSEGV with TEST_PY_BD=sandbox. OTOH, TEST_PY_BD=sandbox64 worked fine but it might have been a fluke.
Thanks,
Signature · 1 line
Jerome
Quoted 9 lines
Best regards
Heinrich
Quoted 3 lines
default 4
help
Force the each linker list to be aligned to this boundary. This
Re: [PATCH v11 03/29] linker_lists: set LINKER_LIST_ALIGN to 8 for CPU_MIPS64
Quoted 55 lines · Jerome Forissier
Quoted 40 lines · Heinrich Schuchardt
Quoted 33 lines · Jerome Forissier
Note: Patch posted separately [0].
[0] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
CPU_MIPS64needs 8-byte alignment on the linker lists, otherwise an exception may occur. Fixes an issue found on malta64 with QEMU:Breakpoint 1,
lists_driver_lookup_name(name=0xffffffffbe043578 "root_driver") at/home/uboot/u-boot/drivers/core/lists.c:3131 if (!strcmp(name,entry->name))
[...]
ld a1,0(s0)(gdb) p/x
&entry->name
0xffffffffbe04b0d4
(gdb) p/x $s0
0xffffffffbe04b0d4$ grep __u_boot_list /tmp/malta64/u-boot.objdump 4 __u_boot_list 000018e0 ffffffffbe04a4d4 ffffffffbe04a4d4 0004a584 2**2Signed-off-by Jerome Forissier <[email protected]>---
arch/Kconfig| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)arch/Kconfig +0
-0@@ -45,7 +45,7 @@ config SYS_CACHELINE_SIZEconfig
LINKER_LIST_ALIGN
int
default 32 if SANDBOXQuoted 2 lines
- default 8 if ARM64 || X86 + default 8 if ARM64 || X86 || CPU_MIPS64Shouldn't we set 8 byte alignment on all 64bit architectures including riscv64?
Quoted 1 line
default 8 if 64BIT
Makes sense.
Quoted 7 lines
@Simon
I would not know why 32bit X86 should need 8 byte alignment. I am a bit astonished that you chose 32 byte alignment for the Sandbox. Is there any justification to use more than 4 on the 32bit Sandbox and more than 8 on the 64bit Sandbox? If yes, we should document it via a comment.
Quoted 4 lines
I tried running what CI does manually (.azure_pipelines.yml) with "default 32 if SANDBOX" removed, and I got SIGSEGV with TEST_PY_BD=sandbox. OTOH, TEST_PY_BD=sandbox64 worked fine but it might have been a fluke.
I think we can leave sandbox as a future cleanup, and perhaps file an issue at https://source.denx.de/u-boot/custodians/u-boot-dm/-/issues/ so it doesn't get lost.
Signature · 1 line
Tom
Re: [PATCH v11 03/29] linker_lists: set LINKER_LIST_ALIGN to 8 for CPU_MIPS64
Quoted 56 lines · Tom Rini
Quoted 55 lines · Jerome Forissier
Quoted 40 lines · Heinrich Schuchardt
Quoted 33 lines · Jerome Forissier
Note: Patch posted separately [0].
[0] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
CPU_MIPS64needs 8-byte alignment on the linker lists, otherwise an exception may occur. Fixes an issue found on malta64 with QEMU:Breakpoint 1,
lists_driver_lookup_name(name=0xffffffffbe043578 "root_driver") at/home/uboot/u-boot/drivers/core/lists.c:3131 if (!strcmp(name,entry->name))
[...]
ld a1,0(s0)(gdb) p/x
&entry->name
0xffffffffbe04b0d4
(gdb) p/x $s0
0xffffffffbe04b0d4$ grep __u_boot_list /tmp/malta64/u-boot.objdump 4 __u_boot_list 000018e0 ffffffffbe04a4d4 ffffffffbe04a4d4 0004a584 2**2Signed-off-by Jerome Forissier <[email protected]>---
arch/Kconfig| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)arch/Kconfig +0
-0@@ -45,7 +45,7 @@ config SYS_CACHELINE_SIZEconfig
LINKER_LIST_ALIGN
int
default 32 if SANDBOXQuoted 2 lines
- default 8 if ARM64 || X86 + default 8 if ARM64 || X86 || CPU_MIPS64Shouldn't we set 8 byte alignment on all 64bit architectures including riscv64?
Quoted 1 line
default 8 if 64BIT
Makes sense.
Quoted 7 lines
@Simon
I would not know why 32bit X86 should need 8 byte alignment. I am a bit astonished that you chose 32 byte alignment for the Sandbox. Is there any justification to use more than 4 on the 32bit Sandbox and more than 8 on the 64bit Sandbox? If yes, we should document it via a comment.
Quoted 8 lines
Quoted 4 lines
I tried running what CI does manually (.azure_pipelines.yml) with "default 32 if SANDBOX" removed, and I got SIGSEGV with TEST_PY_BD=sandbox. OTOH, TEST_PY_BD=sandbox64 worked fine but it might have been a fluke.
I think we can leave sandbox as a future cleanup, and perhaps file an issue at https://source.denx.de/u-boot/custodians/u-boot-dm/-/issues/ so it doesn't get lost.
https://source.denx.de/u-boot/custodians/u-boot-dm/-/issues/29
Thanks,
Signature · 1 line
Jerome
Re: [PATCH v11 03/29] linker_lists: set LINKER_LIST_ALIGN to 8 for CPU_MIPS64
In reply to Heinrich SchuchardtHi Heinrich,
Quoted 41 lines · Heinrich Schuchardt
Quoted 30 lines · Jerome Forissier
Note: Patch posted separately [0].
[0] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
CPU_MIPS64needs 8-byte alignment on the linker lists, otherwise an exception may occur. Fixes an issue found on malta64 with QEMU:Breakpoint 1,
lists_driver_lookup_name(name=0xffffffffbe043578 "root_driver") at/home/uboot/u-boot/drivers/core/lists.c:31
31 if (!strcmp(name,entry->name))
[...]
ld a1,0(s0)(gdb) p/x
&entry->name
0xffffffffbe04b0d4
(gdb) p/x $s0
0xffffffffbe04b0d4$ grep __u_boot_list /tmp/malta64/u-boot.objdump 4 __u_boot_list 000018e0 ffffffffbe04a4d4 ffffffffbe04a4d4 0004a584 2**2Signed-off-by Jerome Forissier <[email protected]>--- arch/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/Kconfig +0
-0arch/Kconfig config SYS_CACHELINE_SIZE · line 48
Quoted 5 lines
arch/Kconfig +1
-1@@ -45,7 +45,7 @@ config SYS_CACHELINE_SIZE config LINKER_LIST_ALIGN int default 32 if SANDBOX - default 8 if ARM64 || X86 + default 8 if ARM64 || X86 || CPU_MIPS64Shouldn't we set 8 byte alignment on all 64bit architectures including riscv64?
Quoted 8 lines
default 8 if 64BIT
@Simon
I would not know why 32bit X86 should need 8 byte alignment. I am a bit astonished that you chose 32 byte alignment for the Sandbox. Is there any justification to use more than 4 on the 32bit Sandbox and more than 8 on the 64bit Sandbox? If yes, we should document it via a comment.
It was really long so I put it in the commit message. Please check 'git blame' as there is often stuff there:
linker_lists: Fix alignment issue
The linker script uses alphabetic sorting to group the different linker lists together. Each group has its own struct and potentially its own alignment. But when the linker packs the structs together it cannot ensure that a linker list starts on the expected alignment boundary.
For example, if the first list has a struct size of 8 and we place 3 of them in the image, that means that the next struct will start at offset 0x18 from the start of the linker_list section. If the next struct has a size of 16 then it will start at an 8-byte aligned offset, but not a 16-byte aligned offset.
With sandbox on x86_64, a reference to a linker list item using ll_entry_get() can force alignment of that particular linker_list item, if it is in the same file as the linker_list item is declared.
Consider this example, where struct driver is 0x80 bytes:
ll_entry_declare(struct driver, fred, driver)
...
void *p = ll_entry_get(struct driver, fred, driver)
If these two lines of code are in the same file, then the entry is forced to be aligned at the 'struct driver' alignment, which is 16 bytes. If the second line of code is in a different file, then no action is taken, since the compiler cannot update the alignment of the linker_list item.
In the first case, an 8-byte 'fill' region is added:
.u_boot_list_2_driver_2_testbus_drv
0x0000000000270018 0x80 test/built-in.o
0x0000000000270018
_u_boot_list_2_driver_2_testbus_drv
.u_boot_list_2_driver_2_testfdt1_drv
0x0000000000270098 0x80 test/built-in.o
0x0000000000270098
_u_boot_list_2_driver_2_testfdt1_drv
*fill* 0x0000000000270118 0x8
.u_boot_list_2_driver_2_testfdt_drv
0x0000000000270120 0x80 test/built-in.o
0x0000000000270120
_u_boot_list_2_driver_2_testfdt_drv
.u_boot_list_2_driver_2_testprobe_drv
0x00000000002701a0 0x80 test/built-in.o
0x00000000002701a0_u_boot_list_2_driver_2_testprobe_drv
With this, the linker_list no-longer works since items after testfdt1_drv are not at the expected address.
Ideally we would have a way to tell gcc not to align structs in this way. It is not clear how we could do this, and in any case it would require us to adjust every struct used by the linker_list feature.
One possible fix is to force each separate linker_list to start on the largest possible boundary that can be required by the compiler. However that does not seem to work on x86_64, which uses 16-byte alignment in this case but needs 32-byte alignment.
So add a Kconfig option to handle this. Set the default value to 4 so as to avoid changing platforms that don't need it.
Update the ll_entry_start() accordingly.
Regards,
Simon
PATCH v11 4/29 sandbox: add dummy driver ETH_SANDBOX_LWIP
In reply to Jerome ForissierIntroduce ETH_SANDBOX_LWIP which enables a mock driver similar to ETH_SANDOX but without the dependencies on the legacy network stack (NET) so that it may be enabled when the lwIP stack (NET_LWIP) is introduced. The driver does nothing at this stage but its presence will allow dm_test_iommu_noiommu [1] to pass.
[1] ./u-boot -T -c "ut dm dm_test_iommu_noiommu"
--- drivers/net/Kconfig | 11 +++++ drivers/net/Makefile | 1 + drivers/net/sandbox-lwip.c | 85 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 drivers/net/sandbox-lwip.c
drivers/net/Kconfig +11 -0
@@ -350,6 +350,17 @@ config ETH_SANDBOX This driver is particularly useful in the test/dm/eth.c tests +config ETH_SANDBOX_LWIP + depends on SANDBOX + depends on NET_LWIP + default y + bool "Sandbox: Mocked Ethernet driver (for NET_LWIP)" + help + This driver is meant as a replacement for ETH_SANDBOX when + the network stack is NET_LWIP rather than NET. It currently + does nothing, i.e. it drops the sent packets and never receives + data. + config ETH_SANDBOX_RAW depends on SANDBOX default y
drivers/net/Makefile +1 -0
@@ -39,6 +39,7 @@ obj-$(CONFIG_ETH_DESIGNWARE_SOCFPGA) += dwmac_socfpga.o obj-$(CONFIG_ETH_SANDBOX) += sandbox.o obj-$(CONFIG_ETH_SANDBOX_RAW) += sandbox-raw-bus.o obj-$(CONFIG_ETH_SANDBOX_RAW) += sandbox-raw.o +obj-$(CONFIG_ETH_SANDBOX_LWIP) += sandbox-lwip.o obj-$(CONFIG_FEC_MXC) += fec_mxc.o obj-$(CONFIG_FMAN_ENET) += fm/ obj-$(CONFIG_FMAN_ENET) += fsl_mdio.o
drivers/net/sandbox-lwip.c new file +85 -0
85 lines not on this page · raw message
Signature · 1 line
2.40.1
Re: [PATCH v11 04/29] sandbox: add dummy driver ETH_SANDBOX_LWIP
Quoted 143 lines · Jerome Forissier
Introduce
ETH_SANDBOX_LWIPwhich enables a mock driver similar toETH_SANDOXbut without the dependencies on the legacy network stack (NET) so that it may be enabled when the lwIP stack (NET_LWIP) is introduced. The driver does nothing at this stage but its presence will allowdm_test_iommu_noiommu[1] to pass.[1] ./u-boot -T -c "ut dm
dm_test_iommu_noiommu"Signed-off-by Jerome Forissier <[email protected]>--- drivers/net/Kconfig | 11 +++++ drivers/net/Makefile | 1 + drivers/net/sandbox-lwip.c | 85 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 drivers/net/sandbox-lwip.cdrivers/net/Kconfig +11
-0@@ -350,6 +350,17 @@ config ETH_SANDBOX This driver is particularly useful in the test/dm/eth.c tests +config ETH_SANDBOX_LWIP + depends on SANDBOX + depends on NET_LWIP + default y + bool "Sandbox: Mocked Ethernet driver (for NET_LWIP)" + help + This driver is meant as a replacement for ETH_SANDBOX when + the network stack is NET_LWIP rather than NET. It currently + does nothing, i.e. it drops the sent packets and never receives + data. + config ETH_SANDBOX_RAW depends on SANDBOX default ydrivers/net/Makefile +1
-0@@ -39,6 +39,7 @@ obj-$(CONFIG_ETH_DESIGNWARE_SOCFPGA) += dwmac_socfpga.o obj-$(CONFIG_ETH_SANDBOX) += sandbox.o obj-$(CONFIG_ETH_SANDBOX_RAW) += sandbox-raw-bus.o obj-$(CONFIG_ETH_SANDBOX_RAW) += sandbox-raw.o +obj-$(CONFIG_ETH_SANDBOX_LWIP) += sandbox-lwip.o obj-$(CONFIG_FEC_MXC) += fec_mxc.o obj-$(CONFIG_FMAN_ENET) += fm/ obj-$(CONFIG_FMAN_ENET) += fsl_mdio.odrivers/net/sandbox-lwip.c new file +85
-1@@ -0,0 +1,85 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) 2015 National Instruments +* +* (C) Copyright 2015 +* Joe Hershberger <[email protected]> +*/ + +#include <dm.h> +#include <log.h> +#include <malloc.h> +#include <net.h> +#include <asm/eth.h> +#include <asm/global_data.h> +#include <asm/test.h> + +DECLARE_GLOBAL_DATA_PTR ; + +static int sb_lwip_eth_start (struct udevice *dev) +{ +debug ("eth_sandbox_lwip: Start\n" ); + +return 0 ; +} + +static int sb_lwip_eth_send (struct udevice *dev,void *packet,int length) +{ +debug ("eth_sandbox_lwip: Send packet %d\n" , length); + +return -ENOTSUPP ; +} + +static int sb_lwip_eth_recv (struct udevice *dev,int flags,uchar **packetp) +{ +return -EAGAIN ; +} + +static int sb_lwip_eth_free_pkt (struct udevice *dev,uchar *packet,int length) +{ +return 0 ; +} + +static void sb_lwip_eth_stop (struct udevice *dev) +{ +} + +static int sb_lwip_eth_write_hwaddr (struct udevice *dev) +{ +return 0 ; +} + +static const struct eth_ops sb_eth_ops = { + .start = sb_lwip_eth_start, + .send = sb_lwip_eth_send, + .recv = sb_lwip_eth_recv, + .free_pkt = sb_lwip_eth_free_pkt, + .stop = sb_lwip_eth_stop, + .write_hwaddr = sb_lwip_eth_write_hwaddr, +}; + +static int sb_lwip_eth_remove (struct udevice *dev) +{ +return 0 ; +} + +static int sb_lwip_eth_of_to_plat (struct udevice *dev) +{ +return 0 ; +} + +static const struct udevice_id sb_eth_ids[] = { + { .compatible ="sandbox,eth" }, + { } +}; + +U_BOOT_DRIVER (eth_sandbox) = { + .name ="eth_lwip_sandbox" , + .id =UCLASS_ETH , + .of_match = sb_eth_ids, + .of_to_plat = sb_lwip_eth_of_to_plat, + .remove = sb_lwip_eth_remove, + .ops = &sb_eth_ops, + .priv_auto =0 , + .plat_auto =sizeof (struct eth_pdata ), +}; --
Quoted 2 lines
2.40.1
Re: [PATCH v11 04/29] sandbox: add dummy driver ETH_SANDBOX_LWIP
In reply to Jerome ForissierQuoted 9 lines · Jerome Forissier
Introduce
ETH_SANDBOX_LWIPwhich enables a mock driver similar toETH_SANDOXbut without the dependencies on the legacy network stack (NET) so that it may be enabled when the lwIP stack (NET_LWIP) is introduced. The driver does nothing at this stage but its presence will allowdm_test_iommu_noiommu[1] to pass.[1] ./u-boot -T -c "ut dm
dm_test_iommu_noiommu"
Quoted 7 lines
Signed-off-by Jerome Forissier <[email protected]>--- drivers/net/Kconfig | 11 +++++ drivers/net/Makefile | 1 + drivers/net/sandbox-lwip.c | 85 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 drivers/net/sandbox-lwip.c
I hope that you can get a few tests in there soon.
PATCH v11 5/29 test: boot: fix bootdev_test_any for when DSA_SANDBOX is disabled
In reply to Jerome ForissierWhen DSA_SANDBOX is not set, the sandbox tests fail as follows:
$ ./test/py/test.py --build-dir=$(pwd) -k bootdev_test_any [...] Test: bootdev_test_any: bootdev.c test/boot/bootdev.c:156, bootdev_test_any(): "mmc2" = media->name: Expected "mmc2", got "mmc0" [...]
This is due to the device list containing two less entries than expected. Therefore, adjust the expected index to be two less when DSA_SANDBOX is disabled.
The actual use case is NET_LWIP=y (to be introduced in later patches) which implies DSA_SANDBOX=n for the time being.
--- test/boot/bootdev.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
test/boot/bootdev.c +10 -1
@@ -128,6 +128,7 @@ BOOTSTD_TEST(bootdev_test_labels, UTF_DM | UTF_SCAN_FDT | UTF_ETH_BOOTDEV);static int bootdev_test_any (struct unit_test_state *uts) {struct udevice *dev, *media; +char *seq;int mflags;/*
@@ -147,8 +148,16 @@ static int bootdev_test_any(struct unit_test_state *uts)* 8 [ ] OK mmc mmc2.bootdev * 9 [ + ] OK mmc mmc1.bootdev * a [ ] OK mmc mmc0.bootdev +* +* However if DSA_SANDBOX is disabled the dsa-test@{0,1} devices +* are not there. */ -ut_assertok (bootdev_find_by_any ("8" , &dev, &mflags)); +if (CONFIG_IS_ENABLED (DSA_SANDBOX )) + seq ="8" ; +else + seq ="6" ; + +ut_assertok (bootdev_find_by_any (seq, &dev, &mflags));ut_asserteq (UCLASS_BOOTDEV ,device_get_uclass_id (dev));ut_asserteq (BOOTFLOW_METHF_SINGLE_DEV , mflags); media =dev_get_parent (dev);
Signature · 1 line
2.40.1
Re: [PATCH v11 05/29] test: boot: fix bootdev_test_any for when DSA_SANDBOX is disabled
Quoted 13 lines · Jerome Forissier
When
DSA_SANDBOXis not set, the sandbox tests fail as follows:$ ./test/py/test.py --build-dir=$(pwd) -k bootdev_test_any [...] Test: bootdev_test_any: bootdev.c test/boot/bootdev.c:156, bootdev_test_any(): "mmc2" = media->name: Expected "mmc2", got "mmc0" [...]This is due to the device list containing two less entries than expected. Therefore, adjust the expected index to be two less when
DSA_SANDBOXis disabled.
Quoted 8 lines
The actual use case is NET_LWIP=y (to be introduced in later patches) which implies DSA_SANDBOX=n for the time being.
Signed-off-by Jerome Forissier <[email protected]>--- test/boot/bootdev.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
Quoted 33 lines
test/boot/bootdev.c +10
-2@@ -128,6 +128,7 @@ BOOTSTD_TEST(bootdev_test_labels, UTF_DM | UTF_SCAN_FDT | UTF_ETH_BOOTDEV);static int bootdev_test_any (struct unit_test_state *uts) {struct udevice *dev, *media; +char *seq;int mflags;/* @@ -147,8 +148,16 @@ static int bootdev_test_any(struct unit_test_state *uts)* 8 [ ] OK mmc mmc2.bootdev * 9 [ + ] OK mmc mmc1.bootdev * a [ ] OK mmc mmc0.bootdev +* +* However if DSA_SANDBOX is disabled the dsa-test@{0,1} devices +* are not there. */ -ut_assertok (bootdev_find_by_any ("8" , &dev, &mflags)); +if (CONFIG_IS_ENABLED (DSA_SANDBOX )) + seq ="8" ; +else + seq ="6" ; + +ut_assertok (bootdev_find_by_any (seq, &dev, &mflags));ut_asserteq (UCLASS_BOOTDEV ,device_get_uclass_id (dev));ut_asserteq (BOOTFLOW_METHF_SINGLE_DEV , mflags); media =dev_get_parent (dev); --2.40.1
PATCH v11 6/29 test: boot: fix bootflow_cmd_label for when DSA_SANDBOX is disabled
In reply to Jerome ForissierWhen DSA_SANDBOX is not set, the sandbox tests fail as follows:
$ ./test/py/test.py --build-dir=$(pwd) -k bootdev_test_any [...] Scanning for bootflows with label '9' [...] Cannot find '9' (err=-19)
This is due to the device list containing two less entries than expected. Therefore, look for label '7' when DSA_SANDBOX is disabled.
The actual use case is NET_LWIP=y (to be introduced in later patches) which implies DSA_SANDBOX=n for the time being.
--- test/boot/bootflow.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
test/boot/bootflow.c +5 -2
@@ -109,9 +109,12 @@ static int bootflow_cmd_label(struct unit_test_state *uts)* 8 [ ] OK mmc mmc2.bootdev * 9 [ + ] OK mmc mmc1.bootdev * a [ ] OK mmc mmc0.bootdev +* +* However with CONFIG_DSA_SANDBOX=n we have two less (dsa-test@0 and +* dsa-test@1). */ -ut_assertok (run_command ("bootflow scan -lH 9" ,0 )); -ut_assert_nextline ("Scanning for bootflows with label '9'" ); +ut_assertok (run_command ("bootflow scan -lH 7" ,0 )); +ut_assert_nextline ("Scanning for bootflows with label '7'" );ut_assert_skip_to_line ("(1 bootflow, 1 valid)" );ut_assertok (run_command ("bootflow scan -lH 0" ,0 ));
Signature · 1 line
2.40.1
Re: [PATCH v11 06/29] test: boot: fix bootflow_cmd_label for when DSA_SANDBOX is disabled
Hi Jerome,
Quoted 25 lines · Jerome Forissier
When
DSA_SANDBOXis not set, the sandbox tests fail as follows:$ ./test/py/test.py --build-dir=$(pwd) -k bootdev_test_any [...] Scanning for bootflows with label '9' [...] Cannot find '9' (err=-19)This is due to the device list containing two less entries than expected. Therefore, look for label '7' when
DSA_SANDBOXis disabled.The actual use case is NET_LWIP=y (to be introduced in later patches) which implies DSA_SANDBOX=n for the time being.
Signed-off-by Jerome Forissier <[email protected]>--- test/boot/bootflow.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)test/boot/bootflow.c +0
-0
test/boot/bootflow.c static int bootflow_cmd_label(struct unit_test_state *uts) · line 114
Quoted 9 lines
test/boot/bootflow.c +3
-2@@ -109,9 +109,12 @@ static int bootflow_cmd_label(struct unit_test_state *uts)* 8 [ ] OK mmc mmc2.bootdev * 9 [ + ] OK mmc mmc1.bootdev * a [ ] OK mmc mmc0.bootdev +* +* However with CONFIG_DSA_SANDBOX=n we have two less (dsa-test@0 and +* dsa-test@1). */ -ut_assertok (run_command ("bootflow scan -lH 9" ,0 )); -ut_assert_nextline ("Scanning for bootflows with label '9'" );
Shouldn't this under and #ifdef, IS_ENABLED etc?
Quoted 8 lines
test/boot/bootflow.c +2
-1+ut_assertok (run_command ("bootflow scan -lH 7" ,0 )); +ut_assert_nextline ("Scanning for bootflows with label '7'" );ut_assert_skip_to_line ("(1 bootflow, 1 valid)" );ut_assertok (run_command ("bootflow scan -lH 0" ,0 )); --2.40.1
Re: [PATCH v11 06/29] test: boot: fix bootflow_cmd_label for when DSA_SANDBOX is disabled
Quoted 24 lines · Ilias Apalodimas
Hi Jerome,
Quoted 20 lines · Jerome Forissier
When
DSA_SANDBOXis not set, the sandbox tests fail as follows:$ ./test/py/test.py --build-dir=$(pwd) -k bootdev_test_any [...] Scanning for bootflows with label '9' [...] Cannot find '9' (err=-19)This is due to the device list containing two less entries than expected. Therefore, look for label '7' when
DSA_SANDBOXis disabled.The actual use case is NET_LWIP=y (to be introduced in later patches) which implies DSA_SANDBOX=n for the time being.
Signed-off-by Jerome Forissier <[email protected]>--- test/boot/bootflow.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
Quoted 16 lines
Quoted 5 lines
test/boot/bootflow.c +0
-0test/boot/bootflow.c static int bootflow_cmd_label(struct unit_test_state *uts) · line 114
Quoted 9 lines
test/boot/bootflow.c +3
-2@@ -109,9 +109,12 @@ static int bootflow_cmd_label(struct unit_test_state *uts)* 8 [ ] OK mmc mmc2.bootdev * 9 [ + ] OK mmc mmc1.bootdev * a [ ] OK mmc mmc0.bootdev +* +* However with CONFIG_DSA_SANDBOX=n we have two less (dsa-test@0 and +* dsa-test@1). */ -ut_assertok (run_command ("bootflow scan -lH 9" ,0 )); -ut_assert_nextline ("Scanning for bootflows with label '9'" );Shouldn't this under and #ifdef,
IS_ENABLEDetc?
In theory yes, but we can avoid the conditional by using index 7 which is always valid, i.e., in all configurations we have at least 7 devices (even 8 actually).
Quoted 9 lines
Quoted 9 lines
test/boot/bootflow.c +2
-1+ut_assertok (run_command ("bootflow scan -lH 7" ,0 )); +ut_assert_nextline ("Scanning for bootflows with label '7'" );ut_assert_skip_to_line ("(1 bootflow, 1 valid)" );ut_assertok (run_command ("bootflow scan -lH 0" ,0 )); --2.40.1
Re: [PATCH v11 06/29] test: boot: fix bootflow_cmd_label for when DSA_SANDBOX is disabled
Quoted 45 lines · Jerome Forissier
Quoted 24 lines · Ilias Apalodimas
Hi Jerome,
Quoted 20 lines · Jerome Forissier
When
DSA_SANDBOXis not set, the sandbox tests fail as follows:$ ./test/py/test.py --build-dir=$(pwd) -k bootdev_test_any [...] Scanning for bootflows with label '9' [...] Cannot find '9' (err=-19)This is due to the device list containing two less entries than expected. Therefore, look for label '7' when
DSA_SANDBOXis disabled.The actual use case is NET_LWIP=y (to be introduced in later patches) which implies DSA_SANDBOX=n for the time being.
Signed-off-by Jerome Forissier <[email protected]>--- test/boot/bootflow.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)Quoted 16 lines
Quoted 5 lines
test/boot/bootflow.c +0
-0test/boot/bootflow.c static int bootflow_cmd_label(struct unit_test_state *uts) · line 114
Quoted 9 lines
test/boot/bootflow.c +3
-2@@ -109,9 +109,12 @@ static int bootflow_cmd_label(struct unit_test_state *uts)* 8 [ ] OK mmc mmc2.bootdev * 9 [ + ] OK mmc mmc1.bootdev * a [ ] OK mmc mmc0.bootdev +* +* However with CONFIG_DSA_SANDBOX=n we have two less (dsa-test@0 and +* dsa-test@1). */ -ut_assertok (run_command ("bootflow scan -lH 9" ,0 )); -ut_assert_nextline ("Scanning for bootflows with label '9'" );Shouldn't this under and #ifdef,
IS_ENABLEDetc?
Quoted 2 lines
In theory yes, but we can avoid the conditional by using index 7 which is always valid, i.e., in all configurations we have at least 7 devices (even 8 actually).
Ok, but I *think* Simon was trying to match the exact out put here, not 'at least 7'.
I think we are better off being strict on this test
Thanks
/Ilias
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
test/boot/bootflow.c +2
-1+ut_assertok (run_command ("bootflow scan -lH 7" ,0 )); +ut_assert_nextline ("Scanning for bootflows with label '7'" );ut_assert_skip_to_line ("(1 bootflow, 1 valid)" );ut_assertok (run_command ("bootflow scan -lH 0" ,0 )); --2.40.1
Re: [PATCH v11 06/29] test: boot: fix bootflow_cmd_label for when DSA_SANDBOX is disabled
Quoted 47 lines · Ilias Apalodimas
Quoted 45 lines · Jerome Forissier
Quoted 40 lines · Ilias Apalodimas
Hi Jerome,
Quoted 25 lines · Jerome Forissier
When
DSA_SANDBOXis not set, the sandbox tests fail as follows:$ ./test/py/test.py --build-dir=$(pwd) -k bootdev_test_any [...] Scanning for bootflows with label '9' [...] Cannot find '9' (err=-19)This is due to the device list containing two less entries than expected. Therefore, look for label '7' when
DSA_SANDBOXis disabled.The actual use case is NET_LWIP=y (to be introduced in later patches) which implies DSA_SANDBOX=n for the time being.
Signed-off-by Jerome Forissier <[email protected]>--- test/boot/bootflow.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)test/boot/bootflow.c +0
-0test/boot/bootflow.c static int bootflow_cmd_label(struct unit_test_state *uts) · line 114
Quoted 9 lines
test/boot/bootflow.c +3
-2@@ -109,9 +109,12 @@ static int bootflow_cmd_label(struct unit_test_state *uts)* 8 [ ] OK mmc mmc2.bootdev * 9 [ + ] OK mmc mmc1.bootdev * a [ ] OK mmc mmc0.bootdev +* +* However with CONFIG_DSA_SANDBOX=n we have two less (dsa-test@0 and +* dsa-test@1). */ -ut_assertok (run_command ("bootflow scan -lH 9" ,0 )); -ut_assert_nextline ("Scanning for bootflows with label '9'" );Shouldn't this under and #ifdef,
IS_ENABLEDetc?
Quoted 7 lines
Quoted 2 lines
In theory yes, but we can avoid the conditional by using index 7 which is always valid, i.e., in all configurations we have at least 7 devices (even 8 actually).
Ok, but I *think* Simon was trying to match the exact out put here, not 'at least 7'.
I think we are better off being strict on this test
No because there are 10 entries according to the comment ("a" hex being mmc0.bootdev). Simon, what do you suggest?
Thanks,
Signature · 1 line
Jerome
Quoted 13 lines
Thanks
/IliasQuoted 10 lines
Quoted 10 lines
Quoted 10 lines
test/boot/bootflow.c +2
-1+ut_assertok (run_command ("bootflow scan -lH 7" ,0 )); +ut_assert_nextline ("Scanning for bootflows with label '7'" );ut_assert_skip_to_line ("(1 bootflow, 1 valid)" );ut_assertok (run_command ("bootflow scan -lH 0" ,0 )); --2.40.1
Simon Glass
Reviewed-byRe: [PATCH v11 06/29] test: boot: fix bootflow_cmd_label for when DSA_SANDBOX is disabled
Hi Jerome,
Quoted 54 lines · Jerome Forissier
Quoted 50 lines · Ilias Apalodimas
Quoted 47 lines · Jerome Forissier
Quoted 24 lines · Ilias Apalodimas
Hi Jerome,
Quoted 20 lines · Jerome Forissier
When
DSA_SANDBOXis not set, the sandbox tests fail as follows:$ ./test/py/test.py --build-dir=$(pwd) -k bootdev_test_any [...] Scanning for bootflows with label '9' [...] Cannot find '9' (err=-19)This is due to the device list containing two less entries than expected. Therefore, look for label '7' when
DSA_SANDBOXis disabled.The actual use case is NET_LWIP=y (to be introduced in later patches) which implies DSA_SANDBOX=n for the time being.
Signed-off-by Jerome Forissier <[email protected]>--- test/boot/bootflow.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)Quoted 16 lines
Quoted 5 lines
test/boot/bootflow.c +0
-0test/boot/bootflow.c static int bootflow_cmd_label(struct unit_test_state *uts) · line 114
Quoted 9 lines
test/boot/bootflow.c +3
-2@@ -109,9 +109,12 @@ static int bootflow_cmd_label(struct unit_test_state *uts)* 8 [ ] OK mmc mmc2.bootdev * 9 [ + ] OK mmc mmc1.bootdev * a [ ] OK mmc mmc0.bootdev +* +* However with CONFIG_DSA_SANDBOX=n we have two less (dsa-test@0 and +* dsa-test@1). */ -ut_assertok (run_command ("bootflow scan -lH 9" ,0 )); -ut_assert_nextline ("Scanning for bootflows with label '9'" );Shouldn't this under and #ifdef,
IS_ENABLEDetc?In theory yes, but we can avoid the conditional by using index 7 which is always valid, i.e., in all configurations we have at least 7 devices (even 8 actually).
Quoted 7 lines
Quoted 4 lines
Ok, but I *think* Simon was trying to match the exact out put here, not 'at least 7'.
I think we are better off being strict on this test
No because there are 10 entries according to the comment ("a" hex being mmc0.bootdev). Simon, what do you suggest?
I don't think this is a huge deal.
BTW, 'fewer', not 'less', if you can count them
Quoted 18 lines
Thanks,
--
JeromeQuoted 13 lines
Thanks
/IliasQuoted 10 lines
Quoted 10 lines
Quoted 10 lines
test/boot/bootflow.c +2
-1+ut_assertok (run_command ("bootflow scan -lH 7" ,0 )); +ut_assert_nextline ("Scanning for bootflows with label '7'" );ut_assert_skip_to_line ("(1 bootflow, 1 valid)" );ut_assertok (run_command ("bootflow scan -lH 0" ,0 )); --2.40.1
Re: [PATCH v11 06/29] test: boot: fix bootflow_cmd_label for when DSA_SANDBOX is disabled
Quoted 61 lines · Simon Glass
Hi Jerome,
Quoted 57 lines · Jerome Forissier
Quoted 53 lines · Ilias Apalodimas
Quoted 45 lines · Jerome Forissier
Quoted 24 lines · Ilias Apalodimas
Hi Jerome,
Quoted 20 lines · Jerome Forissier
When
DSA_SANDBOXis not set, the sandbox tests fail as follows:$ ./test/py/test.py --build-dir=$(pwd) -k bootdev_test_any [...] Scanning for bootflows with label '9' [...] Cannot find '9' (err=-19)This is due to the device list containing two less entries than expected. Therefore, look for label '7' when
DSA_SANDBOXis disabled.The actual use case is NET_LWIP=y (to be introduced in later patches) which implies DSA_SANDBOX=n for the time being.
Signed-off-by Jerome Forissier <[email protected]>--- test/boot/bootflow.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)Quoted 16 lines
Quoted 5 lines
test/boot/bootflow.c +0
-0test/boot/bootflow.c static int bootflow_cmd_label(struct unit_test_state *uts) · line 114
Quoted 9 lines
test/boot/bootflow.c +3
-2@@ -109,9 +109,12 @@ static int bootflow_cmd_label(struct unit_test_state *uts)* 8 [ ] OK mmc mmc2.bootdev * 9 [ + ] OK mmc mmc1.bootdev * a [ ] OK mmc mmc0.bootdev +* +* However with CONFIG_DSA_SANDBOX=n we have two less (dsa-test@0 and +* dsa-test@1). */ -ut_assertok (run_command ("bootflow scan -lH 9" ,0 )); -ut_assert_nextline ("Scanning for bootflows with label '9'" );Shouldn't this under and #ifdef,
IS_ENABLEDetc?Quoted 2 lines
In theory yes, but we can avoid the conditional by using index 7 which is always valid, i.e., in all configurations we have at least 7 devices (even 8 actually).
Ok, but I *think* Simon was trying to match the exact out put here, not 'at least 7'.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
I think we are better off being strict on this test
No because there are 10 entries according to the comment ("a" hex being mmc0.bootdev). Simon, what do you suggest?
I don't think this is a huge deal.
Reviewed-by Simon Glass <[email protected]>
Unfortunately this patch breaks the default config (NET=y and therefore DSA_SANDBOX=y):
=> ut bootstd bootflow_cmd_label
Test: bootflow_cmd_label: bootflow.c
Scanning for bootflows with label 'mmc1'
Seq Method State Uclass Part Name Filename --- ----------- ------ -------- ---- ------------------------ ----------------
Scanning bootdev 'mmc1.bootdev':
0 extlinux ready mmc 1 mmc1.bootdev.part_1 /extlinux/extlinux.conf
No more bootdevs
--- ----------- ------ -------- ---- ------------------------ ---------------- (1 bootflow, 1 valid)
Scanning for bootflows with label '0'
Seq Method State Uclass Part Name Filename --- ----------- ------ -------- ---- ------------------------ ---------------- --- ----------- ------ -------- ---- ------------------------ ---------------- (0 bootflows, 0 valid) Scanning for bootflows with label '7' Seq Method State Uclass Part Name Filename --- ----------- ------ -------- ---- ------------------------ ---------------- --- ----------- ------ -------- ---- ------------------------ ----------------
(0 bootflows, 0 valid) test/boot/bootflow.c:118, bootflow_cmd_label(): console:
Expected '(1 bootflow, 1 valid)',
got to '(0 bootflows, 0 valid)'
[...]
So for v12 I'll do what Ilias suggested:
- ut_assertok(run_command("bootflow scan -lH 9", 0));
- ut_assert_nextline("Scanning for bootflows with label '9'");
+ if (CONFIG_IS_ENABLED(DSA_SANDBOX)) {+ ut_assertok(run_command("bootflow scan -lH 9", 0));
+ ut_assert_nextline("Scanning for bootflows with label '9'");
+ } else {
+ ut_assertok(run_command("bootflow scan -lH 7", 0));
+ ut_assert_nextline("Scanning for bootflows with label '7'");
+ }
ut_assert_skip_to_line("(1 bootflow, 1 valid)");Tested OK with DSA_SANDBOX=y as well as DSA_SANDBOX=n.
Quoted 1 line
BTW, 'fewer', not 'less', if you can count them
Sure :)
Thanks,
Signature · 1 line
Jerome
PATCH v11 7/29 net: introduce alternative implementation as net-lwip/
In reply to Jerome ForissierPrepare the introduction of the lwIP (lightweight IP) TCP/IP stack by adding a new net/lwip/ directory and the NET_LWIP symbol. Network support is either NO_NET, NET (legacy stack) or NET_LWIP. Subsequent commits will introduce the lwIP code, re-work the NETDEVICE integration and port some of the NET commands and features to lwIP.
SPL_NET cannot be enabled when 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.
Similarly, DFU_TFTP and FASTBOOT are not compatible with NET_LWIP because of dependencies on net_loop(), tftp_timeout_ms, tftp_timeout_count_max and other NET things. Let's add a dependency on !NET_LWIP for now.
SANDBOX can select NET_LWIP but doing so will currently disable the eth dm tests as well as the wget tests which have strong dependencies on the NET code.
Other adjustments to Kconfig files are made to fix "unmet direct dependencies detected" for USB_FUNCTION_SDP and CMD_FASTBOOT when the default networking stack is set to NET_LWIP ("default NET_LWIP" instead of "default NET" in Kconfig).
--- Kconfig | 29 ++++++++++++++++++ Makefile | 2 +- boot/Kconfig | 4 ++- cmd/Kconfig | 1 + common/Kconfig | 2 +- common/spl/Kconfig | 1 + drivers/dfu/Kconfig | 1 + drivers/fastboot/Kconfig | 1 + drivers/net/Kconfig | 3 ++ drivers/net/phy/Kconfig | 2 +- drivers/usb/gadget/Kconfig | 2 +- net/Kconfig | 61 +++++++++++++++++++------------------- net/Makefile | 4 +++ net/lwip/Kconfig | 49 ++++++++++++++++++++++++++++++ test/cmd/Makefile | 2 ++ test/dm/Makefile | 2 ++ 16 files changed, 131 insertions(+), 35 deletions(-) create mode 100644 net/lwip/Kconfig
Kconfig +29 -0
@@ -752,8 +752,37 @@ source "dts/Kconfig" source "env/Kconfig" +menu Networking + +choice + prompt "Networking stack" + default NET + +config NO_NET + bool "No networking support" + +config NET + bool "Legacy U-Boot networking stack" + imply NETDEVICES + +config NET_LWIP + bool "Use lwIP for networking stack" + imply NETDEVICES + help + Include networking support based on the lwIP (lightweight IP) + TCP/IP stack (https://nongnu.org/lwip). This is a replacement for + the default U-Boot network stack and applications located in net/ + and enabled via CONFIG_NET as well as other pieces of code that + depend on CONFIG_NET (such as cmd/net.c enabled via CONFIG_CMD_NET). + Therefore the two symbols CONFIG_NET and CONFIG_NET_LWIP are mutually + exclusive. + +endchoice + source "net/Kconfig" +endmenu + source "drivers/Kconfig" source "fs/Kconfig"
Makefile +1 -1
@@ -859,7 +859,7 @@ libs-$(CONFIG_OF_EMBED) += dts/ libs-y += env/ libs-y += lib/ libs-y += fs/ -libs-y += net/ +libs-$(filter y,$(CONFIG_NET) $(CONFIG_NET_LWIP)) += net/ libs-y += disk/ libs-y += drivers/ libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/
boot/Kconfig +3 -1
@@ -503,7 +503,8 @@ config BOOTMETH_ANDROID select ANDROID_AB select ANDROID_BOOT_IMAGE select CMD_BCB - select CMD_FASTBOOT + imply CMD_FASTBOOT + imply FASTBOOT if !NET_LWIP select PARTITION_TYPE_GUID select PARTITION_UUIDS help
@@ -559,6 +560,7 @@ config BOOTMETH_EXTLINUX_PXE config BOOTMETH_EFILOADER bool "Bootdev support for EFI boot" depends on EFI_BINARY_EXEC + imply CMD_TFTPBOOT if CMD_NET default y help Enables support for EFI boot using bootdevs. This makes the
cmd/Kconfig +1 -0
@@ -1661,6 +1661,7 @@ config CMD_USB config CMD_USB_SDP bool "sdp" + depends on USB_GADGET_DOWNLOAD select USB_FUNCTION_SDP help Enables the command "sdp" which is used to have U-Boot emulating the
common/Kconfig +1 -1
@@ -424,7 +424,7 @@ config LOGF_FUNC_PAD config LOG_SYSLOG bool "Log output to syslog server" - depends on NET + depends on NET || NET_LWIP help Enables a log driver which broadcasts log records via UDP port 514 to syslog servers.
common/spl/Kconfig +1 -0
@@ -1073,6 +1073,7 @@ config SPL_DM_SPI_FLASH config SPL_NET bool "Support networking" + depends on !NET_LWIP help Enable support for network devices (such as Ethernet) in SPL. This permits SPL to load U-Boot over a network link rather than
drivers/dfu/Kconfig +1 -0
@@ -20,6 +20,7 @@ config DFU_WRITE_ALT config DFU_TFTP bool "DFU via TFTP" depends on NETDEVICES + depends on !NET_LWIP select UPDATE_COMMON select DFU_OVER_TFTP help
drivers/fastboot/Kconfig +1 -0
@@ -1,5 +1,6 @@ menu "Fastboot support" depends on CMDLINE + depends on !NET_LWIP config FASTBOOT bool
drivers/net/Kconfig +3 -0
@@ -48,6 +48,7 @@ config DM_DSA bool "Enable Driver Model for DSA switches" depends on DM_MDIO depends on PHY_FIXED + depends on !NET_LWIP help Enable driver model for DSA switches
@@ -342,6 +343,7 @@ config ESSEDMA config ETH_SANDBOX depends on SANDBOX + depends on NET default y bool "Sandbox: Mocked Ethernet driver" help
@@ -363,6 +365,7 @@ config ETH_SANDBOX_LWIP config ETH_SANDBOX_RAW depends on SANDBOX + depends on NET default y bool "Sandbox: Bridge to Linux Raw Sockets" help
drivers/net/phy/Kconfig +1 -1
@@ -11,7 +11,7 @@ config MV88E6352_SWITCH menuconfig PHYLIB bool "Ethernet PHY (physical media interface) support" - depends on NET + depends on NET || NET_LWIP help Enable Ethernet PHY (physical media interface) support.
drivers/usb/gadget/Kconfig +1 -1
@@ -224,7 +224,7 @@ endif # USB_GADGET_DOWNLOAD config USB_ETHER bool "USB Ethernet Gadget" - depends on NET + depends on NET || NET_LWIP default y if ARCH_SUNXI && USB_MUSB_GADGET help Creates an Ethernet network device through a USB peripheral
net/Kconfig +31 -30
83 lines not on this page · raw message
net/Makefile +4 -0
@@ -5,6 +5,8 @@ #ccflags-y += -DDEBUG +ifeq ($(CONFIG_NET),y) + obj-$(CONFIG_NET) += arp.o obj-$(CONFIG_CMD_BOOTP) += bootp.o obj-$(CONFIG_CMD_CDP) += cdp.o
@@ -38,3 +40,5 @@ obj-$(CONFIG_CMD_WGET) += wget.o # sprintf(buf, index ? "foo%d" : "foo", index) # and this is intentional usage. CFLAGS_eth_common.o += -Wno-format-extra-args + +endif
net/lwip/Kconfig new file +49 -0
49 lines not on this page · raw message
test/cmd/Makefile +2 -0
@@ -30,7 +30,9 @@ ifdef CONFIG_SANDBOX obj-$(CONFIG_CMD_MBR) += mbr.o obj-$(CONFIG_CMD_READ) += rw.o obj-$(CONFIG_CMD_SETEXPR) += setexpr.o +ifdef CONFIG_NET obj-$(CONFIG_CMD_WGET) += wget.o +endif obj-$(CONFIG_ARM_FFA_TRANSPORT) += armffa.o endif obj-$(CONFIG_CMD_TEMPERATURE) += temperature.o
test/dm/Makefile +2 -0
@@ -48,7 +48,9 @@ obj-$(CONFIG_VIDEO_MIPI_DSI) += dsi_host.o obj-$(CONFIG_DM_DSA) += dsa.o obj-$(CONFIG_ECDSA_VERIFY) += ecdsa.o obj-$(CONFIG_EFI_MEDIA_SANDBOX) += efi_media.o +ifdef CONFIG_NET obj-$(CONFIG_DM_ETH) += eth.o +endif obj-$(CONFIG_EXTCON) += extcon.o ifneq ($(CONFIG_EFI_PARTITION),) obj-$(CONFIG_FASTBOOT_FLASH_MMC) += fastboot.o
Signature · 1 line
2.40.1
PATCH v11 8/29 configs: replace '# CONFIG_NET is not set' with CONFIG_NO_NET=y
In reply to Jerome ForissierThe parent patch has made the networking stack a choice between NO_NET, NET and NET_LWIP. Therefore '# CONFIG_NET is not set' is now 'CONFIG_NO_NET=y'. Adjust the defconfigs accordingly. Note that this patch is intended to be folded in but is kept separate separate for now to make review easier.
--- configs/LicheePi_Zero_defconfig | 2 +- configs/M5249EVB_defconfig | 2 +- configs/am335x_pdu001_defconfig | 2 +- configs/am62ax_evm_r5_defconfig | 2 +- configs/am62px_evm_r5_defconfig | 2 +- configs/am62x_beagleplay_r5_defconfig | 2 +- configs/amcore_defconfig | 2 +- configs/amd_versal2_mini_defconfig | 2 +- configs/amd_versal2_mini_emmc_defconfig | 2 +- configs/amd_versal2_mini_ospi_defconfig | 2 +- configs/amd_versal2_mini_qspi_defconfig | 2 +- configs/anbernic-rgxx3-rk3566_defconfig | 2 +- configs/ap143_defconfig | 2 +- configs/ap152_defconfig | 2 +- configs/apple_m1_defconfig | 2 +- configs/astro_mcf5373l_defconfig | 2 +- configs/at91sam9rlek_dataflash_defconfig | 2 +- configs/at91sam9rlek_mmc_defconfig | 2 +- configs/at91sam9rlek_nandflash_defconfig | 2 +- configs/bcm7260_defconfig | 2 +- configs/bcm7445_defconfig | 2 +- configs/bcm968380gerg_ram_defconfig | 2 +- configs/bcmns_defconfig | 2 +- configs/chromebook_samus_tpl_defconfig | 2 +- configs/cortina_presidio-asic-base_defconfig | 2 +- configs/cortina_presidio-asic-pnand_defconfig | 2 +- configs/durian_defconfig | 2 +- configs/e850-96_defconfig | 2 +- configs/ea-lpc3250devkitv2_defconfig | 2 +- configs/efi-x86_app32_defconfig | 2 +- configs/efi-x86_app64_defconfig | 2 +- configs/emsdp_defconfig | 2 +- configs/evb-px5_defconfig | 2 +- configs/generic-rk3568_defconfig | 2 +- configs/generic-rk3588_defconfig | 2 +- configs/hc2910_2aghd05_defconfig | 2 +- configs/igep00x0_defconfig | 2 +- configs/imx6q_bosch_acc_defconfig | 2 +- configs/imx6ulz_smm_m2_defconfig | 2 +- configs/iot_devkit_defconfig | 2 +- configs/j722s_evm_r5_defconfig | 2 +- configs/legoev3_defconfig | 2 +- configs/mk808_defconfig | 2 +- configs/mx23evk_defconfig | 2 +- configs/mx28evk_defconfig | 2 +- configs/mx6memcal_defconfig | 2 +- configs/mx6ulz_14x14_evk_defconfig | 2 +- configs/mx7ulp_com_defconfig | 2 +- configs/mx7ulp_evk_defconfig | 2 +- configs/mx7ulp_evk_plugin_defconfig | 2 +- configs/netgear_cg3100d_ram_defconfig | 2 +- configs/nsim_700_defconfig | 2 +- configs/nsim_700be_defconfig | 2 +- configs/nsim_hs38be_defconfig | 2 +- configs/openpiton_riscv64_defconfig | 2 +- configs/openpiton_riscv64_spl_defconfig | 2 +- configs/origen_defconfig | 2 +- configs/pe2201_defconfig | 2 +- configs/pinecube_defconfig | 2 +- configs/pm9261_defconfig | 2 +- configs/s5p4418_nanopi2_defconfig | 2 +- configs/s5p_goni_defconfig | 2 +- configs/s5pc210_universal_defconfig | 2 +- configs/sama5d27_giantboard_defconfig | 2 +- configs/sama5d29_curiosity_mmc1_defconfig | 2 +- configs/sama5d29_curiosity_mmc_defconfig | 2 +- configs/sama5d29_curiosity_qspiflash_defconfig | 2 +- configs/sama7g54_curiosity_mmc_defconfig | 2 +- configs/sama7g54_curiosity_nandflash_defconfig | 2 +- configs/sama7g54_curiosity_qspiflash_defconfig | 2 +- configs/sipeed_maix_bitm_defconfig | 2 +- configs/sipeed_maix_smode_defconfig | 2 +- configs/stemmy_defconfig | 2 +- configs/stm32f429-discovery_defconfig | 2 +- configs/stm32f429-evaluation_defconfig | 2 +- configs/stm32f469-discovery_defconfig | 2 +- configs/stm32h743-disco_defconfig | 2 +- configs/stm32h743-eval_defconfig | 2 +- configs/stm32h750-art-pi_defconfig | 2 +- configs/stm32mp25_defconfig | 2 +- configs/stmark2_defconfig | 2 +- configs/th1520_lpi4a_defconfig | 2 +- configs/thunderx_88xx_defconfig | 2 +- configs/tools-only_defconfig | 2 +- configs/topic_miami_defconfig | 2 +- configs/topic_miamilite_defconfig | 2 +- configs/topic_miamiplus_defconfig | 2 +- configs/total_compute_defconfig | 2 +- configs/trats2_defconfig | 2 +- configs/trats_defconfig | 2 +- configs/xenguest_arm64_defconfig | 2 +- configs/xenguest_arm64_virtio_defconfig | 2 +- configs/xilinx_versal_mini_defconfig | 2 +- configs/xilinx_versal_mini_emmc0_defconfig | 2 +- configs/xilinx_versal_mini_emmc1_defconfig | 2 +- configs/xilinx_versal_mini_ospi_defconfig | 2 +- configs/xilinx_versal_mini_qspi_defconfig | 2 +- configs/xilinx_versal_net_mini_defconfig | 2 +- configs/xilinx_versal_net_mini_emmc_defconfig | 2 +- configs/xilinx_versal_net_mini_ospi_defconfig | 2 +- configs/xilinx_versal_net_mini_qspi_defconfig | 2 +- configs/xilinx_zynqmp_mini_defconfig | 2 +- configs/xilinx_zynqmp_mini_emmc0_defconfig | 2 +- configs/xilinx_zynqmp_mini_emmc1_defconfig | 2 +- configs/xilinx_zynqmp_mini_nand_defconfig | 2 +- configs/xilinx_zynqmp_mini_nand_single_defconfig | 2 +- configs/xilinx_zynqmp_mini_qspi_defconfig | 2 +- configs/zynq_cse_nand_defconfig | 2 +- configs/zynq_cse_nor_defconfig | 2 +- configs/zynq_cse_qspi_defconfig | 2 +- 110 files changed, 110 insertions(+), 110 deletions(-)
configs/LicheePi_Zero_defconfig +1 -1
@@ -5,4 +5,4 @@ CONFIG_SPL=y CONFIG_MACH_SUN8I_V3S=y CONFIG_DRAM_CLK=360 # CONFIG_HAS_ARMV7_SECURE_BASE is not set -# CONFIG_NET is not set +CONFIG_NO_NET=y
configs/M5249EVB_defconfig +1 -1
@@ -22,7 +22,7 @@ CONFIG_CMD_MX_CYCLIC=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_CACHE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_MTD=y CONFIG_MTD_NOR_FLASH=y CONFIG_FLASH_CFI_DRIVER=y
configs/am335x_pdu001_defconfig +1 -1
@@ -41,7 +41,7 @@ CONFIG_OF_CONTROL=y CONFIG_SPL_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_SPL_OF_TRANSLATE=y
configs/am62ax_evm_r5_defconfig +1 -1
@@ -68,7 +68,7 @@ CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_MMC_ENV_PART=1 -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_REGMAP=y
configs/am62px_evm_r5_defconfig +1 -1
@@ -72,7 +72,7 @@ CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_MMC_ENV_PART=1 -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM=y CONFIG_SPL_DM_DEVICE_REMOVE=y CONFIG_SPL_DM_SEQ_ALIAS=y
configs/am62x_beagleplay_r5_defconfig +1 -1
@@ -69,7 +69,7 @@ CONFIG_SPL_OF_CONTROL=y CONFIG_SPL_MULTI_DTB_FIT=y CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_REGMAP=y
configs/amcore_defconfig +1 -1
@@ -33,7 +33,7 @@ CONFIG_CMD_DIAG=y CONFIG_ENV_IS_IN_FLASH=y CONFIG_USE_HOSTNAME=y CONFIG_HOSTNAME="AMCORE" -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_MTD=y CONFIG_MTD_NOR_FLASH=y CONFIG_FLASH_CFI_DRIVER=y
configs/amd_versal2_mini_defconfig +1 -1
@@ -62,7 +62,7 @@ CONFIG_CMD_CACHE=y # CONFIG_CMD_SLEEP is not set CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set # CONFIG_GPIO is not set # CONFIG_I2C is not set
configs/amd_versal2_mini_emmc_defconfig +1 -1
@@ -53,7 +53,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_MMC_HS200_SUPPORT=y CONFIG_MMC_SDHCI=y
configs/amd_versal2_mini_ospi_defconfig +1 -1
@@ -56,7 +56,7 @@ CONFIG_CMD_CACHE=y # CONFIG_CMD_SLEEP is not set CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set # CONFIG_GPIO is not set # CONFIG_I2C is not set
configs/amd_versal2_mini_qspi_defconfig +1 -1
@@ -56,7 +56,7 @@ CONFIG_CMD_CACHE=y # CONFIG_CMD_SLEEP is not set CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set # CONFIG_GPIO is not set # CONFIG_I2C is not set
configs/anbernic-rgxx3-rk3566_defconfig +1 -1
@@ -41,7 +41,7 @@ CONFIG_OF_LIVE=y # CONFIG_OF_UPSTREAM is not set CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_SPL_REGMAP=y CONFIG_SPL_SYSCON=y
configs/ap143_defconfig +1 -1
@@ -46,7 +46,7 @@ CONFIG_MTDPARTS_DEFAULT="mtdparts=spi-flash.0:256k(u-boot),64k(u-boot-env),6336k CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_ENV_SPI_MAX_HZ=25000000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_MTD=y CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH_ATMEL=y
configs/ap152_defconfig +1 -1
@@ -46,7 +46,7 @@ CONFIG_MTDPARTS_DEFAULT="mtdparts=spi-flash.0:256k(u-boot),64k(u-boot-env),6336k CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_ENV_SPI_MAX_HZ=25000000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_MTD=y CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH_BAR=y
configs/apple_m1_defconfig +1 -1
@@ -11,7 +11,7 @@ CONFIG_SYS_PBSIZE=276 CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_BOARD_LATE_INIT=y CONFIG_CMD_SELECT_FONT=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SYS_64BIT_LBA=y CONFIG_APPLE_SPI_KEYB=y # CONFIG_MMC is not set
configs/astro_mcf5373l_defconfig +1 -1
@@ -27,7 +27,7 @@ CONFIG_CMD_I2C=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_CACHE=y CONFIG_CMD_JFFS2=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_FPGA_ALTERA=y CONFIG_FPGA_CYCLON2=y CONFIG_FPGA_XILINX=y
configs/at91sam9rlek_dataflash_defconfig +1 -1
@@ -41,7 +41,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_ENV_SPI_MAX_HZ=15000000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK=y CONFIG_CLK_AT91=y CONFIG_AT91_GPIO=y
configs/at91sam9rlek_mmc_defconfig +1 -1
@@ -39,7 +39,7 @@ CONFIG_CMD_FAT=y CONFIG_OF_CONTROL=y CONFIG_ENV_IS_IN_FAT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK=y CONFIG_CLK_AT91=y CONFIG_AT91_GPIO=y
configs/at91sam9rlek_nandflash_defconfig +1 -1
@@ -40,7 +40,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_IS_IN_NAND=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK=y CONFIG_CLK_AT91=y CONFIG_AT91_GPIO=y
configs/bcm7260_defconfig +1 -1
@@ -35,7 +35,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_BCMSTB=y CONFIG_MTD=y
configs/bcm7445_defconfig +1 -1
@@ -37,7 +37,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_BCMSTB=y CONFIG_MTD=y
configs/bcm968380gerg_ram_defconfig +1 -1
@@ -41,7 +41,7 @@ CONFIG_CMD_GPIO=y CONFIG_CMD_NAND=y # CONFIG_CMD_SLEEP is not set CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_BCM6345_GPIO=y CONFIG_LED=y
configs/bcmns_defconfig +1 -1
@@ -28,7 +28,7 @@ CONFIG_CMD_CACHE=y CONFIG_OF_EMBED=y CONFIG_USE_HOSTNAME=y CONFIG_HOSTNAME="NS" -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK=y CONFIG_MTD=y CONFIG_DM_MTD=y
configs/chromebook_samus_tpl_defconfig +1 -1
@@ -74,7 +74,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="bzImage" -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_REGMAP=y CONFIG_SYSCON=y # CONFIG_ACPIGEN is not set
configs/cortina_presidio-asic-base_defconfig +1 -1
@@ -31,7 +31,7 @@ CONFIG_CMD_TIMER=y CONFIG_CMD_SMC=y CONFIG_OF_CONTROL=y CONFIG_OF_LIVE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CORTINA_GPIO=y # CONFIG_MMC is not set CONFIG_DM_SERIAL=y
configs/cortina_presidio-asic-pnand_defconfig +1 -1
@@ -32,7 +32,7 @@ CONFIG_CMD_TIMER=y CONFIG_CMD_SMC=y CONFIG_OF_CONTROL=y CONFIG_OF_LIVE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CORTINA_GPIO=y # CONFIG_MMC is not set CONFIG_MTD=y
configs/durian_defconfig +1 -1
@@ -28,7 +28,7 @@ CONFIG_SYS_PROMPT="durian#" CONFIG_CMD_PCI=y CONFIG_OF_CONTROL=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SCSI_AHCI=y CONFIG_AHCI_PCI=y # CONFIG_MMC is not set
configs/e850-96_defconfig +1 -1
@@ -20,7 +20,7 @@ CONFIG_CMD_MMC=y CONFIG_CMD_PART=y CONFIG_CMD_TIME=y CONFIG_CMD_RNG=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK_EXYNOS850=y CONFIG_MMC_DW=y CONFIG_SOC_SAMSUNG=y
configs/ea-lpc3250devkitv2_defconfig +1 -1
@@ -25,7 +25,7 @@ CONFIG_SYS_PROMPT="EA-LPC3250v2=> " CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_OF_CONTROL=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_LPC32XX_GPIO=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_LPC32XX=y
configs/efi-x86_app32_defconfig +1 -1
@@ -35,7 +35,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="bzImage" -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_REGMAP=y CONFIG_SYSCON=y # CONFIG_GZIP is not set
configs/efi-x86_app64_defconfig +1 -1
@@ -38,7 +38,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="bzImage" -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_REGMAP=y CONFIG_SYSCON=y CONFIG_CONSOLE_SCROLL_LINES=5
configs/emsdp_defconfig +1 -1
@@ -30,7 +30,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="app.bin" CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_MMC=y CONFIG_MMC_DW=y CONFIG_MMC_DW_SNPS=y
configs/evb-px5_defconfig +1 -1
@@ -57,7 +57,7 @@ CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names interrupt-parent" CONFIG_TPL_OF_PLATDATA=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_TPL_DM=y CONFIG_REGMAP=y CONFIG_SPL_REGMAP=y
configs/generic-rk3568_defconfig +1 -1
@@ -40,7 +40,7 @@ CONFIG_OF_LIVE=y # CONFIG_OF_UPSTREAM is not set CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_SPL_REGMAP=y CONFIG_SPL_SYSCON=y
configs/generic-rk3588_defconfig +1 -1
@@ -35,7 +35,7 @@ CONFIG_OF_LIVE=y # CONFIG_OF_UPSTREAM is not set CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_SPL_REGMAP=y CONFIG_SPL_SYSCON=y
configs/hc2910_2aghd05_defconfig +1 -1
@@ -36,7 +36,7 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_PARTITION_TYPE_GUID=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_GPIO is not set # CONFIG_I2C is not set # CONFIG_INPUT is not set
configs/igep00x0_defconfig +1 -1
@@ -60,7 +60,7 @@ CONFIG_ENV_UBI_VOLUME="config" CONFIG_ENV_UBI_VOLUME_REDUND="config_r" CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM=y CONFIG_DM_I2C=y CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
configs/imx6q_bosch_acc_defconfig +1 -1
@@ -81,7 +81,7 @@ CONFIG_SYS_MMC_ENV_PART=1 CONFIG_ENV_WRITEABLE_LIST=y CONFIG_ENV_ACCESS_IGNORE_FORCE=y CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM=y CONFIG_BOOTCOUNT_LIMIT=y CONFIG_DM_BOOTCOUNT=y
configs/imx6ulz_smm_m2_defconfig +1 -1
@@ -42,7 +42,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_NAND=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_BOUNCE_BUFFER=y CONFIG_USB_FUNCTION_FASTBOOT=y CONFIG_FASTBOOT_BUF_ADDR=0x82000000
configs/iot_devkit_defconfig +1 -1
@@ -34,7 +34,7 @@ CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="app.bin" -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_MMC=y CONFIG_MMC_DW=y CONFIG_MMC_DW_SNPS=y
configs/j722s_evm_r5_defconfig +1 -1
@@ -72,7 +72,7 @@ CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_MMC_ENV_PART=1 -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM=y CONFIG_SPL_DM_DEVICE_REMOVE=y CONFIG_SPL_DM_SEQ_ALIAS=y
configs/legoev3_defconfig +1 -1
@@ -44,7 +44,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="uImage" CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_DM_I2C=y CONFIG_SYS_I2C_DAVINCI=y
configs/mk808_defconfig +1 -1
@@ -68,7 +68,7 @@ CONFIG_OF_DTB_PROPS_REMOVE=y CONFIG_SPL_OF_PLATDATA=y CONFIG_TPL_OF_PLATDATA=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_TPL_DM=y CONFIG_REGMAP=y CONFIG_SPL_REGMAP=y
configs/mx23evk_defconfig +1 -1
@@ -41,7 +41,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="uImage" CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_MXS_GPIO=y CONFIG_MMC_MXS=y CONFIG_PINCTRL=y
configs/mx28evk_defconfig +1 -1
@@ -47,7 +47,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="uImage" CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM=y CONFIG_MXS_GPIO=y CONFIG_MMC_MXS=y
configs/mx6memcal_defconfig +1 -1
@@ -38,7 +38,7 @@ CONFIG_CMD_MEMTEST=y CONFIG_CMD_CACHE=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_BOUNCE_BUFFER=y # CONFIG_MMC is not set CONFIG_FSL_USDHC=y
configs/mx6ulz_14x14_evk_defconfig +1 -1
@@ -36,7 +36,7 @@ CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_MMC_ENV_DEV=1 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_BOUNCE_BUFFER=y CONFIG_DM_74X164=y CONFIG_DM_I2C=y
configs/mx7ulp_com_defconfig +1 -1
@@ -33,7 +33,7 @@ CONFIG_CMD_FAT=y CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_MMC=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_BOUNCE_BUFFER=y CONFIG_IMX_RGPIO2P=y # CONFIG_MXC_GPIO is not set
configs/mx7ulp_evk_defconfig +1 -1
@@ -33,7 +33,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_BOUNCE_BUFFER=y CONFIG_IMX_RGPIO2P=y # CONFIG_MXC_GPIO is not set
configs/mx7ulp_evk_plugin_defconfig +1 -1
@@ -31,7 +31,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_BOUNCE_BUFFER=y CONFIG_IMX_RGPIO2P=y # CONFIG_MXC_GPIO is not set
configs/netgear_cg3100d_ram_defconfig +1 -1
@@ -39,7 +39,7 @@ CONFIG_CMD_MEMINFO=y CONFIG_CMD_SPI=y # CONFIG_CMD_SLEEP is not set CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_BCM6345_GPIO=y CONFIG_LED=y
configs/nsim_700_defconfig +1 -1
@@ -25,7 +25,7 @@ CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="uImage" -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_SHIFT=2 CONFIG_SYS_NS16550=y
configs/nsim_700be_defconfig +1 -1
@@ -26,7 +26,7 @@ CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="uImage" -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_SHIFT=2 CONFIG_SYS_NS16550=y
configs/nsim_hs38be_defconfig +1 -1
@@ -27,7 +27,7 @@ CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_BOOTFILE=y CONFIG_BOOTFILE="uImage" -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_SHIFT=2 CONFIG_SYS_NS16550=y
configs/openpiton_riscv64_defconfig +1 -1
@@ -61,7 +61,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y # CONFIG_DOS_PARTITION is not set CONFIG_OF_EMBED=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CPU=y CONFIG_MMC=y # CONFIG_MMC_WRITE is not set
configs/openpiton_riscv64_spl_defconfig +1 -1
@@ -77,7 +77,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y # CONFIG_DOS_PARTITION is not set # CONFIG_SPL_PARTITION_UUIDS is not set -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CPU=y CONFIG_MMC=y # CONFIG_MMC_WRITE is not set
configs/origen_defconfig +1 -1
@@ -41,7 +41,7 @@ CONFIG_CMD_EXT4_WRITE=y CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_DFU_MMC=y CONFIG_SYS_DFU_DATA_BUF_SIZE=0x2000000 CONFIG_MMC_DW=y
configs/pe2201_defconfig +1 -1
@@ -27,7 +27,7 @@ CONFIG_CMD_DM=y CONFIG_CMD_PCI=y CONFIG_OF_CONTROL=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SCSI_AHCI=y CONFIG_AHCI_PCI=y # CONFIG_MMC is not set
configs/pinecube_defconfig +1 -1
@@ -9,7 +9,7 @@ CONFIG_DRAM_ODT_EN=y CONFIG_I2C0_ENABLE=y # CONFIG_HAS_ARMV7_SECURE_BASE is not set CONFIG_SPL_I2C=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_MVTWSI=y CONFIG_SYS_I2C_SLAVE=0x7f
configs/pm9261_defconfig +1 -1
@@ -37,7 +37,7 @@ CONFIG_MTDPARTS_DEFAULT="mtdparts=physmap-flash.0:256k(u-boot)ro,64k(u-boot-env) CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_FLASH=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK=y CONFIG_CLK_AT91=y CONFIG_AT91_GPIO=y
configs/s5p4418_nanopi2_defconfig +1 -1
@@ -49,7 +49,7 @@ CONFIG_CMD_FAT=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_MMC_ENV_DEV=2 -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_NEXELL=y CONFIG_MMC_DW=y
configs/s5p_goni_defconfig +1 -1
@@ -44,7 +44,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_DFU_MMC=y CONFIG_SYS_DFU_DATA_BUF_SIZE=0x2000000 CONFIG_DM_I2C_GPIO=y
configs/s5pc210_universal_defconfig +1 -1
@@ -41,7 +41,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_DFU_MMC=y CONFIG_SYS_DFU_DATA_BUF_SIZE=0x2000000 CONFIG_SYS_I2C_S3C24X0=y
configs/sama5d27_giantboard_defconfig +1 -1
@@ -64,7 +64,7 @@ CONFIG_OF_CONTROL=y CONFIG_SPL_OF_CONTROL=y CONFIG_OF_SPL_REMOVE_PROPS="interrupts interrupt-parent dmas dma-names" CONFIG_ENV_IS_IN_FAT=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_CLK=y
configs/sama5d29_curiosity_mmc1_defconfig +1 -1
@@ -70,7 +70,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_HOSTNAME=y CONFIG_HOSTNAME="SAMA5D29" CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK=y CONFIG_CLK_AT91=y CONFIG_AT91_UTMI=y
configs/sama5d29_curiosity_mmc_defconfig +1 -1
@@ -69,7 +69,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_HOSTNAME=y CONFIG_HOSTNAME="SAMA5D29" CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK=y CONFIG_CLK_AT91=y CONFIG_AT91_UTMI=y
configs/sama5d29_curiosity_qspiflash_defconfig +1 -1
@@ -69,7 +69,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_HOSTNAME=y CONFIG_HOSTNAME="SAMA5D29" CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK=y CONFIG_CLK_AT91=y CONFIG_AT91_UTMI=y
configs/sama7g54_curiosity_mmc_defconfig +1 -1
@@ -74,7 +74,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_HOSTNAME=y CONFIG_HOSTNAME="SAMA7G54" CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK=y CONFIG_CLK_CCF=y CONFIG_CLK_AT91=y
configs/sama7g54_curiosity_nandflash_defconfig +1 -1
@@ -72,7 +72,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_HOSTNAME=y CONFIG_HOSTNAME="SAMA7G54" CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK=y CONFIG_CLK_CCF=y CONFIG_CLK_AT91=y
configs/sama7g54_curiosity_qspiflash_defconfig +1 -1
@@ -73,7 +73,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_HOSTNAME=y CONFIG_HOSTNAME="SAMA7G54" CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK=y CONFIG_CLK_CCF=y CONFIG_CLK_AT91=y
configs/sipeed_maix_bitm_defconfig +1 -1
@@ -17,7 +17,7 @@ CONFIG_BOARD_EARLY_INIT_F=y CONFIG_HUSH_PARSER=y CONFIG_MTDIDS_DEFAULT="nor0=spi3:0" CONFIG_MTDPARTS_DEFAULT="nor0:1M(u-boot),0x1000@0xfff000(env)" -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK_K210_SET_RATE=y # CONFIG_INPUT is not set CONFIG_SF_DEFAULT_BUS=3
configs/sipeed_maix_smode_defconfig +1 -1
@@ -18,7 +18,7 @@ CONFIG_SYS_PBSIZE=276 CONFIG_HUSH_PARSER=y CONFIG_MTDIDS_DEFAULT="nor0=spi3:0" CONFIG_MTDPARTS_DEFAULT="nor0:1M(u-boot),0x1000@0xfff000(env)" -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_INPUT is not set CONFIG_SF_DEFAULT_BUS=3 CONFIG_FS_EXT4=y
configs/stemmy_defconfig +1 -1
@@ -28,7 +28,7 @@ CONFIG_CMD_MMC=y CONFIG_CMD_PART=y CONFIG_CMD_GETTIME=y CONFIG_EFI_PARTITION=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_USB_FUNCTION_FASTBOOT=y CONFIG_FASTBOOT_BUF_ADDR=0x18100000 CONFIG_FASTBOOT_FLASH=y
configs/stm32f429-discovery_defconfig +1 -1
@@ -27,7 +27,7 @@ CONFIG_CMD_IMLS=y CONFIG_CMD_TIMER=y CONFIG_OF_CONTROL=y CONFIG_ENV_IS_IN_FLASH=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_MMC is not set CONFIG_MTD=y CONFIG_MTD_NOR_FLASH=y
configs/stm32f429-evaluation_defconfig +1 -1
@@ -25,7 +25,7 @@ CONFIG_CMD_TIMER=y # CONFIG_ISO_PARTITION is not set CONFIG_OF_CONTROL=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_ARM_PL180_MMCI=y CONFIG_MTD=y CONFIG_MTD_NOR_FLASH=y
configs/stm32f469-discovery_defconfig +1 -1
@@ -26,7 +26,7 @@ CONFIG_CMD_TIMER=y # CONFIG_ISO_PARTITION is not set CONFIG_OF_CONTROL=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_ARM_PL180_MMCI=y CONFIG_MTD=y CONFIG_DM_MTD=y
configs/stm32h743-disco_defconfig +1 -1
@@ -30,6 +30,6 @@ CONFIG_CMD_EXT4_WRITE=y # CONFIG_ISO_PARTITION is not set CONFIG_OF_CONTROL=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_STM32_SDMMC2=y # CONFIG_PINCTRL_FULL is not set
configs/stm32h743-eval_defconfig +1 -1
@@ -30,6 +30,6 @@ CONFIG_CMD_EXT4_WRITE=y # CONFIG_ISO_PARTITION is not set CONFIG_OF_CONTROL=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_STM32_SDMMC2=y # CONFIG_PINCTRL_FULL is not set
configs/stm32h750-art-pi_defconfig +1 -1
@@ -36,7 +36,7 @@ CONFIG_CMD_EXT4_WRITE=y # CONFIG_ISO_PARTITION is not set CONFIG_OF_CONTROL=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_DM_DMA=y CONFIG_STM32_SDMMC2=y # CONFIG_PINCTRL_FULL is not set
configs/stm32mp25_defconfig +1 -1
@@ -31,7 +31,7 @@ CONFIG_CMD_TIMER=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_LOG=y CONFIG_OF_LIVE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_GPIO_HOG=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_STM32F7=y
configs/stmark2_defconfig +1 -1
@@ -39,7 +39,7 @@ CONFIG_ENV_SPI_CS=1 CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_USE_HOSTNAME=y CONFIG_HOSTNAME="stmark2" -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_FSL=y CONFIG_MTD=y
configs/th1520_lpi4a_defconfig +1 -1
@@ -58,7 +58,7 @@ CONFIG_CMD_BOOTMENU=y CONFIG_PARTITION_TYPE_GUID=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_VERSION_VARIABLE=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_BLOCK_CACHE is not set # CONFIG_GPIO is not set # CONFIG_I2C is not set
configs/thunderx_88xx_defconfig +1 -1
@@ -32,7 +32,7 @@ CONFIG_SYS_PROMPT="ThunderX_88XX> " # CONFIG_CMD_SAVEENV is not set # CONFIG_CMD_ENV_EXISTS is not set CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_MMC is not set CONFIG_DM_SERIAL=y CONFIG_DEBUG_UART_SKIP_INIT=y
configs/tools-only_defconfig +1 -1
@@ -22,7 +22,7 @@ CONFIG_BOOTCOMMAND="run distro_bootcmd" # CONFIG_CMD_DATE is not set CONFIG_OF_CONTROL=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_ACPIGEN is not set CONFIG_AXI=y CONFIG_AXI_SANDBOX=y
configs/topic_miami_defconfig +1 -1
@@ -52,7 +52,7 @@ CONFIG_CMD_CACHE=y CONFIG_OF_EMBED=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_DFU_RAM=y CONFIG_SYS_DFU_DATA_BUF_SIZE=0x600000
configs/topic_miamilite_defconfig +1 -1
@@ -52,7 +52,7 @@ CONFIG_CMD_CACHE=y CONFIG_OF_EMBED=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_DFU_RAM=y CONFIG_SYS_DFU_DATA_BUF_SIZE=0x600000
configs/topic_miamiplus_defconfig +1 -1
@@ -52,7 +52,7 @@ CONFIG_CMD_CACHE=y CONFIG_OF_EMBED=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_DFU_RAM=y CONFIG_SYS_DFU_DATA_BUF_SIZE=0x600000
configs/total_compute_defconfig +1 -1
@@ -43,7 +43,7 @@ CONFIG_CMD_AVB=y CONFIG_CMD_UBI=y # CONFIG_ISO_PARTITION is not set CONFIG_OF_CONTROL=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_CLK=y # CONFIG_MMC_WRITE is not set CONFIG_ARM_PL180_MMCI=y
configs/trats2_defconfig +1 -1
@@ -43,7 +43,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_DFU_MMC=y CONFIG_SYS_DFU_DATA_BUF_SIZE=0x2000000 CONFIG_DM_I2C_GPIO=y
configs/trats_defconfig +1 -1
@@ -42,7 +42,7 @@ CONFIG_OF_CONTROL=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -# CONFIG_NET is not set +CONFIG_NO_NET=y CONFIG_DFU_MMC=y CONFIG_SYS_DFU_DATA_BUF_SIZE=0x2000000 CONFIG_DM_I2C_GPIO=y
configs/xenguest_arm64_defconfig +1 -1
@@ -37,7 +37,7 @@ CONFIG_CMD_PVBLOCK=y # CONFIG_CMD_SLEEP is not set CONFIG_CMD_EXT4=y CONFIG_CMD_FAT=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_MMC is not set # CONFIG_REQUIRE_SERIAL_CONSOLE is not set CONFIG_DM_SERIAL=y
configs/xenguest_arm64_virtio_defconfig +1 -1
@@ -42,7 +42,7 @@ CONFIG_CMD_PCI=y CONFIG_CMD_EXT4=y CONFIG_CMD_FAT=y CONFIG_PARTITION_TYPE_GUID=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_MMC is not set CONFIG_DM_PCI_COMPAT=y CONFIG_PCI_REGION_MULTI_ENTRY=y
configs/xilinx_versal_mini_defconfig +1 -1
@@ -57,7 +57,7 @@ CONFIG_SYS_ALT_MEMTEST=y # CONFIG_CMD_SETEXPR is not set # CONFIG_CMD_SLEEP is not set CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set # CONFIG_MMC is not set CONFIG_ARM_DCC=y
configs/xilinx_versal_mini_emmc0_defconfig +1 -1
@@ -55,7 +55,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ZYNQ=y
configs/xilinx_versal_mini_emmc1_defconfig +1 -1
@@ -55,7 +55,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ZYNQ=y
configs/xilinx_versal_mini_ospi_defconfig +1 -1
@@ -51,7 +51,7 @@ CONFIG_SYS_PROMPT="Versal> " # CONFIG_CMD_ITEST is not set # CONFIG_CMD_SOURCE is not set # CONFIG_CMD_SETEXPR is not set -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set # CONFIG_MMC is not set CONFIG_MTD=y
configs/xilinx_versal_mini_qspi_defconfig +1 -1
@@ -53,7 +53,7 @@ CONFIG_SYS_PROMPT="Versal> " # CONFIG_CMD_SOURCE is not set # CONFIG_CMD_SETEXPR is not set # CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG is not set -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set # CONFIG_GPIO is not set # CONFIG_I2C is not set
configs/xilinx_versal_net_mini_defconfig +1 -1
@@ -61,7 +61,7 @@ CONFIG_CMD_CACHE=y # CONFIG_CMD_SLEEP is not set CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set # CONFIG_GPIO is not set # CONFIG_I2C is not set
configs/xilinx_versal_net_mini_emmc_defconfig +1 -1
@@ -50,7 +50,7 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_MMC_HS200_SUPPORT=y CONFIG_MMC_SDHCI=y
configs/xilinx_versal_net_mini_ospi_defconfig +1 -1
@@ -50,7 +50,7 @@ CONFIG_SYS_PROMPT="Versal NET> " # CONFIG_CMD_ITEST is not set # CONFIG_CMD_SOURCE is not set # CONFIG_CMD_SETEXPR is not set -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set # CONFIG_MMC is not set CONFIG_MTD=y
configs/xilinx_versal_net_mini_qspi_defconfig +1 -1
@@ -52,7 +52,7 @@ CONFIG_SYS_PROMPT="Versal NET> " # CONFIG_CMD_SOURCE is not set # CONFIG_CMD_SETEXPR is not set # CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG is not set -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set # CONFIG_GPIO is not set # CONFIG_I2C is not set
configs/xilinx_zynqmp_mini_defconfig +1 -1
@@ -53,7 +53,7 @@ CONFIG_CMD_CACHE=y # CONFIG_CMD_SLEEP is not set CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set # CONFIG_DM_MAILBOX is not set # CONFIG_MMC is not set
configs/xilinx_zynqmp_mini_emmc0_defconfig +1 -1
@@ -64,7 +64,7 @@ CONFIG_CMD_FS_GENERIC=y CONFIG_SPL_OF_CONTROL=y CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_SPL_DM_SEQ_ALIAS=y # CONFIG_DM_MAILBOX is not set
configs/xilinx_zynqmp_mini_emmc1_defconfig +1 -1
@@ -64,7 +64,7 @@ CONFIG_CMD_FS_GENERIC=y CONFIG_SPL_OF_CONTROL=y CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_SPL_DM_SEQ_ALIAS=y # CONFIG_DM_MAILBOX is not set
configs/xilinx_zynqmp_mini_nand_defconfig +1 -1
@@ -48,7 +48,7 @@ CONFIG_CLOCKS=y # CONFIG_CMD_SETEXPR is not set CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set # CONFIG_DM_MAILBOX is not set # CONFIG_MMC is not set
configs/xilinx_zynqmp_mini_nand_single_defconfig +1 -1
@@ -48,7 +48,7 @@ CONFIG_CLOCKS=y # CONFIG_CMD_SETEXPR is not set CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set # CONFIG_DM_MAILBOX is not set # CONFIG_MMC is not set
configs/xilinx_zynqmp_mini_qspi_defconfig +1 -1
@@ -67,7 +67,7 @@ CONFIG_SPL_SYS_MALLOC_SIZE=0x1000000 CONFIG_SPL_OF_CONTROL=y CONFIG_OF_EMBED=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_SPL_DM_SEQ_ALIAS=y # CONFIG_FIRMWARE is not set
configs/zynq_cse_nand_defconfig +1 -1
@@ -69,7 +69,7 @@ CONFIG_SYS_MAXARGS=32 CONFIG_OF_EMBED=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_SPL_DM_SEQ_ALIAS=y # CONFIG_MMC is not set
configs/zynq_cse_nor_defconfig +1 -1
@@ -69,7 +69,7 @@ CONFIG_SYS_MAXARGS=32 CONFIG_OF_EMBED=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_SPL_DM_SEQ_ALIAS=y # CONFIG_MMC is not set
configs/zynq_cse_qspi_defconfig +1 -1
@@ -78,7 +78,7 @@ CONFIG_SYS_MAXARGS=32 CONFIG_OF_EMBED=y CONFIG_ENV_OVERWRITE=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y -# CONFIG_NET is not set +CONFIG_NO_NET=y # CONFIG_DM_DEVICE_REMOVE is not set CONFIG_SPL_DM_SEQ_ALIAS=y # CONFIG_MMC is not set
Signature · 1 line
2.40.1
PATCH v11 9/29 net: split include/net.h into net{, -common, -legacy, -lwip}.h
In reply to Jerome ForissierMake net.h a wrapper which includes net-common.h and either net-legacy.h or net-lwip.h based on NET_LWIP.
--- Makefile | 4 +- include/net-common.h | 501 +++++++++++++++++++++++ include/net-legacy.h | 544 +++++++++++++++++++++++++ include/net-lwip.h | 14 + include/net.h | 943 +------------------------------------------ 5 files changed, 1066 insertions(+), 940 deletions(-) create mode 100644 include/net-common.h create mode 100644 include/net-legacy.h create mode 100644 include/net-lwip.h
Makefile +3 -1
@@ -836,7 +836,9 @@ UBOOTINCLUDE := \ -I$(srctree)/arch/arm/thumb1/include)) \ -I$(srctree)/arch/$(ARCH)/include \ -include $(srctree)/include/linux/kconfig.h \ - -I$(srctree)/dts/upstream/include + -I$(srctree)/dts/upstream/include \ + $(if $(CONFIG_NET_LWIP), -I$(srctree)/lib/lwip/lwip/src/include \ + -I$(srctree)/lib/lwip/u-boot) NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
include/net-common.h new file +501 -0
501 lines not on this page · raw message
include/net-legacy.h new file +544 -0
544 lines not on this page · raw message
include/net-lwip.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#ifndef __NET_LWIP_H__ +#define __NET_LWIP_H__ + +#include <lwip/ip4.h> +#include <lwip/netif.h> + +struct netif *net_lwip_new_netif (struct udevice *udev); +struct netif *net_lwip_new_netif_noip (struct udevice *udev); +void net_lwip_remove_netif (struct netif *netif); +struct netif *net_lwip_get_netif (void ); + +#endif /* __NET_LWIP_H__ */
include/net.h +4 -939
953 lines not on this page · raw message
Signature · 1 line
2.40.1
Re: [PATCH v11 09/29] net: split include/net.h into net{, -common, -legacy, -lwip}.h
Quoted 2,067 lines · Jerome Forissier
Make
net.ha wrapper which includesnet-common.hand eithernet-legacy.hornet-lwip.hbased onNET_LWIP.Signed-off-by Jerome Forissier <[email protected]>--- Makefile | 4 +- include/net-common.h | 501 +++++++++++++++++++++++ include/net-legacy.h | 544 +++++++++++++++++++++++++ include/net-lwip.h | 14 + include/net.h | 943 +------------------------------------------ 5 files changed, 1066 insertions(+), 940 deletions(-) create mode 100644 include/net-common.h create mode 100644 include/net-legacy.h create mode 100644 include/net-lwip.hMakefile +3
-1@@ -836,7 +836,9 @@ UBOOTINCLUDE := \ -I$(srctree)/arch/arm/thumb1/include)) \ -I$(srctree)/arch/$(ARCH)/include \ -include $(srctree)/include/linux/kconfig.h \ - -I$(srctree)/dts/upstream/include + -I$(srctree)/dts/upstream/include \ + $(if $(CONFIG_NET_LWIP), -I$(srctree)/lib/lwip/lwip/src/include \ + -I$(srctree)/lib/lwip/u-boot) NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)include/net-common.h new file +501
-0@@ -0,0 +1,501 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#ifndef __NET_COMMON_H__ +#define __NET_COMMON_H__ + +#include <asm/cache.h> +#include <command.h> +#include <env.h> +#include <hexdump.h> +#include <linux/if_ether.h> +#include <linux/types.h> +#include <rand.h> +#include <time.h> + +#define DEBUG_NET_PKT_TRACE 0/* Trace all packet data */ + +/* +* The number of receive packet buffers, and the required packet buffer +* alignment in memory. +* +*/ +#define PKTBUFSRX CONFIG_SYS_RX_ETH_BUFFER +#define PKTALIGN ARCH_DMA_MINALIGN + +/* IPv4 addresses are always 32 bits in size */ +struct in_addr { +__be32 s_addr; +}; + +#define PROT_IP 0x0800/* IP protocol */ +#define PROT_ARP 0x0806/* IP ARP protocol */ +#define PROT_WOL 0x0842/* ether-wake WoL protocol */ +#define PROT_RARP 0x8035/* IP ARP protocol */ +#define PROT_VLAN 0x8100/* IEEE 802.1q protocol */ +#define PROT_IPV6 0x86dd/* IPv6 over bluebook */ +#define PROT_PPP_SES 0x8864/* PPPoE session messages */ +#define PROT_NCSI 0x88f8/* NC-SI control packets */ + +#define IPPROTO_ICMP 1/* Internet Control Message Protocol */ +#define IPPROTO_TCP 6/* Transmission Control Protocol */ +#define IPPROTO_UDP 17/* User Datagram Protocol */ + +#define IP_OFFS 0x1fff/* ip offset *= 8 */ +#define IP_FLAGS 0xe000/* first 3 bits */ +#define IP_FLAGS_RES 0x8000/* reserved */ +#define IP_FLAGS_DFRAG 0x4000/* don't fragments */ +#define IP_FLAGS_MFRAG 0x2000/* more fragments */ + +#define IP_HDR_SIZE (sizeof(struct ip_hdr)) + +#define IP_MIN_FRAG_DATAGRAM_SIZE (IP_HDR_SIZE + 8) + +/* +* Internet Protocol (IP) + UDP header. +*/ +struct ip_udp_hdr { +u8 ip_hl_v;/* header length and version */ +u8 ip_tos;/* type of service */ +u16 ip_len;/* total length */ +u16 ip_id;/* identification */ +u16 ip_off;/* fragment offset field */ +u8 ip_ttl;/* time to live */ +u8 ip_p;/* protocol */ +u16 ip_sum;/* checksum */ +struct in_addr ip_src;/* Source IP address */ +struct in_addr ip_dst;/* Destination IP address */ +u16 udp_src;/* UDP source port */ +u16 udp_dst;/* UDP destination port */ +u16 udp_len;/* Length of UDP packet */ +u16 udp_xsum;/* Checksum */ +} __attribute__((packed)); + +#define IP_UDP_HDR_SIZE (sizeof(struct ip_udp_hdr)) +#define UDP_HDR_SIZE (IP_UDP_HDR_SIZE - IP_HDR_SIZE) + +/* Number of packets processed together */ +#define ETH_PACKETS_BATCH_RECV 32 + +/* ARP hardware address length */ +#define ARP_HLEN 6 +/* +* The size of a MAC address in string form, each digit requires two chars +* and five separator characters to form '00:00:00:00:00:00'. +*/ +#define ARP_HLEN_ASCII (ARP_HLEN * 2) + (ARP_HLEN - 1) + +#define ARP_HDR_SIZE (8+20)/* Size assuming ethernet */ + +# define ARP_ETHER 1/* Ethernet hardware address */ + +/* +* Maximum packet size; used to allocate packet storage. Use +* the maxium Ethernet frame size as specified by the Ethernet +* standard including the 802.1Q tag (VLAN tagging). +* maximum packet size = 1522 +* maximum packet size and multiple of 32 bytes = 1536 +*/ +#define PKTSIZE 1522 +#ifndef CONFIG_DM_DSA +#define PKTSIZE_ALIGN 1536 +#else +/* Maximum DSA tagging overhead (headroom and/or tailroom) */ +#define DSA_MAX_OVR 256 +#define PKTSIZE_ALIGN (1536 + DSA_MAX_OVR) +#endif + +/* +* Maximum receive ring size; that is, the number of packets +* we can buffer before overflow happens. Basically, this just +* needs to be enough to prevent a packet being discarded while +* we are processing the previous one. +* Used only in drivers/net/mvgbe.c. +*/ +#define RINGSZ 4 +#define RINGSZ_LOG2 2 + +extern int net_restart_wrap;/* Tried all network devices */ +extern uchar *net_rx_packets[PKTBUFSRX ];/* Receive packets */ +extern const u8 net_bcast_ethaddr[ARP_HLEN ];/* Ethernet broadcast address */ +extern char net_boot_file_name[1024 ];/* Boot File name */ + +/** +* compute_ip_checksum() - Compute IP checksum +* +* @addr: Address to check (must be 16-bit aligned) +* @nbytes: Number of bytes to check (normally a multiple of 2) +* Return: 16-bit IP checksum +*/ +unsigned compute_ip_checksum (const void *addr,unsigned nbytes); + +/** +* ip_checksum_ok() - check if a checksum is correct +* +* This works by making sure the checksum sums to 0 +* +* @addr: Address to check (must be 16-bit aligned) +* @nbytes: Number of bytes to check (normally a multiple of 2) +* Return: true if the checksum matches, false if not +*/ +int ip_checksum_ok (const void *addr,unsigned nbytes); + +/** +* add_ip_checksums() - add two IP checksums +* +* @offset: Offset of first sum (if odd we do a byte-swap) +* @sum: First checksum +* @new_sum: New checksum to add +* Return: updated 16-bit IP checksum +*/ +unsigned add_ip_checksums (unsigned offset,unsigned sum,unsigned new_sum); + +/* +* The devname can be either an exact name given by the driver or device tree +* or it can be an alias of the form "eth%d" +*/ +struct udevice *eth_get_dev_by_name (const char *devname); +int eth_is_active (struct udevice *dev);/* Test device for active state */ + +/* +* Get the hardware address for an ethernet interface . +* Args: +* base_name - base name for device (normally "eth") +* index - device index number (0 for first) +* enetaddr - returns 6 byte hardware address +* Returns: +* Return true if the address is valid. +*/ +int eth_env_get_enetaddr_by_index (const char *base_name,int index, +uchar *enetaddr); + +/** +* eth_env_set_enetaddr_by_index() - set the MAC address environment variable +* +* This sets up an environment variable with the given MAC address (@enetaddr). +* The environment variable to be set is defined by <@base_name><@index>addr. +* If @index is 0 it is omitted. For common Ethernet this means ethaddr, +* eth1addr, etc. +* +* @base_name: Base name for variable, typically "eth" +* @index: Index of interface being updated (>=0) +* @enetaddr: Pointer to MAC address to put into the variable +* Return: 0 if OK, other value on error +*/ +int eth_env_set_enetaddr_by_index (const char *base_name,int index, +uchar *enetaddr); + +/* +* Initialize USB ethernet device with CONFIG_DM_ETH +* Returns: +* 0 is success, non-zero is error status. +*/ +int usb_ether_init (void ); + +int eth_init (void );/* Initialize the device */ +int eth_send (void *packet,int length);/* Send a packet */ +#if defined(CONFIG_API ) || defined(CONFIG_EFI_LOADER ) +int eth_receive (void *packet,int length);/* Receive a packet*/ +extern void (*push_packet)(void *packet,int length); +#endif +int eth_rx (void );/* Check for received packets */ + +/** +* reset_phy() - Reset the Ethernet PHY +* +* This should be implemented by boards if CONFIG_RESET_PHY_R is enabled +*/ +void reset_phy (void ); + +#if CONFIG_IS_ENABLED (NET ) ||CONFIG_IS_ENABLED (NET_LWIP ) +/** +* eth_set_enable_bootdevs() - Enable or disable binding of Ethernet bootdevs +* +* These get in the way of bootstd testing, so are normally disabled by tests. +* This provide control of this setting. It only affects binding of Ethernet +* devices, so if that has already happened, this flag does nothing. +* +* @enable: true to enable binding of bootdevs when binding new Ethernet +* devices, false to disable it +*/ +void eth_set_enable_bootdevs (bool enable); +#else +static inline void eth_set_enable_bootdevs (bool enable) {} +#endif + +static inline void net_send_packet (uchar *pkt,int len) +{ +if (DEBUG_NET_PKT_TRACE ) +print_hex_dump_bytes ("tx: " ,DUMP_PREFIX_OFFSET , pkt, len); +/* Currently no way to return errors from eth_send() */ + (void )eth_send (pkt, len); +} + +enum eth_recv_flags { +/* +* Check hardware device for new packets (otherwise only return those +* which are already in the memory buffer ready to process) +*/ +ETH_RECV_CHECK_DEVICE =1 <<0 , +}; + +/** +* struct eth_ops - functions of Ethernet MAC controllers +* +* start: Prepare the hardware to send and receive packets +* send: Send the bytes passed in "packet" as a packet on the wire +* recv: Check if the hardware received a packet. If so, set the pointer to the +* packet buffer in the packetp parameter. If not, return an error or 0 to +* indicate that the hardware receive FIFO is empty. If 0 is returned, the +* network stack will not process the empty packet, but free_pkt() will be +* called if supplied +* free_pkt: Give the driver an opportunity to manage its packet buffer memory +* when the network stack is finished processing it. This will only be +* called when no error was returned from recv - optional +* stop: Stop the hardware from looking for packets - may be called even if +* state == PASSIVE +* mcast: Join or leave a multicast group (for TFTP) - optional +* write_hwaddr: Write a MAC address to the hardware (used to pass it to Linux +* on some platforms like ARM). This function expects the +* eth_pdata::enetaddr field to be populated. The method can +* return -ENOSYS to indicate that this is not implemented for +this hardware - optional. +* read_rom_hwaddr: Some devices have a backup of the MAC address stored in a +* ROM on the board. This is how the driver should expose it +* to the network stack. This function should fill in the +* eth_pdata::enetaddr field - optional +* set_promisc: Enable or Disable promiscuous mode +* get_sset_count: Number of statistics counters +* get_string: Names of the statistic counters +* get_stats: The values of the statistic counters +*/ +struct eth_ops { +int (*start)(struct udevice *dev); +int (*send)(struct udevice *dev,void *packet,int length); +int (*recv)(struct udevice *dev,int flags,uchar **packetp); +int (*free_pkt)(struct udevice *dev,uchar *packet,int length); +void (*stop)(struct udevice *dev); +int (*mcast)(struct udevice *dev,const u8 *enetaddr,int join); +int (*write_hwaddr)(struct udevice *dev); +int (*read_rom_hwaddr)(struct udevice *dev); +int (*set_promisc)(struct udevice *dev,bool enable); +int (*get_sset_count)(struct udevice *dev); +void (*get_strings)(struct udevice *dev,u8 *data); +void (*get_stats)(struct udevice *dev,u64 *data); +}; + +#define eth_get_ops (dev) ((struct eth_ops *)(dev)->driver->ops) + +struct udevice *eth_get_dev (void );/* get the current device */ +unsigned char *eth_get_ethaddr (void );/* get the current device MAC */ +int eth_rx (void );/* Check for received packets */ +void eth_halt (void );/* stop SCC */ +const char *eth_get_name (void );/* get name of current device */ +int eth_get_dev_index (void ); + +int eth_initialize (void );/* Initialize network subsystem */ +void eth_try_another (int first_restart);/* Change the device */ +void eth_set_current (void );/* set nterface to ethcur var */ + +enum eth_state_t { +ETH_STATE_INIT , +ETH_STATE_PASSIVE , +ETH_STATE_ACTIVE +}; + +/** +* struct eth_pdata - Platform data for Ethernet MAC controllers +* +* @iobase: The base address of the hardware registers +* @enetaddr: The Ethernet MAC address that is loaded from EEPROM or env +* @phy_interface: PHY interface to use - see PHY_INTERFACE_MODE_... +* @max_speed: Maximum speed of Ethernet connection supported by MAC +* @priv_pdata: device specific plat +*/ +struct eth_pdata { +phys_addr_t iobase; +unsigned char enetaddr[ARP_HLEN ]; +int phy_interface; +int max_speed; +void *priv_pdata; +}; + +struct ethernet_hdr { +u8 et_dest[ARP_HLEN ];/* Destination node */ +u8 et_src[ARP_HLEN ];/* Source node */ +u16 et_protlen;/* Protocol or length */ +} __attribute__((packed)); + +/* Ethernet header size */ +#define ETHER_HDR_SIZE (sizeof(struct ethernet_hdr)) + +/** +* net_random_ethaddr - Generate software assigned random Ethernet address +* @addr: Pointer to a six-byte array containing the Ethernet address +* +* Generate a random Ethernet address (MAC) that is not multicast +* and has the local assigned bit set. +*/ +static inline void net_random_ethaddr (uchar *addr) +{ +int i; +unsigned int seed =get_ticks (); + +for (i =0 ; i <6 ; i++) + addr[i] =rand_r (&seed); + + addr[0 ] &=0xfe ;/* clear multicast bit */ + addr[0 ] |=0x02 ;/* set local assignment bit (IEEE802) */ +} + +/** +* is_zero_ethaddr - Determine if give Ethernet address is all zeros. +* @addr: Pointer to a six-byte array containing the Ethernet address +* +* Return true if the address is all zeroes. +*/ +static inline int is_zero_ethaddr (const u8 *addr) +{ +return !(addr[0 ] | addr[1 ] | addr[2 ] | addr[3 ] | addr[4 ] | addr[5 ]); +} + +/** +* is_multicast_ethaddr - Determine if the Ethernet address is a multicast. +* @addr: Pointer to a six-byte array containing the Ethernet address +* +* Return true if the address is a multicast address. +* By definition the broadcast address is also a multicast address. +*/ +static inline int is_multicast_ethaddr (const u8 *addr) +{ +return 0x01 & addr[0 ]; +} + +/* +* is_broadcast_ethaddr - Determine if the Ethernet address is broadcast +* @addr: Pointer to a six-byte array containing the Ethernet address +* +* Return true if the address is the broadcast address. +*/ +static inline int is_broadcast_ethaddr (const u8 *addr) +{ +return (addr[0 ] & addr[1 ] & addr[2 ] & addr[3 ] & addr[4 ] & addr[5 ]) == +0xff ; +} + +/* +* is_valid_ethaddr - Determine if the given Ethernet address is valid +* @addr: Pointer to a six-byte array containing the Ethernet address +* +* Check that the Ethernet address (MAC) is not 00:00:00:00:00:00, is not +* a multicast address, and is not FF:FF:FF:FF:FF:FF. +* +* Return true if the address is valid. +*/ +static inline int is_valid_ethaddr (const u8 *addr) +{ +/* FF:FF:FF:FF:FF:FF is a multicast address so we don't need to +* explicitly check for it here. */ +return !is_multicast_ethaddr (addr) && !is_zero_ethaddr (addr); +} + +/** +* string_to_enetaddr() - Parse a MAC address +* +* Convert a string MAC address +* +* Implemented in lib/net_utils.c (built unconditionally) +* +* @addr: MAC address in aa:bb:cc:dd:ee:ff format, where each part is a 2-digit +* hex value +* @enetaddr: Place to put MAC address (6 bytes) +*/ +void string_to_enetaddr (const char *addr,uint8_t *enetaddr); + +/** +* string_to_ip() - Convert a string to ip address +* +* Implemented in lib/net_utils.c (built unconditionally) +* +* @s: Input string to parse +* @return: in_addr struct containing the parsed IP address +*/ +struct in_addr string_to_ip (const char *s); + +/* copy a filename (allow for "..." notation, limit length) */ +void copy_filename (char *dst,const char *src,int size); + +/* Processes a received packet */ +void net_process_received_packet (uchar *in_packet,int len); + +/** +* update_tftp - Update firmware over TFTP (via DFU) +* +* This function updates board's firmware via TFTP +* +* @param addr - memory address where data is stored +* @param interface - the DFU medium name - e.g. "mmc" +* @param devstring - the DFU medium number - e.g. "1" +* +* Return: - 0 on success, other value on failure +*/ +int update_tftp (ulong addr,char *interface,char *devstring); + +/** +* env_get_ip() - Convert an environment value to to an ip address +* +* @var: Environment variable to convert. The value of this variable must be +* in the format format a.b.c.d, where each value is a decimal number from +* 0 to 255 +* Return: IP address, or 0 if invalid +*/ +static inline struct in_addr env_get_ip (char *var) +{ +return string_to_ip (env_get (var)); +} + +int net_init (void ); + +/** +* dhcp_run() - Run DHCP on the current ethernet device +* +* This sets the autoload variable, then puts it back to similar to its original +* state (y, n or unset). +* +* @addr: Address to load the file into (0 if @autoload is false) +* @fname: Filename of file to load (NULL if @autoload is false or to use the +* default filename) +* @autoload: true to load the file, false to just get the network IP +* @return 0 if OK, -EINVAL if the environment failed, -ENOENT if ant file was +* not found +*/ +int dhcp_run (ulong addr,const char *fname,bool autoload); + +/** +* do_tftpb - Run the tftpboot command +* +* @cmdtp: Command information for tftpboot +* @flag: Command flags (CMD_FLAG_...) +* @argc: Number of arguments +* @argv: List of arguments +* Return: result (see enum command_ret_t) +*/ +int do_tftpb (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); + +/** +* wget_with_dns() - runs dns host IP address resulution before wget +* +* @dst_addr: destination address to download the file +* @uri: uri string of target file of wget +* Return: downloaded file size, negative if failed +*/ +int wget_with_dns (ulong dst_addr,char *uri); +/** +* wget_validate_uri() - varidate the uri +* +* @uri: uri string of target file of wget +* Return: true if uri is valid, false if uri is invalid +*/ +bool wget_validate_uri (char *uri); +//int do_wget(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]); + +#endif /* __NET_COMMON_H__ */ include/net-legacy.h new file +544
-0@@ -0,0 +1,544 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* LiMon Monitor (LiMon) - Network. +* +* Copyright 1994 - 2000 Neil Russell. +* (See License) +* +* History +* 9/16/00 bor adapted to TQM823L/STK8xxL board, RARP/TFTP boot added +*/ + +#ifndef __NET_LEGACY_H__ +#define __NET_LEGACY_H__ + +#include <linux/types.h> +#include <asm/byteorder.h> /* for nton* / ntoh* stuff */ +#include <log.h> +#include <time.h> +#include <linux/if_ether.h> + +struct bd_info ; +struct cmd_tbl ; +struct udevice ; + +#define DEBUG_LL_STATE 0/* Link local state machine changes */ +#define DEBUG_DEV_PKT 0/* Packets or info directed to the device */ +#define DEBUG_NET_PKT 0/* Packets on info on the network at large */ +#define DEBUG_INT_STATE 0/* Internal network state changes */ + +/* ARP hardware address length */ +#define ARP_HLEN 6 +/* +* The size of a MAC address in string form, each digit requires two chars +* and five separator characters to form '00:00:00:00:00:00'. +*/ +#define ARP_HLEN_ASCII (ARP_HLEN * 2) + (ARP_HLEN - 1) + +/** +* An incoming packet handler. +* @param pkt pointer to the application packet +* @param dport destination UDP port +* @param sip source IP address +* @param sport source UDP port +* @param len packet length +*/ +typedef void rxhand_f (uchar *pkt,unsigned dport, +struct in_addr sip,unsigned sport, +unsigned len); + +/** +* An incoming ICMP packet handler. +* @param type ICMP type +* @param code ICMP code +* @param dport destination UDP port +* @param sip source IP address +* @param sport source UDP port +* @param pkt pointer to the ICMP packet data +* @param len packet length +*/ +typedef void rxhand_icmp_f (unsigned type,unsigned code,unsigned dport, +struct in_addr sip,unsigned sport,uchar *pkt,unsigned len); + +/* +* A timeout handler. Called after time interval has expired. +*/ +typedef void thand_f (void ); + +/* +* The devname can be either an exact name given by the driver or device tree +* or it can be an alias of the form "eth%d" +*/ +struct udevice *eth_get_dev_by_name (const char *devname); +int eth_init_state_only (void );/* Set active state */ +void eth_halt_state_only (void );/* Set passive state */ + +/** +* eth_env_set_enetaddr_by_index() - set the MAC address environment variable +* +* This sets up an environment variable with the given MAC address (@enetaddr). +* The environment variable to be set is defined by <@base_name><@index>addr. +* If @index is 0 it is omitted. For common Ethernet this means ethaddr, +* eth1addr, etc. +* +* @base_name: Base name for variable, typically "eth" +* @index: Index of interface being updated (>=0) +* @enetaddr: Pointer to MAC address to put into the variable +* Return: 0 if OK, other value on error +*/ +int eth_env_set_enetaddr_by_index (const char *base_name,int index, +uchar *enetaddr); + +/* +* Get the hardware address for an ethernet interface . +* Args: +* base_name - base name for device (normally "eth") +* index - device index number (0 for first) +* enetaddr - returns 6 byte hardware address +* Returns: +* Return true if the address is valid. +*/ +int eth_env_get_enetaddr_by_index (const char *base_name,int index, +uchar *enetaddr); + +int eth_send (void *packet,int length);/* Send a packet */ + +#if defined(CONFIG_API ) || defined(CONFIG_EFI_LOADER ) +int eth_receive (void *packet,int length);/* Receive a packet*/ +extern void (*push_packet)(void *packet,int length); +#endif +int eth_mcast_join (struct in_addr mcast_addr,int join); + +/**********************************************************************/ +/* +* Protocol headers. +*/ + +#define ETH_FCS_LEN 4/* Octets in the FCS */ + +struct e802_hdr { +u8 et_dest[ARP_HLEN ];/* Destination node */ +u8 et_src[ARP_HLEN ];/* Source node */ +u16 et_protlen;/* Protocol or length */ +u8 et_dsap;/* 802 DSAP */ +u8 et_ssap;/* 802 SSAP */ +u8 et_ctl;/* 802 control */ +u8 et_snap1;/* SNAP */ +u8 et_snap2; +u8 et_snap3; +u16 et_prot;/* 802 protocol */ +} __attribute__((packed)); + +/* 802 + SNAP + ethernet header size */ +#define E802_HDR_SIZE (sizeof(struct e802_hdr)) + +/* +* Virtual LAN Ethernet header +*/ +struct vlan_ethernet_hdr { +u8 vet_dest[ARP_HLEN ];/* Destination node */ +u8 vet_src[ARP_HLEN ];/* Source node */ +u16 vet_vlan_type;/* PROT_VLAN */ +u16 vet_tag;/* TAG of VLAN */ +u16 vet_type;/* protocol type */ +} __attribute__((packed)); + +/* VLAN Ethernet header size */ +#define VLAN_ETHER_HDR_SIZE (sizeof(struct vlan_ethernet_hdr)) + +/* +* Internet Protocol (IP) header. +*/ +struct ip_hdr { +u8 ip_hl_v;/* header length and version */ +u8 ip_tos;/* type of service */ +u16 ip_len;/* total length */ +u16 ip_id;/* identification */ +u16 ip_off;/* fragment offset field */ +u8 ip_ttl;/* time to live */ +u8 ip_p;/* protocol */ +u16 ip_sum;/* checksum */ +struct in_addr ip_src;/* Source IP address */ +struct in_addr ip_dst;/* Destination IP address */ +} __attribute__((packed)); + +#define IP_OFFS 0x1fff/* ip offset *= 8 */ +#define IP_FLAGS 0xe000/* first 3 bits */ +#define IP_FLAGS_RES 0x8000/* reserved */ +#define IP_FLAGS_DFRAG 0x4000/* don't fragments */ +#define IP_FLAGS_MFRAG 0x2000/* more fragments */ + +#define IP_HDR_SIZE (sizeof(struct ip_hdr)) + +#define IP_MIN_FRAG_DATAGRAM_SIZE (IP_HDR_SIZE + 8) + +/* +* Address Resolution Protocol (ARP) header. +*/ +struct arp_hdr { +u16 ar_hrd;/* Format of hardware address */ +# define ARP_ETHER 1/* Ethernet hardware address */ +u16 ar_pro;/* Format of protocol address */ +u8 ar_hln;/* Length of hardware address */ +u8 ar_pln;/* Length of protocol address */ +# define ARP_PLEN 4 +u16 ar_op;/* Operation */ +# define ARPOP_REQUEST 1/* Request to resolve address */ +# define ARPOP_REPLY 2/* Response to previous request */ + +# define RARPOP_REQUEST 3/* Request to resolve address */ +# define RARPOP_REPLY 4/* Response to previous request */ + +/* +* The remaining fields are variable in size, according to +* the sizes above, and are defined as appropriate for +* specific hardware/protocol combinations. +*/ +u8 ar_data[0 ]; +#define ar_sha ar_data[0] +#define ar_spa ar_data[ARP_HLEN] +#define ar_tha ar_data[ARP_HLEN + ARP_PLEN] +#define ar_tpa ar_data[ARP_HLEN + ARP_PLEN + ARP_HLEN] +#if 0 +u8 ar_sha[];/* Sender hardware address */ +u8 ar_spa[];/* Sender protocol address */ +u8 ar_tha[];/* Target hardware address */ +u8 ar_tpa[];/* Target protocol address */ +#endif /* 0 */ +} __attribute__((packed)); + + +/* +* ICMP stuff (just enough to handle (host) redirect messages) +*/ +#define ICMP_ECHO_REPLY 0/* Echo reply */ +#define ICMP_NOT_REACH 3/* Detination unreachable */ +#define ICMP_REDIRECT 5/* Redirect (change route) */ +#define ICMP_ECHO_REQUEST 8/* Echo request */ + +/* Codes for REDIRECT. */ +#define ICMP_REDIR_NET 0/* Redirect Net */ +#define ICMP_REDIR_HOST 1/* Redirect Host */ + +/* Codes for NOT_REACH */ +#define ICMP_NOT_REACH_PORT 3/* Port unreachable */ + +struct icmp_hdr { +u8 type; +u8 code; +u16 checksum; +union { +struct { +u16 id; +u16 sequence; + } echo; +u32 gateway; +struct { +u16 unused; +u16 mtu; + } frag; +u8 data[0 ]; + } un; +} __attribute__((packed)); + +#define ICMP_HDR_SIZE (sizeof(struct icmp_hdr)) +#define IP_ICMP_HDR_SIZE (IP_HDR_SIZE + ICMP_HDR_SIZE) + +/* +* Maximum packet size; used to allocate packet storage. Use +* the maxium Ethernet frame size as specified by the Ethernet +* standard including the 802.1Q tag (VLAN tagging). +* maximum packet size = 1522 +* maximum packet size and multiple of 32 bytes = 1536 +*/ +#define PKTSIZE 1522 +#ifndef CONFIG_DM_DSA +#define PKTSIZE_ALIGN 1536 +#else +/* Maximum DSA tagging overhead (headroom and/or tailroom) */ +#define DSA_MAX_OVR 256 +#define PKTSIZE_ALIGN (1536 + DSA_MAX_OVR) +#endif + +/**********************************************************************/ +/* +* Globals. +* +* Note: +* +* All variables of type struct in_addr are stored in NETWORK byte order +* (big endian). +*/ + +/* net.c */ +/** BOOTP EXTENTIONS **/ +extern struct in_addr net_gateway;/* Our gateway IP address */ +extern struct in_addr net_netmask;/* Our subnet mask (0 = unknown) */ +/* Our Domain Name Server (0 = unknown) */ +extern struct in_addr net_dns_server; +#if defined(CONFIG_BOOTP_DNS2 ) +/* Our 2nd Domain Name Server (0 = unknown) */ +extern struct in_addr net_dns_server2; +#endif +extern char net_nis_domain[32 ];/* Our IS domain */ +extern char net_hostname[32 ];/* Our hostname */ +#ifdef CONFIG_NET +extern char net_root_path[CONFIG_BOOTP_MAX_ROOT_PATH_LEN ];/* Our root path */ +#endif +/* Indicates whether the pxe path prefix / config file was specified in dhcp option */ +extern char *pxelinux_configfile; +/** END OF BOOTP EXTENTIONS **/ +extern u8 net_ethaddr[ARP_HLEN ];/* Our ethernet address */ +extern u8 net_server_ethaddr[ARP_HLEN ];/* Boot server enet address */ +extern struct in_addr net_ip;/* Our IP addr (0 = unknown) */ +extern struct in_addr net_server_ip;/* Server IP addr (0 = unknown) */ +extern uchar *net_tx_packet;/* THE transmit packet */ +extern uchar *net_rx_packets[PKTBUFSRX ];/* Receive packets */ +extern uchar *net_rx_packet;/* Current receive packet */ +extern int net_rx_packet_len;/* Current rx packet length */ +extern const u8 net_null_ethaddr[ARP_HLEN ]; + +#define VLAN_NONE 4095/* untagged */ +#define VLAN_IDMASK 0x0fff/* mask of valid vlan id */ +extern ushort net_our_vlan;/* Our VLAN */ +extern ushort net_native_vlan;/* Our Native VLAN */ + +extern int net_restart_wrap;/* Tried all network devices */ + +enum proto_t { +BOOTP ,RARP ,ARP ,TFTPGET ,DHCP ,DHCP6 ,PING ,PING6 ,DNS ,NFS ,CDP , +NETCONS ,SNTP ,TFTPSRV ,TFTPPUT ,LINKLOCAL ,FASTBOOT_UDP ,FASTBOOT_TCP , +WOL ,UDP ,NCSI ,WGET ,RS +}; +/* Indicates whether the file name was specified on the command line */ +extern bool net_boot_file_name_explicit; +/* The actual transferred size of the bootfile (in bytes) */ +extern u32 net_boot_file_size; +/* Boot file size in blocks as reported by the DHCP server */ +extern u32 net_boot_file_expected_size_in_blocks; + +#if defined(CONFIG_CMD_DNS ) +extern char *net_dns_resolve;/* The host to resolve */ +extern char *net_dns_env_var;/* the env var to put the ip into */ +#endif + +#if defined(CONFIG_CMD_PING ) +extern struct in_addr net_ping_ip;/* the ip address to ping */ +#endif + +#if defined(CONFIG_CMD_CDP ) +/* when CDP completes these hold the return values */ +extern ushort cdp_native_vlan;/* CDP returned native VLAN */ +extern ushort cdp_appliance_vlan;/* CDP returned appliance VLAN */ + +/* +* Check for a CDP packet by examining the received MAC address field +*/ +static inline int is_cdp_packet (const uchar *ethaddr) +{ +extern const u8 net_cdp_ethaddr[ARP_HLEN ]; + +return memcmp (ethaddr, net_cdp_ethaddr,ARP_HLEN ) ==0 ; +} +#endif + +#if defined(CONFIG_CMD_SNTP ) +extern struct in_addr net_ntp_server;/* the ip address to NTP */ +extern int net_ntp_time_offset;/* offset time from UTC */ +#endif + +int net_loop (enum proto_t ); + +/* Load failed. Start again. */ +int net_start_again (void ); + +/* Get size of the ethernet header when we send */ +int net_eth_hdr_size (void ); + +/* Set ethernet header; returns the size of the header */ +int net_set_ether (uchar *xet,const uchar *dest_ethaddr,uint prot); +int net_update_ether (struct ethernet_hdr *et,uchar *addr,uint prot); + +/* Set IP header */ +void net_set_ip_header (uchar *pkt,struct in_addr dest,struct in_addr source, +u16 pkt_len,u8 proto); +void net_set_udp_header (uchar *pkt,struct in_addr dest,int dport, +int sport,int len); + +/* Callbacks */ +rxhand_f *net_get_udp_handler (void );/* Get UDP RX packet handler */ +void net_set_udp_handler (rxhand_f *);/* Set UDP RX packet handler */ +rxhand_f *net_get_arp_handler (void );/* Get ARP RX packet handler */ +void net_set_arp_handler (rxhand_f *);/* Set ARP RX packet handler */ +bool arp_is_waiting (void );/* Waiting for ARP reply? */ +void net_set_icmp_handler (rxhand_icmp_f *f);/* Set ICMP RX handler */ +void net_set_timeout_handler (ulong ,thand_f *);/* Set timeout handler */ + +/* Network loop state */ +enum net_loop_state { +NETLOOP_CONTINUE , +NETLOOP_RESTART , +NETLOOP_SUCCESS , +NETLOOP_FAIL +}; +extern enum net_loop_state net_state; + +static inline void net_set_state (enum net_loop_state state) +{ +debug_cond (DEBUG_INT_STATE ,"--- NetState set to %d\n" , state); + net_state = state; +} + +/* +* net_get_async_tx_pkt_buf - Get a packet buffer that is not in use for +* sending an asynchronous reply +* +* returns - ptr to packet buffer +*/ +uchar *net_get_async_tx_pkt_buf (void ); + +/** +* net_send_ip_packet() - Transmit "net_tx_packet" as UDP or TCP packet, +* send ARP request if needed (ether will be populated) +* @ether: Raw packet buffer +* @dest: IP address to send the datagram to +* @dport: Destination UDP port +* @sport: Source UDP port +* @payload_len: Length of data after the UDP header +* @action: TCP action to be performed +* @tcp_seq_num: TCP sequence number of this transmission +* @tcp_ack_num: TCP stream acknolegement number +* +* Return: 0 on success, other value on failure +*/ +int net_send_ip_packet (uchar *ether,struct in_addr dest,int dport,int sport, +int payload_len,int proto,u8 action,u32 tcp_seq_num, +u32 tcp_ack_num); +/** +* net_send_tcp_packet() - Transmit TCP packet. +* @payload_len: length of payload +* @dport: Destination TCP port +* @sport: Source TCP port +* @action: TCP action to be performed +* @tcp_seq_num: TCP sequence number of this transmission +* @tcp_ack_num: TCP stream acknolegement number +* +* Return: 0 on success, other value on failure +*/ +int net_send_tcp_packet (int payload_len,int dport,int sport,u8 action, +u32 tcp_seq_num,u32 tcp_ack_num); +int net_send_udp_packet (uchar *ether,struct in_addr dest,int dport, +int sport,int payload_len); + +#if defined(CONFIG_NETCONSOLE ) && !defined(CONFIG_SPL_BUILD ) +void nc_start (void ); +int nc_input_packet (uchar *pkt,struct in_addr src_ip,unsigned dest_port, +unsigned src_port,unsigned len); +#endif + +static __always_inline int eth_is_on_demand_init(void) +{ +#if defined(CONFIG_NETCONSOLE ) && !defined(CONFIG_SPL_BUILD ) +extern enum proto_t net_loop_last_protocol; + +return net_loop_last_protocol !=NETCONS ; +#else +return 1 ; +#endif +} + +static inline void eth_set_last_protocol (int protocol) +{ +#if defined(CONFIG_NETCONSOLE ) && !defined(CONFIG_SPL_BUILD ) +extern enum proto_t net_loop_last_protocol; + + net_loop_last_protocol = protocol; +#endif +} + +/* +* Check if autoload is enabled. If so, use either NFS or TFTP to download +* the boot file. +*/ +void net_auto_load (void ); + +/* +* The following functions are a bit ugly, but necessary to deal with +* alignment restrictions on ARM. +* +* We're using inline functions, which had the smallest memory +* footprint in our tests. +*/ +/* return IP *in network byteorder* */ +static inline struct in_addr net_read_ip (void *from) +{ +struct in_addr ip; + +memcpy ((void *)&ip, (void *)from,sizeof (ip)); +return ip; +} + +/* return ulong *in network byteorder* */ +static inline u32 net_read_u32 (void *from) +{ +u32 l; + +memcpy ((void *)&l, (void *)from,sizeof (l)); +return l; +} + +/* write IP *in network byteorder* */ +static inline void net_write_ip (void *to,struct in_addr ip) +{ +memcpy (to, (void *)&ip,sizeof (ip)); +} + +/* copy IP */ +static inline void net_copy_ip (void *to,void *from) +{ +memcpy ((void *)to, from,sizeof (struct in_addr )); +} + +/* copy ulong */ +static inline void net_copy_u32 (void *to,void *from) +{ +memcpy ((void *)to, (void *)from,sizeof (u32)); +} + +/* Convert an IP address to a string */ +void ip_to_string (struct in_addr x,char *s); + +/** +* string_to_ip() - Convert a string to ip address +* +* Implemented in lib/net_utils.c (built unconditionally) +* +* @s: Input string to parse +* @return: in_addr struct containing the parsed IP address +*/ +struct in_addr string_to_ip (const char *s); + +/* Convert a VLAN id to a string */ +void vlan_to_string (ushort x,char *s); + +/* Convert a string to a vlan id */ +ushort string_to_vlan (const char *s); + +/* read a VLAN id from an environment variable */ +ushort env_get_vlan (char *); + +/* check if serverip is specified in filename from the command line */ +int is_serverip_in_cmd (void ); + +/** +* net_parse_bootfile - Parse the bootfile env var / cmd line param +* +* @param ipaddr - a pointer to the ipaddr to populate if included in bootfile +* @param filename - a pointer to the string to save the filename part +* @param max_len - The longest - 1 that the filename part can be +* +* return 1 if parsed, 0 if bootfile is empty +*/ +int net_parse_bootfile (struct in_addr *ipaddr,char *filename,int max_len); + +#endif /* __NET_LEGACY_H__ */ include/net-lwip.h new file +14
-0@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#ifndef __NET_LWIP_H__ +#define __NET_LWIP_H__ + +#include <lwip/ip4.h> +#include <lwip/netif.h> + +struct netif *net_lwip_new_netif (struct udevice *udev); +struct netif *net_lwip_new_netif_noip (struct udevice *udev); +void net_lwip_remove_netif (struct netif *netif); +struct netif *net_lwip_get_netif (void ); + +#endif /* __NET_LWIP_H__ */ include/net.h +4
-940@@ -1,949 +1,14 @@/* SPDX-License-Identifier: GPL-2.0 */ -/* -* LiMon Monitor (LiMon) - Network. -* -* Copyright 1994 - 2000 Neil Russell. -* (See License) -* -* History -* 9/16/00 bor adapted to TQM823L/STK8xxL board, RARP/TFTP boot added -*/ #ifndef __NET_H__#define __NET_H__ -#include <linux/types.h> -#include <asm/cache.h> -#include <asm/byteorder.h> /* for nton* / ntoh* stuff */ -#include <env.h> -#include <hexdump.h> -#include <log.h> -#include <time.h> -#include <linux/if_ether.h> -#include <rand.h> +#include <net-common.h> -struct bd_info ; -struct cmd_tbl ; -struct udevice ; - -#define DEBUG_LL_STATE 0/* Link local state machine changes */ -#define DEBUG_DEV_PKT 0/* Packets or info directed to the device */ -#define DEBUG_NET_PKT 0/* Packets on info on the network at large */ -#define DEBUG_INT_STATE 0/* Internal network state changes */ -#define DEBUG_NET_PKT_TRACE 0/* Trace all packet data */ - -/* -* The number of receive packet buffers, and the required packet buffer -* alignment in memory. -* -*/ -#define PKTBUFSRX CONFIG_SYS_RX_ETH_BUFFER -#define PKTALIGN ARCH_DMA_MINALIGN - -/* Number of packets processed together */ -#define ETH_PACKETS_BATCH_RECV 32 - -/* ARP hardware address length */ -#define ARP_HLEN 6 -/* -* The size of a MAC address in string form, each digit requires two chars -* and five separator characters to form '00:00:00:00:00:00'. -*/ -#define ARP_HLEN_ASCII (ARP_HLEN * 2) + (ARP_HLEN - 1) - -/* IPv4 addresses are always 32 bits in size */ -struct in_addr { -__be32 s_addr; -}; - -/** -* do_tftpb - Run the tftpboot command -* -* @cmdtp: Command information for tftpboot -* @flag: Command flags (CMD_FLAG_...) -* @argc: Number of arguments -* @argv: List of arguments -* Return: result (see enum command_ret_t) -*/ -int do_tftpb (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); - -/** -* dhcp_run() - Run DHCP on the current ethernet device -* -* This sets the autoload variable, then puts it back to similar to its original -* state (y, n or unset). -* -* @addr: Address to load the file into (0 if @autoload is false) -* @fname: Filename of file to load (NULL if @autoload is false or to use the -* default filename) -* @autoload: true to load the file, false to just get the network IP -* @return 0 if OK, -EINVAL if the environment failed, -ENOENT if ant file was -* not found -*/ -int dhcp_run (ulong addr,const char *fname,bool autoload); - -/** -* An incoming packet handler. -* @param pkt pointer to the application packet -* @param dport destination UDP port -* @param sip source IP address -* @param sport source UDP port -* @param len packet length -*/ -typedef void rxhand_f (uchar *pkt,unsigned dport, -struct in_addr sip,unsigned sport, -unsigned len); - -/** -* An incoming ICMP packet handler. -* @param type ICMP type -* @param code ICMP code -* @param dport destination UDP port -* @param sip source IP address -* @param sport source UDP port -* @param pkt pointer to the ICMP packet data -* @param len packet length -*/ -typedef void rxhand_icmp_f (unsigned type,unsigned code,unsigned dport, -struct in_addr sip,unsigned sport,uchar *pkt,unsigned len); - -/* -* A timeout handler. Called after time interval has expired. -*/ -typedef void thand_f (void ); - -enum eth_state_t { -ETH_STATE_INIT , -ETH_STATE_PASSIVE , -ETH_STATE_ACTIVE -}; - -/** -* struct eth_pdata - Platform data for Ethernet MAC controllers -* -* @iobase: The base address of the hardware registers -* @enetaddr: The Ethernet MAC address that is loaded from EEPROM or env -* @phy_interface: PHY interface to use - see PHY_INTERFACE_MODE_... -* @max_speed: Maximum speed of Ethernet connection supported by MAC -* @priv_pdata: device specific plat -*/ -struct eth_pdata { -phys_addr_t iobase; -unsigned char enetaddr[ARP_HLEN ]; -int phy_interface; -int max_speed; -void *priv_pdata; -}; - -enum eth_recv_flags { -/* -* Check hardware device for new packets (otherwise only return those -* which are already in the memory buffer ready to process) -*/ -ETH_RECV_CHECK_DEVICE =1 <<0 , -}; - -/** -* struct eth_ops - functions of Ethernet MAC controllers -* -* start: Prepare the hardware to send and receive packets -* send: Send the bytes passed in "packet" as a packet on the wire -* recv: Check if the hardware received a packet. If so, set the pointer to the -* packet buffer in the packetp parameter. If not, return an error or 0 to -* indicate that the hardware receive FIFO is empty. If 0 is returned, the -* network stack will not process the empty packet, but free_pkt() will be -* called if supplied -* free_pkt: Give the driver an opportunity to manage its packet buffer memory -* when the network stack is finished processing it. This will only be -* called when no error was returned from recv - optional -* stop: Stop the hardware from looking for packets - may be called even if -* state == PASSIVE -* mcast: Join or leave a multicast group (for TFTP) - optional -* write_hwaddr: Write a MAC address to the hardware (used to pass it to Linux -* on some platforms like ARM). This function expects the -* eth_pdata::enetaddr field to be populated. The method can -* return -ENOSYS to indicate that this is not implemented for -this hardware - optional. -* read_rom_hwaddr: Some devices have a backup of the MAC address stored in a -* ROM on the board. This is how the driver should expose it -* to the network stack. This function should fill in the -* eth_pdata::enetaddr field - optional -* set_promisc: Enable or Disable promiscuous mode -* get_sset_count: Number of statistics counters -* get_string: Names of the statistic counters -* get_stats: The values of the statistic counters -*/ -struct eth_ops { -int (*start)(struct udevice *dev); -int (*send)(struct udevice *dev,void *packet,int length); -int (*recv)(struct udevice *dev,int flags,uchar **packetp); -int (*free_pkt)(struct udevice *dev,uchar *packet,int length); -void (*stop)(struct udevice *dev); -int (*mcast)(struct udevice *dev,const u8 *enetaddr,int join); -int (*write_hwaddr)(struct udevice *dev); -int (*read_rom_hwaddr)(struct udevice *dev); -int (*set_promisc)(struct udevice *dev,bool enable); -int (*get_sset_count)(struct udevice *dev); -void (*get_strings)(struct udevice *dev,u8 *data); -void (*get_stats)(struct udevice *dev,u64 *data); -}; - -#define eth_get_ops (dev) ((struct eth_ops *)(dev)->driver->ops) - -struct udevice *eth_get_dev (void );/* get the current device */ -/* -* The devname can be either an exact name given by the driver or device tree -* or it can be an alias of the form "eth%d" -*/ -struct udevice *eth_get_dev_by_name (const char *devname); -unsigned char *eth_get_ethaddr (void );/* get the current device MAC */ - -/* Used only when NetConsole is enabled */ -int eth_is_active (struct udevice *dev);/* Test device for active state */ -int eth_init_state_only (void );/* Set active state */ -void eth_halt_state_only (void );/* Set passive state */ - -int eth_initialize (void );/* Initialize network subsystem */ -void eth_try_another (int first_restart);/* Change the device */ -void eth_set_current (void );/* set nterface to ethcur var */ - -int eth_get_dev_index (void );/* get the device index */ - -/** -* eth_env_set_enetaddr_by_index() - set the MAC address environment variable -* -* This sets up an environment variable with the given MAC address (@enetaddr). -* The environment variable to be set is defined by <@base_name><@index>addr. -* If @index is 0 it is omitted. For common Ethernet this means ethaddr, -* eth1addr, etc. -* -* @base_name: Base name for variable, typically "eth" -* @index: Index of interface being updated (>=0) -* @enetaddr: Pointer to MAC address to put into the variable -* Return: 0 if OK, other value on error -*/ -int eth_env_set_enetaddr_by_index (const char *base_name,int index, -uchar *enetaddr); - -/* -* Initialize USB ethernet device with CONFIG_DM_ETH -* Returns: -* 0 is success, non-zero is error status. -*/ -int usb_ether_init (void ); - -/* -* Get the hardware address for an ethernet interface . -* Args: -* base_name - base name for device (normally "eth") -* index - device index number (0 for first) -* enetaddr - returns 6 byte hardware address -* Returns: -* Return true if the address is valid. -*/ -int eth_env_get_enetaddr_by_index (const char *base_name,int index, -uchar *enetaddr); - -int eth_init (void );/* Initialize the device */ -int eth_send (void *packet,int length);/* Send a packet */ - -#if defined(CONFIG_API ) || defined(CONFIG_EFI_LOADER ) -int eth_receive (void *packet,int length);/* Receive a packet*/ -extern void (*push_packet)(void *packet,int length); -#endif -int eth_rx (void );/* Check for received packets */ -void eth_halt (void );/* stop SCC */ -const char *eth_get_name (void );/* get name of current device */ -int eth_mcast_join (struct in_addr mcast_addr,int join); - -/**********************************************************************/ -/* -* Protocol headers. -*/ - -/* -* Ethernet header -*/ - -struct ethernet_hdr { -u8 et_dest[ARP_HLEN ];/* Destination node */ -u8 et_src[ARP_HLEN ];/* Source node */ -u16 et_protlen;/* Protocol or length */ -} __attribute__((packed)); - -/* Ethernet header size */ -#define ETHER_HDR_SIZE (sizeof(struct ethernet_hdr)) - -#define ETH_FCS_LEN 4/* Octets in the FCS */ - -struct e802_hdr { -u8 et_dest[ARP_HLEN ];/* Destination node */ -u8 et_src[ARP_HLEN ];/* Source node */ -u16 et_protlen;/* Protocol or length */ -u8 et_dsap;/* 802 DSAP */ -u8 et_ssap;/* 802 SSAP */ -u8 et_ctl;/* 802 control */ -u8 et_snap1;/* SNAP */ -u8 et_snap2; -u8 et_snap3; -u16 et_prot;/* 802 protocol */ -} __attribute__((packed)); - -/* 802 + SNAP + ethernet header size */ -#define E802_HDR_SIZE (sizeof(struct e802_hdr)) - -/* -* Virtual LAN Ethernet header -*/ -struct vlan_ethernet_hdr { -u8 vet_dest[ARP_HLEN ];/* Destination node */ -u8 vet_src[ARP_HLEN ];/* Source node */ -u16 vet_vlan_type;/* PROT_VLAN */ -u16 vet_tag;/* TAG of VLAN */ -u16 vet_type;/* protocol type */ -} __attribute__((packed)); - -/* VLAN Ethernet header size */ -#define VLAN_ETHER_HDR_SIZE (sizeof(struct vlan_ethernet_hdr)) - -#define PROT_IP 0x0800/* IP protocol */ -#define PROT_ARP 0x0806/* IP ARP protocol */ -#define PROT_WOL 0x0842/* ether-wake WoL protocol */ -#define PROT_RARP 0x8035/* IP ARP protocol */ -#define PROT_VLAN 0x8100/* IEEE 802.1q protocol */ -#define PROT_IPV6 0x86dd/* IPv6 over bluebook */ -#define PROT_PPP_SES 0x8864/* PPPoE session messages */ -#define PROT_NCSI 0x88f8/* NC-SI control packets */ - -#define IPPROTO_ICMP 1/* Internet Control Message Protocol */ -#define IPPROTO_TCP 6/* Transmission Control Protocol */ -#define IPPROTO_UDP 17/* User Datagram Protocol */ - -/* -* Internet Protocol (IP) header. -*/ -struct ip_hdr { -u8 ip_hl_v;/* header length and version */ -u8 ip_tos;/* type of service */ -u16 ip_len;/* total length */ -u16 ip_id;/* identification */ -u16 ip_off;/* fragment offset field */ -u8 ip_ttl;/* time to live */ -u8 ip_p;/* protocol */ -u16 ip_sum;/* checksum */ -struct in_addr ip_src;/* Source IP address */ -struct in_addr ip_dst;/* Destination IP address */ -} __attribute__((packed)); - -#define IP_OFFS 0x1fff/* ip offset *= 8 */ -#define IP_FLAGS 0xe000/* first 3 bits */ -#define IP_FLAGS_RES 0x8000/* reserved */ -#define IP_FLAGS_DFRAG 0x4000/* don't fragments */ -#define IP_FLAGS_MFRAG 0x2000/* more fragments */ - -#define IP_HDR_SIZE (sizeof(struct ip_hdr)) - -#define IP_MIN_FRAG_DATAGRAM_SIZE (IP_HDR_SIZE + 8) - -/* -* Internet Protocol (IP) + UDP header. -*/ -struct ip_udp_hdr { -u8 ip_hl_v;/* header length and version */ -u8 ip_tos;/* type of service */ -u16 ip_len;/* total length */ -u16 ip_id;/* identification */ -u16 ip_off;/* fragment offset field */ -u8 ip_ttl;/* time to live */ -u8 ip_p;/* protocol */ -u16 ip_sum;/* checksum */ -struct in_addr ip_src;/* Source IP address */ -struct in_addr ip_dst;/* Destination IP address */ -u16 udp_src;/* UDP source port */ -u16 udp_dst;/* UDP destination port */ -u16 udp_len;/* Length of UDP packet */ -u16 udp_xsum;/* Checksum */ -} __attribute__((packed)); - -#define IP_UDP_HDR_SIZE (sizeof(struct ip_udp_hdr)) -#define UDP_HDR_SIZE (IP_UDP_HDR_SIZE - IP_HDR_SIZE) - -/* -* Address Resolution Protocol (ARP) header. -*/ -struct arp_hdr { -u16 ar_hrd;/* Format of hardware address */ -# define ARP_ETHER 1/* Ethernet hardware address */ -u16 ar_pro;/* Format of protocol address */ -u8 ar_hln;/* Length of hardware address */ -u8 ar_pln;/* Length of protocol address */ -# define ARP_PLEN 4 -u16 ar_op;/* Operation */ -# define ARPOP_REQUEST 1/* Request to resolve address */ -# define ARPOP_REPLY 2/* Response to previous request */ - -# define RARPOP_REQUEST 3/* Request to resolve address */ -# define RARPOP_REPLY 4/* Response to previous request */ - -/* -* The remaining fields are variable in size, according to -* the sizes above, and are defined as appropriate for -* specific hardware/protocol combinations. -*/ -u8 ar_data[0 ]; -#define ar_sha ar_data[0] -#define ar_spa ar_data[ARP_HLEN] -#define ar_tha ar_data[ARP_HLEN + ARP_PLEN] -#define ar_tpa ar_data[ARP_HLEN + ARP_PLEN + ARP_HLEN] -#if 0 -u8 ar_sha[];/* Sender hardware address */ -u8 ar_spa[];/* Sender protocol address */ -u8 ar_tha[];/* Target hardware address */ -u8 ar_tpa[];/* Target protocol address */ -#endif /* 0 */ -} __attribute__((packed)); - -#define ARP_HDR_SIZE (8+20)/* Size assuming ethernet */ - -/* -* ICMP stuff (just enough to handle (host) redirect messages) -*/ -#define ICMP_ECHO_REPLY 0/* Echo reply */ -#define ICMP_NOT_REACH 3/* Detination unreachable */ -#define ICMP_REDIRECT 5/* Redirect (change route) */ -#define ICMP_ECHO_REQUEST 8/* Echo request */ - -/* Codes for REDIRECT. */ -#define ICMP_REDIR_NET 0/* Redirect Net */ -#define ICMP_REDIR_HOST 1/* Redirect Host */ - -/* Codes for NOT_REACH */ -#define ICMP_NOT_REACH_PORT 3/* Port unreachable */ - -struct icmp_hdr { -u8 type; -u8 code; -u16 checksum; -union { -struct { -u16 id; -u16 sequence; - } echo; -u32 gateway; -struct { -u16 unused; -u16 mtu; - } frag; -u8 data[0 ]; - } un; -} __attribute__((packed)); - -#define ICMP_HDR_SIZE (sizeof(struct icmp_hdr)) -#define IP_ICMP_HDR_SIZE (IP_HDR_SIZE + ICMP_HDR_SIZE) - -/* -* Maximum packet size; used to allocate packet storage. Use -* the maxium Ethernet frame size as specified by the Ethernet -* standard including the 802.1Q tag (VLAN tagging). -* maximum packet size = 1522 -* maximum packet size and multiple of 32 bytes = 1536 -*/ -#define PKTSIZE 1522 -#ifndef CONFIG_DM_DSA -#define PKTSIZE_ALIGN 1536 +#if defined(CONFIG_NET_LWIP ) +#include <net-lwip.h> #else -/* Maximum DSA tagging overhead (headroom and/or tailroom) */ -#define DSA_MAX_OVR 256 -#define PKTSIZE_ALIGN (1536 + DSA_MAX_OVR) -#endif - -/* -* Maximum receive ring size; that is, the number of packets -* we can buffer before overflow happens. Basically, this just -* needs to be enough to prevent a packet being discarded while -* we are processing the previous one. -*/ -#define RINGSZ 4 -#define RINGSZ_LOG2 2 - -/**********************************************************************/ -/* -* Globals. -* -* Note: -* -* All variables of type struct in_addr are stored in NETWORK byte order -* (big endian). -*/ - -/* net.c */ -/** BOOTP EXTENTIONS **/ -extern struct in_addr net_gateway;/* Our gateway IP address */ -extern struct in_addr net_netmask;/* Our subnet mask (0 = unknown) */ -/* Our Domain Name Server (0 = unknown) */ -extern struct in_addr net_dns_server; -#if defined(CONFIG_BOOTP_DNS2 ) -/* Our 2nd Domain Name Server (0 = unknown) */ -extern struct in_addr net_dns_server2; +#include <net-legacy.h> #endif -extern char net_nis_domain[32 ];/* Our IS domain */ -extern char net_hostname[32 ];/* Our hostname */ -#ifdef CONFIG_NET -extern char net_root_path[CONFIG_BOOTP_MAX_ROOT_PATH_LEN ];/* Our root path */ -#endif -/* Indicates whether the pxe path prefix / config file was specified in dhcp option */ -extern char *pxelinux_configfile; -/** END OF BOOTP EXTENTIONS **/ -extern u8 net_ethaddr[ARP_HLEN ];/* Our ethernet address */ -extern u8 net_server_ethaddr[ARP_HLEN ];/* Boot server enet address */ -extern struct in_addr net_ip;/* Our IP addr (0 = unknown) */ -extern struct in_addr net_server_ip;/* Server IP addr (0 = unknown) */ -extern uchar *net_tx_packet;/* THE transmit packet */ -extern uchar *net_rx_packets[PKTBUFSRX ];/* Receive packets */ -extern uchar *net_rx_packet;/* Current receive packet */ -extern int net_rx_packet_len;/* Current rx packet length */ -extern const u8 net_bcast_ethaddr[ARP_HLEN ];/* Ethernet broadcast address */ -extern const u8 net_null_ethaddr[ARP_HLEN ]; - -#define VLAN_NONE 4095/* untagged */ -#define VLAN_IDMASK 0x0fff/* mask of valid vlan id */ -extern ushort net_our_vlan;/* Our VLAN */ -extern ushort net_native_vlan;/* Our Native VLAN */ - -extern int net_restart_wrap;/* Tried all network devices */ - -enum proto_t { -BOOTP ,RARP ,ARP ,TFTPGET ,DHCP ,DHCP6 ,PING ,PING6 ,DNS ,NFS ,CDP , -NETCONS ,SNTP ,TFTPSRV ,TFTPPUT ,LINKLOCAL ,FASTBOOT_UDP ,FASTBOOT_TCP , -WOL ,UDP ,NCSI ,WGET ,RS -}; - -extern char net_boot_file_name[1024 ];/* Boot File name */ -/* Indicates whether the file name was specified on the command line */ -extern bool net_boot_file_name_explicit; -/* The actual transferred size of the bootfile (in bytes) */ -extern u32 net_boot_file_size; -/* Boot file size in blocks as reported by the DHCP server */ -extern u32 net_boot_file_expected_size_in_blocks; - -#if defined(CONFIG_CMD_DNS ) -extern char *net_dns_resolve;/* The host to resolve */ -extern char *net_dns_env_var;/* the env var to put the ip into */ -#endif - -#if defined(CONFIG_CMD_PING ) -extern struct in_addr net_ping_ip;/* the ip address to ping */ -#endif - -#if defined(CONFIG_CMD_CDP ) -/* when CDP completes these hold the return values */ -extern ushort cdp_native_vlan;/* CDP returned native VLAN */ -extern ushort cdp_appliance_vlan;/* CDP returned appliance VLAN */ - -/* -* Check for a CDP packet by examining the received MAC address field -*/ -static inline int is_cdp_packet (const uchar *ethaddr) -{ -extern const u8 net_cdp_ethaddr[ARP_HLEN ]; - -return memcmp (ethaddr, net_cdp_ethaddr,ARP_HLEN ) ==0 ; -} -#endif - -#if defined(CONFIG_CMD_SNTP ) -extern struct in_addr net_ntp_server;/* the ip address to NTP */ -extern int net_ntp_time_offset;/* offset time from UTC */ -#endif - -/* Initialize the network adapter */ -int net_init (void ); -int net_loop (enum proto_t ); - -/* Load failed. Start again. */ -int net_start_again (void ); - -/* Get size of the ethernet header when we send */ -int net_eth_hdr_size (void ); - -/* Set ethernet header; returns the size of the header */ -int net_set_ether (uchar *xet,const uchar *dest_ethaddr,uint prot); -int net_update_ether (struct ethernet_hdr *et,uchar *addr,uint prot); - -/* Set IP header */ -void net_set_ip_header (uchar *pkt,struct in_addr dest,struct in_addr source, -u16 pkt_len,u8 proto); -void net_set_udp_header (uchar *pkt,struct in_addr dest,int dport, -int sport,int len); - -/** -* compute_ip_checksum() - Compute IP checksum -* -* @addr: Address to check (must be 16-bit aligned) -* @nbytes: Number of bytes to check (normally a multiple of 2) -* Return: 16-bit IP checksum -*/ -unsigned compute_ip_checksum (const void *addr,unsigned nbytes); - -/** -* add_ip_checksums() - add two IP checksums -* -* @offset: Offset of first sum (if odd we do a byte-swap) -* @sum: First checksum -* @new_sum: New checksum to add -* Return: updated 16-bit IP checksum -*/ -unsigned add_ip_checksums (unsigned offset,unsigned sum,unsigned new_sum); - -/** -* ip_checksum_ok() - check if a checksum is correct -* -* This works by making sure the checksum sums to 0 -* -* @addr: Address to check (must be 16-bit aligned) -* @nbytes: Number of bytes to check (normally a multiple of 2) -* Return: true if the checksum matches, false if not -*/ -int ip_checksum_ok (const void *addr,unsigned nbytes); - -/* Callbacks */ -rxhand_f *net_get_udp_handler (void );/* Get UDP RX packet handler */ -void net_set_udp_handler (rxhand_f *);/* Set UDP RX packet handler */ -rxhand_f *net_get_arp_handler (void );/* Get ARP RX packet handler */ -void net_set_arp_handler (rxhand_f *);/* Set ARP RX packet handler */ -bool arp_is_waiting (void );/* Waiting for ARP reply? */ -void net_set_icmp_handler (rxhand_icmp_f *f);/* Set ICMP RX handler */ -void net_set_timeout_handler (ulong ,thand_f *);/* Set timeout handler */ - -/* Network loop state */ -enum net_loop_state { -NETLOOP_CONTINUE , -NETLOOP_RESTART , -NETLOOP_SUCCESS , -NETLOOP_FAIL -}; -extern enum net_loop_state net_state; - -static inline void net_set_state (enum net_loop_state state) -{ -debug_cond (DEBUG_INT_STATE ,"--- NetState set to %d\n" , state); - net_state = state; -} - -/* -* net_get_async_tx_pkt_buf - Get a packet buffer that is not in use for -* sending an asynchronous reply -* -* returns - ptr to packet buffer -*/ -uchar *net_get_async_tx_pkt_buf (void ); - -/* Transmit a packet */ -static inline void net_send_packet (uchar *pkt,int len) -{ -if (DEBUG_NET_PKT_TRACE ) -print_hex_dump_bytes ("tx: " ,DUMP_PREFIX_OFFSET , pkt, len); -/* Currently no way to return errors from eth_send() */ - (void )eth_send (pkt, len); -} - -/** -* net_send_ip_packet() - Transmit "net_tx_packet" as UDP or TCP packet, -* send ARP request if needed (ether will be populated) -* @ether: Raw packet buffer -* @dest: IP address to send the datagram to -* @dport: Destination UDP port -* @sport: Source UDP port -* @payload_len: Length of data after the UDP header -* @action: TCP action to be performed -* @tcp_seq_num: TCP sequence number of this transmission -* @tcp_ack_num: TCP stream acknolegement number -* -* Return: 0 on success, other value on failure -*/ -int net_send_ip_packet (uchar *ether,struct in_addr dest,int dport,int sport, -int payload_len,int proto,u8 action,u32 tcp_seq_num, -u32 tcp_ack_num); -/** -* net_send_tcp_packet() - Transmit TCP packet. -* @payload_len: length of payload -* @dport: Destination TCP port -* @sport: Source TCP port -* @action: TCP action to be performed -* @tcp_seq_num: TCP sequence number of this transmission -* @tcp_ack_num: TCP stream acknolegement number -* -* Return: 0 on success, other value on failure -*/ -int net_send_tcp_packet (int payload_len,int dport,int sport,u8 action, -u32 tcp_seq_num,u32 tcp_ack_num); -int net_send_udp_packet (uchar *ether,struct in_addr dest,int dport, -int sport,int payload_len); - -/* Processes a received packet */ -void net_process_received_packet (uchar *in_packet,int len); - -#if defined(CONFIG_NETCONSOLE ) && !defined(CONFIG_SPL_BUILD ) -void nc_start (void ); -int nc_input_packet (uchar *pkt,struct in_addr src_ip,unsigned dest_port, -unsigned src_port,unsigned len); -#endif - -static __always_inline int eth_is_on_demand_init(void) -{ -#if defined(CONFIG_NETCONSOLE ) && !defined(CONFIG_SPL_BUILD ) -extern enum proto_t net_loop_last_protocol; - -return net_loop_last_protocol !=NETCONS ; -#else -return 1 ; -#endif -} - -static inline void eth_set_last_protocol (int protocol) -{ -#if defined(CONFIG_NETCONSOLE ) && !defined(CONFIG_SPL_BUILD ) -extern enum proto_t net_loop_last_protocol; - - net_loop_last_protocol = protocol; -#endif -} - -/* -* Check if autoload is enabled. If so, use either NFS or TFTP to download -* the boot file. -*/ -void net_auto_load (void ); - -/* -* The following functions are a bit ugly, but necessary to deal with -* alignment restrictions on ARM. -* -* We're using inline functions, which had the smallest memory -* footprint in our tests. -*/ -/* return IP *in network byteorder* */ -static inline struct in_addr net_read_ip (void *from) -{ -struct in_addr ip; - -memcpy ((void *)&ip, (void *)from,sizeof (ip)); -return ip; -} - -/* return ulong *in network byteorder* */ -static inline u32 net_read_u32 (void *from) -{ -u32 l; - -memcpy ((void *)&l, (void *)from,sizeof (l)); -return l; -} - -/* write IP *in network byteorder* */ -static inline void net_write_ip (void *to,struct in_addr ip) -{ -memcpy (to, (void *)&ip,sizeof (ip)); -} - -/* copy IP */ -static inline void net_copy_ip (void *to,void *from) -{ -memcpy ((void *)to, from,sizeof (struct in_addr )); -} - -/* copy ulong */ -static inline void net_copy_u32 (void *to,void *from) -{ -memcpy ((void *)to, (void *)from,sizeof (u32)); -} - -/** -* is_zero_ethaddr - Determine if give Ethernet address is all zeros. -* @addr: Pointer to a six-byte array containing the Ethernet address -* -* Return true if the address is all zeroes. -*/ -static inline int is_zero_ethaddr (const u8 *addr) -{ -return !(addr[0 ] | addr[1 ] | addr[2 ] | addr[3 ] | addr[4 ] | addr[5 ]); -} - -/** -* is_multicast_ethaddr - Determine if the Ethernet address is a multicast. -* @addr: Pointer to a six-byte array containing the Ethernet address -* -* Return true if the address is a multicast address. -* By definition the broadcast address is also a multicast address. -*/ -static inline int is_multicast_ethaddr (const u8 *addr) -{ -return 0x01 & addr[0 ]; -} - -/* -* is_broadcast_ethaddr - Determine if the Ethernet address is broadcast -* @addr: Pointer to a six-byte array containing the Ethernet address -* -* Return true if the address is the broadcast address. -*/ -static inline int is_broadcast_ethaddr (const u8 *addr) -{ -return (addr[0 ] & addr[1 ] & addr[2 ] & addr[3 ] & addr[4 ] & addr[5 ]) == -0xff ; -} - -/* -* is_valid_ethaddr - Determine if the given Ethernet address is valid -* @addr: Pointer to a six-byte array containing the Ethernet address -* -* Check that the Ethernet address (MAC) is not 00:00:00:00:00:00, is not -* a multicast address, and is not FF:FF:FF:FF:FF:FF. -* -* Return true if the address is valid. -*/ -static inline int is_valid_ethaddr (const u8 *addr) -{ -/* FF:FF:FF:FF:FF:FF is a multicast address so we don't need to -* explicitly check for it here. */ -return !is_multicast_ethaddr (addr) && !is_zero_ethaddr (addr); -} - -/** -* net_random_ethaddr - Generate software assigned random Ethernet address -* @addr: Pointer to a six-byte array containing the Ethernet address -* -* Generate a random Ethernet address (MAC) that is not multicast -* and has the local assigned bit set. -*/ -static inline void net_random_ethaddr (uchar *addr) -{ -int i; -unsigned int seed =get_ticks (); - -for (i =0 ; i <6 ; i++) - addr[i] =rand_r (&seed); - - addr[0 ] &=0xfe ;/* clear multicast bit */ - addr[0 ] |=0x02 ;/* set local assignment bit (IEEE802) */ -} - -/** -* string_to_enetaddr() - Parse a MAC address -* -* Convert a string MAC address -* -* Implemented in lib/net_utils.c (built unconditionally) -* -* @addr: MAC address in aa:bb:cc:dd:ee:ff format, where each part is a 2-digit -* hex value -* @enetaddr: Place to put MAC address (6 bytes) -*/ -void string_to_enetaddr (const char *addr,uint8_t *enetaddr); - -/* Convert an IP address to a string */ -void ip_to_string (struct in_addr x,char *s); - -/** -* string_to_ip() - Convert a string to ip address -* -* Implemented in lib/net_utils.c (built unconditionally) -* -* @s: Input string to parse -* @return: in_addr struct containing the parsed IP address -*/ -struct in_addr string_to_ip (const char *s); - -/* Convert a VLAN id to a string */ -void vlan_to_string (ushort x,char *s); - -/* Convert a string to a vlan id */ -ushort string_to_vlan (const char *s); - -/* read a VLAN id from an environment variable */ -ushort env_get_vlan (char *); - -/* copy a filename (allow for "..." notation, limit length) */ -void copy_filename (char *dst,const char *src,int size); - -/* check if serverip is specified in filename from the command line */ -int is_serverip_in_cmd (void ); - -/** -* net_parse_bootfile - Parse the bootfile env var / cmd line param -* -* @param ipaddr - a pointer to the ipaddr to populate if included in bootfile -* @param filename - a pointer to the string to save the filename part -* @param max_len - The longest - 1 that the filename part can be -* -* return 1 if parsed, 0 if bootfile is empty -*/ -int net_parse_bootfile (struct in_addr *ipaddr,char *filename,int max_len); - -/** -* update_tftp - Update firmware over TFTP (via DFU) -* -* This function updates board's firmware via TFTP -* -* @param addr - memory address where data is stored -* @param interface - the DFU medium name - e.g. "mmc" -* @param devstring - the DFU medium number - e.g. "1" -* -* Return: - 0 on success, other value on failure -*/ -int update_tftp (ulong addr,char *interface,char *devstring); - -/** -* env_get_ip() - Convert an environment value to to an ip address -* -* @var: Environment variable to convert. The value of this variable must be -* in the format format a.b.c.d, where each value is a decimal number from -* 0 to 255 -* Return: IP address, or 0 if invalid -*/ -static inline struct in_addr env_get_ip (char *var) -{ -return string_to_ip (env_get (var)); -} - -/** -* reset_phy() - Reset the Ethernet PHY -* -* This should be implemented by boards if CONFIG_RESET_PHY_R is enabled -*/ -void reset_phy (void ); - -#if CONFIG_IS_ENABLED (NET ) -/** -* eth_set_enable_bootdevs() - Enable or disable binding of Ethernet bootdevs -* -* These get in the way of bootstd testing, so are normally disabled by tests. -* This provide control of this setting. It only affects binding of Ethernet -* devices, so if that has already happened, this flag does nothing. -* -* @enable: true to enable binding of bootdevs when binding new Ethernet -* devices, false to disable it -*/ -void eth_set_enable_bootdevs (bool enable); -#else -static inline void eth_set_enable_bootdevs (bool enable) {} -#endif - -/** -* wget_with_dns() - runs dns host IP address resulution before wget -* -* @dst_addr: destination address to download the file -* @uri: uri string of target file of wget -* Return: downloaded file size, negative if failed -*/ -int wget_with_dns (ulong dst_addr,char *uri); - -/** -* wget_validate_uri() - varidate the uri -* -* @uri: uri string of target file of wget -* Return: true if uri is valid, false if uri is invalid -*/ -bool wget_validate_uri (char *uri);#endif /* __NET_H__ */ --
Quoted 2 lines
2.40.1
PATCH v11 10/29 net: move copy_filename() to new file net/net-common.c
In reply to Jerome Forissiercopy_filename() can be useful when NET_LWIP is enabled, therefore move it out of net/net.c which is built only when networking choice is NET.
--- net/Makefile | 2 ++ net/net-common.c | 13 +++++++++++++ net/net.c | 12 ------------ 3 files changed, 15 insertions(+), 12 deletions(-) create mode 100644 net/net-common.c
net/Makefile +2 -0
@@ -42,3 +42,5 @@ obj-$(CONFIG_CMD_WGET) += wget.o CFLAGS_eth_common.o += -Wno-format-extra-args endif + +obj-y += net-common.o
net/net-common.c new file +13 -0
@@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0 + +void copy_filename (char *dst,const char *src,int size) +{ +if (src && *src && (*src =='"' )) { + ++src; + --size; + } + +while ((--size >0 ) && src && *src && (*src !='"' )) + *dst++ = *src++; + *dst ='\0' ; +}
net/net.c +0 -12
@@ -1689,18 +1689,6 @@ void net_set_udp_header(uchar *pkt, struct in_addr dest, int dport, int sport, ip->udp_xsum =0 ; } -void copy_filename (char *dst,const char *src,int size) -{ -if (src && *src && (*src =='"' )) { - ++src; - --size; - } - -while ((--size >0 ) && src && *src && (*src !='"' )) - *dst++ = *src++; - *dst ='\0' ; -} -int is_serverip_in_cmd (void ) {return !!strchr (net_boot_file_name,':' );
Signature · 1 line
2.40.1
Re: [PATCH v11 10/29] net: move copy_filename() to new file net/net-common.c
Quoted 18 lines · Jerome Forissier
copy_filename()can be useful whenNET_LWIPis enabled, therefore move it out ofnet/net.cwhich is built only when networking choice is NET.Signed-off-by Jerome Forissier <[email protected]>--- net/Makefile | 2 ++ net/net-common.c | 13 +++++++++++++ net/net.c | 12 ------------ 3 files changed, 15 insertions(+), 12 deletions(-) create mode 100644 net/net-common.cnet/Makefile +0
-0
net/Makefile obj-$(CONFIG_CMD_WGET) += wget.o · line 46
Quoted 5 lines
net/Makefile +2
-0@@ -42,3 +42,5 @@ obj-$(CONFIG_CMD_WGET) += wget.o CFLAGS_eth_common.o += -Wno-format-extra-args endif + +obj-y += net-common.o
This seems to belong in the net-common split patch?
Quoted 43 lines
net/net-common.c new file +13
-0@@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0 + +void copy_filename (char *dst,const char *src,int size) +{ +if (src && *src && (*src =='"' )) { + ++src; + --size; + } + +while ((--size >0 ) && src && *src && (*src !='"' )) + *dst++ = *src++; + *dst ='\0' ; +}net/net.c +0
-13@@ -1689,18 +1689,6 @@ void net_set_udp_header(uchar *pkt, struct in_addr dest, int dport, int sport, ip->udp_xsum =0 ; } -void copy_filename (char *dst,const char *src,int size) -{ -if (src && *src && (*src =='"' )) { - ++src; - --size; - } - -while ((--size >0 ) && src && *src && (*src !='"' )) - *dst++ = *src++; - *dst ='\0' ; -} -int is_serverip_in_cmd (void ) {return !!strchr (net_boot_file_name,':' ); --
Quoted 2 lines
2.40.1
With the the above fixed
Re: [PATCH v11 10/29] net: move copy_filename() to new file net/net-common.c
Quoted 22 lines · Ilias Apalodimas
Quoted 20 lines · Jerome Forissier
copy_filename()can be useful whenNET_LWIPis enabled, therefore move it out ofnet/net.cwhich is built only when networking choice is NET.Signed-off-by Jerome Forissier <[email protected]>--- net/Makefile | 2 ++ net/net-common.c | 13 +++++++++++++ net/net.c | 12 ------------ 3 files changed, 15 insertions(+), 12 deletions(-) create mode 100644 net/net-common.cnet/Makefile +0
-0@@ -42,3 +42,5 @@ obj-$(CONFIG_CMD_WGET) += wget.o CFLAGS_eth_common.o += -Wno-format-extra-args
Quoted 5 lines
net/Makefile obj-$(CONFIG_CMD_WGET) += wget.o · line 46
Quoted 3 lines
net/Makefile +2
-0endif + +obj-y += net-common.oThis seems to belong in the net-common split patch?
The patch you're referring to only splits the headers. But yeah it would probably make more sense to do this as well. I will combine the two patches in v12.
Quoted 47 lines
Quoted 43 lines
net/net-common.c new file +13
-0@@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0 + +void copy_filename (char *dst,const char *src,int size) +{ +if (src && *src && (*src =='"' )) { + ++src; + --size; + } + +while ((--size >0 ) && src && *src && (*src !='"' )) + *dst++ = *src++; + *dst ='\0' ; +}net/net.c +0
-13@@ -1689,18 +1689,6 @@ void net_set_udp_header(uchar *pkt, struct in_addr dest, int dport, int sport, ip->udp_xsum =0 ; } -void copy_filename (char *dst,const char *src,int size) -{ -if (src && *src && (*src =='"' )) { - ++src; - --size; - } - -while ((--size >0 ) && src && *src && (*src !='"' )) - *dst++ = *src++; - *dst ='\0' ; -} -int is_serverip_in_cmd (void ) {return !!strchr (net_boot_file_name,':' ); --Quoted 2 lines
2.40.1
With the the above fixed
Quoted 1 line
Reviewed-by Ilias Apalodimas <[email protected]>
Thanks,
Signature · 1 line
Jerome
PATCH v11 11/29 net: eth-uclass: add function eth_start_udev()
In reply to Jerome ForissierAdd a function to start a given network device, and update eth_init() to use it.
--- include/net-common.h | 1 + net/eth-uclass.c | 38 +++++++++++++++++++++++++------------- 2 files changed, 26 insertions(+), 13 deletions(-)
include/net-common.h +1 -0
@@ -192,6 +192,7 @@ int eth_env_set_enetaddr_by_index(const char *base_name, int index,int usb_ether_init (void );int eth_init (void );/* Initialize the device */ +int eth_start_udev (struct udevice *dev);/* ->start() if not already running */ int eth_send (void *packet,int length);/* Send a packet */ #if defined(CONFIG_API ) || defined(CONFIG_EFI_LOADER )int eth_receive (void *packet,int length);/* Receive a packet*/
net/eth-uclass.c +25 -13
@@ -284,6 +284,27 @@ static int on_ethaddr(const char *name, const char *value, enum env_op op, }U_BOOT_ENV_CALLBACK (ethaddr, on_ethaddr); +int eth_start_udev (struct udevice *dev) +{ +struct eth_device_priv *priv =dev_get_uclass_priv (dev); +int ret; + +if (priv->running) +return 0 ; + +if (!device_active (dev)) +return -EINVAL ; + + ret =eth_get_ops (dev)->start (dev); +if (ret <0 ) +return ret; + + priv->state =ETH_STATE_ACTIVE ; + priv->running = true; + +return 0 ; +} +int eth_init (void ) {struct udevice *current =NULL ;
@@ -328,20 +349,11 @@ int eth_init(void)if (current) {debug ("Trying %s\n" , current->name); -if (device_active (current)) { - ret =eth_get_ops (current)->start (current); -if (ret >=0 ) { -struct eth_device_priv *priv = -dev_get_uclass_priv (current); - - priv->state =ETH_STATE_ACTIVE ; - priv->running = true; - ret =0 ; - goto end; - } - }else { + ret =eth_start_udev (current); +if (ret <0 ) ret = eth_errno; - } +else +break ;debug ("FAIL\n" ); }else {
Signature · 1 line
2.40.1
Re: [PATCH v11 11/29] net: eth-uclass: add function eth_start_udev()
Quoted 80 lines · Jerome Forissier
Add a function to start a given network device, and update
eth_init()to use it.Signed-off-by Jerome Forissier <[email protected]>--- include/net-common.h | 1 + net/eth-uclass.c | 38 +++++++++++++++++++++++++------------- 2 files changed, 26 insertions(+), 13 deletions(-)include/net-common.h +1
-0@@ -192,6 +192,7 @@ int eth_env_set_enetaddr_by_index(const char *base_name, int index,int usb_ether_init (void );int eth_init (void );/* Initialize the device */ +int eth_start_udev (struct udevice *dev);/* ->start() if not already running */ int eth_send (void *packet,int length);/* Send a packet */ #if defined(CONFIG_API ) || defined(CONFIG_EFI_LOADER )int eth_receive (void *packet,int length);/* Receive a packet*/ net/eth-uclass.c +25
-14@@ -284,6 +284,27 @@ static int on_ethaddr(const char *name, const char *value, enum env_op op, }U_BOOT_ENV_CALLBACK (ethaddr, on_ethaddr); +int eth_start_udev (struct udevice *dev) +{ +struct eth_device_priv *priv =dev_get_uclass_priv (dev); +int ret; + +if (priv->running) +return 0 ; + +if (!device_active (dev)) +return -EINVAL ; + + ret =eth_get_ops (dev)->start (dev); +if (ret <0 ) +return ret; + + priv->state =ETH_STATE_ACTIVE ; + priv->running = true; + +return 0 ; +} +int eth_init (void ) {struct udevice *current =NULL ;@@ -328,20 +349,11 @@ int eth_init(void)if (current) {debug ("Trying %s\n" , current->name); -if (device_active (current)) { - ret =eth_get_ops (current)->start (current); -if (ret >=0 ) { -struct eth_device_priv *priv = -dev_get_uclass_priv (current); - - priv->state =ETH_STATE_ACTIVE ; - priv->running = true; - ret =0 ; - goto end; - } - }else { + ret =eth_start_udev (current); +if (ret <0 ) ret = eth_errno; - } +else +break ;debug ("FAIL\n" ); }else { --
Quoted 2 lines
2.40.1
PATCH v11 12/29 net-lwip: build lwIP
In reply to Jerome ForissierBuild the lwIP library when NET_LWIP is enabled. The following 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.
--- lib/Makefile | 2 + lib/lwip/Makefile | 55 +++++++++++ lib/lwip/u-boot/arch/cc.h | 45 +++++++++ lib/lwip/u-boot/arch/sys_arch.h | 0 lib/lwip/u-boot/limits.h | 0 lib/lwip/u-boot/lwipopts.h | 157 ++++++++++++++++++++++++++++++++ 6 files changed, 259 insertions(+) create mode 100644 lib/lwip/Makefile create mode 100644 lib/lwip/u-boot/arch/cc.h create mode 100644 lib/lwip/u-boot/arch/sys_arch.h create mode 100644 lib/lwip/u-boot/limits.h create mode 100644 lib/lwip/u-boot/lwipopts.h
lib/Makefile +2 -0
@@ -96,6 +96,8 @@ obj-$(CONFIG_LIBAVB) += libavb/ obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += libfdt/ obj-$(CONFIG_$(SPL_TPL_)OF_REAL) += fdtdec_common.o fdtdec.o +obj-$(CONFIG_NET_LWIP) += lwip/ + ifdef CONFIG_SPL_BUILD obj-$(CONFIG_SPL_YMODEM_SUPPORT) += crc16-ccitt.o obj-$(CONFIG_$(SPL_TPL_)HASH) += crc16-ccitt.o
lib/lwip/Makefile new file +55 -0
55 lines not on this page · raw message
lib/lwip/u-boot/arch/cc.h new file +45 -0
45 lines not on this page · raw message
lib/lwip/u-boot/arch/sys_arch.h new file +0 -0
lib/lwip/u-boot/limits.h new file +0 -0
lib/lwip/u-boot/lwipopts.h new file +157 -0
157 lines not on this page · raw message
Signature · 1 line
2.40.1
PATCH v11 13/29 net-lwip: add DHCP support and dhcp commmand
In reply to Jerome ForissierAdd what it takes to enable NETDEVICES with NET_LWIP and enable DHCP as well as the dhcp command. CMD_TFTPBOOT is selected by BOOTMETH_EFI due to this code having an implicit dependency on do_tftpb().
Note that PXE is likely non-fonctional with NET_LWIP (or at least not 100% functional) because DHCP option 209 is not supported by the lwIP library. Therefore, BOOTP_PXE_DHCP_OPTION cannot be enabled.
--- board/engicam/imx8mp/icore_mx8mp.c | 2 +- .../imx8mp_debix_model_a.c | 2 +- board/ti/am335x/board.c | 3 +- board/xilinx/common/board.c | 3 +- cmd/Kconfig | 100 +++--- cmd/Makefile | 6 +- cmd/elf.c | 2 +- cmd/net-lwip.c | 13 + common/board_r.c | 4 +- common/usb_kbd.c | 2 +- drivers/net/Kconfig | 2 +- include/net-common.h | 3 + include/net-legacy.h | 3 - include/net-lwip.h | 3 + lib/tiny-printf.c | 3 +- net/Makefile | 14 +- net/lwip/Makefile | 5 + net/lwip/dhcp.c | 127 ++++++++ net/lwip/eth_internal.h | 35 +++ net/lwip/net-lwip.c | 291 ++++++++++++++++++ net/lwip/tftp.c | 11 + 21 files changed, 572 insertions(+), 62 deletions(-) create mode 100644 cmd/net-lwip.c create mode 100644 net/lwip/Makefile create mode 100644 net/lwip/dhcp.c create mode 100644 net/lwip/eth_internal.h create mode 100644 net/lwip/net-lwip.c create mode 100644 net/lwip/tftp.c
board/engicam/imx8mp/icore_mx8mp.c +1 -1
@@ -33,7 +33,7 @@ static void setup_fec(void)setbits_le32 (&gpr->gpr[1 ],BIT (22 )); } -#if CONFIG_IS_ENABLED (NET ) +#if CONFIG_IS_ENABLED (NET ) ||CONFIG_IS_ENABLED (NET_LWIP )int board_phy_config (struct phy_device *phydev) {if (phydev->drv->config)
board/polyhex/imx8mp_debix_model_a/imx8mp_debix_model_a.c +1 -1
@@ -29,7 +29,7 @@ static void setup_fec(void)setbits_le32 (&gpr->gpr[1 ],BIT (22 )); } -#if CONFIG_IS_ENABLED (NET ) +#if CONFIG_IS_ENABLED (NET ) ||CONFIG_IS_ENABLED (NET_LWIP )int board_phy_config (struct phy_device *phydev) {if (phydev->drv->config)
board/ti/am335x/board.c +2 -1
@@ -900,7 +900,8 @@ int board_late_init(void)#endif /* CPSW plat */ -#if CONFIG_IS_ENABLED(NET) && !CONFIG_IS_ENABLED(OF_CONTROL) +#if (CONFIG_IS_ENABLED(NET) || CONFIG_IS_ENABLED(NET_LWIP)) && \ + !CONFIG_IS_ENABLED(OF_CONTROL) struct cpsw_slave_data slave_data[] = { { .slave_reg_ofs = CPSW_SLAVE0_OFFSET,
board/xilinx/common/board.c +2 -1
@@ -491,7 +491,8 @@ int board_late_init_xilinx(void) ret |=env_set_by_index ("uuid" , id, uuid); } -if (!CONFIG_IS_ENABLED (NET )) +if (!(CONFIG_IS_ENABLED (NET ) || +CONFIG_IS_ENABLED (NET_LWIP )))continue ;for (i =0 ; i <EEPROM_HDR_NO_OF_MAC_ADDR ; i++) {
cmd/Kconfig +57 -43
147 lines not on this page · raw message
cmd/Makefile +5 -1
@@ -127,7 +127,11 @@ obj-y += legacy-mtd-utils.o endif obj-$(CONFIG_CMD_MUX) += mux.o obj-$(CONFIG_CMD_NAND) += nand.o -obj-$(CONFIG_CMD_NET) += net.o +ifdef CONFIG_CMD_NET +obj-$(CONFIG_NET) += net.o +obj-$(CONFIG_NET_LWIP) += net-lwip.o +CFLAGS_net-lwip.o := -I$(srctree)/lib/lwip/lwip/src/include -I$(srctree)/lib/lwip/u-boot +endif obj-$(CONFIG_ENV_SUPPORT) += nvedit.o obj-$(CONFIG_CMD_NVEDIT_EFI) += nvedit_efi.o obj-$(CONFIG_CMD_ONENAND) += onenand.o
cmd/elf.c +1 -1
@@ -130,7 +130,7 @@ int do_bootvx(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])else addr =hextoul (argv[1 ],NULL ); -#if defined(CONFIG_CMD_NET ) +#if defined(CONFIG_CMD_NET ) && !defined(CONFIG_NET_LWIP )/* * Check to see if we need to tftp the image ourselves * before starting
cmd/net-lwip.c new file +13 -0
@@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (C) 2024 Linaro Ltd. */ + +#include <command.h> +#include <net.h> + +#if defined(CONFIG_CMD_DHCP ) +U_BOOT_CMD ( + dhcp,3 ,1 , do_dhcp, +"boot image via network using DHCP/TFTP protocol" , +"[loadAddress] [[hostIPaddr:]bootfilename]" +); +#endif
common/board_r.c +2 -2
@@ -472,7 +472,7 @@ static int initr_status_led(void) }#endif -#ifdef CONFIG_CMD_NET +#if defined(CONFIG_CMD_NET )static int initr_net (void ) {puts ("Net: " );
@@ -738,7 +738,7 @@ static init_fnc_t init_sequence_r[] = {#ifdef CONFIG_PCI_ENDPOINT pci_ep_init,#endif -#ifdef CONFIG_CMD_NET +#if defined(CONFIG_CMD_NET ) INIT_FUNC_WATCHDOG_RESET initr_net,#endif
common/usb_kbd.c +1 -1
@@ -423,7 +423,7 @@ static int usb_kbd_testc(struct stdio_dev *sdev)*/ unsigned long poll_delay =CONFIG_SYS_HZ /50 ; -#ifdef CONFIG_CMD_NET +#if defined(CONFIG_CMD_NET ) && !defined(CONFIG_NET_LWIP )/* * If net_busy_flag is 1, NET transfer is running, * then we check key-pressed every second (first check may be
drivers/net/Kconfig +1 -1
@@ -97,7 +97,7 @@ config DSA_SANDBOX menuconfig NETDEVICES bool "Network device support" - depends on NET + depends on NET || NET_LWIP select DM_ETH help You must select Y to enable any network device support
include/net-common.h +3 -0
@@ -118,6 +118,9 @@ extern int net_restart_wrap; /* Tried all network devices */extern uchar *net_rx_packets[PKTBUFSRX ];/* Receive packets */ extern const u8 net_bcast_ethaddr[ARP_HLEN ];/* Ethernet broadcast address */ extern char net_boot_file_name[1024 ];/* Boot File name */ +extern struct in_addr net_ip;/* Our IP addr (0 = unknown) */ +/* Indicates whether the pxe path prefix / config file was specified in dhcp option */ +extern char *pxelinux_configfile;/** * compute_ip_checksum() - Compute IP checksum
include/net-legacy.h +0 -3
@@ -285,12 +285,9 @@ extern char net_hostname[32]; /* Our hostname */#ifdef CONFIG_NET extern char net_root_path[CONFIG_BOOTP_MAX_ROOT_PATH_LEN ];/* Our root path */ #endif -/* Indicates whether the pxe path prefix / config file was specified in dhcp option */ -extern char *pxelinux_configfile;/** END OF BOOTP EXTENTIONS **/ extern u8 net_ethaddr[ARP_HLEN ];/* Our ethernet address */ extern u8 net_server_ethaddr[ARP_HLEN ];/* Boot server enet address */ -extern struct in_addr net_ip;/* Our IP addr (0 = unknown) */ extern struct in_addr net_server_ip;/* Server IP addr (0 = unknown) */ extern uchar *net_tx_packet;/* THE transmit packet */ extern uchar *net_rx_packets[PKTBUFSRX ];/* Receive packets */
include/net-lwip.h +3 -0
@@ -10,5 +10,8 @@ struct netif *net_lwip_new_netif(struct udevice *udev);struct netif *net_lwip_new_netif_noip (struct udevice *udev);void net_lwip_remove_netif (struct netif *netif);struct netif *net_lwip_get_netif (void ); +int net_lwip_rx (struct udevice *udev,struct netif *netif); + +int do_dhcp (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);#endif /* __NET_LWIP_H__ */
lib/tiny-printf.c +2 -1
@@ -269,7 +269,8 @@ static int _vprintf(struct printf_info *info, const char *fmt, va_list va) }break ;case 'p' : -if (CONFIG_IS_ENABLED (NET ) || _DEBUG) { +if (CONFIG_IS_ENABLED (NET ) || +CONFIG_IS_ENABLED (NET_LWIP ) || _DEBUG) { pointer(info, fmt, va_arg(va, void *));/* * Skip this because it pulls in _ctype which is
net/Makefile +9 -5
@@ -12,11 +12,6 @@ obj-$(CONFIG_CMD_BOOTP) += bootp.o obj-$(CONFIG_CMD_CDP) += cdp.o obj-$(CONFIG_CMD_DNS) += dns.o obj-$(CONFIG_DM_DSA) += dsa-uclass.o -obj-$(CONFIG_$(SPL_)DM_ETH) += eth-uclass.o -obj-$(CONFIG_$(SPL_TPL_)BOOTDEV_ETH) += eth_bootdev.o -obj-$(CONFIG_DM_MDIO) += mdio-uclass.o -obj-$(CONFIG_DM_MDIO_MUX) += mdio-mux-uclass.o -obj-$(CONFIG_$(SPL_)DM_ETH) += eth_common.o obj-$(CONFIG_CMD_LINK_LOCAL) += link_local.o obj-$(CONFIG_IPV6) += ndisc.o obj-$(CONFIG_$(SPL_)DM_ETH) += net.o
@@ -43,4 +38,13 @@ CFLAGS_eth_common.o += -Wno-format-extra-args endif +ifeq ($(filter y,$(CONFIG_NET) $(CONFIG_NET_LWIP)),y) +obj-$(CONFIG_$(SPL_TPL_)BOOTDEV_ETH) += eth_bootdev.o +obj-$(CONFIG_DM_MDIO) += mdio-uclass.o +obj-$(CONFIG_DM_MDIO_MUX) += mdio-mux-uclass.o +obj-$(CONFIG_$(SPL_)DM_ETH) += eth-uclass.o +obj-$(CONFIG_$(SPL_)DM_ETH) += eth_common.o obj-y += net-common.o +endif + +obj-$(CONFIG_NET_LWIP) += lwip/
net/lwip/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +ccflags-y += -I$(srctree)/lib/lwip/lwip/src/include -I$(srctree)/lib/lwip/u-boot + +obj-$(CONFIG_$(SPL_)DM_ETH) += net-lwip.o +obj-$(CONFIG_CMD_DHCP) += dhcp.o +obj-$(CONFIG_CMD_TFTPBOOT) += tftp.o
net/lwip/dhcp.c new file +127 -0
127 lines not on this page · raw message
net/lwip/eth_internal.h new file +35 -0
@@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* (C) Copyright 2001-2015 +* Wolfgang Denk, DENX Software Engineering, [email protected]. +* Joe Hershberger, National Instruments +*/ + +#ifndef __ETH_INTERNAL_H +#define __ETH_INTERNAL_H + +/* Do init that is common to driver model and legacy networking */ +void eth_common_init (void ); + +/** +* eth_env_set_enetaddr_by_index() - set the MAC address environment variable +* +* This sets up an environment variable with the given MAC address (@enetaddr). +* The environment variable to be set is defined by <@base_name><@index>addr. +* If @index is 0 it is omitted. For common Ethernet this means ethaddr, +* eth1addr, etc. +* +* @base_name: Base name for variable, typically "eth" +* @index: Index of interface being updated (>=0) +* @enetaddr: Pointer to MAC address to put into the variable +* Return: 0 if OK, other value on error +*/ +int eth_env_set_enetaddr_by_index (const char *base_name,int index, +uchar *enetaddr); + +int eth_mac_skip (int index); +void eth_current_changed (void ); +void eth_set_dev (struct udevice *dev); +void eth_set_current_to_next (void ); + +#endif
net/lwip/net-lwip.c new file +291 -0
291 lines not on this page · raw message
net/lwip/tftp.c new file +11 -0
@@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* Copyright (C) 2024 Linaro Ltd. */ + +#include <command.h> +#include <net-lwip.h> + +int do_tftpb (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) +{ +/* Not implemented */ +return CMD_RET_FAILURE ; +}
Signature · 1 line
2.40.1
Re: [PATCH v11 13/29] net-lwip: add DHCP support and dhcp commmand
Hi Jerome,
[...]
Quoted 26 lines
net/lwip/dhcp.c new file +26
-0+#define DHCP_TIMEOUT_MS 10000 + +#ifdef CONFIG_CMD_TFTPBOOT +/* Boot file obtained from DHCP (if present) */ +static char boot_file_name[DHCP_BOOT_FILE_LEN ]; +#endif + +static void call_lwip_dhcp_fine_tmr (void *ctx) +{ +dhcp_fine_tmr (); +sys_timeout (10 , call_lwip_dhcp_fine_tmr,NULL ); +} + +static int dhcp_loop (struct udevice *udev) +{ +char *ipstr ="ipaddr\0\0" ; +char *maskstr ="netmask\0\0" ; +char *gwstr ="gatewayip\0\0" ; +unsigned long start; +struct netif *netif; +struct dhcp *dhcp; +bool bound; +int idx; + + idx =dev_seq (udev); +if (idx <0 || idx >99 ) {
net/lwip/dhcp.c line 50
Quoted 10 lines
net/lwip/dhcp.c new file +10
-0+log_err ("unexpected idx %d\n" , idx); +return CMD_RET_FAILURE ; + } + + netif =net_lwip_new_netif_noip (udev); +if (!netif) +return CMD_RET_FAILURE ; + + start =get_timer (0 ); +dhcp_start (netif);
This can fail. Don't we have to check that and exit?
Quoted 18 lines
net/lwip/dhcp.c new file +18
-0+call_lwip_dhcp_fine_tmr (NULL ); + +/* Wait for DHCP to complete */ +do { +net_lwip_rx (udev, netif); +sys_check_timeouts (); + bound =dhcp_supplied_address (netif); +if (bound) +break ; +if (ctrlc ()) { +printf ("Abort\n" ); +break ; + } +mdelay (1 ); + }while (get_timer (start) <DHCP_TIMEOUT_MS ); + +sys_untimeout (call_lwip_dhcp_fine_tmr,NULL ); +
[...]
net/lwip/net-lwip.c line 61
Quoted 12 lines
net/lwip/net-lwip.c new file +12
-0+free (pp); +if (err) { +log_err ("send error %d\n" , err); +return ERR_ABRT ; + } + +return ERR_OK ; +} + +static err_t net_lwip_if_init (struct netif *netif) +{ +#if LWIP_IPV4
Do we ever not set this?
Quoted 34 lines
net/lwip/net-lwip.c new file +34
-0+ netif->output = etharp_output; +#endif + netif->linkoutput = linkoutput; + netif->mtu =1500 ; + netif->flags =NETIF_FLAG_BROADCAST |NETIF_FLAG_ETHARP |NETIF_FLAG_LINK_UP ; + +return ERR_OK ; +} + +static void eth_init_rings (void ) +{ +int i; + +for (i =0 ; i <PKTBUFSRX ; i++) + net_rx_packets[i] = net_pkt_buf + i *PKTSIZE_ALIGN ; +} + +struct netif *net_lwip_get_netif (void ) +{ +struct netif *netif, *found =NULL ; + +NETIF_FOREACH (netif) { +if (!found) + found = netif; +else +printf ("Error: more than one netif in lwIP\n" ); + } +return found; +} + +static int get_udev_ipv4_info (struct udevice *dev,ip4_addr_t *ip, +ip4_addr_t *mask,ip4_addr_t *gw) +{ +char *ipstr ="ipaddr\0\0" ;
net/lwip/net-lwip.c line 105
Quoted 10 lines
net/lwip/net-lwip.c new file +10
-0+char *maskstr ="netmask\0\0" ; +char *gwstr ="gatewayip\0\0" ; +int idx =dev_seq (dev); +char *env; + +if (idx <0 || idx >99 ) { +log_err ("unexpected idx %d\n" , idx); +return -1 ; + } +
[...]
FWIW dhcp seems to work fine
Thanks
/Ilias
Re: [PATCH v11 13/29] net-lwip: add DHCP support and dhcp commmand
Quoted 35 lines · Ilias Apalodimas
Hi Jerome,
[...]
Quoted 30 lines
net/lwip/dhcp.c new file +30
-0+#define DHCP_TIMEOUT_MS 10000 + +#ifdef CONFIG_CMD_TFTPBOOT +/* Boot file obtained from DHCP (if present) */ +static char boot_file_name[DHCP_BOOT_FILE_LEN ]; +#endif + +static void call_lwip_dhcp_fine_tmr (void *ctx) +{ +dhcp_fine_tmr (); +sys_timeout (10 , call_lwip_dhcp_fine_tmr,NULL ); +} + +static int dhcp_loop (struct udevice *udev) +{ +char *ipstr ="ipaddr\0\0" ; +char *maskstr ="netmask\0\0" ; +char *gwstr ="gatewayip\0\0" ; +unsigned long start; +struct netif *netif; +struct dhcp *dhcp; +bool bound; +int idx; + + idx =dev_seq (udev); +if (idx <0 || idx >99 ) { +log_err ("unexpected idx %d\n" , idx); +return CMD_RET_FAILURE ; + } +
Quoted 8 lines
net/lwip/dhcp.c line 50
Quoted 6 lines
net/lwip/dhcp.c new file +6
-0+ netif =net_lwip_new_netif_noip (udev); +if (!netif) +return CMD_RET_FAILURE ; + + start =get_timer (0 ); +dhcp_start (netif);This can fail. Don't we have to check that and exit?
Yes, will fix.
Quoted 21 lines
Quoted 18 lines
net/lwip/dhcp.c new file +18
-0+call_lwip_dhcp_fine_tmr (NULL ); + +/* Wait for DHCP to complete */ +do { +net_lwip_rx (udev, netif); +sys_check_timeouts (); + bound =dhcp_supplied_address (netif); +if (bound) +break ; +if (ctrlc ()) { +printf ("Abort\n" ); +break ; + } +mdelay (1 ); + }while (get_timer (start) <DHCP_TIMEOUT_MS ); + +sys_untimeout (call_lwip_dhcp_fine_tmr,NULL ); +[...]
Quoted 14 lines
net/lwip/net-lwip.c line 61
Quoted 12 lines
net/lwip/net-lwip.c new file +12
-0+free (pp); +if (err) { +log_err ("send error %d\n" , err); +return ERR_ABRT ; + } + +return ERR_OK ; +} + +static err_t net_lwip_if_init (struct netif *netif) +{ +#if LWIP_IPV4 Do we ever not set this?
No. Removed in v12.
Quoted 47 lines
Quoted 44 lines
net/lwip/net-lwip.c new file +44
-0+ netif->output = etharp_output; +#endif + netif->linkoutput = linkoutput; + netif->mtu =1500 ; + netif->flags =NETIF_FLAG_BROADCAST |NETIF_FLAG_ETHARP |NETIF_FLAG_LINK_UP ; + +return ERR_OK ; +} + +static void eth_init_rings (void ) +{ +int i; + +for (i =0 ; i <PKTBUFSRX ; i++) + net_rx_packets[i] = net_pkt_buf + i *PKTSIZE_ALIGN ; +} + +struct netif *net_lwip_get_netif (void ) +{ +struct netif *netif, *found =NULL ; + +NETIF_FOREACH (netif) { +if (!found) + found = netif; +else +printf ("Error: more than one netif in lwIP\n" ); + } +return found; +} + +static int get_udev_ipv4_info (struct udevice *dev,ip4_addr_t *ip, +ip4_addr_t *mask,ip4_addr_t *gw) +{ +char *ipstr ="ipaddr\0\0" ; +char *maskstr ="netmask\0\0" ; +char *gwstr ="gatewayip\0\0" ; +int idx =dev_seq (dev); +char *env; + +if (idx <0 || idx >99 ) { +log_err ("unexpected idx %d\n" , idx); +return -1 ; + } +[...]
Quoted 6 lines
FWIW dhcp seems to work fine
Tested-by Ilias Apalodimas <[email protected]>Thanks
/Ilias
Thanks,
Signature · 1 line
Jerome
PATCH v11 14/29 lwip: tftp: bind to TFTP port only when in server mode
In reply to Jerome ForissierThe TFTP app should not bind to the TFTP server port when configured as a client. Instead, the local port should be chosen from the dynamic range (49152 ~ 65535) so that if the application is stopped and started again, the remote server will not consider the new packets as part of the same context (which would cause an error since a new RRQ would be unexpected).
--- lib/lwip/lwip/src/apps/tftp/tftp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
lib/lwip/lwip/src/apps/tftp/tftp.c +6 -4
@@ -454,10 +454,12 @@ tftp_init_common(u8_t mode, const struct tftp_context *ctx)return ERR_MEM ; } - ret =udp_bind (pcb,IP_ANY_TYPE ,TFTP_PORT ); -if (ret !=ERR_OK ) { -udp_remove (pcb); -return ret; +if (mode ==LWIP_TFTP_MODE_SERVER ) { + ret =udp_bind (pcb,IP_ANY_TYPE ,TFTP_PORT ); +if (ret !=ERR_OK ) { +udp_remove (pcb); +return ret; + } } tftp_state.handle =NULL ;
Signature · 1 line
2.40.1
Re: [PATCH v11 14/29] lwip: tftp: bind to TFTP port only when in server mode
Hi Jerome,
Quoted 21 lines · Jerome Forissier
The TFTP app should not bind to the TFTP server port when configured as a client. Instead, the local port should be chosen from the dynamic range (49152 ~ 65535) so that if the application is stopped and started again, the remote server will not consider the new packets as part of the same context (which would cause an error since a new RRQ would be unexpected).
Signed-off-by Jerome Forissier <[email protected]>--- lib/lwip/lwip/src/apps/tftp/tftp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)lib/lwip/lwip/src/apps/tftp/tftp.c +0
-0@@ -454,10 +454,12 @@ tftp_init_common(u8_t mode, const struct tftp_context *ctx)return ERR_MEM ; }
lib/lwip/lwip/src/apps/tftp/tftp.c tftp_init_common(u8_t mode, const struct tftp_context *ctx) · line 462
Quoted 10 lines
lib/lwip/lwip/src/apps/tftp/tftp.c +6
-4- ret =udp_bind (pcb,IP_ANY_TYPE ,TFTP_PORT ); -if (ret !=ERR_OK ) { -udp_remove (pcb); -return ret; +if (mode ==LWIP_TFTP_MODE_SERVER ) { + ret =udp_bind (pcb,IP_ANY_TYPE ,TFTP_PORT ); +if (ret !=ERR_OK ) { +udp_remove (pcb); +return ret; + }
This should be sent to lwip as well right?
Quoted 6 lines
lib/lwip/lwip/src/apps/tftp/tftp.c +0
-1} tftp_state.handle =NULL ; --2.40.1
Re: [PATCH v11 14/29] lwip: tftp: bind to TFTP port only when in server mode
Quoted 25 lines · Ilias Apalodimas
Hi Jerome,
Quoted 21 lines · Jerome Forissier
The TFTP app should not bind to the TFTP server port when configured as a client. Instead, the local port should be chosen from the dynamic range (49152 ~ 65535) so that if the application is stopped and started again, the remote server will not consider the new packets as part of the same context (which would cause an error since a new RRQ would be unexpected).
Signed-off-by Jerome Forissier <[email protected]>--- lib/lwip/lwip/src/apps/tftp/tftp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)lib/lwip/lwip/src/apps/tftp/tftp.c +0
-0@@ -454,10 +454,12 @@ tftp_init_common(u8_t mode, const struct tftp_context *ctx)return ERR_MEM ; }
Quoted 12 lines
lib/lwip/lwip/src/apps/tftp/tftp.c tftp_init_common(u8_t mode, const struct tftp_context *ctx) · line 462
Quoted 10 lines
lib/lwip/lwip/src/apps/tftp/tftp.c +6
-4- ret =udp_bind (pcb,IP_ANY_TYPE ,TFTP_PORT ); -if (ret !=ERR_OK ) { -udp_remove (pcb); -return ret; +if (mode ==LWIP_TFTP_MODE_SERVER ) { + ret =udp_bind (pcb,IP_ANY_TYPE ,TFTP_PORT ); +if (ret !=ERR_OK ) { +udp_remove (pcb); +return ret; + }This should be sent to lwip as well right?
Yes: https://savannah.nongnu.org/patch/?10480
Link added to the patch description.
Quoted 9 lines
Quoted 7 lines
lib/lwip/lwip/src/apps/tftp/tftp.c +0
-1} tftp_state.handle =NULL ; --2.40.1
Reviewed-by Ilias Apalodimas <[email protected]>
Thanks,
Signature · 1 line
Jerome
PATCH v11 15/29 net-lwip: add TFTP support and tftpboot command
In reply to Jerome ForissierImplement do_tftpb(). This implementation of the tftp command supports an optional port number. For example:
tftp 192.168.0.30:9069:file.bin
It also supports taking the server IP from ${tftpserverip} if defined, before falling back to ${serverip}.
--- cmd/Kconfig | 3 +- cmd/net-lwip.c | 8 ++ include/net-common.h | 4 + include/net-lwip.h | 4 + lib/binman.c | 1 + net/lwip/dhcp.c | 11 +- net/lwip/net-lwip.c | 16 +++ net/lwip/tftp.c | 283 ++++++++++++++++++++++++++++++++++++++++++- 8 files changed, 324 insertions(+), 6 deletions(-)
cmd/Kconfig +1 -2
@@ -2119,10 +2119,9 @@ config CMD_MDIO config CMD_TFTPBOOT bool "tftp" select PROT_UDP_LWIP if NET_LWIP - default n + default y help tftpboot - load file via network using TFTP protocol - Currently a placeholder (not implemented) when NET_LWIP=y. endif # if CMD_NET
cmd/net-lwip.c +8 -0
@@ -11,3 +11,11 @@ U_BOOT_CMD("[loadAddress] [[hostIPaddr:]bootfilename]" );#endif + +#if defined(CONFIG_CMD_TFTPBOOT ) +U_BOOT_CMD ( + tftpboot,3 ,0 , do_tftpb, +"boot image via network using TFTP protocol\n" , +"[loadAddress] [[hostIPaddr:]bootfilename]" +); +#endif
include/net-common.h +4 -0
@@ -459,6 +459,10 @@ static inline struct in_addr env_get_ip(char *var)int net_init (void ); +/* NET compatibility */ +enum proto_t ; +int net_loop (enum proto_t protocol); +/** * dhcp_run() - Run DHCP on the current ethernet device *
include/net-lwip.h +4 -0
@@ -6,6 +6,10 @@#include <lwip/ip4.h> #include <lwip/netif.h> +enum proto_t { +TFTPGET +}; +struct netif *net_lwip_new_netif (struct udevice *udev);struct netif *net_lwip_new_netif_noip (struct udevice *udev);void net_lwip_remove_netif (struct netif *netif);
lib/binman.c +1 -0
@@ -137,6 +137,7 @@ int binman_init(void) {int ret; +return 0 ; binman =malloc (sizeof (struct binman_info ));if (!binman)return log_msg_ret ("space for binman" , -ENOMEM );
net/lwip/dhcp.c +10 -1
@@ -116,11 +116,20 @@ int do_dhcp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])int dhcp_run (ulong addr,const char *fname,bool autoload) {char *dhcp_argv[] = {"dhcp" ,NULL , }; +#ifdef CONFIG_CMD_TFTPBOOT +char *tftp_argv[] = {"tftpboot" , boot_file_name,NULL , }; +#endif struct cmd_tbl cmdtp = {};/* dummy */ if (autoload) { -/* Will be supported when TFTP is added */ +#ifdef CONFIG_CMD_TFTPBOOT +/* Assume DHCP was already performed */ +if (boot_file_name[0 ]) +return do_tftpb (&cmdtp,0 ,2 , tftp_argv); +return 0 ; +#else return -EOPNOTSUPP ; +#endif }return do_dhcp (&cmdtp,0 ,1 , dhcp_argv);
net/lwip/net-lwip.c +16 -0
@@ -28,6 +28,7 @@ const u8 net_bcast_ethaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };char *pxelinux_configfile;/* Our IP addr (0 = unknown) */ struct in_addr net_ip; +char net_boot_file_name[1024 ];static err_t linkoutput (struct netif *netif,struct pbuf *p) {
@@ -285,6 +286,21 @@ void net_process_received_packet(uchar *in_packet, int len)#endif } +int net_loop (enum proto_t protocol) +{ +char *argv[1 ]; + +switch (protocol) { +case TFTPGET : + argv[0 ] ="tftpboot" ; +return do_tftpb (NULL ,0 ,1 , argv); +default : +return -EINVAL ; + } + +return -EINVAL ; +} +u32_t sys_now (void ) {return get_timer (0 );
net/lwip/tftp.c +280 -3
290 lines not on this page · raw message
Signature · 1 line
2.40.1
Re: [PATCH v11 15/29] net-lwip: add TFTP support and tftpboot command
Quoted 451 lines · Jerome Forissier
Implement
do_tftpb(). This implementation of the tftp command supports an optional port number. For example:tftp 192.168.0.30:9069:file.bin
It also supports taking the server IP from ${tftpserverip} if defined, before falling back to ${serverip}.
Signed-off-by Jerome Forissier <[email protected]>--- cmd/Kconfig | 3 +- cmd/net-lwip.c | 8 ++ include/net-common.h | 4 + include/net-lwip.h | 4 + lib/binman.c | 1 + net/lwip/dhcp.c | 11 +- net/lwip/net-lwip.c | 16 +++ net/lwip/tftp.c | 283 ++++++++++++++++++++++++++++++++++++++++++- 8 files changed, 324 insertions(+), 6 deletions(-)cmd/Kconfig +1
-2@@ -2119,10 +2119,9 @@ config CMD_MDIO config CMD_TFTPBOOT bool "tftp" select PROT_UDP_LWIP if NET_LWIP - default n + default y help tftpboot - load file via network using TFTP protocol - Currently a placeholder (not implemented) when NET_LWIP=y. endif # if CMD_NETcmd/net-lwip.c +8
-0@@ -11,3 +11,11 @@ U_BOOT_CMD("[loadAddress] [[hostIPaddr:]bootfilename]" );#endif + +#if defined(CONFIG_CMD_TFTPBOOT ) +U_BOOT_CMD ( + tftpboot,3 ,0 , do_tftpb, +"boot image via network using TFTP protocol\n" , +"[loadAddress] [[hostIPaddr:]bootfilename]" +); +#endif include/net-common.h +4
-0@@ -459,6 +459,10 @@ static inline struct in_addr env_get_ip(char *var)int net_init (void ); +/* NET compatibility */ +enum proto_t ; +int net_loop (enum proto_t protocol); +/** * dhcp_run() - Run DHCP on the current ethernet device * include/net-lwip.h +4
-0@@ -6,6 +6,10 @@#include <lwip/ip4.h> #include <lwip/netif.h> +enum proto_t { +TFTPGET +}; +struct netif *net_lwip_new_netif (struct udevice *udev);struct netif *net_lwip_new_netif_noip (struct udevice *udev);void net_lwip_remove_netif (struct netif *netif);lib/binman.c +1
-0@@ -137,6 +137,7 @@ int binman_init(void) {int ret; +return 0 ; binman =malloc (sizeof (struct binman_info ));if (!binman)return log_msg_ret ("space for binman" , -ENOMEM );net/lwip/dhcp.c +10
-1@@ -116,11 +116,20 @@ int do_dhcp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])int dhcp_run (ulong addr,const char *fname,bool autoload) {char *dhcp_argv[] = {"dhcp" ,NULL , }; +#ifdef CONFIG_CMD_TFTPBOOT +char *tftp_argv[] = {"tftpboot" , boot_file_name,NULL , }; +#endif struct cmd_tbl cmdtp = {};/* dummy */ if (autoload) { -/* Will be supported when TFTP is added */ +#ifdef CONFIG_CMD_TFTPBOOT +/* Assume DHCP was already performed */ +if (boot_file_name[0 ]) +return do_tftpb (&cmdtp,0 ,2 , tftp_argv); +return 0 ; +#else return -EOPNOTSUPP ; +#endif }return do_dhcp (&cmdtp,0 ,1 , dhcp_argv);net/lwip/net-lwip.c +16
-0@@ -28,6 +28,7 @@ const u8 net_bcast_ethaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };char *pxelinux_configfile;/* Our IP addr (0 = unknown) */ struct in_addr net_ip; +char net_boot_file_name[1024 ];static err_t linkoutput (struct netif *netif,struct pbuf *p) {@@ -285,6 +286,21 @@ void net_process_received_packet(uchar *in_packet, int len)#endif } +int net_loop (enum proto_t protocol) +{ +char *argv[1 ]; + +switch (protocol) { +case TFTPGET : + argv[0 ] ="tftpboot" ; +return do_tftpb (NULL ,0 ,1 , argv); +default : +return -EINVAL ; + } + +return -EINVAL ; +} +u32_t sys_now (void ) {return get_timer (0 );net/lwip/tftp.c +280
-4@@ -2,10 +2,287 @@/* Copyright (C) 2024 Linaro Ltd. */ #include <command.h> -#include <net-lwip.h> +#include <console.h> +#include <display_options.h> +#include <dm/device.h> +#include <efi_loader.h> +#include <image.h> +#include <linux/delay.h> +#include <lwip/apps/tftp_client.h> +#include <lwip/timeouts.h> +#include <mapmem.h> +#include <net.h> +#include <time.h> + +#define PROGRESS_PRINT_STEP_BYTES (10 * 1024) + +enum done_state { +NOT_DONE =0 , +SUCCESS , +FAILURE , +ABORTED +}; + +struct tftp_ctx { +ulong daddr; +ulong size; +ulong block_count; +ulong start_time; +enum done_state done; +}; + +static void *tftp_open (const char *fname,const char *mode,u8_t is_write) +{ +return NULL ; +} + +static void tftp_close (void *handle) +{ +struct tftp_ctx *ctx = handle; +ulong elapsed; + +if (ctx->done ==FAILURE || ctx->done ==ABORTED ) { +/* Closing after an error or Ctrl-C */ +return ; + } + ctx->done =SUCCESS ; + + elapsed =get_timer (ctx->start_time); +if (elapsed >0 ) { +puts ("\n\t " );/* Line up with "Loading: " */ +print_size (ctx->size / elapsed *1000 ,"/s" ); + } +puts ("\ndone\n" ); +printf ("Bytes transferred = %lu (%lx hex)\n" , ctx->size, ctx->size); + +if (env_set_hex ("filesize" , ctx->size)) { +log_err ("filesize not updated\n" ); +return ; + } +} + +static int tftp_read (void *handle,void *buf,int bytes) +{ +return 0 ; +} + +static int tftp_write (void *handle,struct pbuf *p) +{ +struct tftp_ctx *ctx = handle; +struct pbuf *q; + +for (q = p; q !=NULL ; q = q->next) { +memcpy ((void *)ctx->daddr, q->payload, q->len); + ctx->daddr += q->len; + ctx->size += q->len; + ctx->block_count++; +if (ctx->block_count %10 ==0 ) { +putc ('#' ); +if (ctx->block_count % (65 *10 ) ==0 ) +puts ("\n\t " ); + } + } + +return 0 ; +} + +static void tftp_error (void *handle,int err,const char *msg,int size) +{ +struct tftp_ctx *ctx = handle; +char message[100 ]; + + ctx->done =FAILURE ; +memset (message,0 ,sizeof (message)); +memcpy (message, msg,LWIP_MIN (sizeof (message) -1 , (size_t )size)); + +printf ("\nTFTP error: %d (%s)\n" , err, message); +} + +static const struct tftp_context tftp_context = { + tftp_open, + tftp_close, + tftp_read, + tftp_write, + tftp_error +}; + +static int tftp_loop (struct udevice *udev,ulong addr,char *fname, +ip_addr_t srvip,uint16_t srvport) +{ +struct netif *netif; +struct tftp_ctx ctx; +err_t err; + +if (!fname || addr ==0 ) +return -1 ; + +if (!srvport) + srvport =TFTP_PORT ; + + netif =net_lwip_new_netif (udev); +if (!netif) +return -1 ; + + ctx.done =NOT_DONE ; + ctx.size =0 ; + ctx.block_count =0 ; + ctx.daddr = addr; + +printf ("Using %s device\n" , udev->name); +printf ("TFTP from server %s; our IP address is %s\n" , +ip4addr_ntoa (&srvip),env_get ("ipaddr" )); +printf ("Filename '%s'.\n" , fname); +printf ("Load address: 0x%lx\n" , ctx.daddr); +printf ("Loading: " ); + + err =tftp_init_client (&tftp_context); +if (!(err ==ERR_OK || err ==ERR_USE )) +log_err ("tftp_init_client err: %d\n" , err); + + ctx.start_time =get_timer (0 ); + err =tftp_get (&ctx, &srvip, srvport, fname,TFTP_MODE_OCTET ); +/* might return different errors, like routing problems */ +if (err !=ERR_OK ) { +printf ("tftp_get() error %d\n" , err); +net_lwip_remove_netif (netif); +return -1 ; + } + +while (!ctx.done) { +net_lwip_rx (udev, netif); +sys_check_timeouts (); +if (ctrlc ()) { +printf ("\nAbort\n" ); + ctx.done =ABORTED ; +break ; + } + } + +tftp_cleanup (); + +net_lwip_remove_netif (netif); + +if (ctx.done ==SUCCESS ) { +if (env_set_hex ("fileaddr" , addr)) { +log_err ("fileaddr not updated\n" ); +return -1 ; + } +efi_set_bootdev ("Net" ,"" , fname,map_sysmem (addr,0 ), + ctx.size); +return 0 ; + } + +return -1 ; +}int do_tftpb (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -/* Not implemented */ -return CMD_RET_FAILURE ; +int ret =CMD_RET_SUCCESS ; +char *arg =NULL ; +char *words[3 ] = { }; +char *fname =NULL ; +char *server_ip =NULL ; +char *server_port =NULL ; +char *end; +ip_addr_t srvip; +uint16_t port =TFTP_PORT ; +ulong laddr; +ulong addr; +int i; + + laddr =env_get_ulong ("loadaddr" ,16 , image_load_addr); + +switch (argc) { +case 1 : + fname =env_get ("bootfile" ); +break ; +case 2 : +/* +* Only one arg - accept two forms: +* Just load address, or just boot file name. The latter +* form must be written in a format which can not be +* mis-interpreted as a valid number. +*/ + addr =hextoul (argv[1 ], &end); +if (end == (argv[1 ] +strlen (argv[1 ]))) { + laddr = addr; + fname =env_get ("bootfile" ); + }else { + arg =strdup (argv[1 ]); + } +break ; +case 3 : + laddr =hextoul (argv[1 ],NULL ); + arg =strdup (argv[2 ]); +break ; +default : + ret =CMD_RET_USAGE ; + goto out; + } + +if (!arg) + arg = net_boot_file_name; + +if (arg) { +/* Parse [ip:[port:]]fname */ + i =0 ; +while ((*(words + i) =strsep (&arg,":" ))) + i++; + +switch (i) { +case 3 : + server_ip = words[0 ]; + server_port = words[1 ]; + fname = words[2 ]; +break ; +case 2 : + server_ip = words[0 ]; + fname = words[1 ]; +break ; +case 1 : + fname = words[0 ]; +break ; +default : +break ; + } + } + +if (!server_ip) + server_ip =env_get ("tftpserverip" ); +if (!server_ip) + server_ip =env_get ("serverip" ); +if (!server_ip) { +log_err ("error: tftpserverip/serverip has to be set\n" ); + ret =CMD_RET_FAILURE ; + goto out; + } + +if (server_port) + port =dectoul (server_port,NULL ); + +if (!ipaddr_aton (server_ip, &srvip)) { +log_err ("error: ipaddr_aton\n" ); + ret =CMD_RET_FAILURE ; + goto out; + } + +if (!fname) { +log_err ("error: no file name\n" ); + ret =CMD_RET_FAILURE ; + goto out; + } + +if (!laddr) { +log_err ("error: no load address\n" ); + ret =CMD_RET_FAILURE ; + goto out; + } + +eth_set_current (); + +if (tftp_loop (eth_get_dev (), laddr, fname, srvip, port) <0 ) + ret =CMD_RET_FAILURE ; +out: +free (arg); +return ret; } --
Quoted 2 lines
2.40.1
PATCH v11 16/29 net-lwip: add ping command
In reply to Jerome ForissierAdd support for the the ping command with NET_LWIP. The implementation is derived from lwIP's contrib/apps/ping/ping.c.
--- cmd/Kconfig | 11 +-- cmd/net-lwip.c | 8 ++ include/net-lwip.h | 1 + net/lwip/Makefile | 1 + net/lwip/ping.c | 177 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 193 insertions(+), 5 deletions(-) create mode 100644 net/lwip/ping.c
cmd/Kconfig +6 -5
@@ -2018,11 +2018,6 @@ config CMD_WGET wget is a simple command to download kernel, or other files, from a http server over TCP. -config CMD_PING - bool "ping" - help - Send ICMP ECHO_REQUEST to network host - config CMD_PING6 bool "ping6" depends on IPV6
@@ -2116,6 +2111,12 @@ config CMD_MDIO The MDIO interface is orthogonal to the MII interface and extends it by adding access to more registers through indirect addressing. +config CMD_PING + bool "ping" + select PROT_RAW_LWIP if NET_LWIP + help + Send ICMP ECHO_REQUEST to network host + config CMD_TFTPBOOT bool "tftp" select PROT_UDP_LWIP if NET_LWIP
cmd/net-lwip.c +8 -0
@@ -12,6 +12,14 @@ U_BOOT_CMD( );#endif +#if defined(CONFIG_CMD_PING ) +U_BOOT_CMD ( + ping,2 ,1 , do_ping, +"send ICMP ECHO_REQUEST to network host" , +"pingAddress" +); +#endif +#if defined(CONFIG_CMD_TFTPBOOT ) U_BOOT_CMD( tftpboot, 3, 0, do_tftpb,
include/net-lwip.h +1 -0
@@ -17,5 +17,6 @@ struct netif *net_lwip_get_netif(void);int net_lwip_rx (struct udevice *udev,struct netif *netif);int do_dhcp (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); +int do_ping (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);#endif /* __NET_LWIP_H__ */
net/lwip/Makefile +1 -0
@@ -2,4 +2,5 @@ ccflags-y += -I$(srctree)/lib/lwip/lwip/src/include -I$(srctree)/lib/lwip/u-boot obj-$(CONFIG_$(SPL_)DM_ETH) += net-lwip.o obj-$(CONFIG_CMD_DHCP) += dhcp.o +obj-$(CONFIG_CMD_PING) += ping.o obj-$(CONFIG_CMD_TFTPBOOT) += tftp.o
net/lwip/ping.c new file +177 -0
177 lines not on this page · raw message
Signature · 1 line
2.40.1
PATCH v11 17/29 net-lwip: add dns command
In reply to Jerome ForissierAdd CMD_DNS when NET_LWIP is enabled to provide the dns command using lwIP.
--- cmd/Kconfig | 11 ++-- cmd/net-lwip.c | 8 +++ include/net-lwip.h | 1 + net/lwip/Makefile | 1 + net/lwip/dns.c | 127 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 143 insertions(+), 5 deletions(-) create mode 100644 net/lwip/dns.c
cmd/Kconfig +6 -5
@@ -2036,11 +2036,6 @@ config CMD_SNTP help Synchronize RTC via network -config CMD_DNS - bool "dns" - help - Lookup the IP of a hostname - config CMD_LINK_LOCAL bool "linklocal" select LIB_RAND
@@ -2088,6 +2083,12 @@ config CMD_DHCP help Boot image via network using DHCP/TFTP protocol +config CMD_DNS + bool "dns" + select PROT_DNS_LWIP if NET_LWIP + help + Lookup the IP of a hostname + config CMD_MII bool "mii" imply CMD_MDIO
cmd/net-lwip.c +8 -0
@@ -27,3 +27,11 @@ U_BOOT_CMD("[loadAddress] [[hostIPaddr:]bootfilename]" );#endif + +#if defined(CONFIG_CMD_DNS ) +U_BOOT_CMD ( + dns,3 ,1 , do_dns, +"lookup the IP of a hostname" , +"hostname [envvar]" +); +#endif
include/net-lwip.h +1 -0
@@ -17,6 +17,7 @@ struct netif *net_lwip_get_netif(void);int net_lwip_rx (struct udevice *udev,struct netif *netif);int do_dhcp (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); +int do_dns (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ping (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);#endif /* __NET_LWIP_H__ */
net/lwip/Makefile +1 -0
@@ -2,5 +2,6 @@ ccflags-y += -I$(srctree)/lib/lwip/lwip/src/include -I$(srctree)/lib/lwip/u-boot obj-$(CONFIG_$(SPL_)DM_ETH) += net-lwip.o obj-$(CONFIG_CMD_DHCP) += dhcp.o +obj-$(CONFIG_CMD_DNS) += dns.o obj-$(CONFIG_CMD_PING) += ping.o obj-$(CONFIG_CMD_TFTPBOOT) += tftp.o
net/lwip/dns.c new file +127 -0
127 lines not on this page · raw message
Signature · 1 line
2.40.1
PATCH v11 18/29 net: split cmd/net.c into cmd/net.c and cmd/net-common.c
In reply to Jerome ForissierExtract some code from cmd/net.c that will be useful in a subsequent commit to implement wget with NET_LWIP.
--- cmd/Makefile | 5 ++- cmd/net-common.c | 109 ++++++++++++++++++++++++++++++++++++++++++++ cmd/net.c | 115 ----------------------------------------------- 3 files changed, 113 insertions(+), 116 deletions(-) create mode 100644 cmd/net-common.c
cmd/Makefile +4 -1
@@ -130,7 +130,10 @@ obj-$(CONFIG_CMD_NAND) += nand.o ifdef CONFIG_CMD_NET obj-$(CONFIG_NET) += net.o obj-$(CONFIG_NET_LWIP) += net-lwip.o -CFLAGS_net-lwip.o := -I$(srctree)/lib/lwip/lwip/src/include -I$(srctree)/lib/lwip/u-boot +obj-$(filter y,$(CONFIG_CMD_NET) $(CONFIG_CMD_NET_LWIP)) += net-common.o +lwip-includes := -I$(srctree)/lib/lwip/lwip/src/include -I$(srctree)/lib/lwip/u-boot +CFLAGS_net-lwip.o := $(lwip-includes) +CFLAGS_net-common.o := $(lwip-includes) endif obj-$(CONFIG_ENV_SUPPORT) += nvedit.o obj-$(CONFIG_CMD_NVEDIT_EFI) += nvedit_efi.o
cmd/net-common.c new file +109 -0
109 lines not on this page · raw message
cmd/net.c +0 -115
118 lines not on this page · raw message
Signature · 1 line
2.40.1
PATCH v11 19/29 net-lwip: add wget command
In reply to Jerome ForissierAdd support for the wget command with NET_LWIP. The command normally expects a URL: wget [loadaddr] url, but it also accepts the legacy
syntax: wget [loadaddr] [server:]file.
The server IP may alternatively be supplied via ${httpserverip} which has higher priority than ${serverip}.
Based on code initially developed by Maxim U.
--- cmd/Kconfig | 18 ++- cmd/net-lwip.c | 8 + include/net-lwip.h | 18 +++ net/lwip/Makefile | 1 + net/lwip/wget.c | 363 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 400 insertions(+), 8 deletions(-) create mode 100644 net/lwip/wget.c
cmd/Kconfig +10 -8
@@ -2010,14 +2010,6 @@ config SYS_DISABLE_AUTOLOAD is complete. Enable this option to disable this behavior and instead require files to be loaded over the network by subsequent commands. -config CMD_WGET - bool "wget" - select PROT_TCP - default y if SANDBOX - help - wget is a simple command to download kernel, or other files, - from a http server over TCP. - config CMD_PING6 bool "ping6" depends on IPV6
@@ -2125,6 +2117,16 @@ config CMD_TFTPBOOT help tftpboot - load file via network using TFTP protocol +config CMD_WGET + bool "wget" + default y if SANDBOX + select PROT_TCP if NET + select PROT_TCP_LWIP if NET_LWIP + select PROT_DNS_LWIP if NET_LWIP + help + wget is a simple command to download kernel, or other files, + from a http server over TCP. + endif # if CMD_NET config CMD_PXE
cmd/net-lwip.c +8 -0
@@ -35,3 +35,11 @@ U_BOOT_CMD("hostname [envvar]" );#endif + +#if defined(CONFIG_CMD_WGET ) +U_BOOT_CMD ( + wget,3 ,1 , do_wget, +"boot image via network using HTTP protocol" , +"[loadAddress] URL" +); +#endif
include/net-lwip.h +18 -0
@@ -16,8 +16,26 @@ void net_lwip_remove_netif(struct netif *netif);struct netif *net_lwip_get_netif (void );int net_lwip_rx (struct udevice *udev,struct netif *netif); +/** +* wget_with_dns() - runs dns host IP address resulution before wget +* +* @dst_addr: destination address to download the file +* @uri: uri string of target file of wget +* Return: downloaded file size, negative if failed +*/ + +int wget_with_dns (ulong dst_addr,char *uri); +/** +* wget_validate_uri() - varidate the uri +* +* @uri: uri string of target file of wget +* Return: true if uri is valid, false if uri is invalid +*/ +bool wget_validate_uri (char *uri); +int do_dhcp (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_dns (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ping (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); +int do_wget (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);#endif /* __NET_LWIP_H__ */
net/lwip/Makefile +1 -0
@@ -5,3 +5,4 @@ obj-$(CONFIG_CMD_DHCP) += dhcp.o obj-$(CONFIG_CMD_DNS) += dns.o obj-$(CONFIG_CMD_PING) += ping.o obj-$(CONFIG_CMD_TFTPBOOT) += tftp.o +obj-$(CONFIG_CMD_WGET) += wget.o
net/lwip/wget.c new file +363 -0
363 lines not on this page · raw message
Signature · 1 line
2.40.1
PATCH v11 20/29 net-lwip: lwIP wget supports user defined port in the uri, so allow it.
In reply to Jerome ForissierFrom: Jonathan Humphreys <[email protected]>
--- net/lwip/wget.c | 6 ------ 1 file changed, 6 deletions(-)
net/lwip/wget.c +0 -6
@@ -349,12 +349,6 @@ bool wget_validate_uri(char *uri) ret = false; goto out; } - s =strchr (authority,':' ); -if (s) { -log_err ("user defined port is not supported\n" ); - ret = false; - goto out; - } out:free (str_copy);
Signature · 1 line
2.40.1
Re: [PATCH v11 20/29] net-lwip: lwIP wget supports user defined port in the uri, so allow it.
Quoted 2 lines · Jerome Forissier
From: Jonathan Humphreys <[email protected]>
A short description is missing here
Thanks
/Ilias
Quoted 27 lines
Signed-off-by Jonathan Humphreys <[email protected]>Signed-off-by Jerome Forissier <[email protected]>--- net/lwip/wget.c | 6 ------ 1 file changed, 6 deletions(-)net/lwip/wget.c +0
-7@@ -349,12 +349,6 @@ bool wget_validate_uri(char *uri) ret = false; goto out; } - s =strchr (authority,':' ); -if (s) { -log_err ("user defined port is not supported\n" ); - ret = false; - goto out; - } out:free (str_copy); --2.40.1
Re: [PATCH v11 20/29] net-lwip: lwIP wget supports user defined port in the uri, so allow it.
Quoted 6 lines · Ilias Apalodimas
Quoted 2 lines · Jerome Forissier
From: Jonathan Humphreys <[email protected]>
A short description is missing here
I will fold this patch into the previous one since it was a review comment from Jonathan H. ; Jonathan I hope you don't mind?
Thanks,
Signature · 1 line
Jerome
Quoted 30 lines
Thanks
/IliasQuoted 27 lines
Signed-off-by Jonathan Humphreys <[email protected]>Signed-off-by Jerome Forissier <[email protected]>--- net/lwip/wget.c | 6 ------ 1 file changed, 6 deletions(-)net/lwip/wget.c +0
-7@@ -349,12 +349,6 @@ bool wget_validate_uri(char *uri) ret = false; goto out; } - s =strchr (authority,':' ); -if (s) { -log_err ("user defined port is not supported\n" ); - ret = false; - goto out; - } out:free (str_copy); --2.40.1
Re: [PATCH v11 20/29] net-lwip: lwIP wget supports user defined port in the uri, so allow it.
Quoted 11 lines · Jerome Forissier
Quoted 6 lines · Ilias Apalodimas
Quoted 2 lines · Jerome Forissier
From: Jonathan Humphreys <[email protected]>
A short description is missing here
I will fold this patch into the previous one since it was a review comment from Jonathan H. ; Jonathan I hope you don't mind?
No problem.
Jon
Quoted 34 lines
Thanks,
Signature · 1 line
JeromeQuoted 30 lines
Thanks
/IliasQuoted 27 lines
Signed-off-by Jonathan Humphreys <[email protected]>Signed-off-by Jerome Forissier <[email protected]>--- net/lwip/wget.c | 6 ------ 1 file changed, 6 deletions(-)net/lwip/wget.c +0
-7@@ -349,12 +349,6 @@ bool wget_validate_uri(char *uri) ret = false; goto out; } - s =strchr (authority,':' ); -if (s) { -log_err ("user defined port is not supported\n" ); - ret = false; - goto out; - } out:free (str_copy); --2.40.1
PATCH v11 21/29 cmd: bdinfo: enable -e when CONFIG_CMD_NET_LWIP=y
In reply to Jerome ForissierSupport "bdinfo -e" when lwIP is selected.
--- cmd/bdinfo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
cmd/bdinfo.c +3 -2
@@ -151,7 +151,7 @@ static int bdinfo_print_all(struct bd_info *bd)bdinfo_print_num_l ("relocaddr" , gd->relocaddr);bdinfo_print_num_l ("reloc off" , gd->reloc_off);printf ("%-12s= %u-bit\n" ,"Build" , (uint )sizeof (void *) *8 ); -if (IS_ENABLED (CONFIG_CMD_NET )) +if (IS_ENABLED (CONFIG_CMD_NET ) ||IS_ENABLED (CONFIG_CMD_NET_LWIP ))print_eth ();bdinfo_print_num_l ("fdt_blob" , (ulong )map_to_sysmem (gd->fdt_blob));if (IS_ENABLED (CONFIG_VIDEO ))
@@ -192,7 +192,8 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])case 'a' :return bdinfo_print_all (bd);case 'e' : -if (!IS_ENABLED (CONFIG_CMD_NET )) +if (!IS_ENABLED (CONFIG_CMD_NET ) && + !IS_ENABLED (CONFIG_CMD_NET_LWIP ))return CMD_RET_USAGE ;print_eth ();return CMD_RET_SUCCESS ;
Signature · 1 line
2.40.1
PATCH v11 22/29 configs: add qemu_arm64_lwip_defconfig
In reply to Jerome ForissierAdd qemu_arm64_lwip_defconfig which #include's qemu_arm64_defconfig and selects NET_LWIP instead of NET. This config has all the supported net commands enabled.
--- configs/qemu_arm64_lwip_defconfig | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 configs/qemu_arm64_lwip_defconfig
configs/qemu_arm64_lwip_defconfig new file +9 -0
@@ -0,0 +1,9 @@ +#include <configs/qemu_arm64_defconfig> + +CONFIG_ARM=y +CONFIG_ARCH_QEMU=y + +CONFIG_NET_LWIP=y +CONFIG_CMD_DNS=y +CONFIG_CMD_WGET=y +CONFIG_EFI_HTTP_BOOT=y
Signature · 1 line
2.40.1
Re: [PATCH v11 22/29] configs: add qemu_arm64_lwip_defconfig
Quoted 27 lines · Jerome Forissier
Add
qemu_arm64_lwip_defconfigwhich #include'sqemu_arm64_defconfigand selectsNET_LWIPinstead of NET. This config has all the supported net commands enabled.Signed-off-by Jerome Forissier <[email protected]>--- configs/qemu_arm64_lwip_defconfig | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 configs/qemu_arm64_lwip_defconfigconfigs/qemu_arm64_lwip_defconfig new file +9
-1@@ -0,0 +1,9 @@ +#include <configs/qemu_arm64_defconfig> + +CONFIG_ARM=y +CONFIG_ARCH_QEMU=y + +CONFIG_NET_LWIP=y +CONFIG_CMD_DNS=y +CONFIG_CMD_WGET=y +CONFIG_EFI_HTTP_BOOT=y --
Quoted 2 lines
2.40.1
PATCH v11 23/29 lwip: tftp: add support of blksize option to client
In reply to Jerome ForissierThe TFTP protocol uses a default block size of 512 bytes. This value is sub-optimal for ethernet devices, which have a MTU (Maximum Transmission Unit) of 1500 bytes. When taking into acount the overhead of the IP and UDP layers, this leaves 1468 bytes for the TFTP payload.
This patch introduces a new function: tftp_client_set_blksize() which may be used to change the block size from the default. It has to be called after tftp_client_init() and before tftp_get(). If the server does not support the option, the client will still accept to receive 512-byte blocks.
--- lib/lwip/lwip/src/apps/tftp/tftp.c | 94 +++++++++++++++++-- .../lwip/src/include/lwip/apps/tftp_client.h | 1 + 2 files changed, 89 insertions(+), 6 deletions(-)
lib/lwip/lwip/src/apps/tftp/tftp.c +88 -6
@@ -57,7 +57,7 @@#include "lwip/timeouts.h" #include "lwip/debug.h" -#define TFTP_MAX_PAYLOAD_SIZE 512 +#define TFTP_DEFAULT_BLOCK_SIZE 512#define TFTP_HEADER_LENGTH 4#define TFTP_RRQ 1
@@ -65,6 +65,7 @@#define TFTP_DATA 3#define TFTP_ACK 4#define TFTP_ERROR 5 +#define TFTP_OACK 6enum tftp_error {TFTP_ERROR_FILE_NOT_FOUND =1 ,
@@ -88,9 +89,11 @@ struct tftp_state {int timer;int last_pkt;u16_t blknum; +u16_t blksize;u8_t retries;u8_t mode_write;u8_t tftp_mode; +bool wait_oack; };static struct tftp_state tftp_state;
@@ -137,10 +140,24 @@ send_request(const ip_addr_t *addr, u16_t port, u16_t opcode, const char* fname, {size_t fname_length =strlen (fname)+1 ;size_t mode_length =strlen (mode)+1 ; -struct pbuf * p =init_packet (opcode,0 , fname_length + mode_length -2 ); +size_t blksize_length =0 ; +struct pbuf * p;char * payload;err_t ret; +if (tftp_state.blksize) { + blksize_length =14 ;/* maximum (blksize is a u16_t): 'blksize\0XXXXX\0' */ +if (tftp_state.blksize <10000 ) + blksize_length--; +if (tftp_state.blksize <1000 ) + blksize_length--; +if (tftp_state.blksize <100 ) + blksize_length--; +if (tftp_state.blksize <10 ) + blksize_length--; + } + + p =init_packet (opcode,0 , fname_length + mode_length + blksize_length -2 );if (p ==NULL ) {return ERR_MEM ; }
@@ -148,7 +165,10 @@ send_request(const ip_addr_t *addr, u16_t port, u16_t opcode, const char* fname, payload = (char *) p->payload;MEMCPY (payload+2 , fname, fname_length);MEMCPY (payload+2 +fname_length, mode, mode_length); +if (tftp_state.blksize) +sprintf (payload+2 +fname_length+mode_length,"blksize%c%d%c" ,0 , tftp_state.blksize,0 ); + tftp_state.wait_oack = true; ret =udp_sendto (tftp_state.upcb, p, addr, port);pbuf_free (p);return ret;
@@ -221,14 +241,14 @@ send_data(const ip_addr_t *addr, u16_t port)pbuf_free (tftp_state.last_data); } - tftp_state.last_data =init_packet (TFTP_DATA , tftp_state.blknum,TFTP_MAX_PAYLOAD_SIZE ); + tftp_state.last_data =init_packet (TFTP_DATA , tftp_state.blknum,TFTP_DEFAULT_BLOCK_SIZE );if (tftp_state.last_data ==NULL ) {return ; } payload = (u16_t *) tftp_state.last_data->payload; - ret = tftp_state.ctx->read (tftp_state.handle, &payload[2 ],TFTP_MAX_PAYLOAD_SIZE ); + ret = tftp_state.ctx->read (tftp_state.handle, &payload[2 ],TFTP_DEFAULT_BLOCK_SIZE );if (ret <0 ) {send_error (addr, port,TFTP_ERROR_ACCESS_VIOLATION ,"Error occurred while reading the file." );close_handle ();
@@ -239,6 +259,28 @@ send_data(const ip_addr_t *addr, u16_t port)resend_data (addr, port); } +static u16_t payload_size (void ) +{ +if (tftp_state.blksize) +return tftp_state.blksize; +return TFTP_DEFAULT_BLOCK_SIZE ; +} + +static const char * +find_option (struct pbuf *p,const char *option) +{ +int i; +u16_t optlen =strlen (option); +const char *b = p->payload; + +for (i =0 ; i + optlen +1 < p->len; i++) { +if (lwip_strnstr (b + i, option, optlen)) +return b + i + optlen +2 ; + } + +return NULL ; +} +static void tftp_recv (void *arg,struct udp_pcb *upcb,struct pbuf *p,const ip_addr_t *addr,u16_t port) {
@@ -338,6 +380,15 @@ tftp_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr } blknum =lwip_ntohs (sbuf[1 ]); +if (tftp_state.blksize && tftp_state.wait_oack) { +/* +* Data received while we are expecting an OACK for our blksize option. +* This means the server doesn't support it, let's switch back to the +* default block size. +*/ + tftp_state.blksize =0 ; + tftp_state.wait_oack = false; + }if (blknum == tftp_state.blknum) {pbuf_remove_header (p,TFTP_HEADER_LENGTH );
@@ -349,7 +400,7 @@ tftp_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addrsend_ack (addr, port, blknum); } -if (p->tot_len <TFTP_MAX_PAYLOAD_SIZE ) { +if (p->tot_len <payload_size ()) {close_handle (); }else { tftp_state.blknum++;
@@ -386,7 +437,7 @@ tftp_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr lastpkt =0 ;if (tftp_state.last_data !=NULL ) { - lastpkt = tftp_state.last_data->tot_len != (TFTP_MAX_PAYLOAD_SIZE +TFTP_HEADER_LENGTH ); + lastpkt = tftp_state.last_data->tot_len != (TFTP_DEFAULT_BLOCK_SIZE +TFTP_HEADER_LENGTH ); }if (!lastpkt) {
@@ -405,6 +456,25 @@ tftp_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addrclose_handle (); }break ; +case PP_HTONS (TFTP_OACK ): { +const char *optval =find_option (p,"blksize" ); +u16_t srv_blksize =0 ; + tftp_state.wait_oack = false; +if (optval) { +if (!tftp_state.blksize) { +/* We did not request this option */ +send_error (addr, port,TFTP_ERROR_ILLEGAL_OPERATION ,"blksize unexpected" ); + } + srv_blksize =atoi (optval); +if (srv_blksize <=0 || srv_blksize > tftp_state.blksize) { +send_error (addr, port,TFTP_ERROR_ILLEGAL_OPERATION ,"Invalid blksize" ); + } +LWIP_DEBUGF (TFTP_DEBUG |LWIP_DBG_STATE , ("tftp: accepting blksize=%d\n" , srv_blksize)); + tftp_state.blksize = srv_blksize; + } +send_ack (addr, port,0 ); +break ; + }default :send_error (addr, port,TFTP_ERROR_ILLEGAL_OPERATION ,"Unknown operation" );break ;
@@ -495,6 +565,18 @@ tftp_init_client(const struct tftp_context *ctx)return tftp_init_common (LWIP_TFTP_MODE_CLIENT , ctx); } +/** @ingroup tftp +* Set the block size to be used by the TFTP client. The server may choose to +* accept a lower value. +* @param blksize Block size in bytes +*/ +void +tftp_client_set_blksize (u16_t blksize) +{ +if (blksize !=TFTP_DEFAULT_BLOCK_SIZE ) + tftp_state.blksize = blksize; +} +/** @ingroup tftp * Deinitialize ("turn off") TFTP client/server. */
lib/lwip/lwip/src/include/lwip/apps/tftp_client.h +1 -0
@@ -44,6 +44,7 @@ enum tftp_transfer_mode { };err_t tftp_init_client (const struct tftp_context * ctx); +void tftp_client_set_blksize (u16_t blksize);err_t tftp_get (void * handle,const ip_addr_t *addr,u16_t port,const char * fname,enum tftp_transfer_mode mode);err_t tftp_put (void * handle,const ip_addr_t *addr,u16_t port,const char * fname,enum tftp_transfer_mode mode);
Signature · 1 line
2.40.1
Re: [PATCH v11 23/29] lwip: tftp: add support of blksize option to client
Hi Jerome,
Quoted 62 lines · Jerome Forissier
The TFTP protocol uses a default block size of 512 bytes. This value is sub-optimal for ethernet devices, which have a MTU (Maximum Transmission Unit) of 1500 bytes. When taking into acount the overhead of the IP and UDP layers, this leaves 1468 bytes for the TFTP payload.
This patch introduces a new function:
tftp_client_set_blksize()which may be used to change the block size from the default. It has to be called aftertftp_client_init()and beforetftp_get(). If the server does not support the option, the client will still accept to receive 512-byte blocks.Signed-off-by Jerome Forissier <[email protected]>--- lib/lwip/lwip/src/apps/tftp/tftp.c | 94 +++++++++++++++++-- .../lwip/src/include/lwip/apps/tftp_client.h | 1 + 2 files changed, 89 insertions(+), 6 deletions(-)lib/lwip/lwip/src/apps/tftp/tftp.c +7
-2@@ -57,7 +57,7 @@#include "lwip/timeouts.h" #include "lwip/debug.h" -#define TFTP_MAX_PAYLOAD_SIZE 512 +#define TFTP_DEFAULT_BLOCK_SIZE 512#define TFTP_HEADER_LENGTH 4#define TFTP_RRQ 1@@ -65,6 +65,7 @@#define TFTP_DATA 3#define TFTP_ACK 4#define TFTP_ERROR 5 +#define TFTP_OACK 6enum tftp_error {TFTP_ERROR_FILE_NOT_FOUND =1 ,@@ -88,9 +89,11 @@ struct tftp_state {int timer;int last_pkt;u16_t blknum; +u16_t blksize;u8_t retries;u8_t mode_write;u8_t tftp_mode; +bool wait_oack; };static struct tftp_state tftp_state;@@ -137,10 +140,24 @@ send_request(const ip_addr_t *addr, u16_t port, u16_t opcode, const char* fname, {size_t fname_length =strlen (fname)+1 ;size_t mode_length =strlen (mode)+1 ; -struct pbuf * p =init_packet (opcode,0 , fname_length + mode_length -2 ); +size_t blksize_length =0 ; +struct pbuf * p;char * payload;err_t ret; +if (tftp_state.blksize) {
lib/lwip/lwip/src/apps/tftp/tftp.c send_request(const ip_addr_t *addr, u16_t port, u16_t opcode, const char* fname, · line 158
Quoted 10 lines
lib/lwip/lwip/src/apps/tftp/tftp.c +10
-0+ blksize_length =14 ;/* maximum (blksize is a u16_t): 'blksize\0XXXXX\0' */ +if (tftp_state.blksize <10000 ) + blksize_length--; +if (tftp_state.blksize <1000 ) + blksize_length--; +if (tftp_state.blksize <100 ) + blksize_length--; +if (tftp_state.blksize <10 ) + blksize_length--; + }
I don't think we have log10 anywhere in u-boot but I think writing this as blksize_length = strlen("blksize") + 1;
int cnt = 0;
int blksize = tftp_state.blksize;
while (blksize > 10) {
blksize /= 10;
cnt++;
}cnt++;
is a bit easier to read
Quoted 154 lines
lib/lwip/lwip/src/apps/tftp/tftp.c +71
-4+ + p =init_packet (opcode,0 , fname_length + mode_length + blksize_length -2 );if (p ==NULL ) {return ERR_MEM ; }@@ -148,7 +165,10 @@ send_request(const ip_addr_t *addr, u16_t port, u16_t opcode, const char* fname, payload = (char *) p->payload;MEMCPY (payload+2 , fname, fname_length);MEMCPY (payload+2 +fname_length, mode, mode_length); +if (tftp_state.blksize) +sprintf (payload+2 +fname_length+mode_length,"blksize%c%d%c" ,0 , tftp_state.blksize,0 ); + tftp_state.wait_oack = true; ret =udp_sendto (tftp_state.upcb, p, addr, port);pbuf_free (p);return ret;@@ -221,14 +241,14 @@ send_data(const ip_addr_t *addr, u16_t port)pbuf_free (tftp_state.last_data); } - tftp_state.last_data =init_packet (TFTP_DATA , tftp_state.blknum,TFTP_MAX_PAYLOAD_SIZE ); + tftp_state.last_data =init_packet (TFTP_DATA , tftp_state.blknum,TFTP_DEFAULT_BLOCK_SIZE );if (tftp_state.last_data ==NULL ) {return ; } payload = (u16_t *) tftp_state.last_data->payload; - ret = tftp_state.ctx->read (tftp_state.handle, &payload[2 ],TFTP_MAX_PAYLOAD_SIZE ); + ret = tftp_state.ctx->read (tftp_state.handle, &payload[2 ],TFTP_DEFAULT_BLOCK_SIZE );if (ret <0 ) {send_error (addr, port,TFTP_ERROR_ACCESS_VIOLATION ,"Error occurred while reading the file." );close_handle ();@@ -239,6 +259,28 @@ send_data(const ip_addr_t *addr, u16_t port)resend_data (addr, port); } +static u16_t payload_size (void ) +{ +if (tftp_state.blksize) +return tftp_state.blksize; +return TFTP_DEFAULT_BLOCK_SIZE ; +} + +static const char * +find_option (struct pbuf *p,const char *option) +{ +int i; +u16_t optlen =strlen (option); +const char *b = p->payload; + +for (i =0 ; i + optlen +1 < p->len; i++) { +if (lwip_strnstr (b + i, option, optlen)) +return b + i + optlen +2 ; + } + +return NULL ; +} +static void tftp_recv (void *arg,struct udp_pcb *upcb,struct pbuf *p,const ip_addr_t *addr,u16_t port) {@@ -338,6 +380,15 @@ tftp_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr } blknum =lwip_ntohs (sbuf[1 ]); +if (tftp_state.blksize && tftp_state.wait_oack) { +/* +* Data received while we are expecting an OACK for our blksize option. +* This means the server doesn't support it, let's switch back to the +* default block size. +*/ + tftp_state.blksize =0 ; + tftp_state.wait_oack = false; + }if (blknum == tftp_state.blknum) {pbuf_remove_header (p,TFTP_HEADER_LENGTH );@@ -349,7 +400,7 @@ tftp_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addrsend_ack (addr, port, blknum); } -if (p->tot_len <TFTP_MAX_PAYLOAD_SIZE ) { +if (p->tot_len <payload_size ()) {close_handle (); }else { tftp_state.blknum++;@@ -386,7 +437,7 @@ tftp_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr lastpkt =0 ;if (tftp_state.last_data !=NULL ) { - lastpkt = tftp_state.last_data->tot_len != (TFTP_MAX_PAYLOAD_SIZE +TFTP_HEADER_LENGTH ); + lastpkt = tftp_state.last_data->tot_len != (TFTP_DEFAULT_BLOCK_SIZE +TFTP_HEADER_LENGTH ); }if (!lastpkt) {@@ -405,6 +456,25 @@ tftp_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addrclose_handle (); }break ; +case PP_HTONS (TFTP_OACK ): { +const char *optval =find_option (p,"blksize" ); +u16_t srv_blksize =0 ; + tftp_state.wait_oack = false; +if (optval) { +if (!tftp_state.blksize) { +/* We did not request this option */ +send_error (addr, port,TFTP_ERROR_ILLEGAL_OPERATION ,"blksize unexpected" ); + } + srv_blksize =atoi (optval); +if (srv_blksize <=0 || srv_blksize > tftp_state.blksize) { +send_error (addr, port,TFTP_ERROR_ILLEGAL_OPERATION ,"Invalid blksize" ); + } +LWIP_DEBUGF (TFTP_DEBUG |LWIP_DBG_STATE , ("tftp: accepting blksize=%d\n" , srv_blksize)); + tftp_state.blksize = srv_blksize; + } +send_ack (addr, port,0 ); +break ; + }default :send_error (addr, port,TFTP_ERROR_ILLEGAL_OPERATION ,"Unknown operation" );break ;@@ -495,6 +565,18 @@ tftp_init_client(const struct tftp_context *ctx)return tftp_init_common (LWIP_TFTP_MODE_CLIENT , ctx); } +/** @ingroup tftp +* Set the block size to be used by the TFTP client. The server may choose to +* accept a lower value. +* @param blksize Block size in bytes +*/ +void +tftp_client_set_blksize (u16_t blksize) +{ +if (blksize !=TFTP_DEFAULT_BLOCK_SIZE ) + tftp_state.blksize = blksize; +} +/** @ingroup tftp * Deinitialize ("turn off") TFTP client/server. */ lib/lwip/lwip/src/include/lwip/apps/tftp_client.h +1
-1@@ -44,6 +44,7 @@ enum tftp_transfer_mode { };err_t tftp_init_client (const struct tftp_context * ctx); +void tftp_client_set_blksize (u16_t blksize);err_t tftp_get (void * handle,const ip_addr_t *addr,u16_t port,const char * fname,enum tftp_transfer_mode mode);err_t tftp_put (void * handle,const ip_addr_t *addr,u16_t port,const char * fname,enum tftp_transfer_mode mode); --
Quoted 2 lines
2.40.1
I am fine with it as is since this has to be merged in LWIP anyway. The refactoring above can go in a new patch if we decide to merge this now.
PATCH v11 24/29 net-lwip: add TFTP_BLOCKSIZE
In reply to Jerome ForissierAdd support for setting the TFTP block size. The default value (1468) is fine for Ethernet and allows a better throughput than the TFTP default (512), if the server supports the blksize option of course.
I tested this change with qemu_arm64_lwip_defconfig. The throughput is now 875 KiB/s vs. 313 KiB/s before. That is still a low number, but I think we can't expect more without implementing the windowsize option.
--- net/Kconfig | 20 ++++++++++---------- net/lwip/tftp.c | 2 ++ 2 files changed, 12 insertions(+), 10 deletions(-)
net/Kconfig +10 -10
@@ -60,16 +60,6 @@ config SYS_FAULT_ECHO_LINK_DOWN this option is active, then CONFIG_SYS_FAULT_MII_ADDR also needs to be configured. -config TFTP_BLOCKSIZE - int "TFTP block size" - default 1468 - help - Default TFTP block size. - The MTU is typically 1500 for ethernet, so a TFTP block of - 1468 (MTU minus eth.hdrs) provides a good throughput with - almost-MTU block sizes. - You can also activate CONFIG_IP_DEFRAG to set a larger block. - config TFTP_PORT bool "Set TFTP UDP source/destination ports via the environment" help
@@ -254,6 +244,16 @@ config NET_RANDOM_ETHADDR generated. It will be saved to the appropriate environment variable, too. +config TFTP_BLOCKSIZE + int "TFTP block size" + default 1468 + help + Default TFTP block size. + The MTU is typically 1500 for ethernet, so a TFTP block of + 1468 (MTU minus eth.hdrs) provides a good throughput with + almost-MTU block sizes. + You can also activate CONFIG_IP_DEFRAG to set a larger block. + endif # if NET || NET_LWIP config SYS_RX_ETH_BUFFER
net/lwip/tftp.c +2 -0
@@ -139,6 +139,8 @@ static int tftp_loop(struct udevice *udev, ulong addr, char *fname,if (!(err ==ERR_OK || err ==ERR_USE ))log_err ("tftp_init_client err: %d\n" , err); +tftp_client_set_blksize (CONFIG_TFTP_BLOCKSIZE ); + ctx.start_time =get_timer (0 ); err =tftp_get (&ctx, &srvip, srvport, fname,TFTP_MODE_OCTET );/* might return different errors, like routing problems */
Signature · 1 line
2.40.1
PATCH v11 25/29 CI: add qemu_arm64_lwip to the test matrix
In reply to Jerome ForissierBuild and run qemu_arm64_lwip_defconfig in CI. This tests the lightweight IP (lwIP) implementation of the dhcp, tftpboot and ping commands.
--- .azure-pipelines.yml | 7 +++++++ 1 file changed, 7 insertions(+)
.azure-pipelines.yml +7 -0
@@ -238,6 +238,10 @@ stages: cd \${WORK_DIR} git config --global --add safe.directory \${WORK_DIR} git clone --depth=1 https://source.denx.de/u-boot/u-boot-test-hooks /tmp/uboot-test-hooks + # qemu_arm64_lwip_defconfig is the same as qemu_arm64 but with NET_LWIP enabled. + # The test config and the boardenv file from qemu_arm64 can be re-used so create symlinks + ln -s conf.qemu_arm64_na /tmp/uboot-test-hooks/bin/travis-ci/conf.qemu_arm64_lwip_na + ln -s u_boot_boardenv_qemu_arm64_na.py /tmp/uboot-test-hooks/py/travis-ci/u_boot_boardenv_qemu_arm64_lwip_na.py ln -s travis-ci /tmp/uboot-test-hooks/bin/\`hostname\` ln -s travis-ci /tmp/uboot-test-hooks/py/\`hostname\` grub-mkimage --prefix=\"\" -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
@@ -415,6 +419,9 @@ stages: qemu_arm64: TEST_PY_BD: "qemu_arm64" TEST_PY_TEST_SPEC: "not sleep" + qemu_arm64_lwip: + TEST_PY_BD: "qemu_arm64_lwip" + TEST_PY_TEST_SPEC: "test_net_dhcp or test_net_ping or test_net_tftpboot" qemu_m68k: TEST_PY_BD: "M5208EVBE" TEST_PY_ID: "--id qemu"
Signature · 1 line
2.40.1
Re: [PATCH v11 25/29] CI: add qemu_arm64_lwip to the test matrix
Quoted 35 lines · Jerome Forissier
Build and run
qemu_arm64_lwip_defconfigin CI. This tests the lightweight IP (lwIP) implementation of the dhcp, tftpboot and ping commands.Signed-off-by Jerome Forissier <[email protected]>--- .azure-pipelines.yml | 7 +++++++ 1 file changed, 7 insertions(+).azure-pipelines.yml +7
-1@@ -238,6 +238,10 @@ stages: cd \${WORK_DIR} git config --global --add safe.directory \${WORK_DIR} git clone --depth=1 https://source.denx.de/u-boot/u-boot-test-hooks /tmp/uboot-test-hooks + # qemu_arm64_lwip_defconfig is the same as qemu_arm64 but with NET_LWIP enabled. + # The test config and the boardenv file from qemu_arm64 can be re-used so create symlinks + ln -s conf.qemu_arm64_na /tmp/uboot-test-hooks/bin/travis-ci/conf.qemu_arm64_lwip_na + ln -s u_boot_boardenv_qemu_arm64_na.py /tmp/uboot-test-hooks/py/travis-ci/u_boot_boardenv_qemu_arm64_lwip_na.py ln -s travis-ci /tmp/uboot-test-hooks/bin/\`hostname\` ln -s travis-ci /tmp/uboot-test-hooks/py/\`hostname\` grub-mkimage --prefix=\"\" -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd@@ -415,6 +419,9 @@ stages: qemu_arm64: TEST_PY_BD: "qemu_arm64" TEST_PY_TEST_SPEC: "not sleep" + qemu_arm64_lwip: + TEST_PY_BD: "qemu_arm64_lwip" + TEST_PY_TEST_SPEC: "test_net_dhcp or test_net_ping or test_net_tftpboot" qemu_m68k: TEST_PY_BD: "M5208EVBE" TEST_PY_ID: "--id qemu" --
Quoted 2 lines
2.40.1
Re: [PATCH v11 25/29] CI: add qemu_arm64_lwip to the test matrix
In reply to Jerome ForissierQuoted 7 lines · Jerome Forissier
Build and run
qemu_arm64_lwip_defconfigin CI. This tests the lightweight IP (lwIP) implementation of the dhcp, tftpboot and ping commands.Signed-off-by Jerome Forissier <[email protected]>--- .azure-pipelines.yml | 7 +++++++ 1 file changed, 7 insertions(+)
This should be in .gitlab-ci.yml too. Generally it's close enough to get without testing (and using the linter if needed), but I'm sure Ilias can push something through the tpm tree for testing if you want, and we should get you added to source.denx.de (please go sign up) and access to the -net tree, really, anyhow.
Signature · 1 line
Tom
Re: [PATCH v11 25/29] CI: add qemu_arm64_lwip to the test matrix
Quoted 10 lines · Tom Rini
Quoted 7 lines · Jerome Forissier
Build and run
qemu_arm64_lwip_defconfigin CI. This tests the lightweight IP (lwIP) implementation of the dhcp, tftpboot and ping commands.Signed-off-by Jerome Forissier <[email protected]>--- .azure-pipelines.yml | 7 +++++++ 1 file changed, 7 insertions(+)This should be in .gitlab-ci.yml too.
Updated in v12.
Quoted 5 lines
Generally it's close enough to get
without testing (and using the linter if needed), but I'm sure Ilias can push something through the tpm tree for testing if you want, and we should get you added to source.denx.de (please go sign up) and access to the -net tree, really, anyhow.
I have registered on source.denx.de.
Thanks Tom,
Signature · 1 line
Jerome
PATCH v11 26/29 MAINTAINERS: net-lwip: add myself as a maintainer
In reply to Jerome ForissierAdd myself as a maintainer for the lwIP network stack integration code and network commands as well as the sandbox ethernet driver for lwIP.
--- MAINTAINERS | 11 +++++++++++ 1 file changed, 11 insertions(+)
MAINTAINERS +11 -0
@@ -1352,6 +1352,17 @@ F: drivers/net/ F: include/net.h F: net/ +NETWORK (LWIP) +M: Jerome Forissier <[email protected]> +S: Maintained +F: cmd/net-lwip.c +F: configs/qemu_arm64_lwip_defconfig +F: drivers/net/sandbox-lwip.c +F: include/net-lwip.h +F: lib/lwip/Makefile +F: lib/lwip/u-boot/ +F: net/lwip/ + NIOS M: Thomas Chou <[email protected]> S: Maintained
Signature · 1 line
2.40.1
Re: [PATCH v11 26/29] MAINTAINERS: net-lwip: add myself as a maintainer
Quoted 32 lines · Jerome Forissier
Add myself as a maintainer for the lwIP network stack integration code and network commands as well as the sandbox ethernet driver for lwIP.
Signed-off-by Jerome Forissier <[email protected]>--- MAINTAINERS | 11 +++++++++++ 1 file changed, 11 insertions(+)MAINTAINERS +11
-1@@ -1352,6 +1352,17 @@ F: drivers/net/ F: include/net.h F: net/ +NETWORK (LWIP) +M: Jerome Forissier <[email protected]> +S: Maintained +F: cmd/net-lwip.c +F: configs/qemu_arm64_lwip_defconfig +F: drivers/net/sandbox-lwip.c +F: include/net-lwip.h +F: lib/lwip/Makefile +F: lib/lwip/u-boot/ +F: net/lwip/ + NIOS M: Thomas Chou <[email protected]> S: Maintained --
Quoted 2 lines
2.40.1
PATCH v11 27/29 configs: use syntax CONFIG_FOO=n in tools-only_defconfig
In reply to Jerome ForissierThe tools-only defconfig causes troubles on MacOSX due to the default C compiler being Clang (LLVM) rather than GCC and more specifically due to [1]. Therefore replace "# CONFIG_FOO is not set" with the equivalent "CONFIG_FOO=n" using the following command:
$ sed -i -e 's/# \(CONFIG_[^ ]*\) is not set/\1=n/' \
configs/tools-only_defconfigThis fixes the tools_only_macOS CI job on GitHub [2].
[1] https://github.com/llvm/llvm-project/issues/78778
[2] https://dev.azure.com/u-boot/u-boot/_build/results?buildId=9105&view=results
--- configs/tools-only_defconfig | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
configs/tools-only_defconfig +16 -16
@@ -4,26 +4,26 @@ CONFIG_ENV_SIZE=0x2000 CONFIG_DEFAULT_DEVICE_TREE="sandbox" CONFIG_SYS_LOAD_ADDR=0x0 CONFIG_PCI=y -# CONFIG_SANDBOX_SDL is not set +CONFIG_SANDBOX_SDL=n CONFIG_ANDROID_BOOT_IMAGE=y CONFIG_TIMESTAMP=y CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y -# CONFIG_BOOTSTD_FULL is not set -# CONFIG_BOOTMETH_CROS is not set -# CONFIG_BOOTMETH_VBE is not set +CONFIG_BOOTSTD_FULL=n +CONFIG_BOOTMETH_CROS=n +CONFIG_BOOTMETH_VBE=n CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="run distro_bootcmd" -# CONFIG_CMD_BOOTD is not set -# CONFIG_CMD_BOOTM is not set -# CONFIG_CMD_BOOTI is not set -# CONFIG_CMD_ELF is not set -# CONFIG_CMD_EXTENSION is not set -# CONFIG_CMD_DATE is not set +CONFIG_CMD_BOOTD=n +CONFIG_CMD_BOOTM=n +CONFIG_CMD_BOOTI=n +CONFIG_CMD_ELF=n +CONFIG_CMD_EXTENSION=n +CONFIG_CMD_DATE=n CONFIG_OF_CONTROL=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NO_NET=y -# CONFIG_ACPIGEN is not set +CONFIG_ACPIGEN=n CONFIG_AXI=y CONFIG_AXI_SANDBOX=y CONFIG_SANDBOX_GPIO=y
@@ -32,9 +32,9 @@ CONFIG_DM_RTC=y CONFIG_SOUND=y CONFIG_SYSRESET=y CONFIG_TIMER=y -# CONFIG_VIRTIO_MMIO is not set -# CONFIG_VIRTIO_PCI is not set -# CONFIG_VIRTIO_SANDBOX is not set -# CONFIG_GENERATE_ACPI_TABLE is not set -# CONFIG_EFI_LOADER is not set +CONFIG_VIRTIO_MMIO=n +CONFIG_VIRTIO_PCI=n +CONFIG_VIRTIO_SANDBOX=n +CONFIG_GENERATE_ACPI_TABLE=n +CONFIG_EFI_LOADER=n CONFIG_TOOLS_MKEFICAPSULE=y
Signature · 1 line
2.40.1
Re: [PATCH v11 27/29] configs: use syntax CONFIG_FOO=n in tools-only_defconfig
Quoted 79 lines · Jerome Forissier
The tools-only defconfig causes troubles on MacOSX due to the default C compiler being Clang (LLVM) rather than GCC and more specifically due to [1]. Therefore replace "#
CONFIG_FOOis not set" with the equivalent "CONFIG_FOO=n" using the following command:$ sed -i -e 's/# \(CONFIG_[^ ]*\) is not set/\1=n/' \ configs/tools-only_defconfigThis fixes the
tools_only_macOSCI job on GitHub [2].[1] https://github.com/llvm/llvm-project/issues/78778
[2] https://dev.azure.com/u-boot/u-boot/_build/results?buildId=9105&view=resultsSuggested-by Tom Rini <[email protected]>Signed-off-by Jerome Forissier <[email protected]>Reviewed-by Tom Rini <[email protected]>--- configs/tools-only_defconfig | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)configs/tools-only_defconfig +16
-17@@ -4,26 +4,26 @@ CONFIG_ENV_SIZE=0x2000 CONFIG_DEFAULT_DEVICE_TREE="sandbox" CONFIG_SYS_LOAD_ADDR=0x0 CONFIG_PCI=y -# CONFIG_SANDBOX_SDL is not set +CONFIG_SANDBOX_SDL=n CONFIG_ANDROID_BOOT_IMAGE=y CONFIG_TIMESTAMP=y CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y -# CONFIG_BOOTSTD_FULL is not set -# CONFIG_BOOTMETH_CROS is not set -# CONFIG_BOOTMETH_VBE is not set +CONFIG_BOOTSTD_FULL=n +CONFIG_BOOTMETH_CROS=n +CONFIG_BOOTMETH_VBE=n CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="run distro_bootcmd" -# CONFIG_CMD_BOOTD is not set -# CONFIG_CMD_BOOTM is not set -# CONFIG_CMD_BOOTI is not set -# CONFIG_CMD_ELF is not set -# CONFIG_CMD_EXTENSION is not set -# CONFIG_CMD_DATE is not set +CONFIG_CMD_BOOTD=n +CONFIG_CMD_BOOTM=n +CONFIG_CMD_BOOTI=n +CONFIG_CMD_ELF=n +CONFIG_CMD_EXTENSION=n +CONFIG_CMD_DATE=n CONFIG_OF_CONTROL=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NO_NET=y -# CONFIG_ACPIGEN is not set +CONFIG_ACPIGEN=n CONFIG_AXI=y CONFIG_AXI_SANDBOX=y CONFIG_SANDBOX_GPIO=y@@ -32,9 +32,9 @@ CONFIG_DM_RTC=y CONFIG_SOUND=y CONFIG_SYSRESET=y CONFIG_TIMER=y -# CONFIG_VIRTIO_MMIO is not set -# CONFIG_VIRTIO_PCI is not set -# CONFIG_VIRTIO_SANDBOX is not set -# CONFIG_GENERATE_ACPI_TABLE is not set -# CONFIG_EFI_LOADER is not set +CONFIG_VIRTIO_MMIO=n +CONFIG_VIRTIO_PCI=n +CONFIG_VIRTIO_SANDBOX=n +CONFIG_GENERATE_ACPI_TABLE=n +CONFIG_EFI_LOADER=n CONFIG_TOOLS_MKEFICAPSULE=y --
Quoted 2 lines
2.40.1
PATCH v11 28/29 configs: set CONFIG_NET=y for FTGMAC100
In reply to Jerome ForissierFTGMAC100 is not compatible with NET_LWIP which was enabled as the default stack in a previous commit. So enable NET in the defconfig.
--- configs/evb-ast2500_defconfig | 1 + configs/evb-ast2600_defconfig | 1 + 2 files changed, 2 insertions(+)
configs/evb-ast2500_defconfig +1 -0
@@ -35,6 +35,7 @@ CONFIG_CMD_NCSI=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NET=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_REGMAP=y CONFIG_CLK=y
configs/evb-ast2600_defconfig +1 -0
@@ -78,6 +78,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_ENV_SECT_SIZE_AUTO=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NET=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y
Signature · 1 line
2.40.1
Re: [PATCH v11 28/29] [TESTING] configs: set CONFIG_NET=y for FTGMAC100
Quoted 36 lines · Jerome Forissier
FTGMAC100 is not compatible with
NET_LWIPwhich was enabled as the default stack in a previous commit. So enable NET in the defconfig.Signed-off-by Jerome Forissier <[email protected]>Reviewed-by Chia-Wei Wang <[email protected]>--- configs/evb-ast2500_defconfig | 1 + configs/evb-ast2600_defconfig | 1 + 2 files changed, 2 insertions(+)configs/evb-ast2500_defconfig +1
-0@@ -35,6 +35,7 @@ CONFIG_CMD_NCSI=y CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NET=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_REGMAP=y CONFIG_CLK=yconfigs/evb-ast2600_defconfig +1
-1@@ -78,6 +78,7 @@ CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_ENV_SECT_SIZE_AUTO=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_NET=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y --
Quoted 2 lines
2.40.1
Hi Jerome,
I'll have a look, but there seems to be reviewed-by and acked-by tags missing? Any chance you lost those during rebasing ?
Thanks
/Ilias
Quoted 568 lines · Jerome Forissier
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 withKconfig, 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. and Raymond M. (CC'd) have 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. using a secure, authenticated connection directly from the U-Boot shell. Several use cases:
* Authentication: prevent MITM attack (third party replacing the
binary with a different one)
* Confidentiality: prevent third parties from grabbing a copy of the
image as it is being downloaded
* Allow connection to servers that do not support plain HTTP anymore
(this is becoming more and more common on the Internet these days)
- Possibly benefit from additional features implemented in lwIP
- Less code to maintain in U-BootPrior to applying this series, the lwIP stack needs to be added as a Git subtree with the following command:
$ git subtree add --squash --prefix lib/lwip/lwip \ https://github.com/lwip-tcpip/lwip.git STABLE-2_2_0_RELEASENotes
1. A number of features are currently incompatible with
NET_LWIP:DFU_TFTP, FASTBOOT,SPL_NET,ETH_SANDBOX,ETH_SANDBOX_RAW,DM_ETH. They all make assumptions on how the network stack is implemented and/or pull sybols that are not trivially exported from lwIP. Some interface rework may be needed.2. Due to the above, and in order to provide some level of testing of the lwIP code in CI even when the legacy NET is the default, a new QEMU configuration is introduced (
qemu_arm64_lwip_defconfig) which is based onqemu_arm64_defconfigwithNET_LWIPand CMD_*_LWIP enabled. In addition to that, this series has some [TESTING] patches which makeNET_LWIPthe default.[1] https://lore.kernel.org/all/[email protected]/
[2] https://www.nongnu.org/lwip/
[3] https://en.wikipedia.org/wiki/LwIPChanges in v11:
- Rebased onto next
- "Miscellaneous fixes" removed (patches were merged in next). The
series still begins with small fixes posted separately [1] [2] [3].
- Add (some) support forCMD_PXEand therefore drop patch "[TESTING]
configs: setCONFIG_NET=ywhen PXE is enabled". This is build-tested
only and it is very likely that some work is needed to make it useful.
For example, adding the code for DHCP option 209 to lwIP so thatBOOTP_PXE_DHCP_OPTIONcan be supported.
- SANDBOX is now supported, but with the dm eth and wget tests
disabled.
- Moveeth_set_enable_bootdevs()declaration tonet-common.h
Fixes warning withsnow_defconfig:test/test-main.c:310:17: warning: implicit declaration of function ‘eth_set_enable_bootdevs’ [....]
- Doeth_init()andeth_init_rings()only once, and do not forgetlwip_init()! Fixes TFTP stalls on TI K3 (reported by Tom R. and
tested by Ilias A.)
- SetMEM_ALIGNMENTto 8 inlib/lwip/u-boot/lwipopts.h. Fixes TFTP
random crashes on TI K3 (Ilias A.)
-net_lwip_rx(): callfree_pkt()even whenrecv()has returned 0,
as required by the driver model documentation (andimx8mp_evk). Fixes
a regression introduced in v9. Goes together with patch [2].
- Add "lwip: tftp: bind to TFTP port only when in server mode" to
fix an issue with interrupted tftp commands (the tftp command hangs
if it is interrupted with Ctrl-C and started again).
- TFTP: fix uninitialized "ret" variable indo_tftpb(); print "Abort"
on Ctrl-C.
-MAINTAINERS: remove README and add sandbox ethernet driver to the
list of maintained files.
- AFAICT, CI should be all good exceptqemu_xtensa_dc233cwhich is
broken when NET_LWIP=y (QEMU just hangs with no output). I could
not find or build a suitable GDB binary to debug that.[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
[2] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
[3] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/Changes in v10:
- Rebase onto next
- URL for lwIP changed in cover letter: using GitHub now since all tags have suddenly disappeared from the repository on gnu.org.
- Post fixes as a separate series [1] or individual patches [2] [3]
- Add "ifNET_LWIP" tonet/lwip/Kconfigto fix a kconfig warning when doing the full branch build with buildman ("[NEW]")
-net/is added to libs-y only when NET orNET_LWIP, notNO_NET
- Apply review tags[1] http://patchwork.ozlabs.org/project/uboot/list/?series=422079
https://lists.denx.de/pipermail/u-boot/2024-September/563904.html
[2] http://patchwork.ozlabs.org/project/uboot/list/?series=421962
[3] http://patchwork.ozlabs.org/project/uboot/list/?series=421959Changes in v9:
- Rebased onto master, reordered commits to put some fixes that are not strictly related to lwIP first.
- New commit "test/py:test_efi_loader: add missing dependency oncmd_tftpboot" (Tom R.)
-test_efi_loader.py: add missing dependency oncmd_wget(Tom R.)
- wget: fix divide by zero when transfer takes less than 1ms (Tom R.)
- New commit "configs: use syntaxCONFIG_FOO=nin tools-only_defconfig" (Tom R.)
- MakeTCP_WNDconfigurable (viaCONFIG_LWIP_TCP_WND) because a large value is needed for good performance especially with latency but transfers stall in QEMU (-net user) when the value is larger than a few KB (Anton A., offlist)
- Added [TESTING] commits to run CI withNET_LWIPenabled by default except for SANDBOX and platforms that enable PXE, and fixed a number of issues:
*coreboot_defconfig: 'implicit declaration' warnings onip_checksum_ok()andcompute_ip_checksum()
* Fix EFI net tests (bootefi selftest) by adding missingpush_packed()call tonet_process_received_packet()
*qemu_arm64: fixtest_efi_loader.pyfailures (skip HTTP test by default since it needs a HTTP server; fix a bug in the dhcp command which would not set the "serverip" variable)
* QEMU CI tests forr2dplus_i82557c,r2dplus_rtl8139:
Fixed receive errors due to callingfree_pkt()with a length of zero.r2dplus_tulip: fixed "dm_pci_phys_to_bus:
invalid physical address" caused by too lateeth_init_rings().
With that the CI status is all GREEN:
https://dev.azure.com/u-boot/u-boot/_build/results?buildId=9225&view=resultsChanges in v8:
- Fix bootefi with tftp and wget. It would previously fail with an error message: "No UEFI binary known at 200000". Tested on Raspberry 3B+. Also fix the legacy wget. (Tom R.)
- wget: add "Bytes transferred =" message and accept legacy syntax for better compatibility which also makes it easier to add a test to the test suite
- wget: When no server name or address is supplied, use ${httpserverip} then ${serverip}.
- wget: start the timer used for measuring throughput when the first data block is received. In other words: do not include DNS resolution and TCP connection time in measurement. It gives better numbers ;) but more importantly is how the legacy code works.
- wget: handle non-200 result codes from the server as errors.
- tftp: when no server name or ip is supplied, use ${tftpserverip} then fall back to ${serverip}.
- New commit: "test/py: add HTTP (wget) test"
- New commit: "net: wget: removed unused functionwget_success()"
- Change back all !CONFIG_IS_ENABLED(NO_NET) tests to (CONFIG_IS_ENABLED(NET)||CONFIG_IS_ENABLED(NET_LWIP)) since theNO_NETcase is wrong whenCONFIG_SPL_BUILDorCONFIG_TPL_BUILDis defined (Tom R.)Changes in v7:
- Rebased onto master
- Updated binary size comparisons in this cover letter. Note that the increase forimx8mp_evk_defconfigwas wrong due to a configuration error.Changes in v6:
- Rebased on next
- "flash: prefix error codes withFL_"
Updatedrivers/mtd/altera_qspi.ctoo (Tom R.)
- "net: introduce alternative implementation as net-lwip/" Introduce a "Networking" top-level menu in the mainKconfig. Avoids having a lot of network-related symbols on the first screen of menuconfig. The "Networking stack" choice as well as the applicable symbols (depending on the selected choice) are now all inside this "Networking" menu. (Michal S.)
ForPROT_DHCP_LWIPandPROT_DNS_LWIP, use "select"PROT_UDP_LWIPrather than "depends on".
MoveNET_RANDOM_ETHADDRto the common ('if NET ||NET_LWIP') block. MoveSYS_RX_ETH_BUFFERout of 'if NET ||NET_LWIP' since it is used unguarded in some code (e.g.,am62x_beagleplay_r5) (Tom R.).
- "net: splitinclude/net.hinto net{,-common,-legacy,-lwip}.h" Movenet_random_ethaddr()tonet-common.h.
- "net: eth-uclass: add functioneth_start_udev()"
Fix typo and apply Tom R.'s R-b.
- "net-lwip: add DHCP support and dhcp commmand"
Convert !CONFIG_IS_ENABLED(NET) toCONFIG_IS_ENABLED(NO_NET)inboard/xilinx/common/board.cto fix an issue with device having no MAC address (thanks Michal S.). Do the same at other places (icore_mx8mp.c,imx8mp_debix_model_a.c,board/ti/am335x/board.c,tiny-printf.c).
MoveCMD_MIIandCMD_MDIOinto 'if NET ||NET_LWIP'.
- "net-lwip: add TFTP support and tftpboot command":
Fix help string.
- "net: splitcmd/net.cintocmd/net.candcmd/net-common.c":
Apply Ilias' R-b.
- "net-lwip: addTFTP_BLOCKSIZE"
Apply Ilias' R-b. I moved theTFTP_BLOCKSIZEKconfiginto this commit where it belongs (it was previously in "net" split ...net.h").Changes in v5:
- Rebased on next
- RefactorKconfigoptions to avoid duplicates
- Library functions use a more consistent naming (dhcp_loop(),ping_loop()etc.) and take a struct udevice * parameter (Heinrich S.)
- Do not usenet_process_receive_packet()for input anymore. Instead of callingeth_rx()which would invokenet_process_receive_packet(), we call a newnet_lwip_rx(udev)function which invokes the devicerecv()and pushes the packets up the lwIP stack. Thus everything is tied to a udevice now. (Heinrich S.)
- Add "configs: replace '#CONFIG_NETis not set' withCONFIG_NO_NET=y" (Tom R.)
- tftp: unify display with legacy command: add throughput, 65 hashes per line, one every 10 blocks received (Tom R.)
- Moved net-lwip/* tonet/lwip/*(Simon G.)
- Rename static functionlow_level_output()tolinkoutput()since it is the name used in the lwIP netif struct.
- Fixed off-by-one inparse_url()which could cause wget to fail when passed a URL with a host name (as opposed to a URL with an IP address).
- Improved TFTP performance by adding support for the blksize option (patches "lwip: tftp: add support of blksize option to client" and "net-lwip: addTFTP_BLOCKSIZE) (Tom R.)
- Add an optional port number to the tftp command for easier testing (syntax: tftp [[ip:[port:]]filename])
- wget: display an "unsupported URI" error if uri is not http://
(Jon H.)
- Adjusted the lwIP TCP options inlib/lwip/u-boot/lwipopts.hfor better performance, in particularTCP_WND.
- Add "net:fec_mxc_init(): do not ignore return status offec_open()"
- Set the proper environment variables when DHCP succeeds (ipaddr%d etc.) and read the proper ones for the given device innew_netif(), allowing correct behavior when several adapters are available (tested on i.MX8M Plus).
- Fix an alignment issue with outgoing packets (see thelinkoutput()function). With that the i.MX8M Plus ENET1 interface works properly. (reported by Tim H.).
- Add review tagsChanges in v4:
- Fixed the DHCP algorithm which was missing a
sys_timeout()call in the "fine timer" callback. This should close the issue that Tom R. reported with his Raspberry Pi 3 (it does fix it on mine).
- The DHCP exchange timeout is increased from 2 to 10 seconds
- The DHCP exchange can be interrupted with Ctrl-C.
- "net: introduce alternative implementation as net-lwip/": rework dependencies. A few symbols have 'depends on !NET_LWIP' and in addition 'NET_LWIPdepends on !SANDBOX'. Sandbox, DSA and fastboot are unsupported, because they are deeply welded to the current stack.
- All network commands (dns, ping, tftp and wget):
* Get rid of global variables (Ilias A.)
* Useprintf()rather thanlog_info()
- "net-lwip: add ping command": use packet count instead of timeout, fix code style (Ilias A.)
- Add "net: splitcmd/net.cintocmd/net.candcmd/net-common.c" extracted from the wget patch (Ilias A.).
- Add "net: splitinclude/net.hinto net{,-common,-legacy,-lwip}.h" (Ilias A.)
- Add "flash: prefix error codes withFL_" which is required to avoid name clashes when splittingnet.h
- Reworked the initialization of the lwIP stack. One and only one network interface (struct netif) is added for the duration of the command that uses that interface. That's commit "net-lwip:
add DHCP support and dhcp commmand".
- Drop "test: dm: dsa, eth: disable tests whenCONFIG_NET_LWIP=y", not needed now thatNET_LWIPdepend on !SANDBOX.
-qemu_arm64_lwip_defconfignow enablesCMD_DNSandCMD_WGET(so that all the supported network commands are available).Changes in v3:
- Make
NET_LWIPaKconfigchoice in patch "net: introduce alternative implementation as net-lwip/" (Tom R.)
- Drop the patch introducing lwIP as a Git subtree and document the git command in the cover letter instead (Tom R.)
- "net-lwip: add TFTP support and tftpboot command": use the same "Bytes transferred =" message as in the legacy implementation (Tom R., Maxim U.)
- Drop "test/py: net: add_lwipvariants of dhcp, ping and tftpboot tests" which is not needed anymore.
- Add missingkfree()calls incmd/net-common.cand fix the parsing of decimal address innet-lwip/wget.c(patch "net-lwip: add wget command") (Maxim U.)
- "net-lwip: add ping command": drop the ICMP payload (Ilias A.). Set the sequence number to zero when enteringping_loop().Changes in v2:
** Address comments from Ilias A.
- "net-lwip: add wget command"
Implement thewget_with_dns()function to do most of the wget work and call it fromdo_wget(). This allows to simplify patch "net-lwip: add support forEFI_HTTP_BOOT".- "net-lwip: import net command from
cmd/net.c"
Move a few functions fromcmd/net.cto a new filecmd/net-common.crather than duplicating then incmd/net-lwip.c.- "net-lwip: add support for
EFI_HTTP_BOOT"
Sincewget_with_dns()is now implemented in "net-lwip: add wget command", just enable the wget command when the lwIP stack is enabled andEFI_HTTP_BOOTis 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 newCMD_XXX_LWIPsymbols and use existingCMD_XXXinstead.- "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 commit0a0452b2c3".Note that I have not yet addressed your comments on "test: dm: dsa,
eth: disable tests whenCONFIG_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_TFTPnotDFU_TFTPincompatible withNET_LWIP. It seems quite natural to supplement "depends on NET" with "&& !NET_LWIP".
* Make PROT_*_LWIP not visible by removing theKconfigprompt.Jerome Forissier (28):
net:recv(): return-EAGAINinstead of 0 when no cleanup is expected MakeAVB_VERIFYdepend on FASTBOOT
linker_lists: setLINKER_LIST_ALIGNto 8 forCPU_MIPS64
sandbox: add dummy driverETH_SANDBOX_LWIP
test: boot: fixbootdev_test_anyfor whenDSA_SANDBOXis disabled
test: boot: fixbootflow_cmd_labelfor whenDSA_SANDBOXis disabled
net: introduce alternative implementation as net-lwip/
configs: replace '#CONFIG_NETis not set' withCONFIG_NO_NET=y
net: splitinclude/net.hinto net{,-common,-legacy,-lwip}.h
net: movecopy_filename()to new filenet/net-common.c
net: eth-uclass: add functioneth_start_udev()
net-lwip: build lwIP
net-lwip: add DHCP support and dhcp commmand
lwip: tftp: bind to TFTP port only when in server mode
net-lwip: add TFTP support and tftpboot command
net-lwip: add ping command
net-lwip: add dns command
net: splitcmd/net.cintocmd/net.candcmd/net-common.c
net-lwip: add wget command
cmd: bdinfo: enable -e whenCONFIG_CMD_NET_LWIP=y
configs: addqemu_arm64_lwip_defconfig
lwip: tftp: add support of blksize option to client
net-lwip: addTFTP_BLOCKSIZE
CI: addqemu_arm64_lwipto the test matrix
MAINTAINERS: net-lwip: add myself as a maintainer
configs: use syntaxCONFIG_FOO=nin tools-only_defconfig [TESTING] configs: setCONFIG_NET=yfor FTGMAC100 [TESTING]Kconfig: enableNET_LWIPby defaultJonathan Humphreys (1):
net-lwip: lwIP wget supports user defined port in the uri, so allowit..azure-pipelines.yml | 7 + Kconfig | 29 + MAINTAINERS | 11 + Makefile | 6 +- arch/Kconfig | 2 +- board/engicam/imx8mp/icore_mx8mp.c | 2 +- .../imx8mp_debix_model_a.c | 2 +- board/ti/am335x/board.c | 3 +- board/xilinx/common/board.c | 3 +- boot/Kconfig | 4 +- cmd/Kconfig | 140 +-- cmd/Makefile | 9 +- cmd/bdinfo.c | 5 +- cmd/elf.c | 2 +- cmd/net-common.c | 109 ++ cmd/net-lwip.c | 45 + cmd/net.c | 115 --- common/Kconfig | 3 +- common/board_r.c | 4 +- common/spl/Kconfig | 1 + common/usb_kbd.c | 2 +- configs/LicheePi_Zero_defconfig | 2 +- configs/M5249EVB_defconfig | 2 +- configs/am335x_pdu001_defconfig | 2 +- configs/am62ax_evm_r5_defconfig | 2 +- configs/am62px_evm_r5_defconfig | 2 +- configs/am62x_beagleplay_r5_defconfig | 2 +- configs/amcore_defconfig | 2 +- configs/amd_versal2_mini_defconfig | 2 +- configs/amd_versal2_mini_emmc_defconfig | 2 +- configs/amd_versal2_mini_ospi_defconfig | 2 +- configs/amd_versal2_mini_qspi_defconfig | 2 +- configs/anbernic-rgxx3-rk3566_defconfig | 2 +- configs/ap143_defconfig | 2 +- configs/ap152_defconfig | 2 +- configs/apple_m1_defconfig | 2 +- configs/astro_mcf5373l_defconfig | 2 +- configs/at91sam9rlek_dataflash_defconfig | 2 +- configs/at91sam9rlek_mmc_defconfig | 2 +- configs/at91sam9rlek_nandflash_defconfig | 2 +- configs/bcm7260_defconfig | 2 +- configs/bcm7445_defconfig | 2 +- configs/bcm968380gerg_ram_defconfig | 2 +- configs/bcmns_defconfig | 2 +- configs/chromebook_samus_tpl_defconfig | 2 +- configs/cortina_presidio-asic-base_defconfig | 2 +- configs/cortina_presidio-asic-pnand_defconfig | 2 +- configs/durian_defconfig | 2 +- configs/e850-96_defconfig | 2 +- configs/ea-lpc3250devkitv2_defconfig | 2 +- configs/efi-x86_app32_defconfig | 2 +- configs/efi-x86_app64_defconfig | 2 +- configs/emsdp_defconfig | 2 +- configs/evb-ast2500_defconfig | 1 + configs/evb-ast2600_defconfig | 1 + configs/evb-px5_defconfig | 2 +- configs/generic-rk3568_defconfig | 2 +- configs/generic-rk3588_defconfig | 2 +- configs/hc2910_2aghd05_defconfig | 2 +- configs/igep00x0_defconfig | 2 +- configs/imx6q_bosch_acc_defconfig | 2 +- configs/imx6ulz_smm_m2_defconfig | 2 +- configs/iot_devkit_defconfig | 2 +- configs/j722s_evm_r5_defconfig | 2 +- configs/legoev3_defconfig | 2 +- configs/mk808_defconfig | 2 +- configs/mx23evk_defconfig | 2 +- configs/mx28evk_defconfig | 2 +- configs/mx6memcal_defconfig | 2 +- configs/mx6ulz_14x14_evk_defconfig | 2 +- configs/mx7ulp_com_defconfig | 2 +- configs/mx7ulp_evk_defconfig | 2 +- configs/mx7ulp_evk_plugin_defconfig | 2 +- configs/netgear_cg3100d_ram_defconfig | 2 +- configs/nsim_700_defconfig | 2 +- configs/nsim_700be_defconfig | 2 +- configs/nsim_hs38be_defconfig | 2 +- configs/openpiton_riscv64_defconfig | 2 +- configs/openpiton_riscv64_spl_defconfig | 2 +- configs/origen_defconfig | 2 +- configs/pe2201_defconfig | 2 +- configs/pinecube_defconfig | 2 +- configs/pm9261_defconfig | 2 +- configs/qemu_arm64_lwip_defconfig | 9 + configs/s5p4418_nanopi2_defconfig | 2 +- configs/s5p_goni_defconfig | 2 +- configs/s5pc210_universal_defconfig | 2 +- configs/sama5d27_giantboard_defconfig | 2 +- configs/sama5d29_curiosity_mmc1_defconfig | 2 +- configs/sama5d29_curiosity_mmc_defconfig | 2 +- .../sama5d29_curiosity_qspiflash_defconfig | 2 +- configs/sama7g54_curiosity_mmc_defconfig | 2 +- .../sama7g54_curiosity_nandflash_defconfig | 2 +- .../sama7g54_curiosity_qspiflash_defconfig | 2 +- configs/sipeed_maix_bitm_defconfig | 2 +- configs/sipeed_maix_smode_defconfig | 2 +- configs/stemmy_defconfig | 2 +- configs/stm32f429-discovery_defconfig | 2 +- configs/stm32f429-evaluation_defconfig | 2 +- configs/stm32f469-discovery_defconfig | 2 +- configs/stm32h743-disco_defconfig | 2 +- configs/stm32h743-eval_defconfig | 2 +- configs/stm32h750-art-pi_defconfig | 2 +- configs/stm32mp25_defconfig | 2 +- configs/stmark2_defconfig | 2 +- configs/th1520_lpi4a_defconfig | 2 +- configs/thunderx_88xx_defconfig | 2 +- configs/tools-only_defconfig | 34 +- configs/topic_miami_defconfig | 2 +- configs/topic_miamilite_defconfig | 2 +- configs/topic_miamiplus_defconfig | 2 +- configs/total_compute_defconfig | 2 +- configs/trats2_defconfig | 2 +- configs/trats_defconfig | 2 +- configs/xenguest_arm64_defconfig | 2 +- configs/xenguest_arm64_virtio_defconfig | 2 +- configs/xilinx_versal_mini_defconfig | 2 +- configs/xilinx_versal_mini_emmc0_defconfig | 2 +- configs/xilinx_versal_mini_emmc1_defconfig | 2 +- configs/xilinx_versal_mini_ospi_defconfig | 2 +- configs/xilinx_versal_mini_qspi_defconfig | 2 +- configs/xilinx_versal_net_mini_defconfig | 2 +- configs/xilinx_versal_net_mini_emmc_defconfig | 2 +- configs/xilinx_versal_net_mini_ospi_defconfig | 2 +- configs/xilinx_versal_net_mini_qspi_defconfig | 2 +- configs/xilinx_zynqmp_mini_defconfig | 2 +- configs/xilinx_zynqmp_mini_emmc0_defconfig | 2 +- configs/xilinx_zynqmp_mini_emmc1_defconfig | 2 +- configs/xilinx_zynqmp_mini_nand_defconfig | 2 +- .../xilinx_zynqmp_mini_nand_single_defconfig | 2 +- configs/xilinx_zynqmp_mini_qspi_defconfig | 2 +- configs/zynq_cse_nand_defconfig | 2 +- configs/zynq_cse_nor_defconfig | 2 +- configs/zynq_cse_qspi_defconfig | 2 +- drivers/dfu/Kconfig | 1 + drivers/fastboot/Kconfig | 1 + drivers/net/Kconfig | 16 +- drivers/net/Makefile | 1 + drivers/net/eepro100.c | 2 +- drivers/net/phy/Kconfig | 2 +- drivers/net/rtl8139.c | 2 +- drivers/net/sandbox-lwip.c | 85 ++ drivers/usb/gadget/Kconfig | 2 +- include/net-common.h | 509 ++++++++++ include/net-legacy.h | 541 ++++++++++ include/net-lwip.h | 41 + include/net.h | 943 +----------------- lib/Makefile | 2 + lib/binman.c | 1 + lib/lwip/Makefile | 55 + lib/lwip/lwip/src/apps/tftp/tftp.c | 104 +- .../lwip/src/include/lwip/apps/tftp_client.h | 1 + lib/lwip/u-boot/arch/cc.h | 45 + lib/lwip/u-boot/arch/sys_arch.h | 0 lib/lwip/u-boot/limits.h | 0 lib/lwip/u-boot/lwipopts.h | 157 +++ lib/tiny-printf.c | 3 +- net/Kconfig | 81 +- net/Makefile | 20 +- net/eth-uclass.c | 38 +- net/lwip/Kconfig | 49 + net/lwip/Makefile | 8 + net/lwip/dhcp.c | 136 +++ net/lwip/dns.c | 127 +++ net/lwip/eth_internal.h | 35 + net/lwip/net-lwip.c | 307 ++++++ net/lwip/ping.c | 177 ++++ net/lwip/tftp.c | 290 ++++++ net/lwip/wget.c | 357 +++++++ net/net-common.c | 13 + net/net.c | 12 - test/boot/bootdev.c | 11 +- test/boot/bootflow.c | 7 +- test/cmd/Makefile | 2 + test/dm/Makefile | 2 + 175 files changed, 3607 insertions(+), 1346 deletions(-) create mode 100644 cmd/net-common.c create mode 100644 cmd/net-lwip.c create mode 100644 configs/qemu_arm64_lwip_defconfig create mode 100644 drivers/net/sandbox-lwip.c create mode 100644 include/net-common.h create mode 100644 include/net-legacy.h create mode 100644 include/net-lwip.h create mode 100644 lib/lwip/Makefile create mode 100644 lib/lwip/u-boot/arch/cc.h create mode 100644 lib/lwip/u-boot/arch/sys_arch.h create mode 100644 lib/lwip/u-boot/limits.h create mode 100644 lib/lwip/u-boot/lwipopts.h create mode 100644 net/lwip/Kconfig create mode 100644 net/lwip/Makefile create mode 100644 net/lwip/dhcp.c create mode 100644 net/lwip/dns.c create mode 100644 net/lwip/eth_internal.h create mode 100644 net/lwip/net-lwip.c create mode 100644 net/lwip/ping.c create mode 100644 net/lwip/tftp.c create mode 100644 net/lwip/wget.c create mode 100644 net/net-common.c--
2.40.1
Quoted 4 lines · Ilias Apalodimas
Hi Jerome,
I'll have a look, but there seems to be reviewed-by and acked-by tags missing? Any chance you lost those during rebasing ?
I only dropped your R-b from the MAINTAINERS patch because I changed it slightly. Now I see you Acked it so that's good :)
Signature · 1 line
Jerome
Quoted 573 lines
Thanks
/IliasQuoted 568 lines · Jerome Forissier
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 withKconfig, 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. and Raymond M. (CC'd) have 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. using a secure, authenticated connection directly from the U-Boot shell. Several use cases:
* Authentication: prevent MITM attack (third party replacing the
binary with a different one)
* Confidentiality: prevent third parties from grabbing a copy of the
image as it is being downloaded
* Allow connection to servers that do not support plain HTTP anymore
(this is becoming more and more common on the Internet these days)
- Possibly benefit from additional features implemented in lwIP
- Less code to maintain in U-BootPrior to applying this series, the lwIP stack needs to be added as a Git subtree with the following command:
$ git subtree add --squash --prefix lib/lwip/lwip \ https://github.com/lwip-tcpip/lwip.git STABLE-2_2_0_RELEASENotes
1. A number of features are currently incompatible with
NET_LWIP:DFU_TFTP, FASTBOOT,SPL_NET,ETH_SANDBOX,ETH_SANDBOX_RAW,DM_ETH. They all make assumptions on how the network stack is implemented and/or pull sybols that are not trivially exported from lwIP. Some interface rework may be needed.2. Due to the above, and in order to provide some level of testing of the lwIP code in CI even when the legacy NET is the default, a new QEMU configuration is introduced (
qemu_arm64_lwip_defconfig) which is based onqemu_arm64_defconfigwithNET_LWIPand CMD_*_LWIP enabled. In addition to that, this series has some [TESTING] patches which makeNET_LWIPthe default.[1] https://lore.kernel.org/all/[email protected]/
[2] https://www.nongnu.org/lwip/
[3] https://en.wikipedia.org/wiki/LwIPChanges in v11:
- Rebased onto next
- "Miscellaneous fixes" removed (patches were merged in next). The
series still begins with small fixes posted separately [1] [2] [3].
- Add (some) support forCMD_PXEand therefore drop patch "[TESTING]
configs: setCONFIG_NET=ywhen PXE is enabled". This is build-tested
only and it is very likely that some work is needed to make it useful.
For example, adding the code for DHCP option 209 to lwIP so thatBOOTP_PXE_DHCP_OPTIONcan be supported.
- SANDBOX is now supported, but with the dm eth and wget tests
disabled.
- Moveeth_set_enable_bootdevs()declaration tonet-common.h
Fixes warning withsnow_defconfig:test/test-main.c:310:17: warning: implicit declaration of function ‘eth_set_enable_bootdevs’ [....]
- Doeth_init()andeth_init_rings()only once, and do not forgetlwip_init()! Fixes TFTP stalls on TI K3 (reported by Tom R. and
tested by Ilias A.)
- SetMEM_ALIGNMENTto 8 inlib/lwip/u-boot/lwipopts.h. Fixes TFTP
random crashes on TI K3 (Ilias A.)
-net_lwip_rx(): callfree_pkt()even whenrecv()has returned 0,
as required by the driver model documentation (andimx8mp_evk). Fixes
a regression introduced in v9. Goes together with patch [2].
- Add "lwip: tftp: bind to TFTP port only when in server mode" to
fix an issue with interrupted tftp commands (the tftp command hangs
if it is interrupted with Ctrl-C and started again).
- TFTP: fix uninitialized "ret" variable indo_tftpb(); print "Abort"
on Ctrl-C.
-MAINTAINERS: remove README and add sandbox ethernet driver to the
list of maintained files.
- AFAICT, CI should be all good exceptqemu_xtensa_dc233cwhich is
broken when NET_LWIP=y (QEMU just hangs with no output). I could
not find or build a suitable GDB binary to debug that.[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
[2] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
[3] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/Changes in v10:
- Rebase onto next
- URL for lwIP changed in cover letter: using GitHub now since all tags have suddenly disappeared from the repository on gnu.org.
- Post fixes as a separate series [1] or individual patches [2] [3]
- Add "ifNET_LWIP" tonet/lwip/Kconfigto fix a kconfig warning when doing the full branch build with buildman ("[NEW]")
-net/is added to libs-y only when NET orNET_LWIP, notNO_NET
- Apply review tags[1] http://patchwork.ozlabs.org/project/uboot/list/?series=422079
https://lists.denx.de/pipermail/u-boot/2024-September/563904.html
[2] http://patchwork.ozlabs.org/project/uboot/list/?series=421962
[3] http://patchwork.ozlabs.org/project/uboot/list/?series=421959Changes in v9:
- Rebased onto master, reordered commits to put some fixes that are not strictly related to lwIP first.
- New commit "test/py:test_efi_loader: add missing dependency oncmd_tftpboot" (Tom R.)
-test_efi_loader.py: add missing dependency oncmd_wget(Tom R.)
- wget: fix divide by zero when transfer takes less than 1ms (Tom R.)
- New commit "configs: use syntaxCONFIG_FOO=nin tools-only_defconfig" (Tom R.)
- MakeTCP_WNDconfigurable (viaCONFIG_LWIP_TCP_WND) because a large value is needed for good performance especially with latency but transfers stall in QEMU (-net user) when the value is larger than a few KB (Anton A., offlist)
- Added [TESTING] commits to run CI withNET_LWIPenabled by default except for SANDBOX and platforms that enable PXE, and fixed a number of issues:
*coreboot_defconfig: 'implicit declaration' warnings onip_checksum_ok()andcompute_ip_checksum()
* Fix EFI net tests (bootefi selftest) by adding missingpush_packed()call tonet_process_received_packet()
*qemu_arm64: fixtest_efi_loader.pyfailures (skip HTTP test by default since it needs a HTTP server; fix a bug in the dhcp command which would not set the "serverip" variable)
* QEMU CI tests forr2dplus_i82557c,r2dplus_rtl8139:
Fixed receive errors due to callingfree_pkt()with a length of zero.r2dplus_tulip: fixed "dm_pci_phys_to_bus:
invalid physical address" caused by too lateeth_init_rings().
With that the CI status is all GREEN:
https://dev.azure.com/u-boot/u-boot/_build/results?buildId=9225&view=resultsChanges in v8:
- Fix bootefi with tftp and wget. It would previously fail with an error message: "No UEFI binary known at 200000". Tested on Raspberry 3B+. Also fix the legacy wget. (Tom R.)
- wget: add "Bytes transferred =" message and accept legacy syntax for better compatibility which also makes it easier to add a test to the test suite
- wget: When no server name or address is supplied, use ${httpserverip} then ${serverip}.
- wget: start the timer used for measuring throughput when the first data block is received. In other words: do not include DNS resolution and TCP connection time in measurement. It gives better numbers ;) but more importantly is how the legacy code works.
- wget: handle non-200 result codes from the server as errors.
- tftp: when no server name or ip is supplied, use ${tftpserverip} then fall back to ${serverip}.
- New commit: "test/py: add HTTP (wget) test"
- New commit: "net: wget: removed unused functionwget_success()"
- Change back all !CONFIG_IS_ENABLED(NO_NET) tests to (CONFIG_IS_ENABLED(NET)||CONFIG_IS_ENABLED(NET_LWIP)) since theNO_NETcase is wrong whenCONFIG_SPL_BUILDorCONFIG_TPL_BUILDis defined (Tom R.)Changes in v7:
- Rebased onto master
- Updated binary size comparisons in this cover letter. Note that the increase forimx8mp_evk_defconfigwas wrong due to a configuration error.Changes in v6:
- Rebased on next
- "flash: prefix error codes withFL_"
Updatedrivers/mtd/altera_qspi.ctoo (Tom R.)
- "net: introduce alternative implementation as net-lwip/" Introduce a "Networking" top-level menu in the mainKconfig. Avoids having a lot of network-related symbols on the first screen of menuconfig. The "Networking stack" choice as well as the applicable symbols (depending on the selected choice) are now all inside this "Networking" menu. (Michal S.)
ForPROT_DHCP_LWIPandPROT_DNS_LWIP, use "select"PROT_UDP_LWIPrather than "depends on".
MoveNET_RANDOM_ETHADDRto the common ('if NET ||NET_LWIP') block. MoveSYS_RX_ETH_BUFFERout of 'if NET ||NET_LWIP' since it is used unguarded in some code (e.g.,am62x_beagleplay_r5) (Tom R.).
- "net: splitinclude/net.hinto net{,-common,-legacy,-lwip}.h" Movenet_random_ethaddr()tonet-common.h.
- "net: eth-uclass: add functioneth_start_udev()"
Fix typo and apply Tom R.'s R-b.
- "net-lwip: add DHCP support and dhcp commmand"
Convert !CONFIG_IS_ENABLED(NET) toCONFIG_IS_ENABLED(NO_NET)inboard/xilinx/common/board.cto fix an issue with device having no MAC address (thanks Michal S.). Do the same at other places (icore_mx8mp.c,imx8mp_debix_model_a.c,board/ti/am335x/board.c,tiny-printf.c).
MoveCMD_MIIandCMD_MDIOinto 'if NET ||NET_LWIP'.
- "net-lwip: add TFTP support and tftpboot command":
Fix help string.
- "net: splitcmd/net.cintocmd/net.candcmd/net-common.c":
Apply Ilias' R-b.
- "net-lwip: addTFTP_BLOCKSIZE"
Apply Ilias' R-b. I moved theTFTP_BLOCKSIZEKconfiginto this commit where it belongs (it was previously in "net" split ...net.h").Changes in v5:
- Rebased on next
- RefactorKconfigoptions to avoid duplicates
- Library functions use a more consistent naming (dhcp_loop(),ping_loop()etc.) and take a struct udevice * parameter (Heinrich S.)
- Do not usenet_process_receive_packet()for input anymore. Instead of callingeth_rx()which would invokenet_process_receive_packet(), we call a newnet_lwip_rx(udev)function which invokes the devicerecv()and pushes the packets up the lwIP stack. Thus everything is tied to a udevice now. (Heinrich S.)
- Add "configs: replace '#CONFIG_NETis not set' withCONFIG_NO_NET=y" (Tom R.)
- tftp: unify display with legacy command: add throughput, 65 hashes per line, one every 10 blocks received (Tom R.)
- Moved net-lwip/* tonet/lwip/*(Simon G.)
- Rename static functionlow_level_output()tolinkoutput()since it is the name used in the lwIP netif struct.
- Fixed off-by-one inparse_url()which could cause wget to fail when passed a URL with a host name (as opposed to a URL with an IP address).
- Improved TFTP performance by adding support for the blksize option (patches "lwip: tftp: add support of blksize option to client" and "net-lwip: addTFTP_BLOCKSIZE) (Tom R.)
- Add an optional port number to the tftp command for easier testing (syntax: tftp [[ip:[port:]]filename])
- wget: display an "unsupported URI" error if uri is not http://
(Jon H.)
- Adjusted the lwIP TCP options inlib/lwip/u-boot/lwipopts.hfor better performance, in particularTCP_WND.
- Add "net:fec_mxc_init(): do not ignore return status offec_open()"
- Set the proper environment variables when DHCP succeeds (ipaddr%d etc.) and read the proper ones for the given device innew_netif(), allowing correct behavior when several adapters are available (tested on i.MX8M Plus).
- Fix an alignment issue with outgoing packets (see thelinkoutput()function). With that the i.MX8M Plus ENET1 interface works properly. (reported by Tim H.).
- Add review tagsChanges in v4:
- Fixed the DHCP algorithm which was missing a
sys_timeout()call in the "fine timer" callback. This should close the issue that Tom R. reported with his Raspberry Pi 3 (it does fix it on mine).
- The DHCP exchange timeout is increased from 2 to 10 seconds
- The DHCP exchange can be interrupted with Ctrl-C.
- "net: introduce alternative implementation as net-lwip/": rework dependencies. A few symbols have 'depends on !NET_LWIP' and in addition 'NET_LWIPdepends on !SANDBOX'. Sandbox, DSA and fastboot are unsupported, because they are deeply welded to the current stack.
- All network commands (dns, ping, tftp and wget):
* Get rid of global variables (Ilias A.)
* Useprintf()rather thanlog_info()
- "net-lwip: add ping command": use packet count instead of timeout, fix code style (Ilias A.)
- Add "net: splitcmd/net.cintocmd/net.candcmd/net-common.c" extracted from the wget patch (Ilias A.).
- Add "net: splitinclude/net.hinto net{,-common,-legacy,-lwip}.h" (Ilias A.)
- Add "flash: prefix error codes withFL_" which is required to avoid name clashes when splittingnet.h
- Reworked the initialization of the lwIP stack. One and only one network interface (struct netif) is added for the duration of the command that uses that interface. That's commit "net-lwip:
add DHCP support and dhcp commmand".
- Drop "test: dm: dsa, eth: disable tests whenCONFIG_NET_LWIP=y", not needed now thatNET_LWIPdepend on !SANDBOX.
-qemu_arm64_lwip_defconfignow enablesCMD_DNSandCMD_WGET(so that all the supported network commands are available).Changes in v3:
- Make
NET_LWIPaKconfigchoice in patch "net: introduce alternative implementation as net-lwip/" (Tom R.)
- Drop the patch introducing lwIP as a Git subtree and document the git command in the cover letter instead (Tom R.)
- "net-lwip: add TFTP support and tftpboot command": use the same "Bytes transferred =" message as in the legacy implementation (Tom R., Maxim U.)
- Drop "test/py: net: add_lwipvariants of dhcp, ping and tftpboot tests" which is not needed anymore.
- Add missingkfree()calls incmd/net-common.cand fix the parsing of decimal address innet-lwip/wget.c(patch "net-lwip: add wget command") (Maxim U.)
- "net-lwip: add ping command": drop the ICMP payload (Ilias A.). Set the sequence number to zero when enteringping_loop().Changes in v2:
** Address comments from Ilias A.
- "net-lwip: add wget command"
Implement thewget_with_dns()function to do most of the wget work and call it fromdo_wget(). This allows to simplify patch "net-lwip: add support forEFI_HTTP_BOOT".- "net-lwip: import net command from
cmd/net.c"
Move a few functions fromcmd/net.cto a new filecmd/net-common.crather than duplicating then incmd/net-lwip.c.- "net-lwip: add support for
EFI_HTTP_BOOT"
Sincewget_with_dns()is now implemented in "net-lwip: add wget command", just enable the wget command when the lwIP stack is enabled andEFI_HTTP_BOOTis 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 newCMD_XXX_LWIPsymbols and use existingCMD_XXXinstead.- "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 commit0a0452b2c3".Note that I have not yet addressed your comments on "test: dm: dsa,
eth: disable tests whenCONFIG_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_TFTPnotDFU_TFTPincompatible withNET_LWIP. It seems quite natural to supplement "depends on NET" with "&& !NET_LWIP".
* Make PROT_*_LWIP not visible by removing theKconfigprompt.Jerome Forissier (28):
net:recv(): return-EAGAINinstead of 0 when no cleanup is expected MakeAVB_VERIFYdepend on FASTBOOT
linker_lists: setLINKER_LIST_ALIGNto 8 forCPU_MIPS64
sandbox: add dummy driverETH_SANDBOX_LWIP
test: boot: fixbootdev_test_anyfor whenDSA_SANDBOXis disabled
test: boot: fixbootflow_cmd_labelfor whenDSA_SANDBOXis disabled
net: introduce alternative implementation as net-lwip/
configs: replace '#CONFIG_NETis not set' withCONFIG_NO_NET=y
net: splitinclude/net.hinto net{,-common,-legacy,-lwip}.h
net: movecopy_filename()to new filenet/net-common.c
net: eth-uclass: add functioneth_start_udev()
net-lwip: build lwIP
net-lwip: add DHCP support and dhcp commmand
lwip: tftp: bind to TFTP port only when in server mode
net-lwip: add TFTP support and tftpboot command
net-lwip: add ping command
net-lwip: add dns command
net: splitcmd/net.cintocmd/net.candcmd/net-common.c
net-lwip: add wget command
cmd: bdinfo: enable -e whenCONFIG_CMD_NET_LWIP=y
configs: addqemu_arm64_lwip_defconfig
lwip: tftp: add support of blksize option to client
net-lwip: addTFTP_BLOCKSIZE
CI: addqemu_arm64_lwipto the test matrix
MAINTAINERS: net-lwip: add myself as a maintainer
configs: use syntaxCONFIG_FOO=nin tools-only_defconfig [TESTING] configs: setCONFIG_NET=yfor FTGMAC100 [TESTING]Kconfig: enableNET_LWIPby defaultJonathan Humphreys (1):
net-lwip: lwIP wget supports user defined port in the uri, so allowit..azure-pipelines.yml | 7 + Kconfig | 29 + MAINTAINERS | 11 + Makefile | 6 +- arch/Kconfig | 2 +- board/engicam/imx8mp/icore_mx8mp.c | 2 +- .../imx8mp_debix_model_a.c | 2 +- board/ti/am335x/board.c | 3 +- board/xilinx/common/board.c | 3 +- boot/Kconfig | 4 +- cmd/Kconfig | 140 +-- cmd/Makefile | 9 +- cmd/bdinfo.c | 5 +- cmd/elf.c | 2 +- cmd/net-common.c | 109 ++ cmd/net-lwip.c | 45 + cmd/net.c | 115 --- common/Kconfig | 3 +- common/board_r.c | 4 +- common/spl/Kconfig | 1 + common/usb_kbd.c | 2 +- configs/LicheePi_Zero_defconfig | 2 +- configs/M5249EVB_defconfig | 2 +- configs/am335x_pdu001_defconfig | 2 +- configs/am62ax_evm_r5_defconfig | 2 +- configs/am62px_evm_r5_defconfig | 2 +- configs/am62x_beagleplay_r5_defconfig | 2 +- configs/amcore_defconfig | 2 +- configs/amd_versal2_mini_defconfig | 2 +- configs/amd_versal2_mini_emmc_defconfig | 2 +- configs/amd_versal2_mini_ospi_defconfig | 2 +- configs/amd_versal2_mini_qspi_defconfig | 2 +- configs/anbernic-rgxx3-rk3566_defconfig | 2 +- configs/ap143_defconfig | 2 +- configs/ap152_defconfig | 2 +- configs/apple_m1_defconfig | 2 +- configs/astro_mcf5373l_defconfig | 2 +- configs/at91sam9rlek_dataflash_defconfig | 2 +- configs/at91sam9rlek_mmc_defconfig | 2 +- configs/at91sam9rlek_nandflash_defconfig | 2 +- configs/bcm7260_defconfig | 2 +- configs/bcm7445_defconfig | 2 +- configs/bcm968380gerg_ram_defconfig | 2 +- configs/bcmns_defconfig | 2 +- configs/chromebook_samus_tpl_defconfig | 2 +- configs/cortina_presidio-asic-base_defconfig | 2 +- configs/cortina_presidio-asic-pnand_defconfig | 2 +- configs/durian_defconfig | 2 +- configs/e850-96_defconfig | 2 +- configs/ea-lpc3250devkitv2_defconfig | 2 +- configs/efi-x86_app32_defconfig | 2 +- configs/efi-x86_app64_defconfig | 2 +- configs/emsdp_defconfig | 2 +- configs/evb-ast2500_defconfig | 1 + configs/evb-ast2600_defconfig | 1 + configs/evb-px5_defconfig | 2 +- configs/generic-rk3568_defconfig | 2 +- configs/generic-rk3588_defconfig | 2 +- configs/hc2910_2aghd05_defconfig | 2 +- configs/igep00x0_defconfig | 2 +- configs/imx6q_bosch_acc_defconfig | 2 +- configs/imx6ulz_smm_m2_defconfig | 2 +- configs/iot_devkit_defconfig | 2 +- configs/j722s_evm_r5_defconfig | 2 +- configs/legoev3_defconfig | 2 +- configs/mk808_defconfig | 2 +- configs/mx23evk_defconfig | 2 +- configs/mx28evk_defconfig | 2 +- configs/mx6memcal_defconfig | 2 +- configs/mx6ulz_14x14_evk_defconfig | 2 +- configs/mx7ulp_com_defconfig | 2 +- configs/mx7ulp_evk_defconfig | 2 +- configs/mx7ulp_evk_plugin_defconfig | 2 +- configs/netgear_cg3100d_ram_defconfig | 2 +- configs/nsim_700_defconfig | 2 +- configs/nsim_700be_defconfig | 2 +- configs/nsim_hs38be_defconfig | 2 +- configs/openpiton_riscv64_defconfig | 2 +- configs/openpiton_riscv64_spl_defconfig | 2 +- configs/origen_defconfig | 2 +- configs/pe2201_defconfig | 2 +- configs/pinecube_defconfig | 2 +- configs/pm9261_defconfig | 2 +- configs/qemu_arm64_lwip_defconfig | 9 + configs/s5p4418_nanopi2_defconfig | 2 +- configs/s5p_goni_defconfig | 2 +- configs/s5pc210_universal_defconfig | 2 +- configs/sama5d27_giantboard_defconfig | 2 +- configs/sama5d29_curiosity_mmc1_defconfig | 2 +- configs/sama5d29_curiosity_mmc_defconfig | 2 +- .../sama5d29_curiosity_qspiflash_defconfig | 2 +- configs/sama7g54_curiosity_mmc_defconfig | 2 +- .../sama7g54_curiosity_nandflash_defconfig | 2 +- .../sama7g54_curiosity_qspiflash_defconfig | 2 +- configs/sipeed_maix_bitm_defconfig | 2 +- configs/sipeed_maix_smode_defconfig | 2 +- configs/stemmy_defconfig | 2 +- configs/stm32f429-discovery_defconfig | 2 +- configs/stm32f429-evaluation_defconfig | 2 +- configs/stm32f469-discovery_defconfig | 2 +- configs/stm32h743-disco_defconfig | 2 +- configs/stm32h743-eval_defconfig | 2 +- configs/stm32h750-art-pi_defconfig | 2 +- configs/stm32mp25_defconfig | 2 +- configs/stmark2_defconfig | 2 +- configs/th1520_lpi4a_defconfig | 2 +- configs/thunderx_88xx_defconfig | 2 +- configs/tools-only_defconfig | 34 +- configs/topic_miami_defconfig | 2 +- configs/topic_miamilite_defconfig | 2 +- configs/topic_miamiplus_defconfig | 2 +- configs/total_compute_defconfig | 2 +- configs/trats2_defconfig | 2 +- configs/trats_defconfig | 2 +- configs/xenguest_arm64_defconfig | 2 +- configs/xenguest_arm64_virtio_defconfig | 2 +- configs/xilinx_versal_mini_defconfig | 2 +- configs/xilinx_versal_mini_emmc0_defconfig | 2 +- configs/xilinx_versal_mini_emmc1_defconfig | 2 +- configs/xilinx_versal_mini_ospi_defconfig | 2 +- configs/xilinx_versal_mini_qspi_defconfig | 2 +- configs/xilinx_versal_net_mini_defconfig | 2 +- configs/xilinx_versal_net_mini_emmc_defconfig | 2 +- configs/xilinx_versal_net_mini_ospi_defconfig | 2 +- configs/xilinx_versal_net_mini_qspi_defconfig | 2 +- configs/xilinx_zynqmp_mini_defconfig | 2 +- configs/xilinx_zynqmp_mini_emmc0_defconfig | 2 +- configs/xilinx_zynqmp_mini_emmc1_defconfig | 2 +- configs/xilinx_zynqmp_mini_nand_defconfig | 2 +- .../xilinx_zynqmp_mini_nand_single_defconfig | 2 +- configs/xilinx_zynqmp_mini_qspi_defconfig | 2 +- configs/zynq_cse_nand_defconfig | 2 +- configs/zynq_cse_nor_defconfig | 2 +- configs/zynq_cse_qspi_defconfig | 2 +- drivers/dfu/Kconfig | 1 + drivers/fastboot/Kconfig | 1 + drivers/net/Kconfig | 16 +- drivers/net/Makefile | 1 + drivers/net/eepro100.c | 2 +- drivers/net/phy/Kconfig | 2 +- drivers/net/rtl8139.c | 2 +- drivers/net/sandbox-lwip.c | 85 ++ drivers/usb/gadget/Kconfig | 2 +- include/net-common.h | 509 ++++++++++ include/net-legacy.h | 541 ++++++++++ include/net-lwip.h | 41 + include/net.h | 943 +----------------- lib/Makefile | 2 + lib/binman.c | 1 + lib/lwip/Makefile | 55 + lib/lwip/lwip/src/apps/tftp/tftp.c | 104 +- .../lwip/src/include/lwip/apps/tftp_client.h | 1 + lib/lwip/u-boot/arch/cc.h | 45 + lib/lwip/u-boot/arch/sys_arch.h | 0 lib/lwip/u-boot/limits.h | 0 lib/lwip/u-boot/lwipopts.h | 157 +++ lib/tiny-printf.c | 3 +- net/Kconfig | 81 +- net/Makefile | 20 +- net/eth-uclass.c | 38 +- net/lwip/Kconfig | 49 + net/lwip/Makefile | 8 + net/lwip/dhcp.c | 136 +++ net/lwip/dns.c | 127 +++ net/lwip/eth_internal.h | 35 + net/lwip/net-lwip.c | 307 ++++++ net/lwip/ping.c | 177 ++++ net/lwip/tftp.c | 290 ++++++ net/lwip/wget.c | 357 +++++++ net/net-common.c | 13 + net/net.c | 12 - test/boot/bootdev.c | 11 +- test/boot/bootflow.c | 7 +- test/cmd/Makefile | 2 + test/dm/Makefile | 2 + 175 files changed, 3607 insertions(+), 1346 deletions(-) create mode 100644 cmd/net-common.c create mode 100644 cmd/net-lwip.c create mode 100644 configs/qemu_arm64_lwip_defconfig create mode 100644 drivers/net/sandbox-lwip.c create mode 100644 include/net-common.h create mode 100644 include/net-legacy.h create mode 100644 include/net-lwip.h create mode 100644 lib/lwip/Makefile create mode 100644 lib/lwip/u-boot/arch/cc.h create mode 100644 lib/lwip/u-boot/arch/sys_arch.h create mode 100644 lib/lwip/u-boot/limits.h create mode 100644 lib/lwip/u-boot/lwipopts.h create mode 100644 net/lwip/Kconfig create mode 100644 net/lwip/Makefile create mode 100644 net/lwip/dhcp.c create mode 100644 net/lwip/dns.c create mode 100644 net/lwip/eth_internal.h create mode 100644 net/lwip/net-lwip.c create mode 100644 net/lwip/ping.c create mode 100644 net/lwip/tftp.c create mode 100644 net/lwip/wget.c create mode 100644 net/net-common.c--
2.40.1
Quoted 11 lines · Jerome Forissier
Quoted 4 lines · Ilias Apalodimas
Hi Jerome,
I'll have a look, but there seems to be reviewed-by and acked-by tags missing? Any chance you lost those during rebasing ?
I only dropped your R-b from the
MAINTAINERSpatch because I changed it slightly. Now I see you Acked it so that's good :)
Ah thanks, yea I saw that was missing and assumed more would be dropped. Ack is more appropriate in this case, so let's preserve that
Thanks
/Ilias
Quoted 577 lines
--
JeromeQuoted 573 lines
Thanks
/IliasQuoted 568 lines · Jerome Forissier
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 withKconfig, 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. and Raymond M. (CC'd) have 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. using a secure, authenticated connection directly from the U-Boot shell. Several use cases:
* Authentication: prevent MITM attack (third party replacing the
binary with a different one)
* Confidentiality: prevent third parties from grabbing a copy of the
image as it is being downloaded
* Allow connection to servers that do not support plain HTTP anymore
(this is becoming more and more common on the Internet these days)
- Possibly benefit from additional features implemented in lwIP
- Less code to maintain in U-BootPrior to applying this series, the lwIP stack needs to be added as a Git subtree with the following command:
$ git subtree add --squash --prefix lib/lwip/lwip \ https://github.com/lwip-tcpip/lwip.git STABLE-2_2_0_RELEASENotes
1. A number of features are currently incompatible with
NET_LWIP:DFU_TFTP, FASTBOOT,SPL_NET,ETH_SANDBOX,ETH_SANDBOX_RAW,DM_ETH. They all make assumptions on how the network stack is implemented and/or pull sybols that are not trivially exported from lwIP. Some interface rework may be needed.2. Due to the above, and in order to provide some level of testing of the lwIP code in CI even when the legacy NET is the default, a new QEMU configuration is introduced (
qemu_arm64_lwip_defconfig) which is based onqemu_arm64_defconfigwithNET_LWIPand CMD_*_LWIP enabled. In addition to that, this series has some [TESTING] patches which makeNET_LWIPthe default.[1] https://lore.kernel.org/all/[email protected]/
[2] https://www.nongnu.org/lwip/
[3] https://en.wikipedia.org/wiki/LwIPChanges in v11:
- Rebased onto next
- "Miscellaneous fixes" removed (patches were merged in next). The
series still begins with small fixes posted separately [1] [2] [3].
- Add (some) support forCMD_PXEand therefore drop patch "[TESTING]
configs: setCONFIG_NET=ywhen PXE is enabled". This is build-tested
only and it is very likely that some work is needed to make it useful.
For example, adding the code for DHCP option 209 to lwIP so thatBOOTP_PXE_DHCP_OPTIONcan be supported.
- SANDBOX is now supported, but with the dm eth and wget tests
disabled.
- Moveeth_set_enable_bootdevs()declaration tonet-common.h
Fixes warning withsnow_defconfig:test/test-main.c:310:17: warning: implicit declaration of function ‘eth_set_enable_bootdevs’ [....]
- Doeth_init()andeth_init_rings()only once, and do not forgetlwip_init()! Fixes TFTP stalls on TI K3 (reported by Tom R. and
tested by Ilias A.)
- SetMEM_ALIGNMENTto 8 inlib/lwip/u-boot/lwipopts.h. Fixes TFTP
random crashes on TI K3 (Ilias A.)
-net_lwip_rx(): callfree_pkt()even whenrecv()has returned 0,
as required by the driver model documentation (andimx8mp_evk). Fixes
a regression introduced in v9. Goes together with patch [2].
- Add "lwip: tftp: bind to TFTP port only when in server mode" to
fix an issue with interrupted tftp commands (the tftp command hangs
if it is interrupted with Ctrl-C and started again).
- TFTP: fix uninitialized "ret" variable indo_tftpb(); print "Abort"
on Ctrl-C.
-MAINTAINERS: remove README and add sandbox ethernet driver to the
list of maintained files.
- AFAICT, CI should be all good exceptqemu_xtensa_dc233cwhich is
broken when NET_LWIP=y (QEMU just hangs with no output). I could
not find or build a suitable GDB binary to debug that.[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
[2] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
[3] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/Changes in v10:
- Rebase onto next
- URL for lwIP changed in cover letter: using GitHub now since all tags have suddenly disappeared from the repository on gnu.org.
- Post fixes as a separate series [1] or individual patches [2] [3]
- Add "ifNET_LWIP" tonet/lwip/Kconfigto fix a kconfig warning when doing the full branch build with buildman ("[NEW]")
-net/is added to libs-y only when NET orNET_LWIP, notNO_NET
- Apply review tags[1] http://patchwork.ozlabs.org/project/uboot/list/?series=422079
https://lists.denx.de/pipermail/u-boot/2024-September/563904.html
[2] http://patchwork.ozlabs.org/project/uboot/list/?series=421962
[3] http://patchwork.ozlabs.org/project/uboot/list/?series=421959Changes in v9:
- Rebased onto master, reordered commits to put some fixes that are not strictly related to lwIP first.
- New commit "test/py:test_efi_loader: add missing dependency oncmd_tftpboot" (Tom R.)
-test_efi_loader.py: add missing dependency oncmd_wget(Tom R.)
- wget: fix divide by zero when transfer takes less than 1ms (Tom R.)
- New commit "configs: use syntaxCONFIG_FOO=nin tools-only_defconfig" (Tom R.)
- MakeTCP_WNDconfigurable (viaCONFIG_LWIP_TCP_WND) because a large value is needed for good performance especially with latency but transfers stall in QEMU (-net user) when the value is larger than a few KB (Anton A., offlist)
- Added [TESTING] commits to run CI withNET_LWIPenabled by default except for SANDBOX and platforms that enable PXE, and fixed a number of issues:
*coreboot_defconfig: 'implicit declaration' warnings onip_checksum_ok()andcompute_ip_checksum()
* Fix EFI net tests (bootefi selftest) by adding missingpush_packed()call tonet_process_received_packet()
*qemu_arm64: fixtest_efi_loader.pyfailures (skip HTTP test by default since it needs a HTTP server; fix a bug in the dhcp command which would not set the "serverip" variable)
* QEMU CI tests forr2dplus_i82557c,r2dplus_rtl8139:
Fixed receive errors due to callingfree_pkt()with a length of zero.r2dplus_tulip: fixed "dm_pci_phys_to_bus:
invalid physical address" caused by too lateeth_init_rings().
With that the CI status is all GREEN:
https://dev.azure.com/u-boot/u-boot/_build/results?buildId=9225&view=resultsChanges in v8:
- Fix bootefi with tftp and wget. It would previously fail with an error message: "No UEFI binary known at 200000". Tested on Raspberry 3B+. Also fix the legacy wget. (Tom R.)
- wget: add "Bytes transferred =" message and accept legacy syntax for better compatibility which also makes it easier to add a test to the test suite
- wget: When no server name or address is supplied, use ${httpserverip} then ${serverip}.
- wget: start the timer used for measuring throughput when the first data block is received. In other words: do not include DNS resolution and TCP connection time in measurement. It gives better numbers ;) but more importantly is how the legacy code works.
- wget: handle non-200 result codes from the server as errors.
- tftp: when no server name or ip is supplied, use ${tftpserverip} then fall back to ${serverip}.
- New commit: "test/py: add HTTP (wget) test"
- New commit: "net: wget: removed unused functionwget_success()"
- Change back all !CONFIG_IS_ENABLED(NO_NET) tests to (CONFIG_IS_ENABLED(NET)||CONFIG_IS_ENABLED(NET_LWIP)) since theNO_NETcase is wrong whenCONFIG_SPL_BUILDorCONFIG_TPL_BUILDis defined (Tom R.)Changes in v7:
- Rebased onto master
- Updated binary size comparisons in this cover letter. Note that the increase forimx8mp_evk_defconfigwas wrong due to a configuration error.Changes in v6:
- Rebased on next
- "flash: prefix error codes withFL_"
Updatedrivers/mtd/altera_qspi.ctoo (Tom R.)
- "net: introduce alternative implementation as net-lwip/" Introduce a "Networking" top-level menu in the mainKconfig. Avoids having a lot of network-related symbols on the first screen of menuconfig. The "Networking stack" choice as well as the applicable symbols (depending on the selected choice) are now all inside this "Networking" menu. (Michal S.)
ForPROT_DHCP_LWIPandPROT_DNS_LWIP, use "select"PROT_UDP_LWIPrather than "depends on".
MoveNET_RANDOM_ETHADDRto the common ('if NET ||NET_LWIP') block. MoveSYS_RX_ETH_BUFFERout of 'if NET ||NET_LWIP' since it is used unguarded in some code (e.g.,am62x_beagleplay_r5) (Tom R.).
- "net: splitinclude/net.hinto net{,-common,-legacy,-lwip}.h" Movenet_random_ethaddr()tonet-common.h.
- "net: eth-uclass: add functioneth_start_udev()"
Fix typo and apply Tom R.'s R-b.
- "net-lwip: add DHCP support and dhcp commmand"
Convert !CONFIG_IS_ENABLED(NET) toCONFIG_IS_ENABLED(NO_NET)inboard/xilinx/common/board.cto fix an issue with device having no MAC address (thanks Michal S.). Do the same at other places (icore_mx8mp.c,imx8mp_debix_model_a.c,board/ti/am335x/board.c,tiny-printf.c).
MoveCMD_MIIandCMD_MDIOinto 'if NET ||NET_LWIP'.
- "net-lwip: add TFTP support and tftpboot command":
Fix help string.
- "net: splitcmd/net.cintocmd/net.candcmd/net-common.c":
Apply Ilias' R-b.
- "net-lwip: addTFTP_BLOCKSIZE"
Apply Ilias' R-b. I moved theTFTP_BLOCKSIZEKconfiginto this commit where it belongs (it was previously in "net" split ...net.h").Changes in v5:
- Rebased on next
- RefactorKconfigoptions to avoid duplicates
- Library functions use a more consistent naming (dhcp_loop(),ping_loop()etc.) and take a struct udevice * parameter (Heinrich S.)
- Do not usenet_process_receive_packet()for input anymore. Instead of callingeth_rx()which would invokenet_process_receive_packet(), we call a newnet_lwip_rx(udev)function which invokes the devicerecv()and pushes the packets up the lwIP stack. Thus everything is tied to a udevice now. (Heinrich S.)
- Add "configs: replace '#CONFIG_NETis not set' withCONFIG_NO_NET=y" (Tom R.)
- tftp: unify display with legacy command: add throughput, 65 hashes per line, one every 10 blocks received (Tom R.)
- Moved net-lwip/* tonet/lwip/*(Simon G.)
- Rename static functionlow_level_output()tolinkoutput()since it is the name used in the lwIP netif struct.
- Fixed off-by-one inparse_url()which could cause wget to fail when passed a URL with a host name (as opposed to a URL with an IP address).
- Improved TFTP performance by adding support for the blksize option (patches "lwip: tftp: add support of blksize option to client" and "net-lwip: addTFTP_BLOCKSIZE) (Tom R.)
- Add an optional port number to the tftp command for easier testing (syntax: tftp [[ip:[port:]]filename])
- wget: display an "unsupported URI" error if uri is not http://
(Jon H.)
- Adjusted the lwIP TCP options inlib/lwip/u-boot/lwipopts.hfor better performance, in particularTCP_WND.
- Add "net:fec_mxc_init(): do not ignore return status offec_open()"
- Set the proper environment variables when DHCP succeeds (ipaddr%d etc.) and read the proper ones for the given device innew_netif(), allowing correct behavior when several adapters are available (tested on i.MX8M Plus).
- Fix an alignment issue with outgoing packets (see thelinkoutput()function). With that the i.MX8M Plus ENET1 interface works properly. (reported by Tim H.).
- Add review tagsChanges in v4:
- Fixed the DHCP algorithm which was missing a
sys_timeout()call in the "fine timer" callback. This should close the issue that Tom R. reported with his Raspberry Pi 3 (it does fix it on mine).
- The DHCP exchange timeout is increased from 2 to 10 seconds
- The DHCP exchange can be interrupted with Ctrl-C.
- "net: introduce alternative implementation as net-lwip/": rework dependencies. A few symbols have 'depends on !NET_LWIP' and in addition 'NET_LWIPdepends on !SANDBOX'. Sandbox, DSA and fastboot are unsupported, because they are deeply welded to the current stack.
- All network commands (dns, ping, tftp and wget):
* Get rid of global variables (Ilias A.)
* Useprintf()rather thanlog_info()
- "net-lwip: add ping command": use packet count instead of timeout, fix code style (Ilias A.)
- Add "net: splitcmd/net.cintocmd/net.candcmd/net-common.c" extracted from the wget patch (Ilias A.).
- Add "net: splitinclude/net.hinto net{,-common,-legacy,-lwip}.h" (Ilias A.)
- Add "flash: prefix error codes withFL_" which is required to avoid name clashes when splittingnet.h
- Reworked the initialization of the lwIP stack. One and only one network interface (struct netif) is added for the duration of the command that uses that interface. That's commit "net-lwip:
add DHCP support and dhcp commmand".
- Drop "test: dm: dsa, eth: disable tests whenCONFIG_NET_LWIP=y", not needed now thatNET_LWIPdepend on !SANDBOX.
-qemu_arm64_lwip_defconfignow enablesCMD_DNSandCMD_WGET(so that all the supported network commands are available).Changes in v3:
- Make
NET_LWIPaKconfigchoice in patch "net: introduce alternative implementation as net-lwip/" (Tom R.)
- Drop the patch introducing lwIP as a Git subtree and document the git command in the cover letter instead (Tom R.)
- "net-lwip: add TFTP support and tftpboot command": use the same "Bytes transferred =" message as in the legacy implementation (Tom R., Maxim U.)
- Drop "test/py: net: add_lwipvariants of dhcp, ping and tftpboot tests" which is not needed anymore.
- Add missingkfree()calls incmd/net-common.cand fix the parsing of decimal address innet-lwip/wget.c(patch "net-lwip: add wget command") (Maxim U.)
- "net-lwip: add ping command": drop the ICMP payload (Ilias A.). Set the sequence number to zero when enteringping_loop().Changes in v2:
** Address comments from Ilias A.
- "net-lwip: add wget command"
Implement thewget_with_dns()function to do most of the wget work and call it fromdo_wget(). This allows to simplify patch "net-lwip: add support forEFI_HTTP_BOOT".- "net-lwip: import net command from
cmd/net.c"
Move a few functions fromcmd/net.cto a new filecmd/net-common.crather than duplicating then incmd/net-lwip.c.- "net-lwip: add support for
EFI_HTTP_BOOT"
Sincewget_with_dns()is now implemented in "net-lwip: add wget command", just enable the wget command when the lwIP stack is enabled andEFI_HTTP_BOOTis 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 newCMD_XXX_LWIPsymbols and use existingCMD_XXXinstead.- "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 commit0a0452b2c3".Note that I have not yet addressed your comments on "test: dm: dsa,
eth: disable tests whenCONFIG_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_TFTPnotDFU_TFTPincompatible withNET_LWIP. It seems quite natural to supplement "depends on NET" with "&& !NET_LWIP".
* Make PROT_*_LWIP not visible by removing theKconfigprompt.Jerome Forissier (28):
net:recv(): return-EAGAINinstead of 0 when no cleanup is expected MakeAVB_VERIFYdepend on FASTBOOT
linker_lists: setLINKER_LIST_ALIGNto 8 forCPU_MIPS64
sandbox: add dummy driverETH_SANDBOX_LWIP
test: boot: fixbootdev_test_anyfor whenDSA_SANDBOXis disabled
test: boot: fixbootflow_cmd_labelfor whenDSA_SANDBOXis disabled
net: introduce alternative implementation as net-lwip/
configs: replace '#CONFIG_NETis not set' withCONFIG_NO_NET=y
net: splitinclude/net.hinto net{,-common,-legacy,-lwip}.h
net: movecopy_filename()to new filenet/net-common.c
net: eth-uclass: add functioneth_start_udev()
net-lwip: build lwIP
net-lwip: add DHCP support and dhcp commmand
lwip: tftp: bind to TFTP port only when in server mode
net-lwip: add TFTP support and tftpboot command
net-lwip: add ping command
net-lwip: add dns command
net: splitcmd/net.cintocmd/net.candcmd/net-common.c
net-lwip: add wget command
cmd: bdinfo: enable -e whenCONFIG_CMD_NET_LWIP=y
configs: addqemu_arm64_lwip_defconfig
lwip: tftp: add support of blksize option to client
net-lwip: addTFTP_BLOCKSIZE
CI: addqemu_arm64_lwipto the test matrix
MAINTAINERS: net-lwip: add myself as a maintainer
configs: use syntaxCONFIG_FOO=nin tools-only_defconfig [TESTING] configs: setCONFIG_NET=yfor FTGMAC100 [TESTING]Kconfig: enableNET_LWIPby defaultJonathan Humphreys (1):
net-lwip: lwIP wget supports user defined port in the uri, so allowit..azure-pipelines.yml | 7 + Kconfig | 29 + MAINTAINERS | 11 + Makefile | 6 +- arch/Kconfig | 2 +- board/engicam/imx8mp/icore_mx8mp.c | 2 +- .../imx8mp_debix_model_a.c | 2 +- board/ti/am335x/board.c | 3 +- board/xilinx/common/board.c | 3 +- boot/Kconfig | 4 +- cmd/Kconfig | 140 +-- cmd/Makefile | 9 +- cmd/bdinfo.c | 5 +- cmd/elf.c | 2 +- cmd/net-common.c | 109 ++ cmd/net-lwip.c | 45 + cmd/net.c | 115 --- common/Kconfig | 3 +- common/board_r.c | 4 +- common/spl/Kconfig | 1 + common/usb_kbd.c | 2 +- configs/LicheePi_Zero_defconfig | 2 +- configs/M5249EVB_defconfig | 2 +- configs/am335x_pdu001_defconfig | 2 +- configs/am62ax_evm_r5_defconfig | 2 +- configs/am62px_evm_r5_defconfig | 2 +- configs/am62x_beagleplay_r5_defconfig | 2 +- configs/amcore_defconfig | 2 +- configs/amd_versal2_mini_defconfig | 2 +- configs/amd_versal2_mini_emmc_defconfig | 2 +- configs/amd_versal2_mini_ospi_defconfig | 2 +- configs/amd_versal2_mini_qspi_defconfig | 2 +- configs/anbernic-rgxx3-rk3566_defconfig | 2 +- configs/ap143_defconfig | 2 +- configs/ap152_defconfig | 2 +- configs/apple_m1_defconfig | 2 +- configs/astro_mcf5373l_defconfig | 2 +- configs/at91sam9rlek_dataflash_defconfig | 2 +- configs/at91sam9rlek_mmc_defconfig | 2 +- configs/at91sam9rlek_nandflash_defconfig | 2 +- configs/bcm7260_defconfig | 2 +- configs/bcm7445_defconfig | 2 +- configs/bcm968380gerg_ram_defconfig | 2 +- configs/bcmns_defconfig | 2 +- configs/chromebook_samus_tpl_defconfig | 2 +- configs/cortina_presidio-asic-base_defconfig | 2 +- configs/cortina_presidio-asic-pnand_defconfig | 2 +- configs/durian_defconfig | 2 +- configs/e850-96_defconfig | 2 +- configs/ea-lpc3250devkitv2_defconfig | 2 +- configs/efi-x86_app32_defconfig | 2 +- configs/efi-x86_app64_defconfig | 2 +- configs/emsdp_defconfig | 2 +- configs/evb-ast2500_defconfig | 1 + configs/evb-ast2600_defconfig | 1 + configs/evb-px5_defconfig | 2 +- configs/generic-rk3568_defconfig | 2 +- configs/generic-rk3588_defconfig | 2 +- configs/hc2910_2aghd05_defconfig | 2 +- configs/igep00x0_defconfig | 2 +- configs/imx6q_bosch_acc_defconfig | 2 +- configs/imx6ulz_smm_m2_defconfig | 2 +- configs/iot_devkit_defconfig | 2 +- configs/j722s_evm_r5_defconfig | 2 +- configs/legoev3_defconfig | 2 +- configs/mk808_defconfig | 2 +- configs/mx23evk_defconfig | 2 +- configs/mx28evk_defconfig | 2 +- configs/mx6memcal_defconfig | 2 +- configs/mx6ulz_14x14_evk_defconfig | 2 +- configs/mx7ulp_com_defconfig | 2 +- configs/mx7ulp_evk_defconfig | 2 +- configs/mx7ulp_evk_plugin_defconfig | 2 +- configs/netgear_cg3100d_ram_defconfig | 2 +- configs/nsim_700_defconfig | 2 +- configs/nsim_700be_defconfig | 2 +- configs/nsim_hs38be_defconfig | 2 +- configs/openpiton_riscv64_defconfig | 2 +- configs/openpiton_riscv64_spl_defconfig | 2 +- configs/origen_defconfig | 2 +- configs/pe2201_defconfig | 2 +- configs/pinecube_defconfig | 2 +- configs/pm9261_defconfig | 2 +- configs/qemu_arm64_lwip_defconfig | 9 + configs/s5p4418_nanopi2_defconfig | 2 +- configs/s5p_goni_defconfig | 2 +- configs/s5pc210_universal_defconfig | 2 +- configs/sama5d27_giantboard_defconfig | 2 +- configs/sama5d29_curiosity_mmc1_defconfig | 2 +- configs/sama5d29_curiosity_mmc_defconfig | 2 +- .../sama5d29_curiosity_qspiflash_defconfig | 2 +- configs/sama7g54_curiosity_mmc_defconfig | 2 +- .../sama7g54_curiosity_nandflash_defconfig | 2 +- .../sama7g54_curiosity_qspiflash_defconfig | 2 +- configs/sipeed_maix_bitm_defconfig | 2 +- configs/sipeed_maix_smode_defconfig | 2 +- configs/stemmy_defconfig | 2 +- configs/stm32f429-discovery_defconfig | 2 +- configs/stm32f429-evaluation_defconfig | 2 +- configs/stm32f469-discovery_defconfig | 2 +- configs/stm32h743-disco_defconfig | 2 +- configs/stm32h743-eval_defconfig | 2 +- configs/stm32h750-art-pi_defconfig | 2 +- configs/stm32mp25_defconfig | 2 +- configs/stmark2_defconfig | 2 +- configs/th1520_lpi4a_defconfig | 2 +- configs/thunderx_88xx_defconfig | 2 +- configs/tools-only_defconfig | 34 +- configs/topic_miami_defconfig | 2 +- configs/topic_miamilite_defconfig | 2 +- configs/topic_miamiplus_defconfig | 2 +- configs/total_compute_defconfig | 2 +- configs/trats2_defconfig | 2 +- configs/trats_defconfig | 2 +- configs/xenguest_arm64_defconfig | 2 +- configs/xenguest_arm64_virtio_defconfig | 2 +- configs/xilinx_versal_mini_defconfig | 2 +- configs/xilinx_versal_mini_emmc0_defconfig | 2 +- configs/xilinx_versal_mini_emmc1_defconfig | 2 +- configs/xilinx_versal_mini_ospi_defconfig | 2 +- configs/xilinx_versal_mini_qspi_defconfig | 2 +- configs/xilinx_versal_net_mini_defconfig | 2 +- configs/xilinx_versal_net_mini_emmc_defconfig | 2 +- configs/xilinx_versal_net_mini_ospi_defconfig | 2 +- configs/xilinx_versal_net_mini_qspi_defconfig | 2 +- configs/xilinx_zynqmp_mini_defconfig | 2 +- configs/xilinx_zynqmp_mini_emmc0_defconfig | 2 +- configs/xilinx_zynqmp_mini_emmc1_defconfig | 2 +- configs/xilinx_zynqmp_mini_nand_defconfig | 2 +- .../xilinx_zynqmp_mini_nand_single_defconfig | 2 +- configs/xilinx_zynqmp_mini_qspi_defconfig | 2 +- configs/zynq_cse_nand_defconfig | 2 +- configs/zynq_cse_nor_defconfig | 2 +- configs/zynq_cse_qspi_defconfig | 2 +- drivers/dfu/Kconfig | 1 + drivers/fastboot/Kconfig | 1 + drivers/net/Kconfig | 16 +- drivers/net/Makefile | 1 + drivers/net/eepro100.c | 2 +- drivers/net/phy/Kconfig | 2 +- drivers/net/rtl8139.c | 2 +- drivers/net/sandbox-lwip.c | 85 ++ drivers/usb/gadget/Kconfig | 2 +- include/net-common.h | 509 ++++++++++ include/net-legacy.h | 541 ++++++++++ include/net-lwip.h | 41 + include/net.h | 943 +----------------- lib/Makefile | 2 + lib/binman.c | 1 + lib/lwip/Makefile | 55 + lib/lwip/lwip/src/apps/tftp/tftp.c | 104 +- .../lwip/src/include/lwip/apps/tftp_client.h | 1 + lib/lwip/u-boot/arch/cc.h | 45 + lib/lwip/u-boot/arch/sys_arch.h | 0 lib/lwip/u-boot/limits.h | 0 lib/lwip/u-boot/lwipopts.h | 157 +++ lib/tiny-printf.c | 3 +- net/Kconfig | 81 +- net/Makefile | 20 +- net/eth-uclass.c | 38 +- net/lwip/Kconfig | 49 + net/lwip/Makefile | 8 + net/lwip/dhcp.c | 136 +++ net/lwip/dns.c | 127 +++ net/lwip/eth_internal.h | 35 + net/lwip/net-lwip.c | 307 ++++++ net/lwip/ping.c | 177 ++++ net/lwip/tftp.c | 290 ++++++ net/lwip/wget.c | 357 +++++++ net/net-common.c | 13 + net/net.c | 12 - test/boot/bootdev.c | 11 +- test/boot/bootflow.c | 7 +- test/cmd/Makefile | 2 + test/dm/Makefile | 2 + 175 files changed, 3607 insertions(+), 1346 deletions(-) create mode 100644 cmd/net-common.c create mode 100644 cmd/net-lwip.c create mode 100644 configs/qemu_arm64_lwip_defconfig create mode 100644 drivers/net/sandbox-lwip.c create mode 100644 include/net-common.h create mode 100644 include/net-legacy.h create mode 100644 include/net-lwip.h create mode 100644 lib/lwip/Makefile create mode 100644 lib/lwip/u-boot/arch/cc.h create mode 100644 lib/lwip/u-boot/arch/sys_arch.h create mode 100644 lib/lwip/u-boot/limits.h create mode 100644 lib/lwip/u-boot/lwipopts.h create mode 100644 net/lwip/Kconfig create mode 100644 net/lwip/Makefile create mode 100644 net/lwip/dhcp.c create mode 100644 net/lwip/dns.c create mode 100644 net/lwip/eth_internal.h create mode 100644 net/lwip/net-lwip.c create mode 100644 net/lwip/ping.c create mode 100644 net/lwip/tftp.c create mode 100644 net/lwip/wget.c create mode 100644 net/net-common.c--
2.40.1
PATCH v11 29/29 Kconfig: enable NET_LWIP by default
In reply to Jerome ForissierEnable NET_LWIP by default for testing purposes.
--- Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Kconfig +1 -1
@@ -756,7 +756,7 @@ menu Networking choice prompt "Networking stack" - default NET + default NET_LWIP config NO_NET bool "No networking support"
Signature · 1 line
2.40.1
Quoted 19 lines · Jerome Forissier
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 withKconfig, 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. and Raymond M. (CC'd) have 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. using a secure, authenticated connection directly from the U-Boot shell. Several use cases:
* Authentication: prevent MITM attack (third party replacing the
binary with a different one)
* Confidentiality: prevent third parties from grabbing a copy of the
image as it is being downloaded
* Allow connection to servers that do not support plain HTTP anymore
(this is becoming more and more common on the Internet these days)
- Possibly benefit from additional features implemented in lwIP
- Less code to maintain in U-Boot
Quoted 5 lines
Prior to applying this series, the lwIP stack needs to be added as a Git subtree with the following command:
$ git subtree add --squash --prefix lib/lwip/lwip \ https://github.com/lwip-tcpip/lwip.git STABLE-2_2_0_RELEASE
So, assuming the outstanding questions raised on v11 are easy enough to resolve, I think v12 should be posted with being merged in mind (and so no TESTING patches, etc, since I'll "b4 shazam -SM" it. Thanks for working on this so hard!
Signature · 1 line
Tom
Tom
Quoted 25 lines · Tom Rini
Quoted 22 lines · Jerome Forissier
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 withKconfig, 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. and Raymond M. (CC'd) have 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. using a secure, authenticated connection directly from the U-Boot shell. Several use cases:
* Authentication: prevent MITM attack (third party replacing the
binary with a different one)
* Confidentiality: prevent third parties from grabbing a copy of the
image as it is being downloaded
* Allow connection to servers that do not support plain HTTP anymore
(this is becoming more and more common on the Internet these days)
- Possibly benefit from additional features implemented in lwIP
- Less code to maintain in U-BootPrior to applying this series, the lwIP stack needs to be added as a Git subtree with the following command:
Quoted 7 lines
Quoted 2 lines
$ git subtree add --squash --prefix lib/lwip/lwip \ https://github.com/lwip-tcpip/lwip.git STABLE-2_2_0_RELEASESo, assuming the outstanding questions raised on v11 are easy enough to resolve, I think v12 should be posted with being merged in mind (and so no TESTING patches, etc, since I'll "b4 shazam -SM" it. Thanks for working on this so hard!
FWIW I am generally happy with the whole series. Unfortunately I dont have time to do a full detailed review, but we've fixed enough to be confident it's 'ok' to pull.
I think we'll improve it faster over time once people start using it
Thanks
/Ilias
Quoted 3 lines
--
Tom
Quoted 24 lines · Tom Rini
Quoted 22 lines · Jerome Forissier
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 withKconfig, 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. and Raymond M. (CC'd) have 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. using a secure, authenticated connection directly from the U-Boot shell. Several use cases:
* Authentication: prevent MITM attack (third party replacing the
binary with a different one)
* Confidentiality: prevent third parties from grabbing a copy of the
image as it is being downloaded
* Allow connection to servers that do not support plain HTTP anymore
(this is becoming more and more common on the Internet these days)
- Possibly benefit from additional features implemented in lwIP
- Less code to maintain in U-BootPrior to applying this series, the lwIP stack needs to be added as a Git subtree with the following command:
Quoted 7 lines
Quoted 2 lines
$ git subtree add --squash --prefix lib/lwip/lwip \ https://github.com/lwip-tcpip/lwip.git STABLE-2_2_0_RELEASESo, assuming the outstanding questions raised on v11 are easy enough to resolve, I think v12 should be posted with being merged in mind (and so no TESTING patches, etc, since I'll "b4 shazam -SM" it. Thanks for working on this so hard!
Sure. Thanks for reviewing and testing!
Signature · 1 line
Jerome
Quoted 19 lines · Jerome Forissier
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 withKconfig, 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. and Raymond M. (CC'd) have 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. using a secure, authenticated connection directly from the U-Boot shell. Several use cases:
* Authentication: prevent MITM attack (third party replacing the
binary with a different one)
* Confidentiality: prevent third parties from grabbing a copy of the
image as it is being downloaded
* Allow connection to servers that do not support plain HTTP anymore
(this is becoming more and more common on the Internet these days)
- Possibly benefit from additional features implemented in lwIP
- Less code to maintain in U-Boot
Quoted 5 lines
Prior to applying this series, the lwIP stack needs to be added as a Git subtree with the following command:
$ git subtree add --squash --prefix lib/lwip/lwip \ https://github.com/lwip-tcpip/lwip.git STABLE-2_2_0_RELEASE
arm64), Raspberry Pi 4 (32b, 64b, arm64), am64x_evm, am62x_evm, am62x_beagleplay.
And the Pi targets were built with gcc-13 and llvm-17.
Signature · 1 line
Tom