[PATCH uboot v2016.05-aspeed-openbmc 3/9] net: aspeednic: Do not fill in a random MAC address

Cédric Le Goater clg at kaod.org
Thu Jun 30 02:09:45 AEST 2016


From: "Milton D. Miller II" <miltonm at us.ibm.com>

Do not check the u-boot environemnt or fill in a random address
in the write_hwaddr hook, instead rely on the framework to do so.

The doc/README.ethaddr specifically states that random addresses
are only to be assigned as part of a emergency such as a netboot
recovery command.

The upstream commit created a config variable to assign a
random mac when none is set leaving it zero and that has now
been backported.

Note: The hardware address is reset to 0 as part of the ethernet
reset performed at boot.  If no valid MAC address is found in
the environment the hardware will contain zeros and the operating
system will assign a valid random MAC address if u-boot is
configured not to.

The net effect is an attempt to use the network will result in
the ethernet address not set warning being printed if the ethaddr
variable is not set, and a warning iwth the random mac address
if the config is set.  If a valid ethernet address is set
in the environment it will be programmed in the hardware and
used by the operating system.

Signed-off-by: Milton Miller <miltonm at us.ibm.com>
Signed-off-by: Joel Stanley <joel at jms.id.au>
Signed-off-by: Cédric Le Goater <clg at kaod.org>
---
 drivers/net/aspeednic.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/aspeednic.c b/drivers/net/aspeednic.c
index 71e5548fbc05..3f79b949194a 100644
--- a/drivers/net/aspeednic.c
+++ b/drivers/net/aspeednic.c
@@ -1351,10 +1351,6 @@ static void aspeednic_halt(struct eth_device* dev)
 
 static int aspeednic_write_hwaddr(struct eth_device* dev)
 {
-	if (!eth_getenv_enetaddr_by_index("eth", 0, dev->enetaddr)) {
-		net_random_ethaddr(dev->enetaddr);
-	}
-
 	OUTL(dev, ((dev->enetaddr[2] << 24) | (dev->enetaddr[3] << 16)
 				| (dev->enetaddr[4] << 8) | dev->enetaddr[5]), MAC_LADR_REG);
 	OUTL(dev, ((dev->enetaddr[0] << 8) | dev->enetaddr[1]), MAC_MADR_REG);
-- 
2.1.4



More information about the openbmc mailing list