[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ffd2d708-60fb-4049-8c1b-fcfe43a78d57@lunn.ch>
Date: Thu, 1 Aug 2024 14:18:26 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Jijie Shao <shaojijie@...wei.com>
Cc: yisen.zhuang@...wei.com, salil.mehta@...wei.com, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
horms@...nel.org, shenjian15@...wei.com, wangpeiyang1@...wei.com,
liuyonglong@...wei.com, sudongming1@...wei.com,
xujunsheng@...wei.com, shiyongbang@...wei.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH net-next 05/10] net: hibmcge: Implement some .ndo
functions
On Thu, Aug 01, 2024 at 05:13:33PM +0800, Jijie Shao wrote:
>
> on 2024/8/1 8:51, Andrew Lunn wrote:
> > > +static int hbg_net_set_mac_address(struct net_device *dev, void *addr)
> > > +{
> > > + struct hbg_priv *priv = netdev_priv(dev);
> > > + u8 *mac_addr;
> > > +
> > > + mac_addr = ((struct sockaddr *)addr)->sa_data;
> > > + if (ether_addr_equal(dev->dev_addr, mac_addr))
> > > + return 0;
> > > +
> > > + if (!is_valid_ether_addr(mac_addr))
> > > + return -EADDRNOTAVAIL;
> > How does the core pass you an invalid MAC address?
>
> According to my test,
> in the 6.4 rc4 kernel version, invalid mac address is allowed to be configured.
> An error is reported only when ifconfig ethx up.
Ah, interesting.
I see a test in __dev_open(), which is what you are saying here. But i
would also expect a test in rtnetlink, or maybe dev_set_mac_address().
We don't want every driver having to repeat this test in their
.ndo_set_mac_address, when it could be done once in the core.
Andrew
Powered by blists - more mailing lists