Revert "net: eth_bootdev_hunt() should not run DHCP"
PATCH 1/1 Revert "net: eth_bootdev_hunt() should not run DHCP"
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).
--- net/eth_bootdev.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-)
net/eth_bootdev.c +12 -18
@@ -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 = {
Signature · 1 line
2.47.2
Quoted 25 lines · Heiko Stuebner
This reverts commit
1f68057e03206e6597ca8b2be8bb1c49d4bd47d0.Commit
1f68057e0320("net:eth_bootdev_hunt()should not run DHCP") aims to reduce EFI boot times by disabling thedhcp_runwhen checking ethernet bootdevices, by preventing it from running double, with the reasoningWe 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
Quoted 8 lines
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 <[email protected]>--- net/eth_bootdev.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-)
Quoted 9 lines · Simon Glass
Quoted 8 lines · Heiko Stuebner
This reverts commit
1f68057e03206e6597ca8b2be8bb1c49d4bd47d0.Commit
1f68057e0320("net:eth_bootdev_hunt()should not run DHCP") aims to reduce EFI boot times by disabling thedhcp_runwhen checking ethernet bootdevices, by preventing it from running double, with the reasoning
Quoted 6 lines
Quoted 6 lines
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.
The removed call was dhcp_run(addr, NULL, true);
We have:
distro_efi_read_bootflow_net():boot/bootmeth_efi.c:205: ret = dhcp_run(addr, NULL, true);
script_read_bootflow_net():boot/bootmeth_script.c:132: ret = dhcp_run(addr, fname, true);
extlinux_pxe_read_bootflow() seems to be lacking the call.
So instead of reverting1f68057e0320 ("net: eth_bootdev_hunt() should not run DHCP") we should add the missing call in extlinux_pxe_read_bootflow().
Best regards
Heinrich
Quoted 21 lines
Quoted 11 lines
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 setQuoted 8 lines
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 <[email protected]>--- net/eth_bootdev.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-)Reviewed-by Simon Glass <[email protected]>
Hi,
Quoted 25 lines · Heinrich Schuchardt
Quoted 9 lines · Simon Glass
Quoted 8 lines · Heiko Stuebner
This reverts commit
1f68057e03206e6597ca8b2be8bb1c49d4bd47d0.Commit
1f68057e0320("net:eth_bootdev_hunt()should not run DHCP") aims to reduce EFI boot times by disabling thedhcp_runwhen checking ethernet bootdevices, by preventing it from running double, with the reasoningQuoted 6 lines
Quoted 6 lines
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.
The removed call was
dhcp_run(addr, NULL, true);We have:
distro_efi_read_bootflow_net():boot/bootmeth_efi.c:205: ret =dhcp_run(addr, NULL, true);
Quoted 9 lines
script_read_bootflow_net():boot/bootmeth_script.c:132: ret =dhcp_run(addr, fname, true);
extlinux_pxe_read_bootflow()seems to be lacking the call.So instead of reverting
1f68057e0320("net:eth_bootdev_hunt()should not run DHCP") we should add the missing call inextlinux_pxe_read_bootflow().
The original design was to run DHCP once, in the hunter. That seems to have changed, due to it causing problems with EFI?
I'd like to go back to doing it in the hunter. It really doesn't make sense for each bootmeth to do its own DHCP again, does it?
Regards,
Simon
Am Dienstag, 1. April 2025, 18:13:35 MESZ schrieb Heinrich Schuchardt:
Quoted 24 lines · Simon Glass
Quoted 9 lines · Heiko Stuebner
Quoted 8 lines
This reverts commit
1f68057e03206e6597ca8b2be8bb1c49d4bd47d0.Commit
1f68057e0320("net:eth_bootdev_hunt()should not run DHCP") aims to reduce EFI boot times by disabling thedhcp_runwhen checking ethernet bootdevices, by preventing it from running double, with the reasoningQuoted 6 lines
Quoted 6 lines
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.
The removed call was
dhcp_run(addr, NULL, true);We have:
distro_efi_read_bootflow_net():boot/bootmeth_efi.c:205: ret =dhcp_run(addr, NULL, true);
Quoted 8 lines
script_read_bootflow_net():boot/bootmeth_script.c:132: ret =dhcp_run(addr, fname, true);
extlinux_pxe_read_bootflow()seems to be lacking the call.So instead of reverting
1f68057e0320("net:eth_bootdev_hunt()should not run DHCP") we should add the missing call inextlinux_pxe_read_bootflow().
doing
----- 8< -----
boot/bootmeth_pxe.c +4 -0
@@ -73,6 +73,10 @@ static int extlinux_pxe_read_bootflow(struct udevice *dev,return log_msg_ret ("pxeb" , -EPERM ); addr =simple_strtoul (addr_str,NULL ,16 ); + ret =dhcp_run (addr,NULL , false); +if (ret) +return log_msg_ret ("dhc" , ret); +log_debug ("calling pxe_get()\n" ); ret =pxe_get (addr, &bootdir, &size, false);log_debug ("pxe_get() returned %d\n" , ret);
----- 8< -----
does seem to work in _my_ usecase and gets me loading stuff over pxe again.
I guess this whole thing now becomes a strategy decision ;-) :
- it's very late in the release, do we revert to the known working state or hope the above fixes all issues
- Simon's wish of not sprinkling dhcp_run calls in multiple places
I guess I'm fine with both way, as either fixes my use-case ;-)
Heiko
Am Mittwoch, 2. April 2025, 23:36:46 MESZ schrieb Heiko Stübner:
Quoted 54 lines
Am Dienstag, 1. April 2025, 18:13:35 MESZ schrieb Heinrich Schuchardt:
Quoted 24 lines · Simon Glass
Quoted 9 lines · Heiko Stuebner
Quoted 8 lines
This reverts commit
1f68057e03206e6597ca8b2be8bb1c49d4bd47d0.Commit
1f68057e0320("net:eth_bootdev_hunt()should not run DHCP") aims to reduce EFI boot times by disabling thedhcp_runwhen checking ethernet bootdevices, by preventing it from running double, with the reasoningQuoted 6 lines
Quoted 6 lines
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.
The removed call was
dhcp_run(addr, NULL, true);We have:
distro_efi_read_bootflow_net():boot/bootmeth_efi.c:205: ret =dhcp_run(addr, NULL, true);Quoted 8 lines
script_read_bootflow_net():boot/bootmeth_script.c:132: ret =dhcp_run(addr, fname, true);
extlinux_pxe_read_bootflow()seems to be lacking the call.So instead of reverting
1f68057e0320("net:eth_bootdev_hunt()should not run DHCP") we should add the missing call inextlinux_pxe_read_bootflow().doing
----- 8< -----
boot/bootmeth_pxe.c +4
-1@@ -73,6 +73,10 @@ static int extlinux_pxe_read_bootflow(struct udevice *dev,return log_msg_ret ("pxeb" , -EPERM ); addr =simple_strtoul (addr_str,NULL ,16 ); + ret =dhcp_run (addr,NULL , false); +if (ret) +return log_msg_ret ("dhc" , ret); +log_debug ("calling pxe_get()\n" ); ret =pxe_get (addr, &bootdir, &size, false);log_debug ("pxe_get() returned %d\n" , ret); ----- 8< -----
Quoted 2 lines
does seem to work in _my_ usecase and gets me loading stuff over pxe again.
For reference, I implemented that now in
https://lore.kernel.org/u-boot/[email protected]/
So people can decide which way to go :-)
Heiko
Quoted 9 lines
I guess this whole thing now becomes a strategy decision ;-) :
- it's very late in the release, do we revert to the known working state or hope the above fixes all issues
- Simon's wish of not sprinklingdhcp_runcalls in multiple placesI guess I'm fine with both way, as either fixes my use-case ;-)
Heiko
Hi Heiko,
Quoted 58 lines · Heiko Stübner
Am Dienstag, 1. April 2025, 18:13:35 MESZ schrieb Heinrich Schuchardt:
Quoted 24 lines · Simon Glass
Quoted 9 lines · Heiko Stuebner
Quoted 8 lines
This reverts commit
1f68057e03206e6597ca8b2be8bb1c49d4bd47d0.Commit
1f68057e0320("net:eth_bootdev_hunt()should not run DHCP") aims to reduce EFI boot times by disabling thedhcp_runwhen checking ethernet bootdevices, by preventing it from running double, with the reasoningQuoted 6 lines
Quoted 6 lines
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.
The removed call was
dhcp_run(addr, NULL, true);We have:
distro_efi_read_bootflow_net():boot/bootmeth_efi.c:205: ret =dhcp_run(addr, NULL, true);Quoted 8 lines
script_read_bootflow_net():boot/bootmeth_script.c:132: ret =dhcp_run(addr, fname, true);
extlinux_pxe_read_bootflow()seems to be lacking the call.So instead of reverting
1f68057e0320("net:eth_bootdev_hunt()should not run DHCP") we should add the missing call inextlinux_pxe_read_bootflow().doing
----- 8< -----
boot/bootmeth_pxe.c +4
-1@@ -73,6 +73,10 @@ static int extlinux_pxe_read_bootflow(struct udevice *dev,return log_msg_ret ("pxeb" , -EPERM ); addr =simple_strtoul (addr_str,NULL ,16 ); + ret =dhcp_run (addr,NULL , false); +if (ret) +return log_msg_ret ("dhc" , ret); +log_debug ("calling pxe_get()\n" ); ret =pxe_get (addr, &bootdir, &size, false);log_debug ("pxe_get() returned %d\n" , ret); ----- 8< -----does seem to work in _my_ usecase and gets me loading stuff over pxe again.
Quoted 7 lines
I guess this whole thing now becomes a strategy decision ;-) :
- it's very late in the release, do we revert to the known working state or hope the above fixes all issues
- Simon's wish of not sprinklingdhcp_runcalls in multiple placesI guess I'm fine with both way, as either fixes my use-case ;-)
For the reasons you patch seems fine to me. As you say, it is very late in the cycle.
I already gave this feedback to Heinrich, so once the revert is in he may have time to take a look.
Regards,
Simon