[PATCH] Revert "net: eth_bootdev_hunt() should not run DHCP"
Heiko Stuebner
heiko at sntech.de
Tue Apr 1 10:38:30 CEST 2025
This reverts commit 1f68057e03206e6597ca8b2be8bb1c49d4bd47d0.
Commit 1f68057e0320 ("net: eth_bootdev_hunt() should not run DHCP")
aims to reduce EFI boot times by disabling the dhcp_run when
checking ethernet bootdevices, by preventing it from running double,
with the reasoning
We need to call eth_bootdev_hunt() when setting up the EFI sub-system to
supply the simple network protocol. We don't need an IP address set up.
That might by true for EFI, but not for everything else, because when
running distro-boot and for example the PXE method in it, nothing will
set up an IP address now.
So for example in my setup of Rockchip boards, no dhcp runs and pxe then
fails with messages like:
Retrieving file: pxelinux.cfg/01-....
Speed: 100, full duplex
*** ERROR: `serverip' not set
Retrieving file: pxelinux.cfg/00000000
Speed: 100, full duplex
*** ERROR: `serverip' not set
As the original commit message talks about speed efficiencies for the EFI
side mostly, reverting this should just restore previous functionality
(and in fact does so on my Rockchip boards).
Signed-off-by: Heiko Stuebner <heiko at sntech.de>
---
net/eth_bootdev.c | 30 ++++++++++++------------------
1 file changed, 12 insertions(+), 18 deletions(-)
diff --git a/net/eth_bootdev.c b/net/eth_bootdev.c
index b0fca6e8313..6ee54e3c790 100644
--- a/net/eth_bootdev.c
+++ b/net/eth_bootdev.c
@@ -64,23 +64,9 @@ static int eth_bootdev_bind(struct udevice *dev)
return 0;
}
-/**
- * eth_bootdev_hunt() - probe all network devices
- *
- * Network devices can also come from USB, but that is a higher
- * priority (BOOTDEVP_5_SCAN_SLOW) than network, so it should have been
- * enumerated already. If something like 'bootflow scan dhcp' is used,
- * then the user will need to run 'usb start' first.
- *
- * @info: info structure describing this hunter
- * @show: true to show information from the hunter
- *
- * Return: 0 if device found, -EINVAL otherwise
- */
static int eth_bootdev_hunt(struct bootdev_hunter *info, bool show)
{
int ret;
- struct udevice *dev = NULL;
if (!test_eth_enabled())
return 0;
@@ -92,11 +78,19 @@ static int eth_bootdev_hunt(struct bootdev_hunter *info, bool show)
log_warning("Failed to init PCI (%dE)\n", ret);
}
- ret = -EINVAL;
- uclass_foreach_dev_probe(UCLASS_ETH, dev)
- ret = 0;
+ /*
+ * Ethernet devices can also come from USB, but that is a higher
+ * priority (BOOTDEVP_5_SCAN_SLOW) than ethernet, so it should have been
+ * enumerated already. If something like 'bootflow scan dhcp' is used
+ * then the user will need to run 'usb start' first.
+ */
+ if (IS_ENABLED(CONFIG_CMD_DHCP)) {
+ ret = dhcp_run(0, NULL, false);
+ if (ret)
+ return -EINVAL;
+ }
- return ret;
+ return 0;
}
struct bootdev_ops eth_bootdev_ops = {
--
2.47.2
More information about the U-Boot
mailing list