From: Sascha Hauer <s.hauer@pengutronix.de>
To: Madalin Bucur <madalin.bucur@nxp.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH] fsl/fman: Use random MAC address when none is given
Date: Thu, 5 Mar 2020 13:31:02 +0100 [thread overview]
Message-ID: <20200305123102.GS3335@pengutronix.de> (raw)
In-Reply-To: <DB8PR04MB6985D1FDADE301F4A6C795E3ECE20@DB8PR04MB6985.eurprd04.prod.outlook.com>
On Thu, Mar 05, 2020 at 11:57:37AM +0000, Madalin Bucur wrote:
> > -----Original Message-----
> > From: Sascha Hauer <s.hauer@pengutronix.de>
> > Sent: Thursday, March 5, 2020 1:54 PM
> > To: netdev@vger.kernel.org
> > Cc: Madalin Bucur <madalin.bucur@nxp.com>; Sascha Hauer
> > <s.hauer@pengutronix.de>
> > Subject: [PATCH] fsl/fman: Use random MAC address when none is given
> >
> > There's no need to fail probing when no MAC address is given in the
> > device tree, just use a random MAC address.
> >
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > ---
> > drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 13 +++++++++++--
> > drivers/net/ethernet/freescale/fman/fman_memac.c | 4 ----
> > drivers/net/ethernet/freescale/fman/mac.c | 10 ++--------
> > 3 files changed, 13 insertions(+), 14 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > index fd93d542f497..18a7235af7c2 100644
> > --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
> > @@ -233,8 +233,17 @@ static int dpaa_netdev_init(struct net_device
> > *net_dev,
> > net_dev->features |= net_dev->hw_features;
> > net_dev->vlan_features = net_dev->features;
> >
> > - memcpy(net_dev->perm_addr, mac_addr, net_dev->addr_len);
> > - memcpy(net_dev->dev_addr, mac_addr, net_dev->addr_len);
> > + if (is_valid_ether_addr(mac_addr)) {
> > + dev_info(dev, "FMan MAC address: %pM\n", mac_addr);
> > + memcpy(net_dev->perm_addr, mac_addr, net_dev->addr_len);
> > + memcpy(net_dev->dev_addr, mac_addr, net_dev->addr_len);
> > + } else {
> > + eth_hw_addr_random(net_dev);
> > + dev_info(dev, "Using random MAC address: %pM\n",
> > + net_dev->dev_addr);
> > + }
> > +
> > + dev_info(dev, "FMan perm MAC address: %pM\n", net_dev->perm_addr);
>
> Do you need both prints when using a random MAC address? Otherwise, it's ok.
Erm, no, I accidently committed it. Will remove.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
prev parent reply other threads:[~2020-03-05 12:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-05 11:53 [PATCH] fsl/fman: Use random MAC address when none is given Sascha Hauer
2020-03-05 11:57 ` Madalin Bucur
2020-03-05 12:31 ` Sascha Hauer [this message]
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=20200305123102.GS3335@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=madalin.bucur@nxp.com \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).