Skip to contentSkip to conversation

Introduce the lwIP network stack

PATCH Superseded Jerome Forissier 8 participants 54 messages Jul 25, 2024 – Aug 7, 2024

Subsystems (12)

v5 of 13 Superseded Latest is v13 →

lore
Share & tools
lore
#0 lore raw

v5 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://git.savannah.gnu.org/git/lwip.git STABLE-2_2_0_RELEASE

Notes:

1. A number of features are currently incompatible with NET_LWIP: SANDBOX, DFU_TFTP, FASTBOOT, SPL_NET. 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, a new QEMU configuration is introduced (qemu_arm64_lwip_defconfig) which is the same as qemu_arm64_defconfig but with NET_LWIP and CMD_*_LWIP enabled. Tests are added to test/py/tests/test_net.py for that configuration.

3. The default QEMU networking doesn't work with NET_LWIP. wget pauses and resets the connection. Wireshark shows [TCP Window Full] and [TCP ZeroWindow]. Wen using an emulated e1000 however all is fine (that is "-nic tap,model=e1000" on the QEMU command line, with a bridge configured on the host).

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.

[1] https://lore.kernel.org/all/[email protected]/
[2] https://www.nongnu.org/lwip/
[3] https://en.wikipedia.org/wiki/LwIP

CC Javier Tia <[email protected]>
CC Raymond Mao <[email protected]>

Jerome Forissier (19):
flash: prefix error codes with FL_
net: introduce alternative implementation as net-lwip/
configs: replace '# CONFIG_NET is not set' with CONFIG_NO_NET=y
net: fec_mxc_init(): do not ignore return status of fec_open()
net: split include/net.h into net{,-common,-legacy,-lwip}.h
net: eth-uclass: add function eth_start_udev()
net-lwip: build lwIP
net-lwip: add DHCP support and dhcp commmand
net-lwip: add TFTP support and tftpboot command
net-lwip: add ping command
net-lwip: add dns command
net: 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

Jonathan Humphreys (1):
net-lwip: lwIP wget supports user defined port in the uri, so allow

    it.
 .azure-pipelines.yml                          |   7 +
 Kconfig                                       |  26 +
 MAINTAINERS                                   |  11 +
 Makefile                                      |   4 +-
 board/cobra5272/flash.c                       |  26 +-
 board/freescale/m5253demo/flash.c             |   6 +-
 boot/Kconfig                                  |   3 +-
 cmd/Kconfig                                   |  84 +-
 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                                |   2 +-
 common/board_r.c                              |   4 +-
 common/flash.c                                |  44 +-
 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/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/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             |   5 +
 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                  |   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 +-
 .../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/mtd/cfi_flash.c                       |  36 +-
 drivers/net/Kconfig                           |   3 +-
 drivers/net/fec_mxc.c                         |   3 +-
 drivers/net/phy/Kconfig                       |   2 +-
 drivers/usb/gadget/Kconfig                    |   2 +-
 include/flash.h                               |  20 +-
 include/net-common.h                          | 413 ++++++++
 include/net-legacy.h                          | 635 ++++++++++++
 include/net-lwip.h                            |  37 +
 include/net.h                                 | 944 +-----------------
 lib/Makefile                                  |   2 +
 lib/lwip/Makefile                             |  55 +
 lib/lwip/lwip/src/apps/tftp/tftp.c            |  94 +-
 .../lwip/src/include/lwip/apps/tftp_client.h  |   1 +
 lib/lwip/u-boot/arch/cc.h                     |  43 +
 lib/lwip/u-boot/arch/sys_arch.h               |   0
 lib/lwip/u-boot/limits.h                      |   0
 lib/lwip/u-boot/lwipopts.h                    | 157 +++
 net/Kconfig                                   |  49 +-
 net/Makefile                                  |  19 +-
 net/eth-uclass.c                              |  38 +-
 net/lwip/Kconfig                              |  34 +
 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                           | 292 ++++++
 net/lwip/ping.c                               | 177 ++++
 net/lwip/tftp.c                               | 276 +++++
 net/lwip/wget.c                               | 272 +++++
 157 files changed, 3311 insertions(+), 1321 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 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
Signature · 1 line
2.40.1
#1 lore raw

PATCH v5 1/20 flash: prefix error codes with FL_

Prefix the flash status codes (ERR_*) with FL_ in order to avoid clashes with third-party libraries. Case in point: including the lwIP library header file <lwip/err.h> which defines err_enum_t as an enum with values being ERR_*.

---
 board/cobra5272/flash.c           | 26 +++++++++---------
 board/freescale/m5253demo/flash.c |  6 ++---
 common/flash.c                    | 44 +++++++++++++++----------------
 drivers/mtd/cfi_flash.c           | 36 ++++++++++++-------------
 include/flash.h                   | 20 +++++++-------
 5 files changed, 66 insertions(+), 66 deletions(-)
board/cobra5272/flash.c +13 -13
index 157b71da85e..f2f8d027f6e 100644
@@ -138,22 +138,22 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
 {
 	ulong result;
 	int iflag, cflag, prot, sect;
-	int rc = ERR_OK;
+	int rc = FL_ERR_OK;
 	int chip1;
 	ulong start;
 
 	/* first look for protection bits */
 
 	if (info->flash_id == FLASH_UNKNOWN)
-		return ERR_UNKNOWN_FLASH_TYPE;
+		return FL_ERR_UNKNOWN_FLASH_TYPE;
 
 	if ((s_first < 0) || (s_first > s_last)) {
-		return ERR_INVAL;
+		return FL_ERR_INVAL;
 	}
 
 	if ((info->flash_id & FLASH_VENDMASK) !=
 	    (AMD_MANUFACT & FLASH_VENDMASK)) {
-		return ERR_UNKNOWN_FLASH_VENDOR;
+		return FL_ERR_UNKNOWN_FLASH_VENDOR;
 	}
 
 	prot = 0;
@@ -163,7 +163,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
 		}
 	}
 	if (prot)
-		return ERR_PROTECTED;
+		return FL_ERR_PROTECTED;
 
 	/*
 	 * Disable interrupts which might cause a timeout
@@ -220,11 +220,11 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
 			MEM_FLASH_ADDR1 = CMD_READ_ARRAY;
 
 			if (chip1 == ERR) {
-				rc = ERR_PROG_ERROR;
+				rc = FL_ERR_PROG_ERROR;
 				goto outahere;
 			}
 			if (chip1 == TMO) {
-				rc = ERR_TIMEOUT;
+				rc = FL_ERR_TIMEOUT;
 				goto outahere;
 			}
 
@@ -255,7 +255,7 @@ static int write_word(flash_info_t *info, ulong dest, ulong data)
 {
 	volatile u16 *addr = (volatile u16 *) dest;
 	ulong result;
-	int rc = ERR_OK;
+	int rc = FL_ERR_OK;
 	int cflag, iflag;
 	int chip1;
 	ulong start;
@@ -265,7 +265,7 @@ static int write_word(flash_info_t *info, ulong dest, ulong data)
 	 */
 	result = *addr;
 	if ((result & data) != data)
-		return ERR_NOT_ERASED;
+		return FL_ERR_NOT_ERASED;
 
 
 	/*
@@ -306,7 +306,7 @@ static int write_word(flash_info_t *info, ulong dest, ulong data)
 	*addr = CMD_READ_ARRAY;
 
 	if (chip1 == ERR || *addr != data)
-		rc = ERR_PROG_ERROR;
+		rc = FL_ERR_PROG_ERROR;
 
 	if (iflag)
 		enable_interrupts();
@@ -325,13 +325,13 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
 
 	if (addr & 1) {
 		printf ("unaligned destination not supported\n");
-		return ERR_ALIGN;
+		return FL_ERR_ALIGN;
 	}
 
 #if 0
 	if (cnt & 1) {
 		printf ("odd transfer sizes not supported\n");
-		return ERR_ALIGN;
+		return FL_ERR_ALIGN;
 	}
 #endif
 
@@ -369,5 +369,5 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
 		cnt -= 1;
 	}
 
-	return ERR_OK;
+	return FL_ERR_OK;
 }
board/freescale/m5253demo/flash.c +3 -3
index 334518a4bc9..ab5d2ebff64 100644
@@ -72,7 +72,7 @@ int flash_get_offsets(ulong base, flash_info_t * info)
 		}
 	}
 
-	return ERR_OK;
+	return FL_ERR_OK;
 }
 
 void flash_print_info(flash_info_t * info)
@@ -369,9 +369,9 @@ int write_buff(flash_info_t * info, uchar * src, ulong addr, ulong cnt)
 	}
 
 	if (cnt == 0)
-		return ERR_OK;
+		return FL_ERR_OK;
 
-	return ERR_OK;
+	return FL_ERR_OK;
 }
 
 /*-----------------------------------------------------------------------
common/flash.c +22 -22

97 lines not on this page · raw message

drivers/mtd/cfi_flash.c +18 -18
index a7826e81c17..e50502824ac 100644
@@ -593,11 +593,11 @@ static int flash_status_check(flash_info_t *info, flash_sect_t sector,
 			       flash_read_long(info, sector, 0));
 			flash_write_cmd(info, sector, 0, info->cmd_reset);
 			udelay(1);
-			return ERR_TIMEOUT;
+			return FL_ERR_TIMEOUT;
 		}
 		udelay(1);		/* also triggers watchdog */
 	}
-	return ERR_OK;
+	return FL_ERR_OK;
 }
 
 /*-----------------------------------------------------------------------
@@ -616,9 +616,9 @@ static int flash_full_status_check(flash_info_t *info, flash_sect_t sector,
 	case CFI_CMDSET_INTEL_PROG_REGIONS:
 	case CFI_CMDSET_INTEL_EXTENDED:
 	case CFI_CMDSET_INTEL_STANDARD:
-		if (retcode == ERR_OK &&
+		if (retcode == FL_ERR_OK &&
 		    !flash_isset(info, sector, 0, FLASH_STATUS_DONE)) {
-			retcode = ERR_INVAL;
+			retcode = FL_ERR_INVAL;
 			printf("Flash %s error at address %lx\n", prompt,
 			       info->start[sector]);
 			if (flash_isset(info, sector, 0, FLASH_STATUS_ECLBS |
@@ -627,14 +627,14 @@ static int flash_full_status_check(flash_info_t *info, flash_sect_t sector,
 			} else if (flash_isset(info, sector, 0,
 						FLASH_STATUS_ECLBS)) {
 				puts("Block Erase Error.\n");
-				retcode = ERR_NOT_ERASED;
+				retcode = FL_ERR_NOT_ERASED;
 			} else if (flash_isset(info, sector, 0,
 						FLASH_STATUS_PSLBS)) {
 				puts("Locking Error\n");
 			}
 			if (flash_isset(info, sector, 0, FLASH_STATUS_DPS)) {
 				puts("Block locked.\n");
-				retcode = ERR_PROTECTED;
+				retcode = FL_ERR_PROTECTED;
 			}
 			if (flash_isset(info, sector, 0, FLASH_STATUS_VPENS))
 				puts("Vpp Low Error.\n");
@@ -702,12 +702,12 @@ static int flash_status_poll(flash_info_t *info, void *src, void *dst,
 		if (get_timer(start) > tout) {
 			printf("Flash %s timeout at address %lx data %lx\n",
 			       prompt, (ulong)dst, (ulong)flash_read8(dst));
-			return ERR_TIMEOUT;
+			return FL_ERR_TIMEOUT;
 		}
 		udelay(1);		/* also triggers watchdog */
 	}
 #endif /* CONFIG_SYS_CFI_FLASH_STATUS_POLL */
-	return ERR_OK;
+	return FL_ERR_OK;
 }
 
 /*-----------------------------------------------------------------------
@@ -810,7 +810,7 @@ static int flash_write_cfiword(flash_info_t *info, ulong dest, cfiword_t cword)
 		break;
 	}
 	if (!flag)
-		return ERR_NOT_ERASED;
+		return FL_ERR_NOT_ERASED;
 
 	/* Disable interrupts which might cause a timeout here */
 	flag = disable_interrupts();
@@ -899,7 +899,7 @@ static int flash_write_cfibuffer(flash_info_t *info, ulong dest, uchar *cp,
 		shift = 3;
 		break;
 	default:
-		retcode = ERR_INVAL;
+		retcode = FL_ERR_INVAL;
 		goto out_unmap;
 	}
 
@@ -930,7 +930,7 @@ static int flash_write_cfibuffer(flash_info_t *info, ulong dest, uchar *cp,
 		}
 	}
 	if (!flag) {
-		retcode = ERR_NOT_ERASED;
+		retcode = FL_ERR_NOT_ERASED;
 		goto out_unmap;
 	}
 
@@ -950,7 +950,7 @@ static int flash_write_cfibuffer(flash_info_t *info, ulong dest, uchar *cp,
 		retcode = flash_status_check(info, sector,
 					     info->buffer_write_tout,
 					     "write to buffer");
-		if (retcode == ERR_OK) {
+		if (retcode == FL_ERR_OK) {
 			/* reduce the number of loops by the width of
 			 * the port
 			 */
@@ -975,7 +975,7 @@ static int flash_write_cfibuffer(flash_info_t *info, ulong dest, uchar *cp,
 					src += 8, dst += 8;
 					break;
 				default:
-					retcode = ERR_INVAL;
+					retcode = FL_ERR_INVAL;
 					goto out_unmap;
 				}
 			}
@@ -1025,7 +1025,7 @@ static int flash_write_cfibuffer(flash_info_t *info, ulong dest, uchar *cp,
 			}
 			break;
 		default:
-			retcode = ERR_INVAL;
+			retcode = FL_ERR_INVAL;
 			goto out_unmap;
 		}
 
@@ -1043,7 +1043,7 @@ static int flash_write_cfibuffer(flash_info_t *info, ulong dest, uchar *cp,
 
 	default:
 		debug("Unknown Command Set\n");
-		retcode = ERR_INVAL;
+		retcode = FL_ERR_INVAL;
 		break;
 	}
 
@@ -1389,7 +1389,7 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
 		if (i > cnt)
 			i = cnt;
 		rc = flash_write_cfibuffer(info, wp, src, i);
-		if (rc != ERR_OK)
+		if (rc != FL_ERR_OK)
 			return rc;
 		i -= i & (info->portwidth - 1);
 		wp += i;
@@ -1398,7 +1398,7 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
 		FLASH_SHOW_PROGRESS(scale, dots, digit, i);
 		/* Only check every once in a while */
 		if ((cnt & 0xFFFF) < buffered_size && ctrlc())
-			return ERR_ABORTED;
+			return FL_ERR_ABORTED;
 	}
 #else
 	while (cnt >= info->portwidth) {
@@ -1413,7 +1413,7 @@ int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
 		FLASH_SHOW_PROGRESS(scale, dots, digit, info->portwidth);
 		/* Only check every once in a while */
 		if ((cnt & 0xFFFF) < info->portwidth && ctrlc())
-			return ERR_ABORTED;
+			return FL_ERR_ABORTED;
 	}
 #endif /* CONFIG_SYS_FLASH_USE_BUFFER_WRITE */
 
