From: Quentin Schulz Date: Mon, 20 Apr 2026 11:36:10 +0000 (+0200) Subject: simplify NET_LEGACY || NET_LWIP condition with NET condition X-Git-Tag: v2026.07-rc1~2^2~2 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=95d66d2eb02a4677c63d04c84ca21750a04c49f1;p=thirdparty%2Fu-boot.git simplify NET_LEGACY || NET_LWIP condition with NET condition Since the move to make NET a menuconfig and NO_NET a synonym of NET=n, when NET is enabled, NET_LEGACY || NET_LWIP is necessarily true, so let's simplify the various checks across the codebase. SPL_NET_LWIP doesn't exist but SPL_NET_LEGACY is an alias for SPL_NET so the proper symbol is still defined in SPL whenever needed. Signed-off-by: Quentin Schulz Reviewed-by: Simon Glass Reviewed-by: Peter Robinson Reviewed-by: Tom Rini --- diff --git a/Makefile b/Makefile index 285a9e2beed..32d82c0697a 100644 --- a/Makefile +++ b/Makefile @@ -1081,7 +1081,7 @@ libs-$(CONFIG_OF_EMBED) += dts/ libs-y += env/ libs-y += lib/ libs-y += fs/ -libs-$(filter y,$(CONFIG_NET_LEGACY) $(CONFIG_NET_LWIP)) += net/ +libs-$(CONFIG_NET) += net/ libs-y += disk/ libs-y += drivers/ libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/ diff --git a/board/engicam/imx8mp/icore_mx8mp.c b/board/engicam/imx8mp/icore_mx8mp.c index f01da961235..547cfa3a35f 100644 --- a/board/engicam/imx8mp/icore_mx8mp.c +++ b/board/engicam/imx8mp/icore_mx8mp.c @@ -30,7 +30,7 @@ static void setup_fec(void) setbits_le32(&gpr->gpr[1], BIT(22)); } -#if CONFIG_IS_ENABLED(NET_LEGACY) || CONFIG_IS_ENABLED(NET_LWIP) +#if CONFIG_IS_ENABLED(NET) int board_phy_config(struct phy_device *phydev) { if (phydev->drv->config) diff --git a/board/polyhex/imx8mp_debix_model_a/imx8mp_debix_model_a.c b/board/polyhex/imx8mp_debix_model_a/imx8mp_debix_model_a.c index cff9383bad4..23d24140ca7 100644 --- a/board/polyhex/imx8mp_debix_model_a/imx8mp_debix_model_a.c +++ b/board/polyhex/imx8mp_debix_model_a/imx8mp_debix_model_a.c @@ -26,7 +26,7 @@ static void setup_fec(void) setbits_le32(&gpr->gpr[1], BIT(22)); } -#if CONFIG_IS_ENABLED(NET_LEGACY) || CONFIG_IS_ENABLED(NET_LWIP) +#if CONFIG_IS_ENABLED(NET) int board_phy_config(struct phy_device *phydev) { if (phydev->drv->config) diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index 4b7aa5c8586..b5f69a45a7c 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -911,7 +911,7 @@ int board_late_init(void) #endif /* CPSW plat */ -#if (CONFIG_IS_ENABLED(NET_LEGACY) || CONFIG_IS_ENABLED(NET_LWIP)) && \ +#if CONFIG_IS_ENABLED(NET) && \ !CONFIG_IS_ENABLED(OF_CONTROL) struct cpsw_slave_data slave_data[] = { { diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c index b21a1361137..89562ef77fc 100644 --- a/board/xilinx/common/board.c +++ b/board/xilinx/common/board.c @@ -508,8 +508,7 @@ int board_late_init_xilinx(void) ret |= env_set_by_index("uuid", id, uuid); } - if (!(CONFIG_IS_ENABLED(NET_LEGACY) || - CONFIG_IS_ENABLED(NET_LWIP))) + if (!CONFIG_IS_ENABLED(NET)) continue; for (i = 0; i < EEPROM_HDR_NO_OF_MAC_ADDR; i++) { diff --git a/cmd/Kconfig b/cmd/Kconfig index f19a656146a..64f70b22e26 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1946,7 +1946,7 @@ config CMD_XXD endmenu -if NET_LEGACY || NET_LWIP +if NET menuconfig CMD_NET bool "Network commands" @@ -2329,7 +2329,7 @@ config CMD_PXE endif # if CMD_NET -endif # NET_LEGACY || NET_LWIP +endif # NET menu "Misc commands" diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c index 39e7bec3885..ddf77303735 100644 --- a/cmd/bdinfo.c +++ b/cmd/bdinfo.c @@ -152,7 +152,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_NET_LEGACY) || IS_ENABLED(CONFIG_NET_LWIP)) + if (IS_ENABLED(CONFIG_NET)) print_eth(); bdinfo_print_num_l("fdt_blob", (ulong)map_to_sysmem(gd->fdt_blob)); if (IS_ENABLED(CONFIG_VIDEO)) @@ -194,8 +194,7 @@ 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_NET_LEGACY) && - !IS_ENABLED(CONFIG_NET_LWIP)) + if (!IS_ENABLED(CONFIG_NET)) return CMD_RET_USAGE; print_eth(); return CMD_RET_SUCCESS; @@ -221,7 +220,7 @@ U_BOOT_CMD( " - print all Board Info structure" #if CONFIG_IS_ENABLED(GETOPT) "\n" -#if IS_ENABLED(CONFIG_NET_LEGACY) || IS_ENABLED(CONFIG_NET_LWIP) +#if IS_ENABLED(CONFIG_NET) "bdinfo -e\n" " - print Board Info related to network\n" #endif diff --git a/common/Kconfig b/common/Kconfig index 3c3af0e3647..8e8c733aa29 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -425,7 +425,7 @@ config LOGF_FUNC_PAD config LOG_SYSLOG bool "Log output to syslog server" - depends on NET_LEGACY || NET_LWIP + depends on NET help Enables a log driver which broadcasts log records via UDP port 514 to syslog servers. diff --git a/common/board_r.c b/common/board_r.c index 37e6f51c7a7..45942910829 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -495,7 +495,7 @@ static int initr_boot_led_on(void) return 0; } -#if CONFIG_IS_ENABLED(NET_LEGACY) || CONFIG_IS_ENABLED(NET_LWIP) +#if CONFIG_IS_ENABLED(NET) static int initr_net(void) { puts("Net: "); @@ -756,7 +756,7 @@ static void initcall_run_r(void) #if CONFIG_IS_ENABLED(PCI_ENDPOINT) INITCALL(pci_ep_init); #endif -#if CONFIG_IS_ENABLED(NET_LEGACY) || CONFIG_IS_ENABLED(NET_LWIP) +#if CONFIG_IS_ENABLED(NET) WATCHDOG_RESET(); INITCALL(initr_net); #endif diff --git a/doc/usage/cmd/bdinfo.rst b/doc/usage/cmd/bdinfo.rst index 09db9101bd1..6226d14bd66 100644 --- a/doc/usage/cmd/bdinfo.rst +++ b/doc/usage/cmd/bdinfo.rst @@ -124,12 +124,12 @@ Build current eth name of the active network device - Only shown if CONFIG_NET_LEGACY=y or CONFIG_NET_LWIP=y. + Only shown if CONFIG_NET=y. IP addr network address, value of the environment variable *ipaddr* - Only shown if CONFIG_NET_LEGACY=y or CONFIG_NET_LWIP=y. + Only shown if CONFIG_NET=y. fdt_blob address of U-Boot's own device tree, NULL if none @@ -173,5 +173,4 @@ The bdinfo command is available if CONFIG_CMD_BDI=y. The options to bdinfo are only available if CONFIG_GETOPT=y. -The ``-e`` option is additionally only available if CONFIG_NET_LEGACY=y or -CONFIG_NET_LWIP=y. +The ``-e`` option is additionally only available if CONFIG_NET=y. diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index f0288387aed..666618681df 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -339,7 +339,7 @@ config ESSEDMA config ETH_SANDBOX depends on SANDBOX - depends on NET_LEGACY || NET_LWIP + depends on NET default y bool "Sandbox: Mocked Ethernet driver" help diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 93f32aea595..0025c895f12 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -7,7 +7,7 @@ config MV88E6352_SWITCH menuconfig PHYLIB bool "Ethernet PHY (physical media interface) support" - depends on NET_LEGACY || NET_LWIP + depends on NET help Enable Ethernet PHY (physical media interface) support. diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index d4ffc24c063..18582962249 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -232,7 +232,7 @@ endif # USB_GADGET_DOWNLOAD config USB_ETHER bool "USB Ethernet Gadget" - depends on NET_LEGACY || NET_LWIP + depends on NET default y if ARCH_SUNXI && USB_MUSB_GADGET help Creates an Ethernet network device through a USB peripheral diff --git a/env/flags.c b/env/flags.c index 45eb9820d9f..f1966bc91b4 100644 --- a/env/flags.c +++ b/env/flags.c @@ -22,7 +22,7 @@ #include #endif -#if CONFIG_IS_ENABLED(NET_LEGACY) || CONFIG_IS_ENABLED(NET_LWIP) +#if CONFIG_IS_ENABLED(NET) #define ENV_FLAGS_NET_VARTYPE_REPS "im" #else #define ENV_FLAGS_NET_VARTYPE_REPS "" @@ -57,7 +57,7 @@ static const char * const env_flags_vartype_names[] = { "decimal", "hexadecimal", "boolean", -#if CONFIG_IS_ENABLED(NET_LEGACY) || CONFIG_IS_ENABLED(NET_LWIP) +#if CONFIG_IS_ENABLED(NET) "IP address", "MAC address", #endif @@ -211,7 +211,7 @@ static void skip_num(int hex, const char *value, const char **end, *end = value; } -#if CONFIG_IS_ENABLED(NET_LEGACY) || CONFIG_IS_ENABLED(NET_LWIP) +#if CONFIG_IS_ENABLED(NET) int eth_validate_ethaddr_str(const char *addr) { const char *end; @@ -244,7 +244,7 @@ static int _env_flags_validate_type(const char *value, enum env_flags_vartype type) { const char *end; -#if CONFIG_IS_ENABLED(NET_LEGACY) || CONFIG_IS_ENABLED(NET_LWIP) +#if CONFIG_IS_ENABLED(NET) const char *cur; int i; #endif @@ -273,7 +273,7 @@ static int _env_flags_validate_type(const char *value, if (value[1] != '\0') return -1; break; -#if CONFIG_IS_ENABLED(NET_LEGACY) || CONFIG_IS_ENABLED(NET_LWIP) +#if CONFIG_IS_ENABLED(NET) case env_flags_vartype_ipaddr: cur = value; for (i = 0; i < 4; i++) { diff --git a/include/env_callback.h b/include/env_callback.h index f7bb23df569..1181ab4a157 100644 --- a/include/env_callback.h +++ b/include/env_callback.h @@ -32,7 +32,7 @@ #define DNS_CALLBACK #endif -#if CONFIG_IS_ENABLED(NET_LEGACY) || CONFIG_IS_ENABLED(NET_LWIP) +#if CONFIG_IS_ENABLED(NET) #define NET_CALLBACKS \ "bootfile:bootfile," \ "ipaddr:ipaddr," \ diff --git a/include/env_flags.h b/include/env_flags.h index 85721a89cfb..123fdbcb0ba 100644 --- a/include/env_flags.h +++ b/include/env_flags.h @@ -14,7 +14,7 @@ enum env_flags_vartype { env_flags_vartype_decimal, env_flags_vartype_hex, env_flags_vartype_bool, -#if CONFIG_IS_ENABLED(NET_LEGACY) || CONFIG_IS_ENABLED(NET_LWIP) +#if CONFIG_IS_ENABLED(NET) env_flags_vartype_ipaddr, env_flags_vartype_macaddr, #endif @@ -41,7 +41,7 @@ enum env_flags_varaccess { #define CFG_ENV_FLAGS_LIST_STATIC "" #endif -#if CONFIG_IS_ENABLED(NET_LEGACY) || CONFIG_IS_ENABLED(NET_LWIP) +#if CONFIG_IS_ENABLED(NET) #ifdef CONFIG_REGEX #define ETHADDR_WILDCARD "\\d*" #else @@ -123,7 +123,7 @@ enum env_flags_varaccess env_flags_parse_varaccess(const char *flags); */ enum env_flags_varaccess env_flags_parse_varaccess_from_binflags(int binflags); -#if CONFIG_IS_ENABLED(NET_LEGACY) || CONFIG_IS_ENABLED(NET_LWIP) +#if CONFIG_IS_ENABLED(NET) /* * Check if a string has the format of an Ethernet MAC address */ diff --git a/include/net-common.h b/include/net-common.h index 0cbdf344664..69b6316c1ec 100644 --- a/include/net-common.h +++ b/include/net-common.h @@ -235,7 +235,7 @@ int eth_rx(void); /* Check for received packets */ */ void reset_phy(void); -#if CONFIG_IS_ENABLED(NET_LEGACY) || CONFIG_IS_ENABLED(NET_LWIP) +#if CONFIG_IS_ENABLED(NET) /** * eth_set_enable_bootdevs() - Enable or disable binding of Ethernet bootdevs * diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 495a85fa869..3279fc88354 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -517,7 +517,7 @@ config EFI_RISCV_BOOT_PROTOCOL config EFI_IP4_CONFIG2_PROTOCOL bool "EFI_IP4_CONFIG2_PROTOCOL support" default y if ARCH_QEMU || SANDBOX - depends on NET_LEGACY || NET_LWIP + depends on NET help Provides an implementation of the EFI_IP4_CONFIG2_PROTOCOL, this protocol can be used to set and get the current ip address and @@ -599,7 +599,7 @@ config EFI_BOOTMGR config EFI_HTTP_BOOT bool "EFI HTTP Boot support" - depends on NET_LEGACY || NET_LWIP + depends on NET select CMD_NET select CMD_DHCP select CMD_DNS diff --git a/net/Makefile b/net/Makefile index a9323ceb40b..ceac6de6377 100644 --- a/net/Makefile +++ b/net/Makefile @@ -37,7 +37,7 @@ CFLAGS_eth_common.o += -Wno-format-extra-args endif -ifeq ($(filter y,$(CONFIG_NET_LEGACY) $(CONFIG_NET_LWIP)),y) +ifeq ($(CONFIG_NET),y) obj-$(CONFIG_DM_DSA) += dsa-uclass.o obj-$(CONFIG_$(PHASE_)DM_ETH) += eth-uclass.o obj-$(CONFIG_$(PHASE_)BOOTDEV_ETH) += eth_bootdev.o diff --git a/test/cmd/bdinfo.c b/test/cmd/bdinfo.c index 3233a0a6a51..7f4f1868c6a 100644 --- a/test/cmd/bdinfo.c +++ b/test/cmd/bdinfo.c @@ -172,7 +172,7 @@ static int bdinfo_test_all(struct unit_test_state *uts) ut_assertok(test_num_l(uts, "reloc off", gd->reloc_off)); ut_assert_nextline("%-12s= %u-bit", "Build", (uint)sizeof(void *) * 8); - if (IS_ENABLED(CONFIG_NET_LEGACY) || IS_ENABLED(CONFIG_NET_LWIP)) + if (IS_ENABLED(CONFIG_NET)) ut_assertok(test_eth(uts)); /* @@ -314,7 +314,7 @@ static int bdinfo_test_help(struct unit_test_state *uts) ut_assert_nextlinen("bdinfo -a"); ut_assert_nextlinen(" - print all Board Info structure"); if (CONFIG_IS_ENABLED(GETOPT)) { - if (IS_ENABLED(CONFIG_NET_LEGACY) || IS_ENABLED(CONFIG_NET_LWIP)) { + if (IS_ENABLED(CONFIG_NET)) { ut_assert_nextlinen("bdinfo -e"); ut_assert_nextlinen(" - print Board Info related to network"); } @@ -348,7 +348,7 @@ static int bdinfo_test_eth(struct unit_test_state *uts) ut_assertok(run_commandf("bdinfo -e")); if (!CONFIG_IS_ENABLED(GETOPT)) ut_assertok(bdinfo_test_all(uts)); - else if (IS_ENABLED(CONFIG_NET_LEGACY) || IS_ENABLED(CONFIG_NET_LWIP)) + else if (IS_ENABLED(CONFIG_NET)) ut_assertok(test_eth(uts)); ut_assert_console_end(); diff --git a/test/py/tests/test_efi_loader.py b/test/py/tests/test_efi_loader.py index fc45209a581..91f151d09cd 100644 --- a/test/py/tests/test_efi_loader.py +++ b/test/py/tests/test_efi_loader.py @@ -98,7 +98,7 @@ def test_efi_setup_dhcp(ubman): global net_set_up net_set_up = True -@pytest.mark.buildconfigspec('net_legacy', 'net_lwip') +@pytest.mark.buildconfigspec('net') def test_efi_setup_static(ubman): """Set up the network using a static IP configuration. diff --git a/test/py/tests/test_fpga.py b/test/py/tests/test_fpga.py index 0ab47c0bde5..74cd42b910e 100644 --- a/test/py/tests/test_fpga.py +++ b/test/py/tests/test_fpga.py @@ -506,7 +506,7 @@ def test_fpga_loadfs(ubman): @pytest.mark.buildconfigspec('cmd_fpga_load_secure') @pytest.mark.buildconfigspec('cmd_net') @pytest.mark.buildconfigspec('cmd_dhcp') -@pytest.mark.buildconfigspec('net_legacy', 'net_lwip') +@pytest.mark.buildconfigspec('net') def test_fpga_secure_bit_auth(ubman): test_net.test_net_dhcp(ubman) @@ -534,7 +534,7 @@ def test_fpga_secure_bit_auth(ubman): @pytest.mark.buildconfigspec('cmd_fpga_load_secure') @pytest.mark.buildconfigspec('cmd_net') @pytest.mark.buildconfigspec('cmd_dhcp') -@pytest.mark.buildconfigspec('net_legacy', 'net_lwip') +@pytest.mark.buildconfigspec('net') def test_fpga_secure_bit_img_auth_kup(ubman): test_net.test_net_dhcp(ubman) diff --git a/test/py/tests/test_net.py b/test/py/tests/test_net.py index 4f899530060..27cdd73fd49 100644 --- a/test/py/tests/test_net.py +++ b/test/py/tests/test_net.py @@ -201,7 +201,7 @@ def test_net_dhcp6(ubman): global net6_set_up net6_set_up = True -@pytest.mark.buildconfigspec('net_legacy', 'net_lwip') +@pytest.mark.buildconfigspec('net') def test_net_setup_static(ubman): """Set up a static IP configuration.