[U-Boot] [PATCH 5/5] net: sandbox-raw: Allow interface to be specified by index

Joe Hershberger joe.hershberger at ni.com
Tue Jun 26 23:31:47 UTC 2018


On Tue, Jun 26, 2018 at 6:18 PM, Simon Glass <sjg at chromium.org> wrote:
> Hi Joe,
>
> On 26 June 2018 at 14:19, Joe Hershberger <joe.hershberger at ni.com> wrote:
>> With systemd stable interface names, eth0 will almost never exist.
>> Instead of using that name in the sandbox.dts, use index 2 (the first
>> interface after "lo"). Enumerate the interfaces on the system to choose
>> a valid interace name.
>>
>> Signed-off-by: Joe Hershberger <joe.hershberger at ni.com>
>> ---
>>
>>  arch/sandbox/cpu/eth-raw-os.c         | 28 ++++++++++++++++++++++++++++
>>  arch/sandbox/dts/sandbox.dts          |  2 +-
>>  arch/sandbox/include/asm/eth-raw-os.h |  4 +++-
>>  drivers/net/sandbox-raw.c             |  8 +++++++-
>>  4 files changed, 39 insertions(+), 3 deletions(-)
>>
>
> This seems brittle too. A name seems better to me. I might be missing
> something though. Can we ask the OS for a name, etc?

This asks for the equivalent of "eth0", but asks the OS to tell us the
actual name. I don't know that we can possibly choose the correct
network interface to use across any machine configuration. Choosing
the first one, whatever it's name is, seems like a pretty reliable way
to get a good interface in most cases.

>
> Regards,
> Simon
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot


More information about the U-Boot mailing list