include/flash.h +10 -10
index 0f736977411..ebf8881b0e3 100644
@@ -127,16 +127,16 @@ void flash_perror(int err);
 /*-----------------------------------------------------------------------
  * return codes from flash_write():
  */
-#define ERR_OK				0
-#define ERR_TIMEOUT			1
-#define ERR_NOT_ERASED			2
-#define ERR_PROTECTED			4
-#define ERR_INVAL			8
-#define ERR_ALIGN			16
-#define ERR_UNKNOWN_FLASH_VENDOR	32
-#define ERR_UNKNOWN_FLASH_TYPE		64
-#define ERR_PROG_ERROR			128
-#define ERR_ABORTED			256
+#define FL_ERR_OK			0
+#define FL_ERR_TIMEOUT			1
+#define FL_ERR_NOT_ERASED		2
+#define FL_ERR_PROTECTED		4
+#define FL_ERR_INVAL			8
+#define FL_ERR_ALIGN			16
+#define FL_ERR_UNKNOWN_FLASH_VENDOR	32
+#define FL_ERR_UNKNOWN_FLASH_TYPE	64
+#define FL_ERR_PROG_ERROR		128
+#define FL_ERR_ABORTED			256
 
 /*-----------------------------------------------------------------------
  * Protection Flags for flash_protect():
Signature · 1 line
2.40.1
#2 lore raw

Re: [PATCH v5 01/20] flash: prefix error codes with FL_

Quoted 8 lines · Jerome Forissier

Prefix the flash status codes (ERR_*) with FL_ in order to avoid clashes with third-party libraries. Case in point: including the lwIP library header file <lwip/err.h> which defines err_enum_t as an enum with values being ERR_*.

This is incomplete as for example 10m50 fails to build due to drivers/mtd/altera_qspi.c. It might be worth doing a world build with just this commit applied to check for other problems as well, in v6.

Signature · 1 line
Tom
#3 lore raw

Re: [PATCH v5 01/20] flash: prefix error codes with FL_

Quoted 7 lines · Tom Rini
Quoted 5 lines · Jerome Forissier

Prefix the flash status codes (ERR_*) with FL_ in order to avoid clashes with third-party libraries. Case in point: including the lwIP library header file <lwip/err.h> which defines err_enum_t as an enum with values being ERR_*.

Quoted 7 lines
Quoted 3 lines

This is incomplete as for example 10m50 fails to build due to drivers/mtd/altera_qspi.c. It might be worth doing a world build with just this commit applied to check for other problems as well, in v6.

Fixed in v6. I have now grepped -w all the ERR_ codes and it was the only one I missed.

Thanks,

Signature · 1 line
Jerome
#4 lore raw

PATCH v5 2/20 net: introduce alternative implementation as net-lwip/

In reply to Jerome Forissier

Prepare 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.

As for SANDBOX, NET_LWIP cannot be used either because of strong assumptions on the network stack. Make NET_LWIP depend on !SANDBOX so that the NET_LWIP alternative is not visible in make menuconfig when sandbox_defconfig is used.

---
 Kconfig                    | 26 ++++++++++++++++++++++++++
 common/Kconfig             |  2 +-
 common/spl/Kconfig         |  1 +
 drivers/dfu/Kconfig        |  1 +
 drivers/fastboot/Kconfig   |  1 +
 drivers/net/Kconfig        |  1 +
 drivers/net/phy/Kconfig    |  2 +-
 drivers/usb/gadget/Kconfig |  2 +-
 net/Kconfig                | 29 +++++++++++++++--------------
 net/Makefile               |  4 ++++
 net/lwip/Kconfig           | 36 ++++++++++++++++++++++++++++++++++++
 11 files changed, 88 insertions(+), 17 deletions(-)
 create mode 100644 net/lwip/Kconfig
Kconfig +26 -0
index 82df59f176e..61bc6529617 100644
@@ -745,6 +745,32 @@ source "dts/Kconfig"
 
 source "env/Kconfig"
 
+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
+	depends on !SANDBOX
+	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"
 
 source "drivers/Kconfig"
common/Kconfig +1 -1
index 4bb9f08977a..1daa495080a 100644
@@ -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
index af43b5f5d3c..2731849841a 100644
@@ -1063,6 +1063,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
index 971204758aa..d034b501360 100644
@@ -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
index 70207573de2..1eb460f5a02 100644
@@ -1,5 +1,6 @@
 menu "Fastboot support"
 	depends on CMDLINE
+	depends on !NET_LWIP
 
 config FASTBOOT
 	bool
drivers/net/Kconfig +1 -0
index b4ff033afa9..d332f712a7c 100644
@@ -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
 
drivers/net/phy/Kconfig +1 -1
index 73064b2af68..75986162914 100644
@@ -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
index 4621a6fd5e6..03fe3bca197 100644
@@ -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 +15 -14
index 5dff6336293..952690d677d 100644
@@ -2,11 +2,6 @@
 # Network configuration
 #
 
-menuconfig NET
-	bool "Networking support"
-	default y
-	imply NETDEVICES
-
 if NET
 
 config ARP_TIMEOUT
@@ -26,15 +21,6 @@ config PROT_UDP
 	  Enable a generic udp framework that allows defining a custom
 	  handler for udp protocol.
 
-config BOOTDEV_ETH
-	bool "Enable bootdev for ethernet"
-	depends on BOOTSTD
-	default y
-	help
-	  Provide a bootdev for ethernet so that is it possible to boot
-	  an operationg system over the network, using the PXE (Preboot
-	  Execution Environment) protocol.
-
 config BOOTP_SEND_HOSTNAME
 	bool "Send hostname to DNS server"
 	help
@@ -255,6 +241,19 @@ config IPV6
 
 endif   # if NET
 
+source "net/lwip/Kconfig"
+
+if NET || NET_LWIP
+
+config BOOTDEV_ETH
+	bool "Enable bootdev for ethernet"
+	depends on BOOTSTD
+	default y
+	help
+	  Provide a bootdev for ethernet so that is it possible to boot
+	  an operating system over the network, using the PXE (Preboot
+	  Execution Environment) protocol.
+
 config SYS_RX_ETH_BUFFER
 	int "Number of receive packet buffers"
 	default 4
@@ -263,3 +262,5 @@ config SYS_RX_ETH_BUFFER
 	  controllers it is recommended to set this value to 8 or even higher,
 	  since all buffers can be full shortly after enabling the interface on
 	  high Ethernet traffic.
+
+endif   # if NET || NET_LWIP
net/Makefile +4 -0
index 64ab7ec740a..70eec8caf0d 100644
@@ -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 +36 -0
new file mode 100644
index 00000000000..0a6bcb41369
@@ -0,0 +1,36 @@
+#
+# Network configuration (with lwIP stack)
+#
+
+config LWIP_DEBUG
+	bool "Enable debug traces in the lwIP library"
+
+config LWIP_ASSERT
+	bool "Enable assertions in the lwIP library"
+
+config PROT_DHCP_LWIP
+	bool "DHCP support in lwIP"
+	depends on PROT_UDP_LWIP
+	help
+	  Enable support for the DHCP protocol in lwIP.
+
+config PROT_DNS_LWIP
+	bool
+	depends on PROT_UDP_LWIP
+
+config PROT_RAW_LWIP
+	bool
+
+config PROT_TCP_LWIP
+	bool
+
+config PROT_TCP_SACK_LWIP
+	bool "TCP SACK support"
+	depends on PROT_TCP_LWIP
+	default y
+	help
+	  TCP protocol with selective acknowledgements. Improves
+	  file transfer speed in wget.
+
+config PROT_UDP_LWIP
+	bool
Signature · 1 line
2.40.1
#5 lore raw

Re: [PATCH v5 02/20] net: introduce alternative implementation as net-lwip/

чт, 25 июл. 2024 г. в 15:58, Jerome Forissier <[email protected]>:

Quoted 259 lines

Prepare 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.

As for SANDBOX, NET_LWIP cannot be used either because of strong assumptions on the network stack. Make NET_LWIP depend on !SANDBOX so that the NET_LWIP alternative is not visible in make menuconfig when sandbox_defconfig is used.

---
 Kconfig                    | 26 ++++++++++++++++++++++++++
 common/Kconfig             |  2 +-
 common/spl/Kconfig         |  1 +
 drivers/dfu/Kconfig        |  1 +
 drivers/fastboot/Kconfig   |  1 +
 drivers/net/Kconfig        |  1 +
 drivers/net/phy/Kconfig    |  2 +-
 drivers/usb/gadget/Kconfig |  2 +-
 net/Kconfig                | 29 +++++++++++++++--------------
 net/Makefile               |  4 ++++
 net/lwip/Kconfig           | 36 ++++++++++++++++++++++++++++++++++++
 11 files changed, 88 insertions(+), 17 deletions(-)
 create mode 100644 net/lwip/Kconfig
Kconfig +26 -0
index 82df59f176e..61bc6529617 100644
@@ -745,6 +745,32 @@ source "dts/Kconfig"
 
 source "env/Kconfig"
 
+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
+       depends on !SANDBOX
+       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"
 
 source "drivers/Kconfig"
common/Kconfig +1 -1
index 4bb9f08977a..1daa495080a 100644
@@ -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
index af43b5f5d3c..2731849841a 100644
@@ -1063,6 +1063,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
index 971204758aa..d034b501360 100644
@@ -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
index 70207573de2..1eb460f5a02 100644
@@ -1,5 +1,6 @@
 menu "Fastboot support"
        depends on CMDLINE
+       depends on !NET_LWIP
 
 config FASTBOOT
        bool
drivers/net/Kconfig +1 -0
index b4ff033afa9..d332f712a7c 100644
@@ -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
 
drivers/net/phy/Kconfig +1 -1
index 73064b2af68..75986162914 100644
@@ -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
index 4621a6fd5e6..03fe3bca197 100644
@@ -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 +15 -14
index 5dff6336293..952690d677d 100644
@@ -2,11 +2,6 @@
 # Network configuration
 #
 
-menuconfig NET
-       bool "Networking support"
-       default y
-       imply NETDEVICES
-
 if NET
 
 config ARP_TIMEOUT
@@ -26,15 +21,6 @@ config PROT_UDP
          Enable a generic udp framework that allows defining a custom
          handler for udp protocol.
 
-config BOOTDEV_ETH
-       bool "Enable bootdev for ethernet"
-       depends on BOOTSTD
-       default y
-       help
-         Provide a bootdev for ethernet so that is it possible to boot
-         an operationg system over the network, using the PXE (Preboot
-         Execution Environment) protocol.
-
 config BOOTP_SEND_HOSTNAME
        bool "Send hostname to DNS server"
        help
@@ -255,6 +241,19 @@ config IPV6
 
 endif   # if NET
 
+source "net/lwip/Kconfig"
+
+if NET || NET_LWIP
+
+config BOOTDEV_ETH
+       bool "Enable bootdev for ethernet"
+       depends on BOOTSTD
+       default y
+       help
+         Provide a bootdev for ethernet so that is it possible to boot
+         an operating system over the network, using the PXE (Preboot
+         Execution Environment) protocol.
+
 config SYS_RX_ETH_BUFFER
        int "Number of receive packet buffers"
        default 4
@@ -263,3 +262,5 @@ config SYS_RX_ETH_BUFFER
          controllers it is recommended to set this value to 8 or even higher,
          since all buffers can be full shortly after enabling the interface on
          high Ethernet traffic.
+
+endif   # if NET || NET_LWIP
net/Makefile +4 -0
index 64ab7ec740a..70eec8caf0d 100644
@@ -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 +15 -0
new file mode 100644
index 00000000000..0a6bcb41369
@@ -0,0 +1,36 @@
+#
+# Network configuration (with lwIP stack)
+#
+
+config LWIP_DEBUG
+       bool "Enable debug traces in the lwIP library"
+
+config LWIP_ASSERT
+       bool "Enable assertions in the lwIP library"
+
+config PROT_DHCP_LWIP
+       bool "DHCP support in lwIP"
+       depends on PROT_UDP_LWIP
+       help
+         Enable support for the DHCP protocol in lwIP.

net/lwip/Kconfig line 25

Quoted 10 lines
net/lwip/Kconfig new file +10 -0
+
+config PROT_DNS_LWIP
+       bool
+       depends on PROT_UDP_LWIP
+
+config PROT_RAW_LWIP
+       bool
+
+config PROT_TCP_LWIP
+       bool

Hello Jerome,

Not very critical, but it will be good to align options names. I think CONFIG_NET_LWIP_ is a good prefix.
It will be easier to grep configuration from .config.

BR,
Maxim.

Quoted 14 lines
net/lwip/Kconfig new file +11 -1
+
+config PROT_TCP_SACK_LWIP
+       bool "TCP SACK support"
+       depends on PROT_TCP_LWIP
+       default y
+       help
+         TCP protocol with selective acknowledgements. Improves
+         file transfer speed in wget.
+
+config PROT_UDP_LWIP
+       bool
--

2.40.1

Signature · 2 lines
Best regards,
Maxim Uvarov
#6 lore raw

Re: [PATCH v5 02/20] net: introduce alternative implementation as net-lwip/

In reply to Jerome Forissier
Quoted 16 lines · Jerome Forissier

Prepare 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.

Quoted 6 lines

As for SANDBOX, NET_LWIP cannot be used either because of strong assumptions on the network stack. Make NET_LWIP depend on !SANDBOX so that the NET_LWIP alternative is not visible in make menuconfig when sandbox_defconfig is used.

[snip]

Here in net/Kconfig you do..

Quoted 4 lines
net/Kconfig +4 -0
+if NET || NET_LWIP
+
+config BOOTDEV_ETH
+	bool "Enable bootdev for ethernet"

net/Kconfig config IPV6 · line 259

Quoted 10 lines
net/Kconfig +7 -0
+	depends on BOOTSTD
+	default y
+	help
+	  Provide a bootdev for ethernet so that is it possible to boot
+	  an operating system over the network, using the PXE (Preboot
+	  Execution Environment) protocol.
+
 config SYS_RX_ETH_BUFFER
 	int "Number of receive packet buffers"
 	default 4

But we must have SYS_RX_ETH_BUFFER defined even in the NO_NET case as otherwise previously <net.h> and now <net-common.h> cannot be used, and untying that is another big mess. We include <net.h> in common areas for function prototypes where their usage is guarded. But we use PKTBUFSRX in some structs that aren't guarded. Trying to build for example for am62x_beagleplay_r5 with this series blows up in a lot of places.

Signature · 1 line
Tom
#7 lore raw

Re: [PATCH v5 02/20] net: introduce alternative implementation as net-lwip/

Quoted 40 lines · Tom Rini
Quoted 16 lines · Jerome Forissier

Prepare 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.

Quoted 6 lines

As for SANDBOX, NET_LWIP cannot be used either because of strong assumptions on the network stack. Make NET_LWIP depend on !SANDBOX so that the NET_LWIP alternative is not visible in make menuconfig when sandbox_defconfig is used.

[snip]

Here in net/Kconfig you do..

Quoted 13 lines
net/Kconfig +11 -0
+if NET || NET_LWIP
+
+config BOOTDEV_ETH
+	bool "Enable bootdev for ethernet"
+	depends on BOOTSTD
+	default y
+	help
+	  Provide a bootdev for ethernet so that is it possible to boot
+	  an operating system over the network, using the PXE (Preboot
+	  Execution Environment) protocol.
+
 config SYS_RX_ETH_BUFFER
 	int "Number of receive packet buffers"
Quoted 8 lines
Quoted 1 line

default 4

But we must have SYS_RX_ETH_BUFFER defined even in the NO_NET case as otherwise previously <net.h> and now <net-common.h> cannot be used, and untying that is another big mess. We include <net.h> in common areas for function prototypes where their usage is guarded. But we use PKTBUFSRX in some structs that aren't guarded. Trying to build for example for am62x_beagleplay_r5 with this series blows up in a lot of places.

I have moved SYS_RX_ETH_BUFFER out of the 'if NET || NEW_LWIP' in v6.

Thanks,

Signature · 1 line
Jerome
#8 lore raw

Re: [PATCH v5 02/20] net: introduce alternative implementation as net-lwip/

In reply to Jerome Forissier

čt 25. 7. 2024 v 15:28 odesílatel Jerome Forissier <[email protected]> napsal:

Quoted 166 lines

Prepare 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.

As for SANDBOX, NET_LWIP cannot be used either because of strong assumptions on the network stack. Make NET_LWIP depend on !SANDBOX so that the NET_LWIP alternative is not visible in make menuconfig when sandbox_defconfig is used.

---
 Kconfig                    | 26 ++++++++++++++++++++++++++
 common/Kconfig             |  2 +-
 common/spl/Kconfig         |  1 +
 drivers/dfu/Kconfig        |  1 +
 drivers/fastboot/Kconfig   |  1 +
 drivers/net/Kconfig        |  1 +
 drivers/net/phy/Kconfig    |  2 +-
 drivers/usb/gadget/Kconfig |  2 +-
 net/Kconfig                | 29 +++++++++++++++--------------
 net/Makefile               |  4 ++++
 net/lwip/Kconfig           | 36 ++++++++++++++++++++++++++++++++++++
 11 files changed, 88 insertions(+), 17 deletions(-)
 create mode 100644 net/lwip/Kconfig
Kconfig +26 -0
index 82df59f176e..61bc6529617 100644
@@ -745,6 +745,32 @@ source "dts/Kconfig"
 
 source "env/Kconfig"
 
+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
+       depends on !SANDBOX
+       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"
 
 source "drivers/Kconfig"
common/Kconfig +1 -1
index 4bb9f08977a..1daa495080a 100644
@@ -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
index af43b5f5d3c..2731849841a 100644
@@ -1063,6 +1063,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
index 971204758aa..d034b501360 100644
@@ -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
index 70207573de2..1eb460f5a02 100644
@@ -1,5 +1,6 @@
 menu "Fastboot support"
        depends on CMDLINE
+       depends on !NET_LWIP
 
 config FASTBOOT
        bool
drivers/net/Kconfig +1 -0
index b4ff033afa9..d332f712a7c 100644
@@ -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
 
drivers/net/phy/Kconfig +1 -1
index 73064b2af68..75986162914 100644
@@ -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
index 4621a6fd5e6..03fe3bca197 100644
@@ -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 +0 -0
index 5dff6336293..952690d677d 100644

net/Kconfig line 9

Quoted 8 lines
net/Kconfig +0 -5
@@ -2,11 +2,6 @@
 # Network configuration
 #
 
-menuconfig NET
-       bool "Networking support"
-       default y
-       imply NETDEVICES
-

I looked at menuconfig and saw that so many network options are on the first screen.
TBH It doesn't look nice and I think it should be hidden in any menu.

  │ │        Environment  --->
     │ │
  │ │        Networking stack (Legacy U-Boot networking stack)  --->
     │ │
  │ │    (5000) Milliseconds before trying ARP again
     │ │
  │ │    (5) Number of timeouts before giving up
     │ │
  │ │    [ ] Enable generic udp framework
     │ │
  │ │    [ ] Send hostname to DNS server
     │ │
  │ │    [*] Random ethaddr if unset
     │ │
  │ │    [*] NetConsole support
     │ │
  │ │    [ ] Support IP datagram reassembly
     │ │
  │ │    [*] Echo the inverted Ethernet link state to the fault LED
     │ │
  │ │    [ ] Set TFTP UDP source/destination ports via the environment
     │ │
  │ │    (1) TFTP window size
     │ │
  │ │    [ ] Track TFTP transfers based on file size option
     │ │
  │ │    [ ] Get serverip value from Proxy DHCP response
     │ │
  │ │    (100) # of additional milliseconds to wait for ProxyDHCP
response  │ │
  │ │    [ ] Write the server's MAC address to 'serveraddr'
     │ │
  │ │    [ ] Check the UDP checksum
     │ │
  │ │    [ ] Use the 'serverip' env var for tftp, not bootp
     │ │
  │ │    (64) Option 17 root path length
     │ │
  │ │    [ ] Set a default 'gateway' value in the environment
     │ │
  │ │    [ ] Set a default 'ipaddr' value in the environment
     │ │
  │ │    [ ] Set a default 'netmask' value in the environment
     │ │
  │ │    [ ] Set a default 'rootpath' value in the environment
     │ │
  │ │    [ ] Set a default 'serverip' value in the environment
     │ │
  │ │    -*- TCP stack
     │ │
  │ │    [ ]   TCP SACK support
     │ │
  │ │    [ ] IPv6 support
     │ │
  │ │    [ ] Enable debug traces in the lwIP library
     │ │
  │ │    [ ] Enable assertions in the lwIP library
     │ │
  │ │    [*] Enable bootdev for ethernet
     │ │
  │ │    (4) Number of receive packet buffers
     │ │
  │ │    (1468) TFTP block size
     │ │
  │ │        Device Drivers  --->
     │ │
  │ │        File systems  --->

M

#9 lore raw

Re: [PATCH v5 02/20] net: introduce alternative implementation as net-lwip/

Quoted 171 lines · Michal Simek

čt 25. 7. 2024 v 15:28 odesílatel Jerome Forissier <[email protected]> napsal:

Quoted 169 lines

Prepare 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.

As for SANDBOX, NET_LWIP cannot be used either because of strong assumptions on the network stack. Make NET_LWIP depend on !SANDBOX so that the NET_LWIP alternative is not visible in make menuconfig when sandbox_defconfig is used.

---
 Kconfig                    | 26 ++++++++++++++++++++++++++
 common/Kconfig             |  2 +-
 common/spl/Kconfig         |  1 +
 drivers/dfu/Kconfig        |  1 +
 drivers/fastboot/Kconfig   |  1 +
 drivers/net/Kconfig        |  1 +
 drivers/net/phy/Kconfig    |  2 +-
 drivers/usb/gadget/Kconfig |  2 +-
 net/Kconfig                | 29 +++++++++++++++--------------
 net/Makefile               |  4 ++++
 net/lwip/Kconfig           | 36 ++++++++++++++++++++++++++++++++++++
 11 files changed, 88 insertions(+), 17 deletions(-)
 create mode 100644 net/lwip/Kconfig
Kconfig +26 -0
index 82df59f176e..61bc6529617 100644
@@ -745,6 +745,32 @@ source "dts/Kconfig"
 
 source "env/Kconfig"
 
+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
+       depends on !SANDBOX
+       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"
 
 source "drivers/Kconfig"
common/Kconfig +1 -1
index 4bb9f08977a..1daa495080a 100644
@@ -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
index af43b5f5d3c..2731849841a 100644
@@ -1063,6 +1063,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
index 971204758aa..d034b501360 100644
@@ -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
index 70207573de2..1eb460f5a02 100644
@@ -1,5 +1,6 @@
 menu "Fastboot support"
        depends on CMDLINE
+       depends on !NET_LWIP
 
 config FASTBOOT
        bool
drivers/net/Kconfig +1 -0
index b4ff033afa9..d332f712a7c 100644
@@ -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
 
drivers/net/phy/Kconfig +1 -1
index 73064b2af68..75986162914 100644
@@ -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
index 4621a6fd5e6..03fe3bca197 100644
@@ -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 +0 -0
index 5dff6336293..952690d677d 100644
@@ -2,11 +2,6 @@
 # Network configuration
 #
 
Quoted 9 lines

net/Kconfig line 9

Quoted 5 lines
net/Kconfig +0 -5
-menuconfig NET
-       bool "Networking support"
-       default y
-       imply NETDEVICES
-

I looked at menuconfig and saw that so many network options are on the first screen.
TBH It doesn't look nice and I think it should be hidden in any menu.

True. I have introduced a new "Networking" top-level menu in v6.

Main page:

         Device Tree Control  --->
         Environment  --->
         Networking  --->
         Device Drivers  --->

In "Networking" when legacy stack is selected:

Networking stack (Legacy U-Boot networking stack) --->
(5000) Milliseconds before trying ARP again
(5) Number of timeouts before giving up
[ ] Enable generic udp framework
[ ] Send hostname to DNS server
[ ] Random ethaddr if unset
...

or when lwIP is selected:

Networking stack (Use lwIP for networking stack) --->
[ ] Enable debug traces in the lwIP library
[ ] Enable assertions in the lwIP library
-*- DHCP support in lwIP
[*] TCP SACK support
[*] Enable bootdev for ethernet
(1468) TFTP block size
(4) Number of receive packet buffers

Quoted 69 lines
  │ │        Environment  --->
     │ │
  │ │        Networking stack (Legacy U-Boot networking stack)  --->
     │ │
  │ │    (5000) Milliseconds before trying ARP again
     │ │
  │ │    (5) Number of timeouts before giving up
     │ │
  │ │    [ ] Enable generic udp framework
     │ │
  │ │    [ ] Send hostname to DNS server
     │ │
  │ │    [*] Random ethaddr if unset
     │ │
  │ │    [*] NetConsole support
     │ │
  │ │    [ ] Support IP datagram reassembly
     │ │
  │ │    [*] Echo the inverted Ethernet link state to the fault LED
     │ │
  │ │    [ ] Set TFTP UDP source/destination ports via the environment
     │ │
  │ │    (1) TFTP window size
     │ │
  │ │    [ ] Track TFTP transfers based on file size option
     │ │
  │ │    [ ] Get serverip value from Proxy DHCP response
     │ │
  │ │    (100) # of additional milliseconds to wait for ProxyDHCP
response  │ │
  │ │    [ ] Write the server's MAC address to 'serveraddr'
     │ │
  │ │    [ ] Check the UDP checksum
     │ │
  │ │    [ ] Use the 'serverip' env var for tftp, not bootp
     │ │
  │ │    (64) Option 17 root path length
     │ │
  │ │    [ ] Set a default 'gateway' value in the environment
     │ │
  │ │    [ ] Set a default 'ipaddr' value in the environment
     │ │
  │ │    [ ] Set a default 'netmask' value in the environment
     │ │
  │ │    [ ] Set a default 'rootpath' value in the environment
     │ │
  │ │    [ ] Set a default 'serverip' value in the environment
     │ │
  │ │    -*- TCP stack
     │ │
  │ │    [ ]   TCP SACK support
     │ │
  │ │    [ ] IPv6 support
     │ │
  │ │    [ ] Enable debug traces in the lwIP library
     │ │
  │ │    [ ] Enable assertions in the lwIP library
     │ │
  │ │    [*] Enable bootdev for ethernet
     │ │
  │ │    (4) Number of receive packet buffers
     │ │
  │ │    (1468) TFTP block size
     │ │
  │ │        Device Drivers  --->
     │ │
  │ │        File systems  --->
Quoted 1 line

M

Thanks,

Signature · 1 line
Jerome
#10 lore raw

PATCH v5 3/20 configs: replace '# CONFIG_NET is not set' with CONFIG_NO_NET=y

In reply to Jerome Forissier

The 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/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/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 +-
 105 files changed, 105 insertions(+), 105 deletions(-)
configs/LicheePi_Zero_defconfig +1 -1
index 009384eaf1b..c37c49ccbb1 100644
@@ -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
index eac85b9c2d5..ed1446d81cb 100644
@@ -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
index febe5ebaabb..508caef8adb 100644
@@ -42,7 +42,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
index 44ccb6baa90..1fba779dd0a 100644
@@ -67,7 +67,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
index ace55696737..53925bdbfcb 100644
@@ -71,7 +71,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
index d0cc4f5b405..2179b016134 100644
@@ -68,7 +68,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
index f1f5201b30a..94c5379590d 100644
@@ -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/anbernic-rgxx3-rk3566_defconfig +1 -1
index a03509bf467..937c27a947e 100644
@@ -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
index c22048c1b53..13842e6c0f8 100644
@@ -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
index ec700a5b3f0..5cc0ad2e682 100644
@@ -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
index 20d2cff93f7..e425f114791 100644
@@ -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
index d1942c28971..8dd369d68a1 100644
@@ -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
index 931af2b2fda..01ac2cc8d1e 100644
@@ -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
index 70d431c1f52..93f7d762109 100644
@@ -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
index 1277a357cd2..928ad9f4f70 100644
@@ -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
index 2bf3c0d7fbe..345e37bca7e 100644
@@ -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
index 07e3b57ac33..eb6629ba57a 100644
@@ -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
index 6c119eb42a6..053c459e05c 100644
@@ -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
index 365284e94c3..f2719821656 100644
@@ -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
index 3e7298f16af..864ca47fada 100644
@@ -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
index eb5743da64d..78167d56d83 100644
@@ -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
index c7367d4d91c..f1526227d65 100644
@@ -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
index f1d45ca3064..ae7a05edee1 100644
@@ -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
index 38b9968c167..4102c350953 100644
@@ -11,7 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="exynos/exynos850-e850-96"
 CONFIG_SYS_LOAD_ADDR=0x80000000
 # CONFIG_AUTOBOOT is not set
 # CONFIG_DISPLAY_CPUINFO is not set
-# CONFIG_NET is not set
+CONFIG_NO_NET=y
 CONFIG_CLK_EXYNOS850=y
 # CONFIG_MMC is not set
 CONFIG_SOC_SAMSUNG=y
configs/ea-lpc3250devkitv2_defconfig +1 -1
index af9fc5f2f5c..c3af7afced1 100644
@@ -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
index 53ec63461d5..c2856b4000f 100644
@@ -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
index 3d021483dd0..0b709cf4dad 100644
@@ -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
index 07bed2b5623..26efa794058 100644
@@ -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
index ccd38831533..8efab0c2fc0 100644
@@ -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
index 66a33afbbaf..383dad3087b 100644
@@ -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
index 42bc2c9a765..3c81401968d 100644
@@ -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
index e68b44478a9..4302436d2e6 100644
@@ -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
index 87fd2797eac..41a4f28205f 100644
@@ -66,7 +66,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_SYS_I2C_LEGACY=y
 CONFIG_SPL_SYS_I2C_LEGACY=y
configs/imx6q_bosch_acc_defconfig +1 -1
index 73ae4acfb43..6f147afbc53 100644
@@ -80,7 +80,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
index 93ead4c373b..c2adff17abf 100644
@@ -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
index c4920052f82..3dda897f765 100644
@@ -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/legoev3_defconfig +1 -1
index 34ef3493cac..60b7a84205c 100644
@@ -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
index 9a342d3a33a..36ab4b03401 100644
@@ -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
index 7d0e7cc1e00..59ab64ec97a 100644
@@ -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
index 1fe68ef93f9..868d870cb68 100644
@@ -48,7 +48,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
index 4c8a5960d38..5cc8236feb9 100644
@@ -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
index d57b47ef47a..2c13dd4dbc3 100644
@@ -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
index f8dcc0abef5..6ea84c053ca 100644
@@ -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
index 38e6b62df45..5aadb9e93f1 100644
@@ -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
index d007d180969..2f45fac0a89 100644
@@ -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
index 352b98fc0a5..377cc26f937 100644
@@ -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
index be2539e8cd7..e8400c2dc30 100644
@@ -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
index 1fcf36a28a5..9ce1a255227 100644
@@ -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
index 9c26e4da7d2..80d0e54192d 100644
@@ -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
index cdb9e1c932e..9df92e5c318 100644
@@ -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
index a08040d878d..29304cc50fe 100644
@@ -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
index dc9285d4e99..26702d77079 100644
@@ -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
index 5d32cbf8bf1..91fe7ebf982 100644
@@ -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
index 7cc0a862949..7567a6aa739 100644
@@ -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
index 9f4d434f3e2..026c6de3109 100644
@@ -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
index ee72778995b..0bee0008294 100644
@@ -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
index 4316510541c..084e19e1258 100644
@@ -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
index 67959ad79cd..99e873ff427 100644
@@ -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
index 283c9300c56..34274ca4a32 100644
@@ -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
index 61edb23b196..5d9173a0e57 100644
@@ -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
index 0b16f386735..2b765f56dda 100644
@@ -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
index 9b522e81ef5..d840d0f3d6f 100644
@@ -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
index 00a091df0e5..ba8643c912c 100644
@@ -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
index 0b2116d0419..49b08d3fc2b 100644
@@ -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
index 00e5362a1fa..8fa5857e245 100644
@@ -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
index 67d5a007a8e..8788eabf55a 100644
@@ -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
index 049fac02cac..c8d8b1ac9e1 100644
@@ -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
index ee8e6be6e2c..efa3b477a6e 100644
@@ -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
index 5d59edb7381..21a466572bd 100644
@@ -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
index 3e220d73984..8f20d4ca3f5 100644
@@ -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
index 9b5f38b9efa..33292bfaf0c 100644
@@ -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
index 89d79e98b6f..f098b8dd6da 100644
@@ -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
index 6b4ebd11691..82823e8631f 100644
@@ -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
index 319b3033a40..df3ff43f4a9 100644
@@ -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
index 87038cc773a..9885466f390 100644
@@ -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
index f43a24c5b5e..79b21acd032 100644
@@ -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
index 49ff92f6de3..6893d7622fe 100644
@@ -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
index b754cc01cc8..107ad279e1b 100644
@@ -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
index b54d2cefa10..e00f2c48598 100644
@@ -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
index 638d7306146..74b03d19ffb 100644
@@ -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
index af47fab83c0..46071399a4d 100644
@@ -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
index ad321749694..5562c738c5e 100644
@@ -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
index 5f21d2e367a..b3d2e5c88a6 100644
@@ -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
index 67561368128..acfc42842e3 100644
@@ -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
index 98925243bf4..070ab268474 100644
@@ -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
index 6d040c2c15c..91657e0cd8b 100644
@@ -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
index d00a1ba0143..217b45a2c5e 100644
@@ -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
index b97bf5e60a9..e9183bc8071 100644
@@ -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
index 5c949e34442..7ba7e65597a 100644
@@ -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
index 04cba5bc72d..54cc51ee7f3 100644
@@ -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
index 8f162597603..5ffb2cd5bfb 100644
@@ -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
index 8fbde1c7d3c..552cbdd740b 100644
@@ -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
index d6ebd080463..c4b1a5d5416 100644
@@ -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
index fc88eee10af..c64ab92533b 100644
@@ -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
index 872a4a55952..f1a136fe52c 100644
@@ -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
index 00319e06102..75589c478d8 100644
@@ -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
index 4b45074efc4..09d73b0617f 100644
@@ -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
index 49c7235fb8c..0e0242d8aac 100644
@@ -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
index 1ef89f50444..01297f615b8 100644
@@ -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
index b4719536be1..fd27f565b03 100644
@@ -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
index 7ede17654dd..480c00ed152 100644
@@ -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
index 0d79ecece71..d8830a6f247 100644
@@ -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
index 750ea0db2b2..e7414c78d1e 100644
@@ -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
index 3155fe0b378..4f2186b2a51 100644
@@ -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
index f2e1aa6d3ab..a372a13fe2d 100644
@@ -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
Tested-by on v5 3/20
#11 lore raw

Re: [PATCH v5 03/20] configs: replace '# CONFIG_NET is not set' with CONFIG_NO_NET=y

Quoted 7 lines · Jerome Forissier

The 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.

For the pdu001 board.

#12 lore raw

PATCH v5 4/20 net: fec_mxc_init(): do not ignore return status of fec_open()

In reply to Jerome Forissier

The fec_mxc_init() function currently always returns 0. This does not allow the callers to detect when for instance the PHY initialization failed due to the port being unconnected. Fix that by returning the status of fec_open().

---
 drivers/net/fec_mxc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/fec_mxc.c +1 -2
index 0a0d92bc2cd..2dc1364beec 100644
@@ -615,8 +615,7 @@ static int fecmxc_init(struct udevice *dev)
 	if (fec->xcv_type != SEVENWIRE)
 		miiphy_restart_aneg(dev);
 #endif
-	fec_open(dev);
-	return 0;
+	return fec_open(dev);
 }
 
 /**
Signature · 1 line
2.40.1
#13 lore raw

PATCH v5 5/20 net: split include/net.h into net{, -common, -legacy, -lwip}.h

In reply to Jerome Forissier

Make 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 | 412 +++++++++++++++++++
 include/net-legacy.h | 635 +++++++++++++++++++++++++++++
 include/net-lwip.h   |  14 +
 include/net.h        | 944 +------------------------------------------
 5 files changed, 1068 insertions(+), 941 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
index 07d7947c8af..59925332c48 100644
@@ -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 +412 -0

412 lines not on this page · raw message

include/net-legacy.h new file +635 -0

635 lines not on this page · raw message

include/net-lwip.h new file +14 -0
new file mode 100644
index 00000000000..5c3f9e7e86c
@@ -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

954 lines not on this page · raw message

Signature · 1 line
2.40.1
#14 lore raw

PATCH v5 6/20 net: eth-uclass: add function eth_start_udev()

In reply to Jerome Forissier

Add a function to start a given etwork 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
index 29342b6eee5..b9b47197e4a 100644
@@ -148,6 +148,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);
 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
index e34d7af0229..6dd9b9bb98e 100644
@@ -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) {
+		priv->state = ETH_STATE_ACTIVE;
+		priv->running = true;
+		ret = 0;
+	}
+
+	return ret;
+}
+
 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
+				goto end;
 
 			debug("FAIL\n");
 		} else {
Signature · 1 line
2.40.1
Reviewed-by on v5 6/20
#15 lore raw

Re: [PATCH v5 06/20] net: eth-uclass: add function eth_start_udev()

Quoted 1 line · Jerome Forissier

Add a function to start a given etwork device, and update eth_init()

Typo, "network".

Quoted 3 lines

to use it.

And this is where most of the tiny and acceptable growth comes from in the legacy network case.

But, does the lwIP side end up calling this too then, and so the need to split this out and not have it be static?

Signature · 1 line
Tom
#16 lore raw

Re: [PATCH v5 06/20] net: eth-uclass: add function eth_start_udev()

Quoted 5 lines · Tom Rini
Quoted 1 line · Jerome Forissier

Add a function to start a given etwork device, and update eth_init()

Typo, "network".

Fixed in v6.

Quoted 11 lines
Quoted 3 lines

to use it.

And this is where most of the tiny and acceptable growth comes from in the legacy network case.

But, does the lwIP side end up calling this too then, and so the need to split this out and not have it be static?

Yes, eth_start_udev() is called by new_netif() in net/lwip/net-lwip.c.

Thanks,

Signature · 1 line
Jerome
#17 lore raw

PATCH v5 7/20 net-lwip: build lwIP

In reply to Jerome Forissier

Build 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       |  43 +++++++++
 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, 257 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
index e389ad014f8..7378d907258 100644
@@ -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 +43 -0

43 lines not on this page · raw message

lib/lwip/u-boot/arch/sys_arch.h new file +0 -0
new file mode 100644
index 00000000000..e69de29bb2d
lib/lwip/u-boot/limits.h new file +0 -0
new file mode 100644
index 00000000000..e69de29bb2d
lib/lwip/u-boot/lwipopts.h new file +157 -0

157 lines not on this page · raw message

Signature · 1 line
2.40.1
#18 lore raw

PATCH v5 8/20 net-lwip: add DHCP support and dhcp commmand

In reply to Jerome Forissier

Add 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().

---
 boot/Kconfig            |   3 +-
 cmd/Kconfig             |  45 ++++---
 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-lwip.h      |   3 +
 net/Makefile            |  15 ++-
 net/lwip/Kconfig        |   2 -
 net/lwip/Makefile       |   5 +
 net/lwip/dhcp.c         | 127 +++++++++++++++++
 net/lwip/eth_internal.h |  35 +++++
 net/lwip/net-lwip.c     | 292 ++++++++++++++++++++++++++++++++++++++++
 net/lwip/tftp.c         |  11 ++
 16 files changed, 538 insertions(+), 29 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
boot/Kconfig +2 -1
index 11175fb7bb2..d7ce868fda7 100644
@@ -380,7 +380,7 @@ config BOOT_DEFAULTS_CMDS
 	select CMD_PART if PARTITIONS
 	select CMD_DHCP if CMD_NET
 	select CMD_PING if CMD_NET
-	select CMD_PXE if CMD_NET
+	select CMD_PXE if (CMD_NET && !NET_LWIP)
 	select CMD_BOOTI if ARM64
 	select CMD_BOOTZ if ARM && !ARM64
 	imply CMD_MII if NET
@@ -540,6 +540,7 @@ config BOOTMETH_EXTLINUX_PXE
 config BOOTMETH_EFILOADER
 	bool "Bootdev support for EFI boot"
 	depends on EFI_BINARY_EXEC
+	select CMD_TFTPBOOT if CMD_NET
 	default y
 	help
 	  Enables support for EFI boot using bootdevs. This makes the
cmd/Kconfig +30 -15

86 lines not on this page · raw message

cmd/Makefile +5 -1
index 87133cc27a8..fe733cf6ba9 100644
@@ -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
index 32b7462f92a..70a64b69554 100644
@@ -128,7 +128,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
new file mode 100644
index 00000000000..82edb5fd2e6
@@ -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
index c823cd262f1..db15742763d 100644
@@ -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:   ");
@@ -727,7 +727,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
index f3b4a3c94e6..1a7d8ca9a67 100644
@@ -418,7 +418,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
index d332f712a7c..1dc69224aa8 100644
@@ -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-lwip.h +3 -0
index 5c3f9e7e86c..cfd06726577 100644
@@ -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__ */
net/Makefile +10 -5
index 70eec8caf0d..9b30e961d07 100644
@@ -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
@@ -42,3 +37,13 @@ obj-$(CONFIG_CMD_WGET) += wget.o
 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
