All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v2] net/faraday: Disallow using reversed MAC address from hardware
@ 2016-07-21  1:42 Gavin Shan
  2016-07-21  4:05 ` David Miller
  2016-07-21 14:01 ` Andrew Lunn
  0 siblings, 2 replies; 4+ messages in thread
From: Gavin Shan @ 2016-07-21  1:42 UTC (permalink / raw)
  To: netdev; +Cc: davem, benh, David.Laight, Gavin Shan

The initial MAC address is retrieved from hardware if it's not
provided by device-tree. The reserved MAC address from hardware
will be used if non-reserved MAC address is invalid. It will
cause mismatched MAC address seen by hardware and software.

This disallows using the reserved hardware MAC address to avoid
the mismatched MAC address seen by hardware and software.

Fixes: 113ce107afe9 ("net/faraday: Read MAC address from chip")
Suggested-by: David Laight <David.Laight@ACULAB.COM>
Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
---
v2: Add "net-next" in the subject
---
 drivers/net/ethernet/faraday/ftgmac100.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index 2d4c7ea..36361f8 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -163,15 +163,6 @@ static void ftgmac100_setup_mac(struct ftgmac100 *priv)
 	mac[4] = (l >> 8) & 0xff;
 	mac[5] = l & 0xff;
 
-	if (!is_valid_ether_addr(mac)) {
-		mac[5] = (m >> 8) & 0xff;
-		mac[4] = m & 0xff;
-		mac[3] = (l >> 24) & 0xff;
-		mac[2] = (l >> 16) & 0xff;
-		mac[1] = (l >>  8) & 0xff;
-		mac[0] = l & 0xff;
-	}
-
 	if (is_valid_ether_addr(mac)) {
 		ether_addr_copy(priv->netdev->dev_addr, mac);
 		dev_info(priv->dev, "Read MAC address %pM from chip\n", mac);
-- 
2.1.0

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

* Re: [PATCH net-next v2] net/faraday: Disallow using reversed MAC address from hardware
  2016-07-21  1:42 [PATCH net-next v2] net/faraday: Disallow using reversed MAC address from hardware Gavin Shan
@ 2016-07-21  4:05 ` David Miller
  2016-07-21 14:01 ` Andrew Lunn
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2016-07-21  4:05 UTC (permalink / raw)
  To: gwshan; +Cc: netdev, benh, David.Laight

From: Gavin Shan <gwshan@linux.vnet.ibm.com>
Date: Thu, 21 Jul 2016 11:42:54 +1000

> The initial MAC address is retrieved from hardware if it's not
> provided by device-tree. The reserved MAC address from hardware
> will be used if non-reserved MAC address is invalid. It will
> cause mismatched MAC address seen by hardware and software.
> 
> This disallows using the reserved hardware MAC address to avoid
> the mismatched MAC address seen by hardware and software.
> 
> Fixes: 113ce107afe9 ("net/faraday: Read MAC address from chip")
> Suggested-by: David Laight <David.Laight@ACULAB.COM>
> Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
> ---
> v2: Add "net-next" in the subject

Makes sense, applied, thanks.

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

* Re: [PATCH net-next v2] net/faraday: Disallow using reversed MAC address from hardware
  2016-07-21  1:42 [PATCH net-next v2] net/faraday: Disallow using reversed MAC address from hardware Gavin Shan
  2016-07-21  4:05 ` David Miller
@ 2016-07-21 14:01 ` Andrew Lunn
  2016-07-22  0:01   ` Gavin Shan
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew Lunn @ 2016-07-21 14:01 UTC (permalink / raw)
  To: Gavin Shan; +Cc: netdev, davem, benh, David.Laight

On Thu, Jul 21, 2016 at 11:42:54AM +1000, Gavin Shan wrote:
> The initial MAC address is retrieved from hardware if it's not
> provided by device-tree. The reserved MAC address from hardware
> will be used if non-reserved MAC address is invalid. It will
> cause mismatched MAC address seen by hardware and software.
> 
> This disallows using the reserved hardware MAC address to avoid
> the mismatched MAC address seen by hardware and software.
> 
> Fixes: 113ce107afe9 ("net/faraday: Read MAC address from chip")
> Suggested-by: David Laight <David.Laight@ACULAB.COM>
> Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>

Too late now, since it has been accepted, but the subject line says
reversed, not reserved.

	  Andrew

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

* Re: [PATCH net-next v2] net/faraday: Disallow using reversed MAC address from hardware
  2016-07-21 14:01 ` Andrew Lunn
@ 2016-07-22  0:01   ` Gavin Shan
  0 siblings, 0 replies; 4+ messages in thread
From: Gavin Shan @ 2016-07-22  0:01 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: Gavin Shan, netdev, davem, benh, David.Laight

On Thu, Jul 21, 2016 at 04:01:09PM +0200, Andrew Lunn wrote:
>On Thu, Jul 21, 2016 at 11:42:54AM +1000, Gavin Shan wrote:
>> The initial MAC address is retrieved from hardware if it's not
>> provided by device-tree. The reserved MAC address from hardware
>> will be used if non-reserved MAC address is invalid. It will
>> cause mismatched MAC address seen by hardware and software.
>> 
>> This disallows using the reserved hardware MAC address to avoid
>> the mismatched MAC address seen by hardware and software.
>> 
>> Fixes: 113ce107afe9 ("net/faraday: Read MAC address from chip")
>> Suggested-by: David Laight <David.Laight@ACULAB.COM>
>> Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
>
>Too late now, since it has been accepted, but the subject line says
>reversed, not reserved.
>

Yes, It should be reversed, not reserved in the commit log.

Thanks,
Gavin

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

end of thread, other threads:[~2016-07-22  0:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-21  1:42 [PATCH net-next v2] net/faraday: Disallow using reversed MAC address from hardware Gavin Shan
2016-07-21  4:05 ` David Miller
2016-07-21 14:01 ` Andrew Lunn
2016-07-22  0:01   ` Gavin Shan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.