Skip to contentSkip to conversation

net: fec: make sure to init MAC address

PATCH Applied Lucas Stach 2 participants 2 messages Mar 30, 2014 – Mar 31, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net: fec: make sure to init MAC address

From: Lucas Stach <[email protected]>

Though we made sure to acquire a valid MAC for the netdevice we never actually programmed it into the hardware.
So if the bootloader did not set the MAC, network operation would only work if userspace explicitly asked to transfer the MAC to hardware.

---
v2: make test more obvious

---
 drivers/net/ethernet/freescale/fec_main.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/net/ethernet/freescale/fec_main.c +7 -4
index e19315eaf2dd..8d69e439f0c5 100644
@@ -1898,10 +1898,11 @@ fec_set_mac_address(struct net_device *ndev, void *p)
 	struct fec_enet_private *fep = netdev_priv(ndev);
 	struct sockaddr *addr = p;
 
-	if (!is_valid_ether_addr(addr->sa_data))
-		return -EADDRNOTAVAIL;
-
-	memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len);
+	if (addr) {
+		if (!is_valid_ether_addr(addr->sa_data))
+			return -EADDRNOTAVAIL;
+		memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len);
+	}
 
 	writel(ndev->dev_addr[3] | (ndev->dev_addr[2] << 8) |
 		(ndev->dev_addr[1] << 16) | (ndev->dev_addr[0] << 24),
@@ -2000,6 +2001,8 @@ static int fec_enet_init(struct net_device *ndev)
 
 	/* Get the Ethernet address */
 	fec_get_mac(ndev);
+	/* make sure MAC we just acquired is programmed into the hw */
+	fec_set_mac_address(ndev, NULL);
 
 	/* init the tx & rx ring size */
 	fep->tx_ring_size = TX_RING_SIZE;
Signature · 1 line
1.8.5.3
maintainer Applied
#1 lore raw

From: Lucas Stach <[email protected]>
Date: Sun, 30 Mar 2014 21:32:08 +0200

Quoted 10 lines

From: Lucas Stach <[email protected]>

Though we made sure to acquire a valid MAC for the netdevice we never actually programmed it into the hardware.
So if the bootloader did not set the MAC, network operation would only work if userspace explicitly asked to transfer the MAC to hardware.

Applied, thank you.