+endif
+
+obj-$(CONFIG_NET_LWIP) += lwip/
net/lwip/Kconfig +0 -2
index 0a6bcb41369..0b5df770c90 100644
@@ -11,8 +11,6 @@ config LWIP_ASSERT
 config PROT_DHCP_LWIP
 	bool "DHCP support in lwIP"
 	depends on PROT_UDP_LWIP
-	help
-	  Enable support for the DHCP protocol in lwIP.
 
 config PROT_DNS_LWIP
 	bool
net/lwip/Makefile new file +5 -0
new file mode 100644
index 00000000000..4e92a101ddb
@@ -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
new file mode 100644
index 00000000000..0b829a8d388
@@ -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 +292 -0

292 lines not on this page · raw message

net/lwip/tftp.c new file +11 -0
new file mode 100644
index 00000000000..1fa246f55d9
@@ -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
#19 lore raw

PATCH v5 9/20 net-lwip: add TFTP support and tftpboot command

In reply to 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

---
 cmd/Kconfig     |   1 +
 cmd/net-lwip.c  |   8 ++
 net/lwip/dhcp.c |  11 +-
 net/lwip/tftp.c | 269 +++++++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 285 insertions(+), 4 deletions(-)
cmd/Kconfig +1 -0
index c068054be8c..515df02baf1 100644
@@ -2102,6 +2102,7 @@ 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.
cmd/net-lwip.c +8 -0
index 82edb5fd2e6..80f0872bb8f 100644
@@ -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
net/lwip/dhcp.c +10 -1
index 3c1eeaf9fb1..a91d7e1ca0f 100644
@@ -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/tftp.c +266 -3

