[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y4fGORYQRfYTabH1@x1>
Date: Wed, 30 Nov 2022 16:08:09 -0500
From: Brian Masney <bmasney@...hat.com>
To: Andrew Lunn <andrew@...n.ch>
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, cth451@...il.com
Subject: Re: [PATCH] net: atlantic: fix check for invalid ethernet addresses
On Wed, Nov 30, 2022 at 08:41:29PM +0100, Andrew Lunn wrote:
> On Wed, Nov 30, 2022 at 12:42:59PM -0500, Brian Masney wrote:
> > The Qualcomm sa8540p automotive development board (QDrive3) has an
> > Aquantia NIC wired over PCIe. The ethernet MAC address assigned to
> > all of the boards in our lab is 00:17:b6:00:00:00. The existing
> > check in aq_nic_is_valid_ether_addr() only checks for leading zeros
> > in the MAC address. Let's update the check to also check for trailing
> > zeros in the MAC address so that a random MAC address is assigned
> > in this case.
> >
> > Signed-off-by: Brian Masney <bmasney@...hat.com>
> > ---
> > drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
> > index 06508eebb585..c9c850bbc805 100644
> > --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
> > +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
> > @@ -293,7 +293,8 @@ static bool aq_nic_is_valid_ether_addr(const u8 *addr)
> > /* Some engineering samples of Aquantia NICs are provisioned with a
> > * partially populated MAC, which is still invalid.
> > */
> > - return !(addr[0] == 0 && addr[1] == 0 && addr[2] == 0);
> > + return !(addr[0] == 0 && addr[1] == 0 && addr[2] == 0) &&
> > + !(addr[3] == 0 && addr[4] == 0 && addr[5] == 0);
>
> Hi Brian
>
> is_valid_ether_addr()
aq_nic_ndev_register() already calls is_valid_ether_addr():
if (is_valid_ether_addr(addr) &&
aq_nic_is_valid_ether_addr(addr)) {
(self->ndev, addr);
} else {
...
}
That won't work for this board since that function only checks that the
MAC "is not 00:00:00:00:00:00, is not a multicast address, and is not
FF:FF:FF:FF:FF:FF." The MAC address that we get on all of our boards is
00:17:b6:00:00:00.
Brian
Powered by blists - more mailing lists