mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Wells Lu 呂芳騰" <wells.lu@sunplus.com>
To: Andrew Lunn <andrew@lunn.ch>, Jakub Kicinski <kuba@kernel.org>
Cc: Wells Lu <wellslutw@gmail.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
	"roopa@nvidia.com" <roopa@nvidia.com>,
	"edumazet@google.com" <edumazet@google.com>
Subject: RE: [PATCH net-next v8 2/2] net: ethernet: Add driver for Sunplus SP7021
Date: Tue, 19 Apr 2022 10:07:55 +0000	[thread overview]
Message-ID: <e784ab5356aa4b6e93765b54bdefea0a@sphcmbx02.sunplus.com.tw> (raw)
In-Reply-To: <Ylgjab6qLsrzKZKc@lunn.ch>

> > > +		/* 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);

eth_random_addr() generates locally administered (random) address.

Do you mean I can keep use the mac address: "OUI + random number"?
Only need to add comment for it. 
What comment should I add? Which one do you recommend?

Thank you very much for your review.


Best regards,
Wells


  reply	other threads:[~2022-04-19 10:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-13  2:31 [PATCH net-next v8 0/2] This is a patch series for Ethernet driver of Sunplus SP7021 SoC Wells Lu
2022-04-13  2:31 ` [PATCH net-next v8 1/2] devicetree: bindings: net: Add bindings doc for Sunplus SP7021 Wells Lu
2022-04-13  2:31 ` [PATCH net-next v8 2/2] net: ethernet: Add driver " Wells Lu
2022-04-14 12:18   ` Jakub Kicinski
2022-04-14 13:36     ` Andrew Lunn
2022-04-19 10:07       ` Wells Lu 呂芳騰 [this message]
2022-04-19 13:03         ` Andrew Lunn
2022-04-19  9:49     ` Wells Lu 呂芳騰

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=e784ab5356aa4b6e93765b54bdefea0a@sphcmbx02.sunplus.com.tw \
    --to=wells.lu@sunplus.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=robh+dt@kernel.org \
    --cc=roopa@nvidia.com \
    --cc=wellslutw@gmail.com \
    /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

all inboxes | Powered by JetHome®