276 lines not on this page · raw message

Signature · 1 line
2.40.1
#20 lore raw

PATCH v5 10/20 net-lwip: add ping command

In reply to Jerome Forissier

Add 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
index 515df02baf1..21188a763cf 100644
@@ -2016,11 +2016,6 @@ 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"
-	help
-	  Send ICMP ECHO_REQUEST to network host
-
 config CMD_PING6
 	bool "ping6"
 	depends on IPV6
@@ -2098,6 +2093,12 @@ config CMD_DHCP
 	help
 	  Boot image via network using DHCP/TFTP protocol
 
+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
index 80f0872bb8f..feed719beef 100644
@@ -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
index cfd06726577..58640c04a7f 100644
@@ -13,5 +13,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
index 4e92a101ddb..b5af37a9b18 100644
@@ -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
#21 lore raw

PATCH v5 11/20 net-lwip: add dns command

In reply to Jerome Forissier

Add 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
index 21188a763cf..a862b6415dd 100644
@@ -2034,11 +2034,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
@@ -2093,6 +2088,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_PING
 	bool "ping"
 	select PROT_RAW_LWIP if NET_LWIP
cmd/net-lwip.c +8 -0
index feed719beef..c021da6a674 100644
@@ -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
index 58640c04a7f..cb60537f9f3 100644
@@ -13,6 +13,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
index b5af37a9b18..645d8a8c457 100644
@@ -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
#22 lore raw

PATCH v5 12/20 net: split cmd/net.c into cmd/net.c and cmd/net-common.c

In reply to Jerome Forissier

Extract 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
index fe733cf6ba9..2c3de45a074 100644
@@ -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
Reviewed-by on v5 12/20
#23 lore raw

Re: [PATCH v5 12/20] net: split cmd/net.c into cmd/net.c and cmd/net-common.c

Quoted 267 lines · Jerome Forissier

