netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: ethernet: ax88796: support generating a random mac address
@ 2017-05-25 20:55 Uwe Kleine-König
  2017-05-25 20:57 ` Uwe Kleine-König
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2017-05-25 20:55 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, kernel

Instead of falling back to 00:00:00:00:00:00 generate a random address
if none is provided via platform data or from the the device's register
space.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/8390/ax88796.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c
index db02bc2fb4b2..05d9d3e2e92e 100644
--- a/drivers/net/ethernet/8390/ax88796.c
+++ b/drivers/net/ethernet/8390/ax88796.c
@@ -723,6 +723,12 @@ static int ax_init_dev(struct net_device *dev)
 	    ax->plat->mac_addr)
 		memcpy(dev->dev_addr, ax->plat->mac_addr, ETH_ALEN);
 
+	if (!is_valid_ether_addr(dev->dev_addr)) {
+		eth_hw_addr_random(dev);
+		dev_info(&dev->dev, "Using random MAC address: %pM\n",
+			 dev->dev_addr);
+	}
+
 	ax_reset_8390(dev);
 
 	ei_local->name = "AX88796";
-- 
2.11.0

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

* Re: [PATCH net-next] net: ethernet: ax88796: support generating a random mac address
  2017-05-25 20:55 [PATCH net-next] net: ethernet: ax88796: support generating a random mac address Uwe Kleine-König
@ 2017-05-25 20:57 ` Uwe Kleine-König
  2017-05-25 21:01   ` David Miller
  2017-05-25 21:25 ` Andrew Lunn
  2017-05-26 18:58 ` David Miller
  2 siblings, 1 reply; 5+ messages in thread
From: Uwe Kleine-König @ 2017-05-25 20:57 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, kernel

Hello David,

On Thu, May 25, 2017 at 10:55:11PM +0200, Uwe Kleine-König wrote:
> Instead of falling back to 00:00:00:00:00:00 generate a random address
> if none is provided via platform data or from the the device's register

s/the the/the/

should I resend for this, or can you fixup at commit time (assuming this
patch is ok).

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

* Re: [PATCH net-next] net: ethernet: ax88796: support generating a random mac address
  2017-05-25 20:57 ` Uwe Kleine-König
@ 2017-05-25 21:01   ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2017-05-25 21:01 UTC (permalink / raw)
  To: u.kleine-koenig; +Cc: netdev, kernel

From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date: Thu, 25 May 2017 22:57:41 +0200

> Hello David,
> 
> On Thu, May 25, 2017 at 10:55:11PM +0200, Uwe Kleine-König wrote:
>> Instead of falling back to 00:00:00:00:00:00 generate a random address
>> if none is provided via platform data or from the the device's register
> 
> s/the the/the/
> 
> should I resend for this, or can you fixup at commit time (assuming this
> patch is ok).

I can fix that up.

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

* Re: [PATCH net-next] net: ethernet: ax88796: support generating a random mac address
  2017-05-25 20:55 [PATCH net-next] net: ethernet: ax88796: support generating a random mac address Uwe Kleine-König
  2017-05-25 20:57 ` Uwe Kleine-König
@ 2017-05-25 21:25 ` Andrew Lunn
  2017-05-26 18:58 ` David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2017-05-25 21:25 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: David S. Miller, netdev, kernel

On Thu, May 25, 2017 at 10:55:11PM +0200, Uwe Kleine-König wrote:
> Instead of falling back to 00:00:00:00:00:00 generate a random address
> if none is provided via platform data or from the the device's register
> space.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next] net: ethernet: ax88796: support generating a random mac address
  2017-05-25 20:55 [PATCH net-next] net: ethernet: ax88796: support generating a random mac address Uwe Kleine-König
  2017-05-25 20:57 ` Uwe Kleine-König
  2017-05-25 21:25 ` Andrew Lunn
@ 2017-05-26 18:58 ` David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2017-05-26 18:58 UTC (permalink / raw)
  To: u.kleine-koenig; +Cc: netdev, kernel

From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date: Thu, 25 May 2017 22:55:11 +0200

> Instead of falling back to 00:00:00:00:00:00 generate a random address
> if none is provided via platform data or from the the device's register
> space.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Applied.

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

end of thread, other threads:[~2017-05-26 18:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-25 20:55 [PATCH net-next] net: ethernet: ax88796: support generating a random mac address Uwe Kleine-König
2017-05-25 20:57 ` Uwe Kleine-König
2017-05-25 21:01   ` David Miller
2017-05-25 21:25 ` Andrew Lunn
2017-05-26 18:58 ` 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).