[PATCH u-boot 5/5] net: aspeednic: Do not fill in a random MAC address

OpenBMC Patches openbmc-patches at stwcx.xyz
Sat Mar 12 05:40:44 AEDT 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>
---
 drivers/net/aspeednic.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/aspeednic.c b/drivers/net/aspeednic.c
index 841df8b..e80561f 100644
--- a/drivers/net/aspeednic.c
+++ b/drivers/net/aspeednic.c
@@ -1363,10 +1363,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)) {
-    eth_random_enetaddr(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.7.1




More information about the openbmc mailing list