提交 44934fac 编写于 作者: L Lucas Stach 提交者: David S. Miller

net: fec: make sure to init MAC address

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.
Signed-off-by: NLucas Stach <l.stach@pengutronix.de>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 6dfac5c3
...@@ -1898,10 +1898,11 @@ fec_set_mac_address(struct net_device *ndev, void *p) ...@@ -1898,10 +1898,11 @@ fec_set_mac_address(struct net_device *ndev, void *p)
struct fec_enet_private *fep = netdev_priv(ndev); struct fec_enet_private *fep = netdev_priv(ndev);
struct sockaddr *addr = p; struct sockaddr *addr = p;
if (!is_valid_ether_addr(addr->sa_data)) if (addr) {
return -EADDRNOTAVAIL; if (!is_valid_ether_addr(addr->sa_data))
return -EADDRNOTAVAIL;
memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len); memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len);
}
writel(ndev->dev_addr[3] | (ndev->dev_addr[2] << 8) | writel(ndev->dev_addr[3] | (ndev->dev_addr[2] << 8) |
(ndev->dev_addr[1] << 16) | (ndev->dev_addr[0] << 24), (ndev->dev_addr[1] << 16) | (ndev->dev_addr[0] << 24),
...@@ -2000,6 +2001,8 @@ static int fec_enet_init(struct net_device *ndev) ...@@ -2000,6 +2001,8 @@ static int fec_enet_init(struct net_device *ndev)
/* Get the Ethernet address */ /* Get the Ethernet address */
fec_get_mac(ndev); 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 */ /* init the tx & rx ring size */
fep->tx_ring_size = TX_RING_SIZE; fep->tx_ring_size = TX_RING_SIZE;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册