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 <quentin.schulz@cherry.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
Quentin Schulz
2026-04-20 13:36:10 +02:00
committed by Tom Rini
parent bd275172a8
commit 95d66d2eb0
23 changed files with 39 additions and 42 deletions

View File

@@ -1081,7 +1081,7 @@ libs-$(CONFIG_OF_EMBED) += dts/
libs-y += env/ libs-y += env/
libs-y += lib/ libs-y += lib/
libs-y += fs/ libs-y += fs/
libs-$(filter y,$(CONFIG_NET_LEGACY) $(CONFIG_NET_LWIP)) += net/ libs-$(CONFIG_NET) += net/
libs-y += disk/ libs-y += disk/
libs-y += drivers/ libs-y += drivers/
libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/ libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/

View File

@@ -30,7 +30,7 @@ static void setup_fec(void)
setbits_le32(&gpr->gpr[1], BIT(22)); 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) int board_phy_config(struct phy_device *phydev)
{ {
if (phydev->drv->config) if (phydev->drv->config)

View File

@@ -26,7 +26,7 @@ static void setup_fec(void)
setbits_le32(&gpr->gpr[1], BIT(22)); 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) int board_phy_config(struct phy_device *phydev)
{ {
if (phydev->drv->config) if (phydev->drv->config)

View File

@@ -911,7 +911,7 @@ int board_late_init(void)
#endif #endif
/* CPSW plat */ /* CPSW plat */
#if (CONFIG_IS_ENABLED(NET_LEGACY) || CONFIG_IS_ENABLED(NET_LWIP)) && \ #if CONFIG_IS_ENABLED(NET) && \
!CONFIG_IS_ENABLED(OF_CONTROL) !CONFIG_IS_ENABLED(OF_CONTROL)
struct cpsw_slave_data slave_data[] = { struct cpsw_slave_data slave_data[] = {
{ {

View File

@@ -508,8 +508,7 @@ int board_late_init_xilinx(void)
ret |= env_set_by_index("uuid", id, uuid); ret |= env_set_by_index("uuid", id, uuid);
} }
if (!(CONFIG_IS_ENABLED(NET_LEGACY) || if (!CONFIG_IS_ENABLED(NET))
CONFIG_IS_ENABLED(NET_LWIP)))
continue; continue;
for (i = 0; i < EEPROM_HDR_NO_OF_MAC_ADDR; i++) { for (i = 0; i < EEPROM_HDR_NO_OF_MAC_ADDR; i++) {

View File

@@ -1946,7 +1946,7 @@ config CMD_XXD
endmenu endmenu
if NET_LEGACY || NET_LWIP if NET
menuconfig CMD_NET menuconfig CMD_NET
bool "Network commands" bool "Network commands"
@@ -2329,7 +2329,7 @@ config CMD_PXE
endif # if CMD_NET endif # if CMD_NET
endif # NET_LEGACY || NET_LWIP endif # NET
menu "Misc commands" menu "Misc commands"

View File

@@ -152,7 +152,7 @@ static int bdinfo_print_all(struct bd_info *bd)
bdinfo_print_num_l("relocaddr", gd->relocaddr); bdinfo_print_num_l("relocaddr", gd->relocaddr);
bdinfo_print_num_l("reloc off", gd->reloc_off); bdinfo_print_num_l("reloc off", gd->reloc_off);
printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8); 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(); print_eth();
bdinfo_print_num_l("fdt_blob", (ulong)map_to_sysmem(gd->fdt_blob)); bdinfo_print_num_l("fdt_blob", (ulong)map_to_sysmem(gd->fdt_blob));
if (IS_ENABLED(CONFIG_VIDEO)) 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': case 'a':
return bdinfo_print_all(bd); return bdinfo_print_all(bd);
case 'e': case 'e':
if (!IS_ENABLED(CONFIG_NET_LEGACY) && if (!IS_ENABLED(CONFIG_NET))
!IS_ENABLED(CONFIG_NET_LWIP))
return CMD_RET_USAGE; return CMD_RET_USAGE;
print_eth(); print_eth();
return CMD_RET_SUCCESS; return CMD_RET_SUCCESS;
@@ -221,7 +220,7 @@ U_BOOT_CMD(
" - print all Board Info structure" " - print all Board Info structure"
#if CONFIG_IS_ENABLED(GETOPT) #if CONFIG_IS_ENABLED(GETOPT)
"\n" "\n"
#if IS_ENABLED(CONFIG_NET_LEGACY) || IS_ENABLED(CONFIG_NET_LWIP) #if IS_ENABLED(CONFIG_NET)
"bdinfo -e\n" "bdinfo -e\n"
" - print Board Info related to network\n" " - print Board Info related to network\n"
#endif #endif

View File

@@ -425,7 +425,7 @@ config LOGF_FUNC_PAD
config LOG_SYSLOG config LOG_SYSLOG
bool "Log output to syslog server" bool "Log output to syslog server"
depends on NET_LEGACY || NET_LWIP depends on NET
help help
Enables a log driver which broadcasts log records via UDP port 514 Enables a log driver which broadcasts log records via UDP port 514
to syslog servers. to syslog servers.

View File

@@ -495,7 +495,7 @@ static int initr_boot_led_on(void)
return 0; return 0;
} }
#if CONFIG_IS_ENABLED(NET_LEGACY) || CONFIG_IS_ENABLED(NET_LWIP) #if CONFIG_IS_ENABLED(NET)
static int initr_net(void) static int initr_net(void)
{ {
puts("Net: "); puts("Net: ");
@@ -756,7 +756,7 @@ static void initcall_run_r(void)
#if CONFIG_IS_ENABLED(PCI_ENDPOINT) #if CONFIG_IS_ENABLED(PCI_ENDPOINT)
INITCALL(pci_ep_init); INITCALL(pci_ep_init);
#endif #endif
#if CONFIG_IS_ENABLED(NET_LEGACY) || CONFIG_IS_ENABLED(NET_LWIP) #if CONFIG_IS_ENABLED(NET)
WATCHDOG_RESET(); WATCHDOG_RESET();
INITCALL(initr_net); INITCALL(initr_net);
#endif #endif

View File

@@ -124,12 +124,12 @@ Build
current eth current eth
name of the active network device 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 IP addr
network address, value of the environment variable *ipaddr* 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 fdt_blob
address of U-Boot's own device tree, NULL if none 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 options to bdinfo are only available if CONFIG_GETOPT=y.
The ``-e`` option is additionally only available if CONFIG_NET_LEGACY=y or The ``-e`` option is additionally only available if CONFIG_NET=y.
CONFIG_NET_LWIP=y.

View File

@@ -339,7 +339,7 @@ config ESSEDMA
config ETH_SANDBOX config ETH_SANDBOX
depends on SANDBOX depends on SANDBOX
depends on NET_LEGACY || NET_LWIP depends on NET
default y default y
bool "Sandbox: Mocked Ethernet driver" bool "Sandbox: Mocked Ethernet driver"
help help

View File

@@ -7,7 +7,7 @@ config MV88E6352_SWITCH
menuconfig PHYLIB menuconfig PHYLIB
bool "Ethernet PHY (physical media interface) support" bool "Ethernet PHY (physical media interface) support"
depends on NET_LEGACY || NET_LWIP depends on NET
help help
Enable Ethernet PHY (physical media interface) support. Enable Ethernet PHY (physical media interface) support.

View File

@@ -232,7 +232,7 @@ endif # USB_GADGET_DOWNLOAD
config USB_ETHER config USB_ETHER
bool "USB Ethernet Gadget" bool "USB Ethernet Gadget"
depends on NET_LEGACY || NET_LWIP depends on NET
default y if ARCH_SUNXI && USB_MUSB_GADGET default y if ARCH_SUNXI && USB_MUSB_GADGET
help help
Creates an Ethernet network device through a USB peripheral Creates an Ethernet network device through a USB peripheral

10
env/flags.c vendored
View File

@@ -22,7 +22,7 @@
#include <env_internal.h> #include <env_internal.h>
#endif #endif
#if CONFIG_IS_ENABLED(NET_LEGACY) || CONFIG_IS_ENABLED(NET_LWIP) #if CONFIG_IS_ENABLED(NET)
#define ENV_FLAGS_NET_VARTYPE_REPS "im" #define ENV_FLAGS_NET_VARTYPE_REPS "im"
#else #else
#define ENV_FLAGS_NET_VARTYPE_REPS "" #define ENV_FLAGS_NET_VARTYPE_REPS ""
@@ -57,7 +57,7 @@ static const char * const env_flags_vartype_names[] = {
"decimal", "decimal",
"hexadecimal", "hexadecimal",
"boolean", "boolean",
#if CONFIG_IS_ENABLED(NET_LEGACY) || CONFIG_IS_ENABLED(NET_LWIP) #if CONFIG_IS_ENABLED(NET)
"IP address", "IP address",
"MAC address", "MAC address",
#endif #endif
@@ -211,7 +211,7 @@ static void skip_num(int hex, const char *value, const char **end,
*end = value; *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) int eth_validate_ethaddr_str(const char *addr)
{ {
const char *end; const char *end;
@@ -244,7 +244,7 @@ static int _env_flags_validate_type(const char *value,
enum env_flags_vartype type) enum env_flags_vartype type)
{ {
const char *end; const char *end;
#if CONFIG_IS_ENABLED(NET_LEGACY) || CONFIG_IS_ENABLED(NET_LWIP) #if CONFIG_IS_ENABLED(NET)
const char *cur; const char *cur;
int i; int i;
#endif #endif
@@ -273,7 +273,7 @@ static int _env_flags_validate_type(const char *value,
if (value[1] != '\0') if (value[1] != '\0')
return -1; return -1;
break; break;
#if CONFIG_IS_ENABLED(NET_LEGACY) || CONFIG_IS_ENABLED(NET_LWIP) #if CONFIG_IS_ENABLED(NET)
case env_flags_vartype_ipaddr: case env_flags_vartype_ipaddr:
cur = value; cur = value;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {

View File

@@ -32,7 +32,7 @@
#define DNS_CALLBACK #define DNS_CALLBACK
#endif #endif
#if CONFIG_IS_ENABLED(NET_LEGACY) || CONFIG_IS_ENABLED(NET_LWIP) #if CONFIG_IS_ENABLED(NET)
#define NET_CALLBACKS \ #define NET_CALLBACKS \
"bootfile:bootfile," \ "bootfile:bootfile," \
"ipaddr:ipaddr," \ "ipaddr:ipaddr," \

View File

@@ -14,7 +14,7 @@ enum env_flags_vartype {
env_flags_vartype_decimal, env_flags_vartype_decimal,
env_flags_vartype_hex, env_flags_vartype_hex,
env_flags_vartype_bool, 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_ipaddr,
env_flags_vartype_macaddr, env_flags_vartype_macaddr,
#endif #endif
@@ -41,7 +41,7 @@ enum env_flags_varaccess {
#define CFG_ENV_FLAGS_LIST_STATIC "" #define CFG_ENV_FLAGS_LIST_STATIC ""
#endif #endif
#if CONFIG_IS_ENABLED(NET_LEGACY) || CONFIG_IS_ENABLED(NET_LWIP) #if CONFIG_IS_ENABLED(NET)
#ifdef CONFIG_REGEX #ifdef CONFIG_REGEX
#define ETHADDR_WILDCARD "\\d*" #define ETHADDR_WILDCARD "\\d*"
#else #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); 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 * Check if a string has the format of an Ethernet MAC address
*/ */

View File

@@ -235,7 +235,7 @@ int eth_rx(void); /* Check for received packets */
*/ */
void reset_phy(void); 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 * eth_set_enable_bootdevs() - Enable or disable binding of Ethernet bootdevs
* *

View File

@@ -517,7 +517,7 @@ config EFI_RISCV_BOOT_PROTOCOL
config EFI_IP4_CONFIG2_PROTOCOL config EFI_IP4_CONFIG2_PROTOCOL
bool "EFI_IP4_CONFIG2_PROTOCOL support" bool "EFI_IP4_CONFIG2_PROTOCOL support"
default y if ARCH_QEMU || SANDBOX default y if ARCH_QEMU || SANDBOX
depends on NET_LEGACY || NET_LWIP depends on NET
help help
Provides an implementation of the EFI_IP4_CONFIG2_PROTOCOL, this Provides an implementation of the EFI_IP4_CONFIG2_PROTOCOL, this
protocol can be used to set and get the current ip address and protocol can be used to set and get the current ip address and
@@ -599,7 +599,7 @@ config EFI_BOOTMGR
config EFI_HTTP_BOOT config EFI_HTTP_BOOT
bool "EFI HTTP Boot support" bool "EFI HTTP Boot support"
depends on NET_LEGACY || NET_LWIP depends on NET
select CMD_NET select CMD_NET
select CMD_DHCP select CMD_DHCP
select CMD_DNS select CMD_DNS

View File

@@ -37,7 +37,7 @@ CFLAGS_eth_common.o += -Wno-format-extra-args
endif endif
ifeq ($(filter y,$(CONFIG_NET_LEGACY) $(CONFIG_NET_LWIP)),y) ifeq ($(CONFIG_NET),y)
obj-$(CONFIG_DM_DSA) += dsa-uclass.o obj-$(CONFIG_DM_DSA) += dsa-uclass.o
obj-$(CONFIG_$(PHASE_)DM_ETH) += eth-uclass.o obj-$(CONFIG_$(PHASE_)DM_ETH) += eth-uclass.o
obj-$(CONFIG_$(PHASE_)BOOTDEV_ETH) += eth_bootdev.o obj-$(CONFIG_$(PHASE_)BOOTDEV_ETH) += eth_bootdev.o

View File

@@ -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_assertok(test_num_l(uts, "reloc off", gd->reloc_off));
ut_assert_nextline("%-12s= %u-bit", "Build", (uint)sizeof(void *) * 8); 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)); 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("bdinfo -a");
ut_assert_nextlinen(" - print all Board Info structure"); ut_assert_nextlinen(" - print all Board Info structure");
if (CONFIG_IS_ENABLED(GETOPT)) { 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("bdinfo -e");
ut_assert_nextlinen(" - print Board Info related to network"); 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")); ut_assertok(run_commandf("bdinfo -e"));
if (!CONFIG_IS_ENABLED(GETOPT)) if (!CONFIG_IS_ENABLED(GETOPT))
ut_assertok(bdinfo_test_all(uts)); 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_assertok(test_eth(uts));
ut_assert_console_end(); ut_assert_console_end();

View File

@@ -98,7 +98,7 @@ def test_efi_setup_dhcp(ubman):
global net_set_up global net_set_up
net_set_up = True net_set_up = True
@pytest.mark.buildconfigspec('net_legacy', 'net_lwip') @pytest.mark.buildconfigspec('net')
def test_efi_setup_static(ubman): def test_efi_setup_static(ubman):
"""Set up the network using a static IP configuration. """Set up the network using a static IP configuration.

View File

@@ -506,7 +506,7 @@ def test_fpga_loadfs(ubman):
@pytest.mark.buildconfigspec('cmd_fpga_load_secure') @pytest.mark.buildconfigspec('cmd_fpga_load_secure')
@pytest.mark.buildconfigspec('cmd_net') @pytest.mark.buildconfigspec('cmd_net')
@pytest.mark.buildconfigspec('cmd_dhcp') @pytest.mark.buildconfigspec('cmd_dhcp')
@pytest.mark.buildconfigspec('net_legacy', 'net_lwip') @pytest.mark.buildconfigspec('net')
def test_fpga_secure_bit_auth(ubman): def test_fpga_secure_bit_auth(ubman):
test_net.test_net_dhcp(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_fpga_load_secure')
@pytest.mark.buildconfigspec('cmd_net') @pytest.mark.buildconfigspec('cmd_net')
@pytest.mark.buildconfigspec('cmd_dhcp') @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): def test_fpga_secure_bit_img_auth_kup(ubman):
test_net.test_net_dhcp(ubman) test_net.test_net_dhcp(ubman)

View File

@@ -201,7 +201,7 @@ def test_net_dhcp6(ubman):
global net6_set_up global net6_set_up
net6_set_up = True net6_set_up = True
@pytest.mark.buildconfigspec('net_legacy', 'net_lwip') @pytest.mark.buildconfigspec('net')
def test_net_setup_static(ubman): def test_net_setup_static(ubman):
"""Set up a static IP configuration. """Set up a static IP configuration.