From: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
To: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>,
Michal Simek <michal.simek@amd.com>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Joe Hershberger <joe.hershberger@ni.com>,
Ramon Fried <rfried.dev@gmail.com>,
Jiaxun Yang <jiaxun.yang@flygoat.com>,
Patrick Rudolph <patrick.rudolph@9elements.com>,
Jerome Forissier <jerome.forissier@linaro.org>,
Sumit Garg <sumit.garg@linaro.org>,
Raymond Mao <raymond.mao@linaro.org>,
Weijie Gao <weijie.gao@mediatek.com>,
Daniel Golle <daniel@makrotopia.org>,
Svyatoslav Ryhel <clamor95@gmail.com>,
Mattijs Korpershoek <mkorpershoek@baylibre.com>,
Caleb Connolly <caleb.connolly@linaro.org>,
Marek Vasut <marek.vasut+renesas@mailbox.org>,
Jonathan Humphreys <j-humphreys@ti.com>,
Dmitry Rokosov <ddrokosov@salutedevices.com>,
u-boot@lists.denx.de
Subject: Re: [PATCH v2 4/6] net: eth_bootdev_hunt() should not run DHCP
Date: Wed, 4 Dec 2024 10:10:09 +0100 [thread overview]
Message-ID: <02a3fcf7-bdc7-4d44-9d0e-1a05bd5216a8@canonical.com> (raw)
In-Reply-To: <CAFLszTiS-2MCZih4CzM-3YjgvX0MraxvY_thSDdHVy0_T_do3Q@mail.gmail.com>
On 27.11.24 15:14, Simon Glass wrote:
> Hi Heinrich,
>
> On Wed, 27 Nov 2024 at 07:00, Heinrich Schuchardt
> <heinrich.schuchardt@canonical.com> wrote:
>>
>> On 27.11.24 14:07, Simon Glass wrote:
>>> Hi Heinrich,
>>>
>>> On Wed, 27 Nov 2024 at 00:07, Heinrich Schuchardt
>>> <heinrich.schuchardt@canonical.com> wrote:
>>>>
>>>> Currently when booting dhcp_run() may be executed multiple times:
>>>> once in eth_bootdev_hunt() and once in the network booting bootmeth.
>>>>
>>>> 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.
>>>>
>>>> We can reduce the bootime by not executing dhcp_run() in
>>>> eth_bootdev_hunt().
>>>>
>>>> Furthermore eth_bootdev_hunt() with autostart=yes leads on the legacy
>>>> network statck leads to downloading a file via TFTP and to booting the
>>>
>>> spelling
I will handle that in my pull request.
>>>
>>>> downloaded file.
>>>
>>> I have now found the feature you're referring to - the calls to
>>> env_get_autostart(). Perhaps we can remove this feature? It seems
>>> pretty old and I don't see boards using it.
Commands controlled by autostart include bootelf, dhcp, tftboot.
For tftpboot autostart=no makes sense if you may want to download
multiple files (kernel, initrd, dtb) before booting or the downloaded
file is a firmware upgrade.
But for PXE booting you will need autostart=yes. Many routers allow
recovery via TFTP.
For bootelf autostart=no leads to only checking the file in memory but
not actually booting.
I don't think that we can simply remove the setting looking at the
diverse use cases.
>>>
>>> That feature stops bootstd working properly.
>>>
>>> But if we don't remove it, we need to disable autostart in dhcp_run(),
>>> since in that case it does not behave correctly. I can do a patch for
>>> that if needed.
That change can be implemented separately from this patch series.
>>>
>>>>
>>>> Instead of running dchp_run() just check that there is a network device
>>>> in eth_bootdev_hunt().
>>>>
>>>> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
>>>> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
>>>> ---
>>>> v2:
>>>> reword the commit message
>>>> ---
>>>> net/eth_bootdev.c | 30 ++++++++++++++++++------------
>>>> 1 file changed, 18 insertions(+), 12 deletions(-)
>>>>
>>>> diff --git a/net/eth_bootdev.c b/net/eth_bootdev.c
>>>> index 6ee54e3c790..b0fca6e8313 100644
>>>> --- a/net/eth_bootdev.c
>>>> +++ b/net/eth_bootdev.c
>>>> @@ -64,9 +64,23 @@ 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;
>>>> @@ -78,19 +92,11 @@ static int eth_bootdev_hunt(struct bootdev_hunter *info, bool show)
>>>> log_warning("Failed to init PCI (%dE)\n", ret);
>>>> }
>>>>
>>>> - /*
>>>> - * 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.
>>>> - */
>>>
>>> Please keep this comment
>>
>> I have moved the comment to the function description. See above. I think
>> that is the adequate place.
>>
>>>
>>>> - if (IS_ENABLED(CONFIG_CMD_DHCP)) {
>>>> - ret = dhcp_run(0, NULL, false);
>>>> - if (ret)
>>>> - return -EINVAL;
>>>> - }
>>>> + ret = -EINVAL;
>>>> + uclass_foreach_dev_probe(UCLASS_ETH, dev)
>>>> + ret = 0;
>>>
>>> There is a uclass_probe_all() function.
>>>
>>> My suggestion from the original series was to just do the dhcp once.
>>>
>>> How does probing the ethernet devices actually help EFI? It is not
>>> needed for bootstd, since it probes any devices it uses.
>>
>> bootstd is not the only way to start an EFI application, you could use
>> bootefi or bootm.
>
> That's fine, but I'm just trying to understand what probing does, in
> this particular case. Doesn't EFI probe a device before it uses it? I
> think I am just missing some context.
EFI block devices will not even exist if not probed. See function
efi_disk_probe().
For network devices I would like to change the code in a similar fashion
in future to make all network devices available in the EFI sub-system.
Best regards
Heinrich
next prev parent reply other threads:[~2024-12-04 9:10 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-27 7:06 [PATCH v2 0/6] efi_loader: run bootdev_hunt() to find ESP Heinrich Schuchardt
2024-11-27 7:06 ` [PATCH v2 1/6] test: fix test_extension.py Heinrich Schuchardt
2024-11-27 7:06 ` [PATCH v2 2/6] configs: sandbox_deconfig: remove CONFIG_AMIGA_PARTITION Heinrich Schuchardt
2024-11-27 8:25 ` Ilias Apalodimas
2024-11-27 7:06 ` [PATCH v2 3/6] CI: xilinx_versal_virt: disable USB_DWC3 Heinrich Schuchardt
2024-11-27 12:07 ` Michal Simek
2024-11-27 7:06 ` [PATCH v2 4/6] net: eth_bootdev_hunt() should not run DHCP Heinrich Schuchardt
2024-11-27 13:07 ` Simon Glass
2024-11-27 14:00 ` Heinrich Schuchardt
2024-11-27 14:14 ` Simon Glass
2024-12-04 9:10 ` Heinrich Schuchardt [this message]
2024-12-04 15:13 ` Simon Glass
2024-11-27 7:06 ` [PATCH v2 5/6] cmd: bootmenu: add parameter -e for UEFI boot options Heinrich Schuchardt
2025-01-10 22:45 ` Tom Rini
2025-01-12 19:08 ` Heinrich Schuchardt
2025-01-13 1:51 ` Tom Rini
2025-01-13 19:01 ` Simon Glass
2025-01-13 19:04 ` Heinrich Schuchardt
2025-01-13 19:23 ` Tom Rini
2025-01-13 20:09 ` Simon Glass
2025-01-13 20:35 ` Tom Rini
2025-01-14 0:15 ` Simon Glass
2025-01-14 1:27 ` Tom Rini
2024-11-27 7:06 ` [PATCH v2 6/6] efi_loader: run bootdev_hunt() to find ESP Heinrich Schuchardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=02a3fcf7-bdc7-4d44-9d0e-1a05bd5216a8@canonical.com \
--to=heinrich.schuchardt@canonical.com \
--cc=caleb.connolly@linaro.org \
--cc=clamor95@gmail.com \
--cc=daniel@makrotopia.org \
--cc=ddrokosov@salutedevices.com \
--cc=ilias.apalodimas@linaro.org \
--cc=j-humphreys@ti.com \
--cc=jerome.forissier@linaro.org \
--cc=jiaxun.yang@flygoat.com \
--cc=joe.hershberger@ni.com \
--cc=marek.vasut+renesas@mailbox.org \
--cc=michal.simek@amd.com \
--cc=mkorpershoek@baylibre.com \
--cc=patrick.rudolph@9elements.com \
--cc=raymond.mao@linaro.org \
--cc=rfried.dev@gmail.com \
--cc=sjg@chromium.org \
--cc=sumit.garg@linaro.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=weijie.gao@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.