[U-Boot] [PATCH 021/126] sandbox: net: Suppress the MAC-address warnings

Simon Glass sjg at chromium.org
Wed Sep 25 14:56:05 UTC 2019


These warnings appear every thing sandbox is run (see below) and dwarf the
actual useful output. Suppress them.

Hopefully at some point a way can be found to fix the root cause.

U-Boot 2019.10-rc2

Model: sandbox
DRAM:  128 MiB

Warning: host_lo MAC addresses don't match:
Address in ROM is          a6:28:b7:47:28:93
Address in environment is  00:00:11:22:33:44

Warning: host_enp5s0 MAC addresses don't match:
Address in ROM is          a6:28:b7:47:28:93
Address in environment is  00:00:11:22:33:45

Warning: host_eth6 using MAC address from ROM

Warning: host_docker0 MAC addresses don't match:
Address in ROM is          a6:28:b7:47:28:93
Address in environment is  00:00:11:22:33:46

Warning: host_docker_gwbridge using MAC address from ROM

Warning: host_veth1118e68 MAC addresses don't match:
Address in ROM is          a6:28:b7:47:28:93
Address in environment is  00:00:11:22:33:47
WDT:   Not found!
MMC:
In:    cros-ec-keyb
Out:   vidconsole
Err:   vidconsole
Model: sandbox
SCSI:
Net:   eth0: host_lo, eth1: host_enp5s0, eth2: host_eth6, eth3: host_docker0, eth4: host_docker_gwbridge, eth5: host_veth1118e68
Error: eth at 10002000 address not set.
, eth-1: eth at 10002000
Test 'pmc_base' not found

Warning: host_lo MAC addresses don't match:
Address in ROM is          2a:24:9a:31:90:f8
Address in environment is  00:00:11:22:33:44

Warning: host_enp5s0 MAC addresses don't match:
Address in ROM is          ce:23:d9:74:6f:6c
Address in environment is  00:00:11:22:33:45

Warning: host_eth6 using MAC address from ROM

Warning: host_docker0 MAC addresses don't match:
Address in ROM is          ee:22:1c:3b:be:bc
Address in environment is  00:00:11:22:33:46

Warning: host_docker_gwbridge using MAC address from ROM

Warning: host_veth1118e68 MAC addresses don't match:
Address in ROM is          ae:20:9e:3d:a4:9f
Address in environment is  00:00:11:22:33:47

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 net/eth-uclass.c | 34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)

diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index 3bd98b01ad3..67a7062e9d8 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -485,6 +485,12 @@ static int eth_post_probe(struct udevice *dev)
 	struct eth_device_priv *priv = dev->uclass_priv;
 	struct eth_pdata *pdata = dev->platdata;
 	unsigned char env_enetaddr[ARP_HLEN];
+	/*
+	 * These warnings always appear on sandbox and are not useful. They have
+	 * been here for some time and the issue has not been resolved. So for
+	 * now, disable them.
+	 */
+	bool show_warnings = !IS_ENABLED(CONFIG_SANDBOX);
 
 #if defined(CONFIG_NEEDS_MANUAL_RELOC)
 	struct eth_ops *ops = eth_get_ops(dev);
@@ -526,29 +532,33 @@ static int eth_post_probe(struct udevice *dev)
 	if (!is_zero_ethaddr(env_enetaddr)) {
 		if (!is_zero_ethaddr(pdata->enetaddr) &&
 		    memcmp(pdata->enetaddr, env_enetaddr, ARP_HLEN)) {
-			printf("\nWarning: %s MAC addresses don't match:\n",
-			       dev->name);
-			printf("Address in ROM is          %pM\n",
-			       pdata->enetaddr);
-			printf("Address in environment is  %pM\n",
-			       env_enetaddr);
+			if (show_warnings) {
+				printf("\nWarning: %s MAC addresses don't match:\n",
+				       dev->name);
+				printf("Address in ROM is          %pM\n",
+				       pdata->enetaddr);
+				printf("Address in environment is  %pM\n",
+				       env_enetaddr);
+			}
 		}
 
 		/* Override the ROM MAC address */
 		memcpy(pdata->enetaddr, env_enetaddr, ARP_HLEN);
 	} else if (is_valid_ethaddr(pdata->enetaddr)) {
 		eth_env_set_enetaddr_by_index("eth", dev->seq, pdata->enetaddr);
-		printf("\nWarning: %s using MAC address from ROM\n",
-		       dev->name);
+		if (show_warnings)
+			printf("\nWarning: %s using MAC address from ROM\n",
+			       dev->name);
 	} else if (is_zero_ethaddr(pdata->enetaddr) ||
 		   !is_valid_ethaddr(pdata->enetaddr)) {
 #ifdef CONFIG_NET_RANDOM_ETHADDR
 		net_random_ethaddr(pdata->enetaddr);
-		printf("\nWarning: %s (eth%d) using random MAC address - %pM\n",
-		       dev->name, dev->seq, pdata->enetaddr);
+		if (show_warnings)
+			printf("\nWarning: %s (eth%d) using random MAC address - %pM\n",
+			       dev->name, dev->seq, pdata->enetaddr);
 #else
-		printf("\nError: %s address not set.\n",
-		       dev->name);
+		if (show_warnings)
+			printf("\nError: %s address not set.\n", dev->name);
 		return -EINVAL;
 #endif
 	}
-- 
2.23.0.444.g18eeb5a265-goog



More information about the U-Boot mailing list