Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1719076 > unrolled thread

[PATCH net-next 3/4] net: mvpp2: fix use of the random mac address for PPv2.2

Started byAntoine Tenart <antoine.tenart@free-electrons.com>
First post2017-08-24 11:50 +0200
Last post2017-08-24 11:50 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH net-next 3/4] net: mvpp2: fix use of the random mac address for PPv2.2 Antoine Tenart <antoine.tenart@free-electrons.com> - 2017-08-24 11:50 +0200

#1719076 — [PATCH net-next 3/4] net: mvpp2: fix use of the random mac address for PPv2.2

FromAntoine Tenart <antoine.tenart@free-electrons.com>
Date2017-08-24 11:50 +0200
Subject[PATCH net-next 3/4] net: mvpp2: fix use of the random mac address for PPv2.2
Message-ID<uhWVY-4Hm-13@gated-at.bofh.it>
The MAC retrieval logic is using a variable to store an h/w stored mac
address and checks this mac against invalid ones before using it. But
the mac address is only read from h/w when using PPv2.1. So when using
PPv2.2 it defaults to its init state.

This patches fixes the logic to only check if the h/w mac is valid when
actually retrieving a mac from h/w.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 drivers/net/ethernet/marvell/mvpp2.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
index 908e5b148fd7..fe8309124a09 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -7466,15 +7466,17 @@ static void mvpp2_port_copy_mac_addr(struct net_device *dev, struct mvpp2 *priv,
 		*mac_from = "device tree";
 		ether_addr_copy(dev->dev_addr, dt_mac_addr);
 	} else {
-		if (priv->hw_version == MVPP21)
+		if (priv->hw_version == MVPP21) {
 			mvpp21_get_mac_address(port, hw_mac_addr);
-		if (is_valid_ether_addr(hw_mac_addr)) {
-			*mac_from = "hardware";
-			ether_addr_copy(dev->dev_addr, hw_mac_addr);
-		} else {
-			*mac_from = "random";
-			eth_hw_addr_random(dev);
+			if (is_valid_ether_addr(hw_mac_addr)) {
+				*mac_from = "hardware";
+				ether_addr_copy(dev->dev_addr, hw_mac_addr);
+				return;
+			}
 		}
+
+		*mac_from = "random";
+		eth_hw_addr_random(dev);
 	}
 }
 
-- 
2.13.5

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web