netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Freescale FEC: fall back to random address
@ 2013-03-31 21:06 Pavel Machek
  2013-04-02  8:23 ` Frank Li
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Machek @ 2013-03-31 21:06 UTC (permalink / raw)
  To: kernel list, fabio.estevam, l.stach, Frank.Li, netdev

If there's no valid ethernet address, fall back to randomly generated
one.

(Yes, I need to get newer u-boot for the board, but as the only
available one is from 2009... this might be good idea).

Signed-off-by: Pavel Machek <pavel@denx.de>


index e3f3937..5a7d1e1 100644
pp--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -906,6 +914,16 @@ static void fec_get_mac(struct net_device *ndev)
 		iap = &tmpaddr[0];
 	}
 
+	/*
+	 * 5) random mac address
+	 */
+	if (!is_valid_ether_addr(iap)) {
+		/* Report it and use a random ethernet address instead */
+		netdev_err(ndev, "Invalid MAC address: %pM\n", iap);
+		random_ether_addr(iap);
+		netdev_info(ndev, "Using random MAC address: %pM\n", iap);
+	}
+
 	memcpy(ndev->dev_addr, iap, ETH_ALEN);
 
 	/* Adjust MAC if using macaddr */

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Freescale FEC: fall back to random address
  2013-03-31 21:06 Freescale FEC: fall back to random address Pavel Machek
@ 2013-04-02  8:23 ` Frank Li
  2013-04-02 11:35   ` Pavel Machek
  0 siblings, 1 reply; 4+ messages in thread
From: Frank Li @ 2013-04-02  8:23 UTC (permalink / raw)
  To: Pavel Machek; +Cc: kernel list, fabio.estevam, l.stach, Frank.Li, netdev

I think it is okay.

2013/4/1 Pavel Machek <pavel@denx.de>:
> If there's no valid ethernet address, fall back to randomly generated
> one.
>
> (Yes, I need to get newer u-boot for the board, but as the only
> available one is from 2009... this might be good idea).
>
> Signed-off-by: Pavel Machek <pavel@denx.de>
>
>
> index e3f3937..5a7d1e1 100644
> pp--- a/drivers/net/ethernet/freescale/fec.c
> +++ b/drivers/net/ethernet/freescale/fec.c
> @@ -906,6 +914,16 @@ static void fec_get_mac(struct net_device *ndev)
>                 iap = &tmpaddr[0];
>         }
>
> +       /*
> +        * 5) random mac address
> +        */
> +       if (!is_valid_ether_addr(iap)) {
> +               /* Report it and use a random ethernet address instead */
> +               netdev_err(ndev, "Invalid MAC address: %pM\n", iap);
> +               random_ether_addr(iap);
> +               netdev_info(ndev, "Using random MAC address: %pM\n", iap);
> +       }
> +
>         memcpy(ndev->dev_addr, iap, ETH_ALEN);
>
>         /* Adjust MAC if using macaddr */
>
> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Freescale FEC: fall back to random address
  2013-04-02  8:23 ` Frank Li
@ 2013-04-02 11:35   ` Pavel Machek
       [not found]     ` <CAHrpEqTdTnRx_htZkFyG2KU5wixdhqmWZ-3R5s=fdedQYc6D9w@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Machek @ 2013-04-02 11:35 UTC (permalink / raw)
  To: Frank Li; +Cc: kernel list, fabio.estevam, l.stach, Frank.Li, netdev, davem

Hi!

> I think it is okay.

Ok, now... is there someone maintianing Freescale FEC? Or, Dave, can
you merge the patch?

Thanks,
								Pavel


> 2013/4/1 Pavel Machek <pavel@denx.de>:
> > If there's no valid ethernet address, fall back to randomly generated
> > one.
> >
> > (Yes, I need to get newer u-boot for the board, but as the only
> > available one is from 2009... this might be good idea).
> >
> > Signed-off-by: Pavel Machek <pavel@denx.de>
> >
> >
> > index e3f3937..5a7d1e1 100644
> > pp--- a/drivers/net/ethernet/freescale/fec.c
> > +++ b/drivers/net/ethernet/freescale/fec.c
> > @@ -906,6 +914,16 @@ static void fec_get_mac(struct net_device *ndev)
> >                 iap = &tmpaddr[0];
> >         }
> >
> > +       /*
> > +        * 5) random mac address
> > +        */
> > +       if (!is_valid_ether_addr(iap)) {
> > +               /* Report it and use a random ethernet address instead */
> > +               netdev_err(ndev, "Invalid MAC address: %pM\n", iap);
> > +               random_ether_addr(iap);
> > +               netdev_info(ndev, "Using random MAC address: %pM\n", iap);
> > +       }
> > +
> >         memcpy(ndev->dev_addr, iap, ETH_ALEN);
> >
> >         /* Adjust MAC if using macaddr */

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Freescale FEC: fall back to random address
       [not found]     ` <CAHrpEqTdTnRx_htZkFyG2KU5wixdhqmWZ-3R5s=fdedQYc6D9w@mail.gmail.com>
@ 2013-04-02 15:49       ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-04-02 15:49 UTC (permalink / raw)
  To: lznuaa; +Cc: pavel, linux-kernel, fabio.estevam, l.stach, Frank.Li, netdev

From: Frank Li <lznuaa@gmail.com>
Date: Tue, 2 Apr 2013 21:23:17 +0800

> David will merge it

Someone needs to make a clean resubmission of it though, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-04-02 15:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-31 21:06 Freescale FEC: fall back to random address Pavel Machek
2013-04-02  8:23 ` Frank Li
2013-04-02 11:35   ` Pavel Machek
     [not found]     ` <CAHrpEqTdTnRx_htZkFyG2KU5wixdhqmWZ-3R5s=fdedQYc6D9w@mail.gmail.com>
2013-04-02 15:49       ` David Miller

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).