Re: [U-Boot] [PATCH v4 013/100] RFC: sandbox: net: Suppress the MAC-address warnings

2019-11-22 Thread Joe Hershberger
Hi Simon,

On Thu, Nov 21, 2019 at 10:40 PM Simon Glass  wrote:
>
> These warnings appear every thing sandbox is run (see below) and dwarf the
> actual useful output. Suppress them in two ways:
>
> 1. For the mismatch warnings, only set the ethaddr environment
> variables when running tests.
>
> 2. For the 'MAC address from ROM' warning, never print this on sandbox.
>
> Signed-off-by: Simon Glass 
> ---
> Unfortunately this breaks the tests so is not applicable as is:
>
> $ /tmp/b/sandbox/u-boot -T -c "ut dm eth_prime"
>
> U-Boot 2019.10-00508-g95f6257285-dirty (Oct 13 2019 - 09:21:34 -0600)
>
> Model: sandbox
> DRAM:  128 MiB
> WDT:   Started with servicing (60s timeout)
> MMC:   mmc2: 2 (SD), mmc1: 1 (SD), mmc0: 0 (SD)
> In:serial
> Out:   vidconsole
> Err:   vidconsole
> Model: sandbox
> SCSI:
> Net:
> Error: eth@10002000 address not set.
> eth-1: eth@10002000
> Error: eth@10003000 address not set.
> , eth-1: eth@10003000
> Error: sbe5 address not set.
> , eth-1: sbe5
> Error: eth@10004000 address not set.
> , eth-1: eth@10004000
> Test: dm_test_eth_prime: eth.c
> Test: dm_test_eth_prime: eth.c (flat tree)
> Failures: 0
>
> Old output:
>
> 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@10002000 address not set.
> , eth-1: eth@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
>
> New output:
> U-Boot 2019.10
>
> Model: sandbox
> DRAM:  128 MiB
> 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_vethc7e1b9e
> Error: eth@10002000 address not set.
> , eth-1: eth@10002000
> Hit any key to stop autoboot:  0
> =>
>
>
> Changes in v4: None
> Changes in v3:
> - Only supress the 'MAC address from ROM' warning on sandbox
> - Set the environment variables at runtime to avoid other warnings
>
> Changes in v2: None
>
>  arch/sandbox/cpu/state.c | 12 ++--
>  arch/sandbox/include/asm/state.h |  5 -
>  cmd/nvedit.c |  8 
>  include/configs/sandbox.h|  7 ++-
>  include/env.h| 12 
>  net/eth-uclass.c | 11 +--
>  test/dm/test-main.c  |  2 +-
>  7 files changed, 46 insertions(+), 11 deletions(-)
>
> diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c
> index dee5fde4f7..70b278e4e2 100644
> --- a/arch/sandbox/cpu/state.c
> +++ b/arch/sandbox/cpu/state.c
> @@ -351,7 +351,7 @@ bool state_get_skip_delays(void)
> return state->skip_delays;
>  }
>
> -void state_reset_for_test(struct sandbox_state *state)
> +void state_reset_for_test(struct sandbox_state *state, bool eth_vars)
>  {
> /* No reset yet, so mark it as such. Always allow power reset */
> state->last_sysreset = SYSRESET_COUNT;
> @@ -367,6 +367,14 @@ void state_reset_for_test(struct sandbox_state *state)
>  */
> INIT_LIST_HEAD(>mapmem_head);
> state->next_tag = state->ram_size;
> +
> +   if (eth_vars) {
> +   /* set up some environment variables needed by the eth tests 
> */
> +   env_set_for_test("ethaddr", "00:00:11:22:33:44");
> +   env_set_for_test("eth1addr", "00:00:11:22:33:45");
> +   env_set_for_test("eth3addr", 

[U-Boot] [PATCH v4 013/100] RFC: sandbox: net: Suppress the MAC-address warnings

2019-11-21 Thread Simon Glass
These warnings appear every thing sandbox is run (see below) and dwarf the
actual useful output. Suppress them in two ways:

1. For the mismatch warnings, only set the ethaddr environment
variables when running tests.

2. For the 'MAC address from ROM' warning, never print this on sandbox.

Signed-off-by: Simon Glass 
---
Unfortunately this breaks the tests so is not applicable as is:

$ /tmp/b/sandbox/u-boot -T -c "ut dm eth_prime"

U-Boot 2019.10-00508-g95f6257285-dirty (Oct 13 2019 - 09:21:34 -0600)

Model: sandbox
DRAM:  128 MiB
WDT:   Started with servicing (60s timeout)
MMC:   mmc2: 2 (SD), mmc1: 1 (SD), mmc0: 0 (SD)
In:serial
Out:   vidconsole
Err:   vidconsole
Model: sandbox
SCSI:
Net:
Error: eth@10002000 address not set.
eth-1: eth@10002000
Error: eth@10003000 address not set.
, eth-1: eth@10003000
Error: sbe5 address not set.
, eth-1: sbe5
Error: eth@10004000 address not set.
, eth-1: eth@10004000
Test: dm_test_eth_prime: eth.c
Test: dm_test_eth_prime: eth.c (flat tree)
Failures: 0

Old output:

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@10002000 address not set.
, eth-1: eth@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

New output:
U-Boot 2019.10

Model: sandbox
DRAM:  128 MiB
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_vethc7e1b9e
Error: eth@10002000 address not set.
, eth-1: eth@10002000
Hit any key to stop autoboot:  0
=>


Changes in v4: None
Changes in v3:
- Only supress the 'MAC address from ROM' warning on sandbox
- Set the environment variables at runtime to avoid other warnings

Changes in v2: None

 arch/sandbox/cpu/state.c | 12 ++--
 arch/sandbox/include/asm/state.h |  5 -
 cmd/nvedit.c |  8 
 include/configs/sandbox.h|  7 ++-
 include/env.h| 12 
 net/eth-uclass.c | 11 +--
 test/dm/test-main.c  |  2 +-
 7 files changed, 46 insertions(+), 11 deletions(-)

diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c
index dee5fde4f7..70b278e4e2 100644
--- a/arch/sandbox/cpu/state.c
+++ b/arch/sandbox/cpu/state.c
@@ -351,7 +351,7 @@ bool state_get_skip_delays(void)
return state->skip_delays;
 }
 
-void state_reset_for_test(struct sandbox_state *state)
+void state_reset_for_test(struct sandbox_state *state, bool eth_vars)
 {
/* No reset yet, so mark it as such. Always allow power reset */
state->last_sysreset = SYSRESET_COUNT;
@@ -367,6 +367,14 @@ void state_reset_for_test(struct sandbox_state *state)
 */
INIT_LIST_HEAD(>mapmem_head);
state->next_tag = state->ram_size;
+
+   if (eth_vars) {
+   /* set up some environment variables needed by the eth tests */
+   env_set_for_test("ethaddr", "00:00:11:22:33:44");
+   env_set_for_test("eth1addr", "00:00:11:22:33:45");
+   env_set_for_test("eth3addr", "00:00:11:22:33:46");
+   env_set_for_test("eth5addr", "00:00:11:22:33:47");
+   }
 }
 
 int state_init(void)
@@ -377,7 +385,7 @@ int state_init(void)
state->ram_buf = os_malloc(state->ram_size);
assert(state->ram_buf);
 
-   state_reset_for_test(state);
+   state_reset_for_test(state, false);
/*
 *