[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221130182640.GA394566@cth-desktop-dorm.rtp.nc.cth451.me>
Date: Wed, 30 Nov 2022 13:26:40 -0500
From: Tianhao Chai <cth451@...il.com>
To: Brian Masney <bmasney@...hat.com>
Cc: irusskikh@...vell.com, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: atlantic: fix check for invalid ethernet addresses
On Wed, Nov 30, 2022 at 12:57:23PM -0500, Brian Masney wrote:
> I have a question about the original commit that introduced this check:
> 553217c24426 ("ethernet: aquantia: Try MAC address from device tree").
> The commit message talks about getting the MAC address from device tree,
> however I don't see any compatible lines in this driver, nor a
> of_match_table. As far as I can tell, this driver is only setup to be
> accessed over PCIe.
In aq_nic_ndev_register(), the code calls platform_get_ethdev_address(),
which in turn access the device tree via OF interface.
> The random MAC address is not ideal for our lab since we'd like to have
> stable addresses. I'd like to have the bootloader be able to inject a
> MAC address that's generated based on the board's serial number. I
> assume that it would go in the chosen node in device tree. One of the
> issues is that there are multiple NICs on this board, so I'm not sure
> how that would go in the chosen node and identify this particular NIC.
> Does anyone know of a place in the kernel where this is already done?
I'm not familar with this particular board, but this probably shouldn't
be done in kernel. AFAIK uboot allows overriding MAC with env 'ethaddr'.
uboot then either writes this MAC into DT or calls NIC specific code to
set the MAC into NIC memory before booting the kernel.
The other way around I can think of is to use systemd-networkd or some
other network management daemon to override the mac address as it tries
to establish a network connection. This might be less hassle if you
don't want to mess with the boot loader, but for embedded devices you'd
need a different root fs image for every board.
Acked-by: Tianhao Chai <cth451@...il.com>
Powered by blists - more mailing lists