From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F166CCD4F21 for ; Tue, 12 May 2026 20:58:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5vSXzbfxiDayi3uLMoENhtSVkT6Xt07qc9dfSIxaHTQ=; b=eTlW5r6ttNVSCGyGK/vb9/bpVr b8PlvfMAi7FyTkaNG+NYDr7VXw5ZGT6SmYY+fDUiM/qB4m7dD4QaoBDxe+WWRFv784ff71J6aaNzn 53Lw7S9CRFnI13i18J20o2niVA33KT29STkFsFH6nGxyZolrgwgJeWKfHz/UjLT9SllLCSf4kCZ8F hMo6+rZ0Ayy/AxVl9omKVQRrFnWDtugQmI0V79m6I64BpZo5LyOH+4FUNYplx3U/fvcA1tJzb+C7K HhsdXeofrjnUydNjdttVN4iE06kLZvxOtYiV5M8phNi1/DetNKBjO3kIJ06C5EP9tb2zTd/beiyVr XirRURvQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wMuBj-00000000PLc-0pF1; Tue, 12 May 2026 20:58:47 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wMuBg-00000000PKv-3rrW; Tue, 12 May 2026 20:58:46 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 9CC6840647; Tue, 12 May 2026 20:58:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F35D8C2BCB0; Tue, 12 May 2026 20:58:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778619524; bh=cwRYFJ8mo7xPr/Sm/kd6T4GfCK3h96cELX3tInSSqH4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aew4b/4EDTRlqlXHmm4ka53FQbHCXwfJFmy8x01qQqfmuztLbaflyIT6Z3KXDXwK2 b5JiZYNgRlvCID3NhkRx3KDtWb4nCuI6wimqtfnIwAD1mAAd9SVaDC/JSFiX7UdSOg nBygmXFpmJNoPfEnWc4ul/IPZDtPZbA/n6+FpygRh3jpuCEYeD5hipGFrI1gxOs8M5 mYoOME7LP9wAWubUPs6q5f6D+bABmxyF5wfHBRa4huykaC9maPfJwfYzzR7HaVSHzw ec5dE7LMCOooljRryEym8Iy191vRpFMtPYVbUYxXGVvdndmQCEXS+vjoUznhhOb1qg Oq1FYLT8tvPNg== Date: Tue, 12 May 2026 22:58:41 +0200 From: Lorenzo Bianconi To: Benjamin Larsson Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Christian Marangi , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, Madhur Agrawal Subject: Re: [PATCH net-next v6 11/12] net: airoha: Support multiple LAN/WAN interfaces for hw MAC address configuration Message-ID: References: <20260511-airoha-eth-multi-serdes-v6-0-c899462c4f75@kernel.org> <20260511-airoha-eth-multi-serdes-v6-11-c899462c4f75@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Wnpl3sdvUPuniOKw" Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260512_135845_007062_0F1E20E4 X-CRM114-Status: GOOD ( 24.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --Wnpl3sdvUPuniOKw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On May 12, Benjamin Larsson wrote: > Hi. >=20 > On 11/05/2026 12:49, Lorenzo Bianconi wrote: > > The EN7581 and AN7583 SoCs provide registers to configure hardware LAN/= WAN > > MAC addresses, used to determine whether received traffic is destined f= or > > this host or should be forwarded to another device. > > The SoC hardware design assumes all interfaces configured as LAN (or WA= N) > > share a common upper MAC address, which is programmed into the > > REG_FE_{LAN,WAN}_MAC_H register. The lower bytes of 'local' addresses c= an > > be expressed as a range via the REG_FE_MAC_LMIN and REG_FE_MAC_LMAX > > registers. > > Previously, only a single interface was considered when programming the= se > > registers. Extend the logic to derive the correct minimum and maximum > > values for REG_FE_MAC_LMIN/REG_FE_MAC_LMAX when two or more interfaces = are > > configured as LAN or WAN. > >=20 > > Tested-by: Madhur Agrawal > > Signed-off-by: Lorenzo Bianconi > > --- > > drivers/net/ethernet/airoha/airoha_eth.c | 75 +++++++++++++++++++++++= ++++----- > > drivers/net/ethernet/airoha/airoha_eth.h | 2 +- > > drivers/net/ethernet/airoha/airoha_ppe.c | 4 +- > > 3 files changed, 66 insertions(+), 15 deletions(-) > >=20 > > diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/eth= ernet/airoha/airoha_eth.c > > index 16c0ff9999da..533ffe20f833 100644 > > --- a/drivers/net/ethernet/airoha/airoha_eth.c > > +++ b/drivers/net/ethernet/airoha/airoha_eth.c > > @@ -71,20 +71,67 @@ static void airoha_qdma_irq_disable(struct airoha_i= rq_bank *irq_bank, > > airoha_qdma_set_irqmask(irq_bank, index, mask, 0); > > } > > -static void airoha_set_macaddr(struct airoha_gdm_dev *dev, const u8 *a= ddr) > > +static int airoha_set_macaddr(struct airoha_gdm_dev *dev, const u8 *ad= dr) > > { > > struct airoha_eth *eth =3D dev->eth; > > - u32 val, reg; > > + u8 ref_addr[ETH_ALEN] =3D {}; > > + u32 reg, val, lmin, lmax; > > + int i; > > + > > + lmin =3D (addr[3] << 16) | (addr[4] << 8) | addr[5]; > > + lmax =3D lmin; > > + > > + for (i =3D 0; i < ARRAY_SIZE(eth->ports); i++) { > > + struct airoha_gdm_port *port =3D eth->ports[i]; > > + int j; > > + > > + if (!port) > > + continue; > > + > > + for (j =3D 0; j < ARRAY_SIZE(port->devs); j++) { > > + struct airoha_gdm_dev *iter_dev; > > + struct net_device *netdev; > > + > > + iter_dev =3D port->devs[j]; > > + if (!iter_dev || iter_dev =3D=3D dev) > > + continue; > > + > > + if (airoha_is_lan_gdm_dev(iter_dev) !=3D > > + airoha_is_lan_gdm_dev(dev)) > > + continue; > > + > > + netdev =3D iter_dev->dev; > > + if (netdev->reg_state !=3D NETREG_REGISTERED) > > + continue; > > + > > + ether_addr_copy(ref_addr, netdev->dev_addr); > > + val =3D (netdev->dev_addr[3] << 16) | > > + (netdev->dev_addr[4] << 8) | netdev->dev_addr[5]; > > + if (val < lmin) > > + lmin =3D val; > > + if (val > lmax) > > + lmax =3D val; > > + } > > + } > > + > > + if (!is_zero_ether_addr(ref_addr) && memcmp(ref_addr, addr, 3)) { > > + /* According to the HW design, hw mac address MS bits > > + * must be the same for each net_device with the same > > + * LAN/WAN configuration. > > + */ > > + return -EINVAL; > > + } >=20 > Maybe this information should be relayed to the user somehow? netdev_err()? Regards, Lorenzo >=20 > MvH >=20 > Benjamin Larsson >=20 --Wnpl3sdvUPuniOKw Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCagOUgQAKCRA6cBh0uS2t rIn+APwKpb4qxMrPaC5ng4+5c/Ub1S62RXR68TIg3As8A6JbIwD/RGedQbqaS9xg zxmKutUfiYEtLPbAvGErfwePBAN6Gws= =JHOg -----END PGP SIGNATURE----- --Wnpl3sdvUPuniOKw--