[PATCH] net/faraday: Disallow using reversed MAC address from hardware

Subsystems: networking drivers, the rest

STALE3672d

2 messages, 1 author, 2016-07-21 · open the first message on its own page

[PATCH] net/faraday: Disallow using reversed MAC address from hardware

From: Gavin Shan <hidden>
Date: 2016-07-21 01:29:38

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 <redacted>
Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Gavin Shan <redacted>
---
 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

Re: [PATCH] net/faraday: Disallow using reversed MAC address from hardware

From: Gavin Shan <hidden>
Date: 2016-07-21 01:38:49

On Thu, Jul 21, 2016 at 11:29:23AM +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 <redacted>
Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Gavin Shan <redacted>
---
The "net-next" is missed from the subject. I will send a v2 to
fix it. Sorry for the noise.

Thanks,
Gavin
quoted hunk
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help