Extract 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
index fe733cf6ba9..2c3de45a074 100644
@@ -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
new file mode 100644
index 00000000000..1c9fb83b896
@@ -0,0 +1,109 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, [email protected].
+ */
+
+#include <command.h>
+#include <dm/device.h>
+#include <dm/uclass.h>
+#include <net.h>
+#include <linux/compat.h>
+#include <linux/ethtool.h>
+
+static int do_net_list(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
+{
+       const struct udevice *current = eth_get_dev();
+       unsigned char env_enetaddr[ARP_HLEN];
+       const struct udevice *dev;
+       struct uclass *uc;
+
+       uclass_id_foreach_dev(UCLASS_ETH, dev, uc) {
+               eth_env_get_enetaddr_by_index("eth", dev_seq(dev), env_enetaddr);
+               printf("eth%d : %s %pM %s\n", dev_seq(dev), dev->name, env_enetaddr,
+                      current == dev ? "active" : "");
+       }
+       return CMD_RET_SUCCESS;
+}
+
+static int do_net_stats(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
+{
+       int nstats, err, i, off;
+       struct udevice *dev;
+       u64 *values;
+       u8 *strings;
+
+       if (argc < 2)
+               return CMD_RET_USAGE;
+
+       err = uclass_get_device_by_name(UCLASS_ETH, argv[1], &dev);
+       if (err) {
+               printf("Could not find device %s\n", argv[1]);
+               return CMD_RET_FAILURE;
+       }
+
+       if (!eth_get_ops(dev)->get_sset_count ||
+           !eth_get_ops(dev)->get_strings ||
+           !eth_get_ops(dev)->get_stats) {
+               printf("Driver does not implement stats dump!\n");
+               return CMD_RET_FAILURE;
+       }
+
+       nstats = eth_get_ops(dev)->get_sset_count(dev);
+       strings = kcalloc(nstats, ETH_GSTRING_LEN, GFP_KERNEL);
+       if (!strings)
+               return CMD_RET_FAILURE;
+
+       values = kcalloc(nstats, sizeof(u64), GFP_KERNEL);
+       if (!values)
+               goto err_free_strings;
+
+       eth_get_ops(dev)->get_strings(dev, strings);
+       eth_get_ops(dev)->get_stats(dev, values);
+
+       off = 0;
+       for (i = 0; i < nstats; i++) {
+               printf("  %s: %llu\n", &strings[off], values[i]);
+               off += ETH_GSTRING_LEN;
+       };
+
+       kfree(strings);
+       kfree(values);
+
+       return CMD_RET_SUCCESS;
+
+err_free_strings:
+       kfree(strings);
+
+       return CMD_RET_FAILURE;
+}
+
+static struct cmd_tbl cmd_net[] = {
+       U_BOOT_CMD_MKENT(list, 1, 0, do_net_list, "", ""),
+       U_BOOT_CMD_MKENT(stats, 2, 0, do_net_stats, "", ""),
+};
+
+static int do_net(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
+{
+       struct cmd_tbl *cp;
+
+       cp = find_cmd_tbl(argv[1], cmd_net, ARRAY_SIZE(cmd_net));
+
+       /* Drop the net command */
+       argc--;
+       argv++;
+
+       if (!cp || argc > cp->maxargs)
+               return CMD_RET_USAGE;
+       if (flag == CMD_FLAG_REPEAT && !cmd_is_repeatable(cp))
+               return CMD_RET_SUCCESS;
+
+       return cp->cmd(cmdtp, flag, argc, argv);
+}
+
+U_BOOT_CMD(
+       net, 3, 1, do_net,
+       "NET sub-system",
+       "list - list available devices\n"
+       "stats <device> - dump statistics for specified device\n"
+);
cmd/net.c +0 -116
index b206ff58e68..ad5aaf9245e 100644
@@ -675,118 +675,3 @@ U_BOOT_CMD(
 );
 
 #endif  /* CONFIG_CMD_LINK_LOCAL */
-
-static int do_net_list(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
-{
-       const struct udevice *current = eth_get_dev();
-       unsigned char env_enetaddr[ARP_HLEN];
-       const struct udevice *dev;
-       struct uclass *uc;
-
-       uclass_id_foreach_dev(UCLASS_ETH, dev, uc) {
-               eth_env_get_enetaddr_by_index("eth", dev_seq(dev), env_enetaddr);
-               printf("eth%d : %s %pM %s\n", dev_seq(dev), dev->name, env_enetaddr,
-                      current == dev ? "active" : "");
-       }
-       return CMD_RET_SUCCESS;
-}
-
-static int do_net_stats(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
-{
-       int nstats, err, i, off;
-       struct udevice *dev;
-       u64 *values;
-       u8 *strings;
-
-       if (argc < 2)
-               return CMD_RET_USAGE;
-
-       err = uclass_get_device_by_name(UCLASS_ETH, argv[1], &dev);
-       if (err) {
-               printf("Could not find device %s\n", argv[1]);
-               return CMD_RET_FAILURE;
-       }
-
-       if (!eth_get_ops(dev)->get_sset_count ||
-           !eth_get_ops(dev)->get_strings ||
-           !eth_get_ops(dev)->get_stats) {
-               printf("Driver does not implement stats dump!\n");
-               return CMD_RET_FAILURE;
-       }
-
-       nstats = eth_get_ops(dev)->get_sset_count(dev);
-       strings = kcalloc(nstats, ETH_GSTRING_LEN, GFP_KERNEL);
-       if (!strings)
-               return CMD_RET_FAILURE;
-
-       values = kcalloc(nstats, sizeof(u64), GFP_KERNEL);
-       if (!values)
-               goto err_free_strings;
-
-       eth_get_ops(dev)->get_strings(dev, strings);
-       eth_get_ops(dev)->get_stats(dev, values);
-
-       off = 0;
-       for (i = 0; i < nstats; i++) {
-               printf("  %s: %llu\n", &strings[off], values[i]);
-               off += ETH_GSTRING_LEN;
-       };
-
-       return CMD_RET_SUCCESS;
-
-err_free_strings:
-       kfree(strings);
-
-       return CMD_RET_FAILURE;
-}
-
-static struct cmd_tbl cmd_net[] = {
-       U_BOOT_CMD_MKENT(list, 1, 0, do_net_list, "", ""),
-       U_BOOT_CMD_MKENT(stats, 2, 0, do_net_stats, "", ""),
-};
-
-static int do_net(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
-{
-       struct cmd_tbl *cp;
-
-       cp = find_cmd_tbl(argv[1], cmd_net, ARRAY_SIZE(cmd_net));
-
-       /* Drop the net command */
-       argc--;
-       argv++;
-
-       if (!cp || argc > cp->maxargs)
-               return CMD_RET_USAGE;
-       if (flag == CMD_FLAG_REPEAT && !cmd_is_repeatable(cp))
-               return CMD_RET_SUCCESS;
-
-       return cp->cmd(cmdtp, flag, argc, argv);
-}
-
-U_BOOT_CMD(
-       net, 3, 1, do_net,
-       "NET sub-system",
-       "list - list available devices\n"
-       "stats <device> - dump statistics for specified device\n"
-);
-
-#if defined(CONFIG_CMD_NCSI)
-static int do_ncsi(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
-{
-       if (!phy_interface_is_ncsi() || !ncsi_active()) {
-               printf("Device not configured for NC-SI\n");
-               return CMD_RET_FAILURE;
-       }
-
-       if (net_loop(NCSI) < 0)
-               return CMD_RET_FAILURE;
-
-       return CMD_RET_SUCCESS;
-}
-
-U_BOOT_CMD(
-       ncsi,   1,      1,      do_ncsi,
-       "Configure attached NIC via NC-SI",
-       ""
-);
-#endif  /* CONFIG_CMD_NCSI */
--
Quoted 2 lines

2.40.1

#24 lore raw

PATCH v5 13/20 net-lwip: add wget command

In reply to Jerome Forissier

Add support for the wget command with NET_LWIP.

Based on code initially developed by Maxim U.

---
 cmd/Kconfig        |  16 +--
 cmd/net-lwip.c     |   8 ++
 include/net-lwip.h |  18 +++
 net/lwip/Makefile  |   1 +
 net/lwip/wget.c    | 278 +++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 314 insertions(+), 7 deletions(-)
 create mode 100644 net/lwip/wget.c
cmd/Kconfig +9 -7
index a862b6415dd..1251a996809 100644
@@ -1986,13 +1986,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
-	help
-	  wget is a simple command to download kernel, or other files,
-	  from a http server over TCP.
-
 config CMD_MII
 	bool "mii"
 	imply CMD_MDIO
@@ -2109,6 +2102,15 @@ config CMD_TFTPBOOT
 	  tftpboot - load file via network using TFTP protocol
 	  Currently a placeholder (not implemented) when NET_LWIP=y.
 
+config CMD_WGET
+	bool "wget"
+	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
 
 endif  # if NET || NET_LWIP
cmd/net-lwip.c +8 -0
index c021da6a674..42f8bd6b259 100644
@@ -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
index cb60537f9f3..f5d9255ccaf 100644
@@ -12,8 +12,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
index 645d8a8c457..f2558f8763a 100644
@@ -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 +278 -0

278 lines not on this page · raw message

Signature · 1 line
2.40.1
#25 lore raw

PATCH v5 14/20 net-lwip: lwIP wget supports user defined port in the uri, so allow it.

In reply to Jerome Forissier

From: Jonathan Humphreys <[email protected]>

---
 net/lwip/wget.c | 6 ------
 1 file changed, 6 deletions(-)
net/lwip/wget.c +0 -6
index 65a69fab6e8..bd1aab499d2 100644
@@ -264,12 +264,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
#26 lore raw

PATCH v5 15/20 cmd: bdinfo: enable -e when CONFIG_CMD_NET_LWIP=y

In reply to Jerome Forissier

Support "bdinfo -e" when lwIP is selected.

---
 cmd/bdinfo.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
cmd/bdinfo.c +3 -2
index 437ac4e8630..472e5c42b08 100644
@@ -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));
 	bdinfo_print_num_l("new_fdt", (ulong)map_to_sysmem(gd->new_fdt));
@@ -197,7 +197,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
#27 lore raw

PATCH v5 16/20 configs: add qemu_arm64_lwip_defconfig

In reply to Jerome Forissier

Add 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 | 5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 configs/qemu_arm64_lwip_defconfig
configs/qemu_arm64_lwip_defconfig new file +5 -0
new file mode 100644
index 00000000000..1afef04d7a0
@@ -0,0 +1,5 @@
+#include <configs/qemu_arm64_defconfig>
+CONFIG_NET_LWIP=y
+CONFIG_CMD_DNS=y
+CONFIG_CMD_WGET=y
+CONFIG_EFI_HTTP_BOOT=y
Signature · 1 line
2.40.1
#28 lore raw

Re: [PATCH v5 16/20] configs: add qemu_arm64_lwip_defconfig

Quoted 17 lines · Jerome Forissier

Add 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 | 5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 configs/qemu_arm64_lwip_defconfig
configs/qemu_arm64_lwip_defconfig new file +0 -0
new file mode 100644
index 00000000000..1afef04d7a0

configs/qemu_arm64_lwip_defconfig line 5

Quoted 5 lines
configs/qemu_arm64_lwip_defconfig new file +5 -0
@@ -0,0 +1,5 @@
+#include <configs/qemu_arm64_defconfig>
+CONFIG_NET_LWIP=y
+CONFIG_CMD_DNS=y
+CONFIG_CMD_WGET=y
+CONFIG_EFI_HTTP_BOOT=y

This doesn't work, you need:

configs/qemu_arm64_lwip_defconfig +4 -0
index 1afef04d7a04..d3d8ef16e668 100644
@@ -1,4 +1,8 @@
 #include <configs/qemu_arm64_defconfig>
+
+CONFIG_ARM=y
+CONFIG_ARCH_QEMU=y
+
 CONFIG_NET_LWIP=y
 CONFIG_CMD_DNS=y
 CONFIG_CMD_WGET=y
Signature · 1 line
Tom
#29 lore raw

Re: [PATCH v5 16/20] configs: add qemu_arm64_lwip_defconfig

Quoted 13 lines · Tom Rini
Quoted 11 lines · Jerome Forissier

Add 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 | 5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 configs/qemu_arm64_lwip_defconfig
Quoted 13 lines

configs/qemu_arm64_lwip_defconfig line 5

Quoted 11 lines
configs/qemu_arm64_lwip_defconfig new file +5 -0
new file mode 100644
index 00000000000..1afef04d7a0
@@ -0,0 +1,5 @@
+#include <configs/qemu_arm64_defconfig>
+CONFIG_NET_LWIP=y
+CONFIG_CMD_DNS=y
+CONFIG_CMD_WGET=y
+CONFIG_EFI_HTTP_BOOT=y

This doesn't work,

How so? I've used "make qemu_arm64_lwip_defconfig" hundreds of time to build for arm64 QEMU :o

configs/qemu_arm64_lwip_defconfig line 4

Quoted 11 lines

you need:

configs/qemu_arm64_lwip_defconfig +3 -0
index 1afef04d7a04..d3d8ef16e668 100644
@@ -1,4 +1,8 @@
 #include <configs/qemu_arm64_defconfig>
+
+CONFIG_ARM=y
+CONFIG_ARCH_QEMU=y

Those are both set to =y in my .config after "make qemu_arm64_lwip_defconfig"

configs/qemu_arm64_lwip_defconfig line 8

Quoted 5 lines
configs/qemu_arm64_lwip_defconfig +1 -0
+
 CONFIG_NET_LWIP=y
 CONFIG_CMD_DNS=y
 CONFIG_CMD_WGET=y

Thanks,

Signature · 1 line
Jerome
#30 lore raw

Re: [PATCH v5 16/20] configs: add qemu_arm64_lwip_defconfig

Quoted 30 lines · Jerome Forissier
Quoted 13 lines · Tom Rini
Quoted 11 lines · Jerome Forissier

Add 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 | 5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 configs/qemu_arm64_lwip_defconfig
Quoted 13 lines

configs/qemu_arm64_lwip_defconfig line 5

Quoted 11 lines
configs/qemu_arm64_lwip_defconfig new file +5 -0
new file mode 100644
index 00000000000..1afef04d7a0
@@ -0,0 +1,5 @@
+#include <configs/qemu_arm64_defconfig>
+CONFIG_NET_LWIP=y
+CONFIG_CMD_DNS=y
+CONFIG_CMD_WGET=y
+CONFIG_EFI_HTTP_BOOT=y

This doesn't work,

Quoted 2 lines

How so? I've used "make qemu_arm64_lwip_defconfig" hundreds of time to build for arm64 QEMU :o

Yes, but buildman (and CI) are in a chicken-and-egg situation without a few more details in the new defconfig, sadly.

Signature · 1 line
Tom
#31 lore raw

Re: [PATCH v5 16/20] configs: add qemu_arm64_lwip_defconfig

Quoted 31 lines · Tom Rini
Quoted 30 lines · Jerome Forissier
Quoted 26 lines · Tom Rini
Quoted 17 lines · Jerome Forissier

Add 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 | 5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 configs/qemu_arm64_lwip_defconfig
configs/qemu_arm64_lwip_defconfig new file +0 -0
new file mode 100644
index 00000000000..1afef04d7a0

configs/qemu_arm64_lwip_defconfig line 5

Quoted 5 lines
configs/qemu_arm64_lwip_defconfig new file +5 -0
@@ -0,0 +1,5 @@
+#include <configs/qemu_arm64_defconfig>
+CONFIG_NET_LWIP=y
+CONFIG_CMD_DNS=y
+CONFIG_CMD_WGET=y
+CONFIG_EFI_HTTP_BOOT=y

This doesn't work,

Quoted 5 lines
Quoted 2 lines

How so? I've used "make qemu_arm64_lwip_defconfig" hundreds of time to build for arm64 QEMU :o

Yes, but buildman (and CI) are in a chicken-and-egg situation without a few more details in the new defconfig, sadly.

With:

$ cat configs/qemu_arm64_lwip_defconfig
#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

...I get:

$ make qemu_arm64_lwip_defconfig
generated_defconfig:71:warning: override: reassigning to symbol ARM
generated_defconfig:71:warning: override: ARM changes choice state
generated_defconfig:72:warning: override: reassigning to symbol ARCH_QEMU
generated_defconfig:72:warning: override: ARCH_QEMU changes choice state
#
# configuration written to .config
#

It is OK?

Signature · 1 line
Jerome
#32 lore raw

Re: [PATCH v5 16/20] configs: add qemu_arm64_lwip_defconfig

Quoted 64 lines · Jerome Forissier
Quoted 31 lines · Tom Rini
Quoted 30 lines · Jerome Forissier
Quoted 26 lines · Tom Rini
Quoted 17 lines · Jerome Forissier

Add 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 | 5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 configs/qemu_arm64_lwip_defconfig
configs/qemu_arm64_lwip_defconfig new file +0 -0
new file mode 100644
index 00000000000..1afef04d7a0

configs/qemu_arm64_lwip_defconfig line 5

Quoted 5 lines
configs/qemu_arm64_lwip_defconfig new file +5 -0
@@ -0,0 +1,5 @@
+#include <configs/qemu_arm64_defconfig>
+CONFIG_NET_LWIP=y
+CONFIG_CMD_DNS=y
+CONFIG_CMD_WGET=y
+CONFIG_EFI_HTTP_BOOT=y

This doesn't work,

Quoted 5 lines
Quoted 2 lines

How so? I've used "make qemu_arm64_lwip_defconfig" hundreds of time to build for arm64 QEMU :o

Yes, but buildman (and CI) are in a chicken-and-egg situation without a few more details in the new defconfig, sadly.

With:

$ cat configs/qemu_arm64_lwip_defconfig
#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

...I get:

$ make qemu_arm64_lwip_defconfig
generated_defconfig:71:warning: override: reassigning to symbol ARM
generated_defconfig:71:warning: override: ARM changes choice state
generated_defconfig:72:warning: override: reassigning to symbol ARCH_QEMU
generated_defconfig:72:warning: override: ARCH_QEMU changes choice state
#
# configuration written to .config
#
Quoted 1 line

It is OK?

Yes, that's fine. Thanks.

Signature · 1 line
Tom
#33 lore raw

PATCH v5 17/20 lwip: tftp: add support of blksize option to client

In reply to 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 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
index ddfdbfc0c1b..e08e9665124 100644
@@ -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  6
 
 enum 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 *addr
           send_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 *addr
         close_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;
@@ -493,6 +563,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
index 24dbda6a8c9..e1e21d06b67 100644
@@ -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
#34 lore raw

PATCH v5 18/20 net-lwip: add TFTP_BLOCKSIZE

In reply to Jerome Forissier

Add 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
index 952690d677d..7e5406bb923 100644
@@ -69,16 +69,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
@@ -263,4 +253,14 @@ config SYS_RX_ETH_BUFFER
 	  since all buffers can be full shortly after enabling the interface on
 	  high Ethernet traffic.
 
+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
net/lwip/tftp.c +2 -0
index 78de0bd0dba..1fe948c84ec 100644
@@ -136,6 +136,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
#35 lore raw

Re: [PATCH v5 18/20] net-lwip: add TFTP_BLOCKSIZE

Hi Jerome,

Quoted 23 lines · Jerome Forissier

Add 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 +0 -0
index 952690d677d..7e5406bb923 100644
@@ -69,16 +69,6 @@ config SYS_FAULT_ECHO_LINK_DOWN
          this option is active, then CONFIG_SYS_FAULT_MII_ADDR also needs to
          be configured.
 

net/Kconfig config SYS_FAULT_ECHO_LINK_DOWN · line 81

Quoted 10 lines
net/Kconfig +0 -10
-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.
-

Why do you have to move the config option?

Cheers
/Ilias

Quoted 34 lines
net/Kconfig +10 -0
 config TFTP_PORT
        bool "Set TFTP UDP source/destination ports via the environment"
        help
@@ -263,4 +253,14 @@ config SYS_RX_ETH_BUFFER
          since all buffers can be full shortly after enabling the interface on
          high Ethernet traffic.
 
+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
net/lwip/tftp.c +2 -1
index 78de0bd0dba..1fe948c84ec 100644
@@ -136,6 +136,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 */
--

2.40.1

#36 lore raw

Re: [PATCH v5 18/20] net-lwip: add TFTP_BLOCKSIZE

Hi Ilias,

Quoted 27 lines · Ilias Apalodimas

Hi Jerome,

Quoted 23 lines · Jerome Forissier

Add 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 +0 -0
index 952690d677d..7e5406bb923 100644
@@ -69,16 +69,6 @@ config SYS_FAULT_ECHO_LINK_DOWN
          this option is active, then CONFIG_SYS_FAULT_MII_ADDR also needs to
          be configured.
 
Quoted 12 lines

net/Kconfig config SYS_FAULT_ECHO_LINK_DOWN · line 81

Quoted 10 lines
net/Kconfig +0 -10
-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.
-

Why do you have to move the config option?

It is moved from the 'if NET' block to the 'if NET || NET_LWIP' block since it now applies to both.

Thanks,

Signature · 1 line
Jerome
Quoted 37 lines

Cheers
/Ilias

Quoted 34 lines
net/Kconfig +10 -0
 config TFTP_PORT
        bool "Set TFTP UDP source/destination ports via the environment"
        help
@@ -263,4 +253,14 @@ config SYS_RX_ETH_BUFFER
          since all buffers can be full shortly after enabling the interface on
          high Ethernet traffic.
 
+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
net/lwip/tftp.c +2 -1
index 78de0bd0dba..1fe948c84ec 100644
@@ -136,6 +136,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 */
--

2.40.1

Reviewed-by
#37 lore raw

Re: [PATCH v5 18/20] net-lwip: add TFTP_BLOCKSIZE

Quoted 80 lines · Jerome Forissier

Hi Ilias,

Quoted 27 lines · Ilias Apalodimas

Hi Jerome,

Quoted 23 lines · Jerome Forissier

Add 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 +0 -0
index 952690d677d..7e5406bb923 100644
@@ -69,16 +69,6 @@ config SYS_FAULT_ECHO_LINK_DOWN
          this option is active, then CONFIG_SYS_FAULT_MII_ADDR also needs to
          be configured.
 
Quoted 12 lines

net/Kconfig config SYS_FAULT_ECHO_LINK_DOWN · line 81

Quoted 10 lines
net/Kconfig +0 -10
-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.
-

Why do you have to move the config option?

It is moved from the 'if NET' block to the 'if NET || NET_LWIP' block since it now applies to both.

Thanks,
--
Jerome

Quoted 29 lines

Cheers
/Ilias

Quoted 26 lines
net/Kconfig +10 -0
 config TFTP_PORT
        bool "Set TFTP UDP source/destination ports via the environment"
        help
@@ -263,4 +253,14 @@ config SYS_RX_ETH_BUFFER
          since all buffers can be full shortly after enabling the interface on
          high Ethernet traffic.
 
+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
net/lwip/tftp.c +0 -0
index 78de0bd0dba..1fe948c84ec 100644
@@ -136,6 +136,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);
 
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
net/lwip/tftp.c +2 -1
+       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 */
--

2.40.1

reviewer
#38 lore raw
In reply to Jerome Forissier

Hi Jerome,

Quoted 8 lines · Jerome Forissier

- 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.).

Adding Tim.

Thanks for fixing the i.MX8MP problems.

Cheers

#39 lore raw

PATCH v5 19/20 CI: add qemu_arm64_lwip to the test matrix

In reply to Jerome Forissier

Build 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
index c43bb51066a..7f91f204676 100644
@@ -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
@@ -410,6 +414,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
#40 lore raw

PATCH v5 20/20 MAINTAINERS: net-lwip: add myself as a maintainer

In reply to Jerome Forissier

Add myself as a maintainer for the lwIP network stack integration code and network commands. The library code itself (i.e., most files under lib/lwip/ except README, Makefile and integration files in u-boot) is unmodified from upstream and therefore does not need a maintainer.

---
 MAINTAINERS | 11 +++++++++++
 1 file changed, 11 insertions(+)
MAINTAINERS +11 -0
index 6b32a6d9464..10323efffad 100644
@@ -1336,6 +1336,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:	include/net-lwip.h
+F:	lib/lwip/Makefile
+F:	lib/lwip/README
+F:	lib/lwip/u-boot/
+F:	net-lwip/
+
 NIOS
 M:	Thomas Chou <[email protected]>
 S:	Maintained
Signature · 1 line
2.40.1
#41 lore raw
In reply to Jerome Forissier
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 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

Quoted 4 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://git.savannah.gnu.org/git/lwip.git STABLE-2_2_0_RELEASE

This is better than v4, and on the hardware platforms I could build and boot on (which was most of mine except the am62x_beagleplay), the tests ran and completed, including the tftp+boot a Linux kernel.

The bad news is CI blows up, a lot:
https://source.denx.de/u-boot/u-boot/-/pipelines/21764
And:
https://dev.azure.com/u-boot/a1096300-2999-4ec4-a21a-4c22075e3771/_apis/build/builds/9014/logs/106
which is another Kconfig dependency problem. I don't _think_ I introduced that, but since this wasn't against top of tree, I had to apply the cmd/Kconfig patch manually.

I have my world build running still and may have more comments based on that.

Signature · 1 line
Tom
#42 lore raw
Quoted 38 lines · Tom Rini
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 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

Quoted 4 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://git.savannah.gnu.org/git/lwip.git STABLE-2_2_0_RELEASE

This is better than v4, and on the hardware platforms I could build and boot on (which was most of mine except the am62x_beagleplay), the tests ran and completed, including the tftp+boot a Linux kernel.

The bad news is CI blows up, a lot:
https://source.denx.de/u-boot/u-boot/-/pipelines/21764
And:
https://dev.azure.com/u-boot/a1096300-2999-4ec4-a21a-4c22075e3771/_apis/build/builds/9014/logs/106
which is another Kconfig dependency problem. I don't _think_ I introduced that, but since this wasn't against top of tree, I had to apply the cmd/Kconfig patch manually.

Quoted 2 lines

I have my world build running still and may have more comments based on that.

First, with NET_LWIP being default rather than NET, there's a lot of other Kconfig dependency issues. Unfortunately I don't see an easy tool for making sure this is all clean aside from a shell loop like:
for C in (cd configs;ls);do make -s $C;done

Once those are fixed, this is feeling pretty OK I think. I assume PXE
support is high on the follow-up TODO list? That said, after taking tiger-rk3588 as an example platform and hacking out PXE related stuff and turning on lwIP:
aarch64: (for 1/1 boards) all +10144.0 bss -4040.0 data -64.0 rodata -100.0 text +14348.0
tiger-rk3588 : all +10144 bss -4040 data -64 rodata -100 text +14348
u-boot: add: 161/-115, grow: 8/-6 bytes: 24552/-14382 (10170)
function old new delta
dhcp_recv - 1296 +1296
tftp_recv - 1152 +1152
ip4_input - 596 +596
new_netif - 556 +556
etharp_query - 552 +552
udp_input - 540 +540
etharp_input - 532 +532
distro_efi_read_bootflow_net - 516 +516
dhcp_loop - 512 +512
ip4addr_aton - 492 +492
static.dhcp_select - 484 +484
ip4_output_if_src - 436 +436
udp_sendto_if_src - 408 +408
static.dhcp_reboot - 400 +400
etharp_output - 400 +400
dhcp_create_msg - 384 +384
etharp_find_entry - 376 +376
dhcp_bind - 364 +364
send_request - 352 +352
dhcp_discover - 352 +352
raw_sendto_if_src - 328 +328
pbuf_copy_partial_pbuf - 328 +328
netif_add - 324 +324
do_tftpb 544 868 +324
pbuf_alloc - 308 +308
dhcp_release_and_stop - 308 +308
net_lwip_rx - 292 +292
raw_input - 288 +288
udp_bind - 284 +284
ethernet_input - 284 +284
etharp_raw - 284 +284
static.dhcp_handle_ack - 272 +272
ping_send - 248 +248
ip4addr_ntoa_r - 220 +220
inet_chksum_pseudo - 216 +216
ping_recv - 212 +212
etharp_output_to_arp_index - 208 +208
netif_set_addr - 204 +204
do_ping 124 328 +204
dhcp_start - 204 +204
send_data - 192 +192
dhcp_fine_tmr - 192 +192
pbuf_copy_partial - 184 +184
tftp_close - 176 +176
script_read_bootflow 420 596 +176
linkoutput - 176 +176
ethernet_output - 176 +176
tftp_write - 172 +172
pbuf_memcmp - 168 +168
static.send_error - 164 +164
netif_remove - 164 +164
raw_sendto - 160 +160
arp_table - 160 +160
tftp_init_common - 156 +156
pbuf_realloc - 152 +152
dhcp_inc_pcb_refcount - 152 +152
tftp_tmr - 148 +148
pbuf_free - 148 +148
udp_sendto - 144 +144
udp_connect - 144 +144
sys_timeout_abs - 140 +140
ip4_route - 136 +136
static.resend_data - 132 +132
pbuf_memfind - 128 +128
pbuf_add_header_impl - 128 +128
boot_file_name - 128 +128
static.netif_do_set_ipaddr - 124 +124
lwip_standard_chksum - 124 +124
sys_check_timeouts - 120 +120
tftp_error - 116 +116
etharp_free_entry - 116 +116
tftp_get - 112 +112
dhcp_run - 112 +112
static.send_ack - 108 +108
eth_start_udev - 104 +104
close_handle - 96 +96
sys_untimeout - 92 +92
ip4_addr_isbroadcast_u32 - 92 +92
init_packet - 92 +92
etharp_cleanup_netif - 92 +92
raw_new - 88 +88
pbuf_remove_header - 88 +88
net_lwip_get_netif - 88 +88
dhcp_option_trailer - 88 +88
udp_sendto_if - 84 +84
pbuf_alloc_reference - 84 +84
udp_remove - 80 +80
ip4_input_accept - 80 +80
netif_set_link_up - 76 +76
udp_netif_ip_addr_changed - 72 +72
raw_remove - 72 +72
raw_netif_ip_addr_changed - 72 +72
dhcp_option_long - 68 +68
dhcp_dec_pcb_refcount - 68 +68
udp_new - 64 +64
sys_timeout - 60 +60
pbuf_try_get_at - 60 +60
pbuf_clone - 60 +60
dhcp_network_changed_link_up - 60 +60
tftp_cleanup - 56 +56
pbuf_cat - 56 +56
netif_get_by_index - 56 +56
_u_boot_list_2_cmd_2_dhcp - 56 +56
tftp_state 4 56 +52
pbuf_skip_const - 48 +48
net_lwip_if_init - 48 +48
dhcp_supplied_address - 48 +48
netif_issue_reports - 44 +44
tftp_context - 40 +40
ip_data - 40 +40
etharp_request - 40 +40
raw_bind - 36 +36
net_lwip_remove_netif - 36 +36
memp_malloc - 36 +36
ip4_output_if - 36 +36
dhcp_option_short - 36 +36
call_lwip_dhcp_fine_tmr - 36 +36
netif_set_up - 32 +32
netif_set_down - 32 +32
inet_chksum - 32 +32
dhcp_set_state - 32 +32
dhcp_rx_options_val - 32 +32
pbuf_get_at - 28 +28
distro_efi_read_bootflow 60 88 +28
distro_efi_boot 360 388 +28
tftp_client_set_blksize - 24 +24
sys_now - 24 +24
pbuf_copy - 24 +24
pbuf_chain - 24 +24
memp_free - 24 +24
eth_bootdev_hunt 44 68 +24
do_dhcp - 24 +24
pbuf_ref - 20 +20
netif_input - 20 +20
do_net_stats 328 348 +20
static.str - 16 +16
ip4addr_ntoa - 16 +16
udp_recv - 12 +12
tftp_init_client - 12 +12
netif_set_default - 12 +12
udp_pcbs - 8 +8
tftp_read - 8 +8
tftp_open - 8 +8
raw_recv - 8 +8
raw_pcbs - 8 +8
pbuf_add_header - 8 +8
next_timeout - 8 +8
netif_null_output_ip4 - 8 +8
netif_list - 8 +8
netif_default - 8 +8
net_lwip_new_netif_noip - 8 +8
net_lwip_new_netif - 8 +8
lwip_htons - 8 +8
lwip_htonl - 8 +8
dhcp_rx_options_given - 8 +8
dhcp_pcb - 8 +8
udp_new_ip_type - 4 +4
static.xid - 4 +4
mem_trim - 4 +4
mem_malloc - 4 +4
mem_free - 4 +4
ip_chksum_pseudo - 4 +4
current_timeout_due_time - 4 +4
udp_port - 2 +2
ip_id - 2 +2
static.called - 1 +1
netif_num - 1 +1
etharp_cached_entry - 1 +1
dhcp_pcb_refcount - 1 +1
net_boot_file_name_explicit 1 - -1
tftp_windowsize 2 - -2
tftp_window_size_option 2 - -2
tftp_next_ack 2 - -2
tftp_last_nack 2 - -2
tftp_block_size_option 2 - -2
tftp_block_size 2 - -2
ping_seq_number 2 - -2
net_our_vlan 2 - -2
net_native_vlan 2 - -2
env_flags_vartype_rep 7 5 -2
timeout_count_max 4 - -4
timeout_count 4 - -4
tftp_timeout_count_max 4 - -4
tftp_remote_port 4 - -4
tftp_remote_ip 4 - -4
tftp_our_port 4 - -4
static.first_call 4 - -4
saved_tftp_block_size_option 4 - -4
net_try_count 4 - -4
net_state 4 - -4
net_server_ip 4 - -4
net_rx_packet_len 4 - -4
net_restarted 4 - -4
net_ping_ip 4 - -4
net_netmask 4 - -4
net_ip_id 4 - -4
net_ip 4 - -4
net_gateway 4 - -4
net_dns_server 4 - -4
net_dev_exists 4 - -4
net_boot_file_size 4 - -4
net_boot_file_expected_size_in_blocks 4 - -4
net_arp_wait_reply_ip 4 - -4
net_arp_wait_packet_ip 4 - -4
dummy_handler 4 - -4
arp_wait_tx_packet_size 4 - -4
arp_wait_try 4 - -4
net_server_ethaddr 6 - -6
net_ethaddr 6 - -6
udp_packet_handler 8 - -8
timeout_ms 8 - -8
time_handler 8 - -8
time_delta 8 - -8
tftp_prev_block 8 - -8
tftp_load_size 8 - -8
tftp_load_addr 8 - -8
tftp_cur_block 8 - -8
tftp_block_wrap_offset 8 - -8
tftp_block_wrap 8 - -8
net_tx_packet 8 - -8
net_rx_packet 8 - -8
arp_wait_timer_start 8 - -8
arp_wait_packet_ethaddr 8 - -8
arp_tx_packet 8 - -8
arp_packet_handler 8 - -8
net_get_arp_handler 12 - -12
default_filename 13 - -13
time_start 16 - -16
start_again_timeout_handler 16 - -16
_u_boot_list_2_env_clbk_2_vlan 16 - -16
_u_boot_list_2_env_clbk_2_serverip 16 - -16
_u_boot_list_2_env_clbk_2_nvlan 16 - -16
_u_boot_list_2_env_clbk_2_netmask 16 - -16
_u_boot_list_2_env_clbk_2_ipaddr 16 - -16
_u_boot_list_2_env_clbk_2_gatewayip 16 - -16
arp_is_waiting 20 - -20
net_set_udp_handler 24 - -24
ip_checksum_ok 28 - -28
ping_timeout_handler 32 - -32
net_clear_handlers 36 - -36
ip_to_string 36 - -36
is_serverip_in_cmd 40 - -40
net_send_udp_packet 44 - -44
net_get_async_tx_pkt_buf 44 - -44
eth_halt_state_only 44 - -44
on_vlan 48 - -48
on_serverip 48 - -48
on_nvlan 48 - -48
on_netmask 48 - -48
on_ipaddr 48 - -48
on_gatewayip 48 - -48
net_eth_hdr_size 56 - -56
arp_init 56 - -56
net_init_loop 60 - -60
eth_init 300 232 -68
env_flags_validate 644 576 -68
copy_filename 76 - -76
net_init 112 32 -80
string_to_vlan 84 - -84
net_set_timeout_handler 84 - -84
compute_ip_checksum 92 - -92
tftp_init_load_addr 100 - -100
skip_num 104 - -104
tftp_filename 128 - -128
arp_request 128 - -128
tftp_timeout_handler 132 - -132
lmb_get_free_size 136 - -136
net_set_udp_header 144 - -144
arp_timeout_check 148 - -148
net_update_ether 152 - -152
eth_validate_ethaddr_str 152 - -152
string_to_ip 156 - -156
net_parse_bootfile 160 - -160
net_set_ether 180 - -180
net_set_ip_header 184 - -184
arp_raw_request 228 - -228
ping_start 276 - -276
net_send_ip_packet 292 - -292
net_check_prereq 308 - -308
ping_receive 332 - -332
net_start_again 336 - -336
net_loop 544 - -544
arp_receive 560 - -560
tftp_send 584 - -584
net_process_received_packet 764 4 -760
tftp_start 908 - -908
net_boot_file_name 1024 - -1024
tftp_handler 1308 - -1308
net_pkt_buf 7744 6208 -1536
arp_tx_packet_buf 1600 - -1600

Although I'm not 100% sure that config is functionally equivalent, so perhaps it would be helpful if you could take a board or two and reconfigure them with the legacy stack, but equivalent functionality to with lwIP, for comparison sake? Thanks!

Signature · 1 line
Tom
#43 lore raw
Quoted 39 lines · Tom Rini
Quoted 38 lines · Tom Rini
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 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

Quoted 4 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://git.savannah.gnu.org/git/lwip.git STABLE-2_2_0_RELEASE

This is better than v4, and on the hardware platforms I could build and boot on (which was most of mine except the am62x_beagleplay), the tests ran and completed, including the tftp+boot a Linux kernel.

The bad news is CI blows up, a lot:
https://source.denx.de/u-boot/u-boot/-/pipelines/21764
And:
https://dev.azure.com/u-boot/a1096300-2999-4ec4-a21a-4c22075e3771/_apis/build/builds/9014/logs/106
which is another Kconfig dependency problem. I don't _think_ I introduced that, but since this wasn't against top of tree, I had to apply the cmd/Kconfig patch manually.

Quoted 7 lines
Quoted 2 lines

I have my world build running still and may have more comments based on that.

First, with NET_LWIP being default rather than NET, there's a lot of other Kconfig dependency issues. Unfortunately I don't see an easy tool for making sure this is all clean aside from a shell loop like:
for C in (cd configs;ls);do make -s $C;done

I have run this loop successfully with the upcoming v6 version. Some configs do print some warnings but there is no error.

Quoted 2 lines

Once those are fixed, this is feeling pretty OK I think. I assume PXE support is high on the follow-up TODO list?

Certainly, although I'm not sure I'll be able to spend time on it in the very near future.

Quoted 6 lines

That said, after taking
tiger-rk3588 as an example platform and hacking out PXE related stuff and turning on lwIP:

   aarch64: (for 1/1 boards) all +10144.0 bss -4040.0 data -64.0 rodata -100.0 text +14348.0
            tiger-rk3588   : all +10144 bss -4040 data -64 rodata -100 text +14348
               u-boot: add: 161/-115, grow: 8/-6 bytes: 24552/-14382 (10170)

[snip]

Quoted 4 lines

Although I'm not 100% sure that config is functionally equivalent, so perhaps it would be helpful if you could take a board or two and reconfigure them with the legacy stack, but equivalent functionality to with lwIP, for comparison sake? Thanks!

I tried two boards and compared NET (u-boot.net) agains NET_LWIP (u-boot). I will give more details on how to remove PXE from the NET build and select/unselect the proper Kconfig symbols to obtain equivalent functionality in the cover letter for v6. Note that dhcp, ping, dns, tftp and wget are enabled in both builds. Here are the results.

- For imx8mp_evk_defconfig:

$ ~/work/linux/scripts/bloat-o-meter u-boot.net u-boot | sed -n '1p;$p'
add/remove: 228/162 grow/shrink: 49/4 up/down: 51217/-29078 (22139)
Total: Before=651990, After=674129, chg +3.40%

- For rpi_3_32b_defconfig:

$ ~/work/linux/scripts/bloat-o-meter u-boot.net u-boot | sed -n '1p;$p'
add/remove: 256/92 grow/shrink: 5/8 up/down: 50934/-16780 (34154)
Total: Before=418877, After=453031, chg +8.15%

I will post v6 soon.

Thanks,

Signature · 1 line
Jerome
#44 lore raw
Quoted 45 lines · Jerome Forissier
Quoted 42 lines · Tom Rini
Quoted 40 lines · Tom Rini
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 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

Quoted 4 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://git.savannah.gnu.org/git/lwip.git STABLE-2_2_0_RELEASE

This is better than v4, and on the hardware platforms I could build and boot on (which was most of mine except the am62x_beagleplay), the tests ran and completed, including the tftp+boot a Linux kernel.

The bad news is CI blows up, a lot:
https://source.denx.de/u-boot/u-boot/-/pipelines/21764
And:
https://dev.azure.com/u-boot/a1096300-2999-4ec4-a21a-4c22075e3771/_apis/build/builds/9014/logs/106
which is another Kconfig dependency problem. I don't _think_ I introduced that, but since this wasn't against top of tree, I had to apply the cmd/Kconfig patch manually.

I have my world build running still and may have more comments based on that.

Quoted 7 lines
Quoted 4 lines

First, with NET_LWIP being default rather than NET, there's a lot of other Kconfig dependency issues. Unfortunately I don't see an easy tool for making sure this is all clean aside from a shell loop like:
for C in (cd configs;ls);do make -s $C;done

I have run this loop successfully with the upcoming v6 version. Some configs do print some warnings but there is no error.

Those warnings are the problem, I wasn't clear, sorry. If I could make it error, I would since then CI would catch it.

Signature · 1 line
Tom
#45 lore raw
Quoted 51 lines · Tom Rini
Quoted 50 lines · Jerome Forissier
Quoted 46 lines · Tom Rini
Quoted 38 lines · Tom Rini
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 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

Quoted 4 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://git.savannah.gnu.org/git/lwip.git STABLE-2_2_0_RELEASE

This is better than v4, and on the hardware platforms I could build and boot on (which was most of mine except the am62x_beagleplay), the tests ran and completed, including the tftp+boot a Linux kernel.

The bad news is CI blows up, a lot:
https://source.denx.de/u-boot/u-boot/-/pipelines/21764
And:
https://dev.azure.com/u-boot/a1096300-2999-4ec4-a21a-4c22075e3771/_apis/build/builds/9014/logs/106
which is another Kconfig dependency problem. I don't _think_ I introduced that, but since this wasn't against top of tree, I had to apply the cmd/Kconfig patch manually.

Quoted 2 lines

I have my world build running still and may have more comments based on that.

First, with NET_LWIP being default rather than NET, there's a lot of other Kconfig dependency issues. Unfortunately I don't see an easy tool for making sure this is all clean aside from a shell loop like:
for C in (cd configs;ls);do make -s $C;done

Quoted 5 lines
Quoted 2 lines

I have run this loop successfully with the upcoming v6 version. Some configs do print some warnings but there is no error.

Those warnings are the problem, I wasn't clear, sorry. If I could make it error, I would since then CI would catch it.

v6 won't add any warning besides the ones in the new qemu_arm64_lwip_defconfig file that you said were OK:

$ git co origin/next
$ for C in `(cd configs;ls)`;do echo $C...; make -s $C || break;done 2>&1 | tee configs_next.log
$ git checkout to-upstream/v6-wip
$ for C in `(cd configs;ls)`;do echo $C...; make -s $C || break;done 2>&1 | tee configs.log
$ diff -u configs_next.log configs.log
--- configs_next.log    2024-08-01 17:10:50.903533652 +0200
+++ configs.log 2024-08-01 17:03:55.497799493 +0200
@@ -2016,6 +2016,11 @@
 q8_a33_tablet_800x480_defconfig...
 qcom_defconfig...
 qemu_arm64_defconfig...
+qemu_arm64_lwip_defconfig...
+generated_defconfig:71:warning: override: reassigning to symbol ARM
+generated_defconfig:71:warning: override: ARM changes choice state
+generated_defconfig:72:warning: override: reassigning to symbol ARCH_QEMU
+generated_defconfig:72:warning: override: ARCH_QEMU changes choice state
 qemu_arm_defconfig...
 qemu-ppce500_defconfig...
 qemu-riscv32_defconfig...

Thanks,

Signature · 1 line
Jerome
#46 lore raw
Quoted 72 lines · Jerome Forissier
Quoted 51 lines · Tom Rini
Quoted 50 lines · Jerome Forissier
Quoted 46 lines · Tom Rini
Quoted 38 lines · Tom Rini
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 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

Quoted 4 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://git.savannah.gnu.org/git/lwip.git STABLE-2_2_0_RELEASE

This is better than v4, and on the hardware platforms I could build and boot on (which was most of mine except the am62x_beagleplay), the tests ran and completed, including the tftp+boot a Linux kernel.

The bad news is CI blows up, a lot:
https://source.denx.de/u-boot/u-boot/-/pipelines/21764
And:
https://dev.azure.com/u-boot/a1096300-2999-4ec4-a21a-4c22075e3771/_apis/build/builds/9014/logs/106
which is another Kconfig dependency problem. I don't _think_ I introduced that, but since this wasn't against top of tree, I had to apply the cmd/Kconfig patch manually.

Quoted 2 lines

I have my world build running still and may have more comments based on that.

First, with NET_LWIP being default rather than NET, there's a lot of other Kconfig dependency issues. Unfortunately I don't see an easy tool for making sure this is all clean aside from a shell loop like:
for C in (cd configs;ls);do make -s $C;done

Quoted 5 lines
Quoted 2 lines

I have run this loop successfully with the upcoming v6 version. Some configs do print some warnings but there is no error.

Those warnings are the problem, I wasn't clear, sorry. If I could make it error, I would since then CI would catch it.

v6 won't add any warning besides the ones in the new qemu_arm64_lwip_defconfig file that you said were OK:

$ git co origin/next
$ for C in `(cd configs;ls)`;do echo $C...; make -s $C || break;done 2>&1 | tee configs_next.log
$ git checkout to-upstream/v6-wip
$ for C in `(cd configs;ls)`;do echo $C...; make -s $C || break;done 2>&1 | tee configs.log
$ diff -u configs_next.log configs.log
configs.log 2024-08-01 17:03:55.497799493 +0200 renamed from configs_next.log 2024-08-01 17:10:50.903533652 +0200 +0 -0
@@ -2016,6 +2016,11 @@
 q8_a33_tablet_800x480_defconfig...

configs.log 2024-08-01 17:03:55.497799493 +0200 line 2026

Quoted 10 lines
configs.log 2024-08-01 17:03:55.497799493 +0200 renamed from configs_next.log 2024-08-01 17:10:50.903533652 +0200 +5 -0
 qcom_defconfig...
 qemu_arm64_defconfig...
+qemu_arm64_lwip_defconfig...
+generated_defconfig:71:warning: override: reassigning to symbol ARM
+generated_defconfig:71:warning: override: ARM changes choice state
+generated_defconfig:72:warning: override: reassigning to symbol ARCH_QEMU
+generated_defconfig:72:warning: override: ARCH_QEMU changes choice state
 qemu_arm_defconfig...
 qemu-ppce500_defconfig...
 qemu-riscv32_defconfig...

Ah, ok, thanks.

Signature · 1 line
Tom
#47 lore raw
In reply to Jerome Forissier
Quoted 45 lines · Jerome Forissier
Quoted 42 lines · Tom Rini
Quoted 40 lines · Tom Rini
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 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

Quoted 4 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://git.savannah.gnu.org/git/lwip.git STABLE-2_2_0_RELEASE

This is better than v4, and on the hardware platforms I could build and boot on (which was most of mine except the am62x_beagleplay), the tests ran and completed, including the tftp+boot a Linux kernel.

The bad news is CI blows up, a lot:
https://source.denx.de/u-boot/u-boot/-/pipelines/21764
And:
https://dev.azure.com/u-boot/a1096300-2999-4ec4-a21a-4c22075e3771/_apis/build/builds/9014/logs/106
which is another Kconfig dependency problem. I don't _think_ I introduced that, but since this wasn't against top of tree, I had to apply the cmd/Kconfig patch manually.

I have my world build running still and may have more comments based on that.

Quoted 7 lines
Quoted 4 lines

First, with NET_LWIP being default rather than NET, there's a lot of other Kconfig dependency issues. Unfortunately I don't see an easy tool for making sure this is all clean aside from a shell loop like:
for C in (cd configs;ls);do make -s $C;done

I have run this loop successfully with the upcoming v6 version. Some configs do print some warnings but there is no error.

Oh. Right. So, to make the rest of the problems show up, switch the default stack to NET_LWIP and then we see other issues.

Signature · 1 line
Tom
#48 lore raw
Quoted 51 lines · Tom Rini
Quoted 50 lines · Jerome Forissier
Quoted 46 lines · Tom Rini
Quoted 38 lines · Tom Rini
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 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

Quoted 4 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://git.savannah.gnu.org/git/lwip.git STABLE-2_2_0_RELEASE

This is better than v4, and on the hardware platforms I could build and boot on (which was most of mine except the am62x_beagleplay), the tests ran and completed, including the tftp+boot a Linux kernel.

The bad news is CI blows up, a lot:
https://source.denx.de/u-boot/u-boot/-/pipelines/21764
And:
https://dev.azure.com/u-boot/a1096300-2999-4ec4-a21a-4c22075e3771/_apis/build/builds/9014/logs/106
which is another Kconfig dependency problem. I don't _think_ I introduced that, but since this wasn't against top of tree, I had to apply the cmd/Kconfig patch manually.

Quoted 2 lines

I have my world build running still and may have more comments based on that.

First, with NET_LWIP being default rather than NET, there's a lot of other Kconfig dependency issues. Unfortunately I don't see an easy tool for making sure this is all clean aside from a shell loop like:
for C in (cd configs;ls);do make -s $C;done

Quoted 5 lines
Quoted 2 lines

I have run this loop successfully with the upcoming v6 version. Some configs do print some warnings but there is no error.

Oh. Right. So, to make the rest of the problems show up, switch the default stack to NET_LWIP and then we see other issues.

Indeed. I fixed a couple "unmet direct dependencies detected" warnings in v8.

Thanks,

Signature · 1 line
Jerome
#49 lore raw
In reply to Tom Rini
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 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:

Quoted 8 lines
Quoted 1 line
 $  git subtree add --squash --prefix lib/lwip/lwip https://git.savannah.gnu.org/git/lwip.git STABLE-2_2_0_RELEASE

This is better than v4, and on the hardware platforms I could build and boot on (which was most of mine except the am62x_beagleplay), the tests ran and completed, including the tftp+boot a Linux kernel.

The bad news is CI blows up, a lot:
https://source.denx.de/u-boot/u-boot/-/pipelines/21764

They're all failing with: undefined reference to `tftp_start' The reason is I inadvertently removed the 'default y' on CMD_TFTPBOOT :/ Fixed in v6.

Quoted 5 lines

And:
https://dev.azure.com/u-boot/a1096300-2999-4ec4-a21a-4c22075e3771/_apis/build/builds/9014/logs/106
which is another Kconfig dependency problem. I don't _think_ I introduced that, but since this wasn't against top of tree, I had to apply the cmd/Kconfig patch manually.

What's the build command? I can see:

/bin/bash --noprofile --norc /Users/runner/work/_temp/9710a6d2-6670-4f76-81bc-990cc45b1898.sh

...but that's not super helpful ;)

Quoted 3 lines

I have my world build running still and may have more comments based on that.

Thanks,

Signature · 1 line
Jerome
#50 lore raw
Quoted 46 lines · Jerome Forissier
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 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:

Quoted 8 lines
Quoted 1 line
 $  git subtree add --squash --prefix lib/lwip/lwip https://git.savannah.gnu.org/git/lwip.git STABLE-2_2_0_RELEASE

This is better than v4, and on the hardware platforms I could build and boot on (which was most of mine except the am62x_beagleplay), the tests ran and completed, including the tftp+boot a Linux kernel.

The bad news is CI blows up, a lot:
https://source.denx.de/u-boot/u-boot/-/pipelines/21764

They're all failing with: undefined reference to `tftp_start' The reason is I inadvertently removed the 'default y' on CMD_TFTPBOOT :/ Fixed in v6.

Quoted 5 lines

And:
https://dev.azure.com/u-boot/a1096300-2999-4ec4-a21a-4c22075e3771/_apis/build/builds/9014/logs/106
which is another Kconfig dependency problem. I don't _think_ I introduced that, but since this wasn't against top of tree, I had to apply the cmd/Kconfig patch manually.

Quoted 5 lines

What's the build command? I can see:

/bin/bash --noprofile --norc /Users/runner/work/_temp/9710a6d2-6670-4f76-81bc-990cc45b1898.sh

...but that's not super helpful ;)

make tools-only_defconfig or so, sorry.

Signature · 1 line
Tom
#51 lore raw
Quoted 47 lines · Tom Rini
Quoted 46 lines · Jerome Forissier
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 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:

Quoted 8 lines
Quoted 1 line
 $  git subtree add --squash --prefix lib/lwip/lwip https://git.savannah.gnu.org/git/lwip.git STABLE-2_2_0_RELEASE

This is better than v4, and on the hardware platforms I could build and boot on (which was most of mine except the am62x_beagleplay), the tests ran and completed, including the tftp+boot a Linux kernel.

The bad news is CI blows up, a lot:
https://source.denx.de/u-boot/u-boot/-/pipelines/21764

They're all failing with: undefined reference to `tftp_start' The reason is I inadvertently removed the 'default y' on CMD_TFTPBOOT :/ Fixed in v6.

Quoted 5 lines

And:
https://dev.azure.com/u-boot/a1096300-2999-4ec4-a21a-4c22075e3771/_apis/build/builds/9014/logs/106
which is another Kconfig dependency problem. I don't _think_ I introduced that, but since this wasn't against top of tree, I had to apply the cmd/Kconfig patch manually.

Quoted 7 lines
Quoted 5 lines

What's the build command? I can see:

/bin/bash --noprofile --norc /Users/runner/work/_temp/9710a6d2-6670-4f76-81bc-990cc45b1898.sh

...but that's not super helpful ;)

make tools-only_defconfig or so, sorry.

Thanks. With this config on my build machine, v5 fails with 'CONFIG_SYS_RX_BUFFER undeclared here'. It is an issue that you mentioned (and which I fixed for v6) but it is not the same error reported in the CI. Anyways with the SYS_RX_BUFFER issue fixed the build is now successful:

$ make tools-only_defconfig && make -s -j$(nproc) && echo OK
#
# configuration written to .config
#
OK

Thanks,

Signature · 1 line
Jerome
#52 lore raw
In reply to Jerome Forissier

Hi Jerome

Quoted 45 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 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://git.savannah.gnu.org/git/lwip.git STABLE-2_2_0_RELEASE

Notes:

1. A number of features are currently incompatible with NET_LWIP: SANDBOX, DFU_TFTP, FASTBOOT, SPL_NET. 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, a new QEMU configuration is introduced (qemu_arm64_lwip_defconfig) which is the same as qemu_arm64_defconfig but with NET_LWIP and CMD_*_LWIP enabled. Tests are added to test/py/tests/test_net.py for that configuration.

3. The default QEMU networking doesn't work with NET_LWIP. wget pauses and resets the connection. Wireshark shows [TCP Window Full] and [TCP ZeroWindow]. Wen using an emulated e1000 however all is fine (that is "-nic tap,model=e1000" on the QEMU command line, with a bridge configured on the host).

Changes in v5:

Quoted 11 lines

- 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.)

Here I have some questions. You can have CONFIG_NET with two alternatives and the alternatives are exclusive. Why do we need a CONFIG_NO_NET definition?

Michael

Quoted 336 lines

- 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.

[1] https://lore.kernel.org/all/[email protected]/
[2] https://www.nongnu.org/lwip/
[3] https://en.wikipedia.org/wiki/LwIP

CC Javier Tia <[email protected]>
CC Raymond Mao <[email protected]>

Jerome Forissier (19):
flash: prefix error codes with FL_
net: introduce alternative implementation as net-lwip/
configs: replace '# CONFIG_NET is not set' with CONFIG_NO_NET=y
net: fec_mxc_init(): do not ignore return status of fec_open()
net: split include/net.h into net{,-common,-legacy,-lwip}.h
net: eth-uclass: add function eth_start_udev()
net-lwip: build lwIP
net-lwip: add DHCP support and dhcp commmand
net-lwip: add TFTP support and tftpboot command
net-lwip: add ping command
net-lwip: add dns command
net: 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

Jonathan Humphreys (1):
net-lwip: lwIP wget supports user defined port in the uri, so allow

    it.
 .azure-pipelines.yml                          |   7 +
 Kconfig                                       |  26 +
 MAINTAINERS                                   |  11 +
 Makefile                                      |   4 +-
 board/cobra5272/flash.c                       |  26 +-
 board/freescale/m5253demo/flash.c             |   6 +-
 boot/Kconfig                                  |   3 +-
 cmd/Kconfig                                   |  84 +-
 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                                |   2 +-
 common/board_r.c                              |   4 +-
 common/flash.c                                |  44 +-
 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/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/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             |   5 +
 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                  |   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 +-
 .../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/mtd/cfi_flash.c                       |  36 +-
 drivers/net/Kconfig                           |   3 +-
 drivers/net/fec_mxc.c                         |   3 +-
 drivers/net/phy/Kconfig                       |   2 +-
 drivers/usb/gadget/Kconfig                    |   2 +-
 include/flash.h                               |  20 +-
 include/net-common.h                          | 413 ++++++++
 include/net-legacy.h                          | 635 ++++++++++++
 include/net-lwip.h                            |  37 +
 include/net.h                                 | 944 +-----------------
 lib/Makefile                                  |   2 +
 lib/lwip/Makefile                             |  55 +
 lib/lwip/lwip/src/apps/tftp/tftp.c            |  94 +-
 .../lwip/src/include/lwip/apps/tftp_client.h  |   1 +
 lib/lwip/u-boot/arch/cc.h                     |  43 +
 lib/lwip/u-boot/arch/sys_arch.h               |   0
 lib/lwip/u-boot/limits.h                      |   0
 lib/lwip/u-boot/lwipopts.h                    | 157 +++
 net/Kconfig                                   |  49 +-
 net/Makefile                                  |  19 +-
 net/eth-uclass.c                              |  38 +-
 net/lwip/Kconfig                              |  34 +
 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                           | 292 ++++++
 net/lwip/ping.c                               | 177 ++++
 net/lwip/tftp.c                               | 276 +++++
 net/lwip/wget.c                               | 272 +++++
 157 files changed, 3311 insertions(+), 1321 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 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

--
2.40.1

Signature · 11 lines
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com
#53 lore raw
Quoted 61 lines · Michael Nazzareno Trimarchi

Hi Jerome

Quoted 45 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 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://git.savannah.gnu.org/git/lwip.git STABLE-2_2_0_RELEASE

Notes:

1. A number of features are currently incompatible with NET_LWIP: SANDBOX, DFU_TFTP, FASTBOOT, SPL_NET. 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, a new QEMU configuration is introduced (qemu_arm64_lwip_defconfig) which is the same as qemu_arm64_defconfig but with NET_LWIP and CMD_*_LWIP enabled. Tests are added to test/py/tests/test_net.py for that configuration.

3. The default QEMU networking doesn't work with NET_LWIP. wget pauses and resets the connection. Wireshark shows [TCP Window Full] and [TCP ZeroWindow]. Wen using an emulated e1000 however all is fine (that is "-nic tap,model=e1000" on the QEMU command line, with a bridge configured on the host).

Changes in v5:

Quoted 11 lines

- 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.)

Quoted 2 lines

Here I have some questions. You can have CONFIG_NET with two alternatives and the alternatives are exclusive. Why do we need a CONFIG_NO_NET definition?

For the platforms that today don't enable networking at all (of which there are a small but reasonable number). Since it's a "choice" statement we need a "none of the above" option.

Signature · 1 line
Tom