Subject: Re: [PATCH net-next v8 2/2] net: ethernet: Add driver for Sunplus SP7021

From: Andrew Lunn <[email-masked]>
Date: Tue, 19 Apr 2022 15:03:03 +0200

On Tue, Apr 19, 2022 at 10:07:55AM +0000, Wells Lu 呂芳騰 wrote:
> > > > +		/* Get mac-address from nvmem. */
> > > > +		ret = spl2sw_nvmem_get_mac_address(&pdev->dev, port_np, mac_addr);
> > > > +		if (ret) {
> > > > +			dev_info(&pdev->dev, "Generate a random mac address!\n");
> > > > +
> > > > +			/* Generate a mac address using OUI of Sunplus Technology
> > > > +			 * and random controller number.
> > > > +			 */
> > > > +			mac_addr[0] = 0xfc; /* OUI of Sunplus: fc:4b:bc */
> > > > +			mac_addr[1] = 0x4b;
> > > > +			mac_addr[2] = 0xbc;
> > > > +			mac_addr[3] = get_random_int() % 256;
> > > > +			mac_addr[4] = get_random_int() % 256;
> > > > +			mac_addr[5] = get_random_int() % 256;
> > >
> > > I don't think you can do that. Either you use your OUI and assign the
> > > address at manufacture or you must use a locally administered address.
> > > And if locally administered address is used it better be completely
> > > random to lower the probability of collision to absolute minimum.
> > 
> > I commented about that in an earlier version of these patches. We probably need a quote
> > from the 802.1 or 802.3 which says this is O.K.
> > 
> > 	 Andrew
> 
> Hi Andrew,
> 
> I plan to replace above statements with:
> 
> 	eth_random_addr(mac_addr);

O.K, that is good.

> Do you mean I can keep use the mac address: "OUI + random number"?

If you can show us text in an IEEE 802.1, IEEE 802.3, or some other
IEEE document which says this is allowed.

> Only need to add comment for it.

Add a comment which points to a document which says you are allowed to
do this. This is very unusual, so questions will be asked, and if you
point people at the answer it will help.

      Andrew