From: Lorenzo Bianconi <lorenzo@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org,
netdev@vger.kernel.org
Subject: Re: [PATCH net-next v7 10/10] net: airoha: Support multiple LAN/WAN interfaces for hw MAC address configuration
Date: Tue, 19 May 2026 10:37:53 +0200 [thread overview]
Message-ID: <agwhYWN-6-c7syDK@lore-desk> (raw)
In-Reply-To: <20260517055815.89B7CC2BCB0@smtp.kernel.org>
[-- Attachment #1: Type: text/plain, Size: 3166 bytes --]
On May 17, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] Device probe fails when multiple LAN/WAN interfaces are assigned randomly generated MAC addresses.
> --
>
> commit 7861c44e7e1da4203e80f67d02418deac7e491b4
> Author: Lorenzo Bianconi <lorenzo@kernel.org>
>
> net: airoha: Support multiple LAN/WAN interfaces for hw MAC address configuration
>
> This commit extends the hardware MAC address configuration logic in the airoha
> driver to support multiple LAN or WAN interfaces by deriving minimum and
> maximum values for the lower MAC bytes, while expecting the upper MAC bytes to
> be shared.
>
> > diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c
> > --- a/drivers/net/ethernet/airoha/airoha_eth.c
> > +++ b/drivers/net/ethernet/airoha/airoha_eth.c
> > @@ -71,20 +71,69 @@ static void airoha_qdma_irq_disable(struct airoha_irq_bank *irq_bank,
> > airoha_qdma_set_irqmask(irq_bank, index, mask, 0);
> > }
> >
> > -static void airoha_set_macaddr(struct airoha_gdm_dev *dev, const u8 *addr)
> > +static int airoha_set_macaddr(struct airoha_gdm_dev *dev, const u8 *addr)
> > {
> > + u8 ref_addr[ETH_ALEN] __aligned(2);
> > struct airoha_eth *eth = dev->eth;
>
> [ ... ]
>
> > + netdev = iter_dev->dev;
> > + if (netdev->reg_state != NETREG_REGISTERED)
> > + continue;
> > +
> > + ether_addr_copy(ref_addr, netdev->dev_addr);
> > + val = (netdev->dev_addr[3] << 16) |
> > + (netdev->dev_addr[4] << 8) | netdev->dev_addr[5];
> > + if (val < lmin)
> > + lmin = val;
> > + if (val > lmax)
> > + lmax = val;
> > + }
> > + }
> > +
> > + if (!is_zero_ether_addr(ref_addr) && memcmp(ref_addr, addr, 3)) {
>
> If the device tree lacks a MAC address for an interface and the driver assigns
> a random one via eth_hw_addr_random(), will this comparison fail during device
> probe?
>
> Since eth_hw_addr_random() generates independent random bytes for each
> interface, the upper 3 bytes will likely mismatch. This returns -EINVAL and
> propagates up to register_netdev(), which causes the driver probe to abort.
>
> Prior to this patch, the hardware MAC register was overwritten with the newest
> interface's MAC, but the probe continued successfully. Can this be adjusted to
> handle randomly generated MAC addresses without aborting the probe?
As already pointed out this is a requirement imposed by the hw design. Please
note we are not introducing any regression since this is required just when we
have multiple net_devices configured as LAN and this feature is introduced by
this patch.
Regards,
Lorenzo
>
> > + /* According to the HW design, hw mac address MS bits
> > + * must be the same for each net_device with the same
> > + * LAN/WAN configuration.
> > + */
> > + netdev_err(dev->dev, "wrong mac addr for shared GDM port\n");
> > + return -EINVAL;
> > + }
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260516-airoha-eth-multi-serdes-v7-0-99e0093303e2@kernel.org?part=10
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
prev parent reply other threads:[~2026-05-19 8:37 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-16 5:57 [PATCH net-next v7 00/10] net: airoha: Support multiple net_devices connected to the same GDM port Lorenzo Bianconi
2026-05-16 5:57 ` [PATCH net-next v7 01/10] dt-bindings: net: airoha: Add EN7581 ethernet-ports properties Lorenzo Bianconi
[not found] ` <20260517055811.EFECEC2BCB3@smtp.kernel.org>
2026-05-18 20:39 ` Lorenzo Bianconi
2026-05-16 5:57 ` [PATCH net-next v7 02/10] net: airoha: Introduce airoha_gdm_dev struct Lorenzo Bianconi
[not found] ` <20260517055812.CEC33C2BCB0@smtp.kernel.org>
2026-05-18 20:59 ` Lorenzo Bianconi
2026-05-16 5:57 ` [PATCH net-next v7 03/10] net: airoha: Move airoha_qdma pointer in " Lorenzo Bianconi
[not found] ` <20260517055811.39179C2BCB0@smtp.kernel.org>
2026-05-19 8:21 ` Lorenzo Bianconi
2026-05-16 5:57 ` [PATCH net-next v7 04/10] net: airoha: Rely on airoha_gdm_dev pointer in airoha_is_lan_gdm_port() Lorenzo Bianconi
2026-05-16 5:57 ` [PATCH net-next v7 05/10] net: airoha: Move qos_sq_bmap in airoha_gdm_dev struct Lorenzo Bianconi
[not found] ` <20260517055814.3D107C2BCB0@smtp.kernel.org>
2026-05-19 8:23 ` Lorenzo Bianconi
2026-05-16 5:57 ` [PATCH net-next v7 06/10] net: airoha: Move {cpu,fwd}_tx_packets " Lorenzo Bianconi
2026-05-16 5:57 ` [PATCH net-next v7 07/10] net: airoha: Support multiple net_devices for a single FE GDM port Lorenzo Bianconi
[not found] ` <20260517055813.7DF3AC2BCF5@smtp.kernel.org>
2026-05-18 21:28 ` Lorenzo Bianconi
2026-05-16 5:57 ` [PATCH net-next v7 08/10] net: airoha: Do not stop GDM port if it is shared Lorenzo Bianconi
[not found] ` <20260517055814.DB1F8C2BCB0@smtp.kernel.org>
2026-05-18 22:12 ` Lorenzo Bianconi
2026-05-16 5:57 ` [PATCH net-next v7 09/10] net: airoha: Introduce WAN device flag Lorenzo Bianconi
2026-05-16 5:57 ` [PATCH net-next v7 10/10] net: airoha: Support multiple LAN/WAN interfaces for hw MAC address configuration Lorenzo Bianconi
[not found] ` <20260517055815.89B7CC2BCB0@smtp.kernel.org>
2026-05-19 8:37 ` Lorenzo Bianconi [this message]
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=agwhYWN-6-c7syDK@lore-desk \
--to=lorenzo@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.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