From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Jakub Kicinski <kuba@kernel.org>
Cc: sashiko-reviews@lists.linux.dev, robh@kernel.org,
devicetree@vger.kernel.org, conor+dt@kernel.org,
netdev@vger.kernel.org
Subject: Re: [PATCH net-next v8 10/10] net: airoha: Support multiple LAN/WAN interfaces for hw MAC address configuration
Date: Fri, 22 May 2026 21:25:37 +0200 [thread overview]
Message-ID: <ahCtsVA1VhYmhZq-@lore-desk> (raw)
In-Reply-To: <20260522112514.1ad6e947@kicinski-fedora-PF5CM1Y0>
[-- Attachment #1: Type: text/plain, Size: 3538 bytes --]
On May 22, Jakub Kicinski wrote:
> On Wed, 20 May 2026 14:49:37 +0200 Lorenzo Bianconi wrote:
> > > Does this strict OUI validation cause the driver probe to fail when MAC addresses
> > > are randomly generated?
> > >
> > > If a MAC address is not provided in the device tree, the driver generates a random
> > > one via eth_hw_addr_random(). For multi-port configurations, each port receives an
> > > independently generated random MAC address.
> > >
> > > Since the upper 3 bytes of these random addresses will almost certainly differ,
> > > when register_netdev() is called for the second port, its ndo_init callback
> > > (airoha_dev_init) will invoke airoha_set_macaddr() and hit this check. Returning
> > > -EINVAL will fail register_netdev() and abort the entire driver probe, leaving
> > > the system without networking.
> > >
> > > Does this also prevent users from changing the MAC address OUI?
> > >
> > > When an administrator attempts to change the MAC address via standard userspace
> > > tools, only one interface can be modified at a time. The driver will compare the
> > > new MAC against the existing MAC of the other port.
> > >
> > > If the MSBs differ, the change is rejected. This makes it impossible to atomically
> > > change the OUI of both interfaces simultaneously, locking the MAC address OUI
> > > to its initial probe-time value.
> >
> > As pointed out before, this is a hw design requirement when multiple
> > net_devices are configured as LAN.
>
> What about Clashiko report about the MAC address?
Do you the following one?
https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260519-airoha-eth-multi-serdes-v8-0-6bd70e329df6%40kernel.org
- What happens when device tree does not provide MAC addresses for two or
more same-side GDM interfaces?
- This is the same comment reported in [0].
Since the hw exposes just a single register (REG_FE_LAN_MAC_H or
REG_FE_WAN_MAC_H) for the LAN/WAN mac address MSBs, we need to
require all the interfaces configured as LAN or WAN to share the
mac address MSBs and the user needs to select the new mac address
observing this limitation.
Please note this limitation is only valid if multiple net_devices
are configured as LAN (or WAN). Since in the current codebase we
do not support multiple interfaces configured as LAN or WAN, we are
not introducing any regression.
I do not think selecting a "base" for the mac address is helpful
if the user does not provide the mac address via the DTS or NVME
(as suggested by sashiko) since it will not help us if the mac
addresses configured via DTS are "wrong" (if they do not respect
the limitation described above). What do you think?
- If airoha_set_macaddr() succeeds (and has just widened the shared
[lmin, lmax] range to include this dev) and airoha_set_gdm2_loopback()
then fails, airoha_dev_init() returns the error but there is no
airoha_dev_uninit / ndo_uninit to roll the LMIN/LMAX update back.
The shared range is then wider than the set of currently-registered peers.
- I guess it is not harmful to keep the already configured mac address
range if airoha_set_gdm2_loopback() fails and I decided to not unwind
the changes to keep the code simple. Moreover, in the current codebase,
if ndo_init() fails, the airoha_probe() will fail.
Regards,
Lorenzo
[0] https://sashiko.dev/#/patchset/20260519-airoha-eth-multi-serdes-v8-0-6bd70e329df6%40kernel.org
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2026-05-22 19:25 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-19 8:57 [PATCH net-next v8 00/10] net: airoha: Support multiple net_devices connected to the same GDM port Lorenzo Bianconi
2026-05-19 8:57 ` [PATCH net-next v8 01/10] dt-bindings: net: airoha: Add GDM port ethernet child node Lorenzo Bianconi
2026-05-22 19:27 ` Lorenzo Bianconi
2026-05-19 8:57 ` [PATCH net-next v8 02/10] net: airoha: Introduce airoha_gdm_dev struct Lorenzo Bianconi
[not found] ` <20260520085932.9473C1F000E9@smtp.kernel.org>
2026-05-20 12:25 ` Lorenzo Bianconi
2026-05-19 8:57 ` [PATCH net-next v8 03/10] net: airoha: Move airoha_qdma pointer in " Lorenzo Bianconi
2026-05-19 8:57 ` [PATCH net-next v8 04/10] net: airoha: Rely on airoha_gdm_dev pointer in airoha_is_lan_gdm_port() Lorenzo Bianconi
2026-05-19 8:57 ` [PATCH net-next v8 05/10] net: airoha: Move qos_sq_bmap in airoha_gdm_dev struct Lorenzo Bianconi
[not found] ` <20260520085926.97A481F000E9@smtp.kernel.org>
2026-05-20 12:24 ` Lorenzo Bianconi
2026-05-19 8:57 ` [PATCH net-next v8 06/10] net: airoha: Move {cpu,fwd}_tx_packets " Lorenzo Bianconi
2026-05-19 8:57 ` [PATCH net-next v8 07/10] net: airoha: Support multiple net_devices for a single FE GDM port Lorenzo Bianconi
[not found] ` <20260520085933.35D171F00897@smtp.kernel.org>
2026-05-20 12:28 ` Lorenzo Bianconi
2026-05-20 12:33 ` Lorenzo Bianconi
2026-05-19 8:57 ` [PATCH net-next v8 08/10] net: airoha: Do not stop GDM port if it is shared Lorenzo Bianconi
2026-05-19 8:57 ` [PATCH net-next v8 09/10] net: airoha: Introduce WAN device flag Lorenzo Bianconi
[not found] ` <20260520085933.C009F1F00893@smtp.kernel.org>
2026-05-20 12:46 ` Lorenzo Bianconi
2026-05-19 8:57 ` [PATCH net-next v8 10/10] net: airoha: Support multiple LAN/WAN interfaces for hw MAC address configuration Lorenzo Bianconi
[not found] ` <20260520085934.54AD01F00894@smtp.kernel.org>
2026-05-20 12:49 ` Lorenzo Bianconi
2026-05-22 18:25 ` Jakub Kicinski
2026-05-22 19:25 ` Lorenzo Bianconi [this message]
2026-05-22 23:58 ` Jakub Kicinski
2026-05-23 8:23 ` Lorenzo Bianconi
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=ahCtsVA1VhYmhZq-@lore-desk \
--to=lorenzo@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox