netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] sh_eth: use random MAC address if no valid one supplied
@ 2013-04-29 19:49 Sergei Shtylyov
  2013-04-29 20:39 ` Laurent Pinchart
  2013-04-30 19:37 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2013-04-29 19:49 UTC (permalink / raw)
  To: netdev; +Cc: nobuhiro.iwamatsu.yj, linux-sh

On Renesas R-Car based development boards, although a MAC address is printed on
all the Ethernet port labels, U-Boot  doesn't write a valid MAC address  to the
Ether MAHR/MALR registers (there's no storage provided for the Ether MAC address
either), so we have to resort to using a random MAC address...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
This patch is against the 'net-next.git' repository.

Changes since the original posting:
- don't break the message string into 2 lines.

 drivers/net/ethernet/renesas/sh_eth.c |    5 +++++
 1 file changed, 5 insertions(+)

Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ net-next/drivers/net/ethernet/renesas/sh_eth.c
@@ -2735,6 +2735,11 @@ static int sh_eth_drv_probe(struct platf
 
 	/* read and set MAC address */
 	read_mac_address(ndev, pd->mac_addr);
+	if (!is_valid_ether_addr(ndev->dev_addr)) {
+		dev_warn(&pdev->dev,
+			 "no valid MAC address supplied, using a random one.\n");
+		eth_hw_addr_random(ndev);
+	}
 
 	/* ioremap the TSU registers */
 	if (mdp->cd->tsu) {

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

* Re: [PATCH v2] sh_eth: use random MAC address if no valid one supplied
  2013-04-29 19:49 [PATCH v2] sh_eth: use random MAC address if no valid one supplied Sergei Shtylyov
@ 2013-04-29 20:39 ` Laurent Pinchart
  2013-04-30  2:01   ` Simon Horman
  2013-04-30 19:37 ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Laurent Pinchart @ 2013-04-29 20:39 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: netdev, nobuhiro.iwamatsu.yj, linux-sh

On Monday 29 April 2013 23:49:42 Sergei Shtylyov wrote:
> On Renesas R-Car based development boards, although a MAC address is printed
> on all the Ethernet port labels, U-Boot  doesn't write a valid MAC address 
> to the Ether MAHR/MALR registers (there's no storage provided for the Ether
> MAC address either), so we have to resort to using a random MAC address...
> 
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
> This patch is against the 'net-next.git' repository.
> 
> Changes since the original posting:
> - don't break the message string into 2 lines.
> 
>  drivers/net/ethernet/renesas/sh_eth.c |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
> ===================================================================
> --- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
> +++ net-next/drivers/net/ethernet/renesas/sh_eth.c
> @@ -2735,6 +2735,11 @@ static int sh_eth_drv_probe(struct platf
> 
>  	/* read and set MAC address */
>  	read_mac_address(ndev, pd->mac_addr);
> +	if (!is_valid_ether_addr(ndev->dev_addr)) {
> +		dev_warn(&pdev->dev,
> +			 "no valid MAC address supplied, using a random one.\n");
> +		eth_hw_addr_random(ndev);
> +	}
> 
>  	/* ioremap the TSU registers */
>  	if (mdp->cd->tsu) {

-- 
Regards,

Laurent Pinchart


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

* Re: [PATCH v2] sh_eth: use random MAC address if no valid one supplied
  2013-04-29 20:39 ` Laurent Pinchart
@ 2013-04-30  2:01   ` Simon Horman
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2013-04-30  2:01 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: Sergei Shtylyov, netdev, nobuhiro.iwamatsu.yj, linux-sh

On Mon, Apr 29, 2013 at 10:39:17PM +0200, Laurent Pinchart wrote:
> On Monday 29 April 2013 23:49:42 Sergei Shtylyov wrote:
> > On Renesas R-Car based development boards, although a MAC address is printed
> > on all the Ethernet port labels, U-Boot  doesn't write a valid MAC address 
> > to the Ether MAHR/MALR registers (there's no storage provided for the Ether
> > MAC address either), so we have to resort to using a random MAC address...
> > 
> > Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> 
> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Acked-by: Simon Horman <horms+renesas@verge.net.au>

FYI, I believe that the lager board, which is an R-Car based development
board (AFAIK) does not suffer from this problem.

> > ---
> > This patch is against the 'net-next.git' repository.
> > 
> > Changes since the original posting:
> > - don't break the message string into 2 lines.
> > 
> >  drivers/net/ethernet/renesas/sh_eth.c |    5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
> > ===================================================================
> > --- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
> > +++ net-next/drivers/net/ethernet/renesas/sh_eth.c
> > @@ -2735,6 +2735,11 @@ static int sh_eth_drv_probe(struct platf
> > 
> >  	/* read and set MAC address */
> >  	read_mac_address(ndev, pd->mac_addr);
> > +	if (!is_valid_ether_addr(ndev->dev_addr)) {
> > +		dev_warn(&pdev->dev,
> > +			 "no valid MAC address supplied, using a random one.\n");
> > +		eth_hw_addr_random(ndev);
> > +	}
> > 
> >  	/* ioremap the TSU registers */
> >  	if (mdp->cd->tsu) {
> 
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" 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] 5+ messages in thread

* Re: [PATCH v2] sh_eth: use random MAC address if no valid one supplied
  2013-04-29 19:49 [PATCH v2] sh_eth: use random MAC address if no valid one supplied Sergei Shtylyov
  2013-04-29 20:39 ` Laurent Pinchart
@ 2013-04-30 19:37 ` David Miller
  2013-04-30 20:18   ` Sergei Shtylyov
  1 sibling, 1 reply; 5+ messages in thread
From: David Miller @ 2013-04-30 19:37 UTC (permalink / raw)
  To: sergei.shtylyov; +Cc: netdev, nobuhiro.iwamatsu.yj, linux-sh

From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date: Mon, 29 Apr 2013 23:49:42 +0400

> On Renesas R-Car based development boards, although a MAC address is printed on
> all the Ethernet port labels, U-Boot  doesn't write a valid MAC address  to the
> Ether MAHR/MALR registers (there's no storage provided for the Ether MAC address
> either), so we have to resort to using a random MAC address...
> 
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

Applied, thanks.

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

* Re: [PATCH v2] sh_eth: use random MAC address if no valid one supplied
  2013-04-30 19:37 ` David Miller
@ 2013-04-30 20:18   ` Sergei Shtylyov
  0 siblings, 0 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2013-04-30 20:18 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, nobuhiro.iwamatsu.yj, linux-sh

On 04/30/2013 11:37 PM, David Miller wrote:

>
>> On Renesas R-Car based development boards, although a MAC address is printed on
>> all the Ethernet port labels, U-Boot  doesn't write a valid MAC address  to the
>> Ether MAHR/MALR registers (there's no storage provided for the Ether MAC address
>> either), so we have to resort to using a random MAC address...
>>
>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Applied, thanks.

     Thanks to you. I thought I'll have to wait after merge window 
closes now... :-)

WBR, Sergei


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

end of thread, other threads:[~2013-04-30 20:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-29 19:49 [PATCH v2] sh_eth: use random MAC address if no valid one supplied Sergei Shtylyov
2013-04-29 20:39 ` Laurent Pinchart
2013-04-30  2:01   ` Simon Horman
2013-04-30 19:37 ` David Miller
2013-04-30 20:18   ` Sergei Shtylyov

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