summaryrefslogtreecommitdiff
path: root/test/dm/eth.c
diff options
context:
space:
mode:
authorMichael Walle <michael@walle.cc>2020-06-02 01:47:09 +0200
committerSimon Glass <sjg@chromium.org>2020-06-11 20:52:11 -0600
commitbe1a6e94254af205bd67d69e3bdb26b161ccd72f (patch)
tree5bff9218c993494bbb5cbfa8d817b31f2c13d682 /test/dm/eth.c
parent0a6b75f7d8cbf7edc62c7d132b521703f1e2a53d (diff)
dm: uclass: don't assign aliased seq numbers
If there are aliases for an uclass, set the base for the "dynamically" allocated numbers next to the highest alias. Please note, that this might lead to holes in the sequences, depending on the device tree. For example if there is only an alias "ethernet1", the next device seq number would be 2. In particular this fixes a problem with boards which are using ethernet aliases but also might have network add-in cards like the E1000. If the board is started with the add-in card and depending on the order of the drivers, the E1000 might occupy the first ethernet device and mess up all the hardware addresses, because the devices are now shifted by one. Also adapt the test cases to the new handling and add test cases checking the holes in the seq numbers. Signed-off-by: Michael Walle <michael@walle.cc> Reviewed-by: Alex Marginean <alexandru.marginean@nxp.com> Tested-by: Alex Marginean <alexandru.marginean@nxp.com> Acked-by: Vladimir Oltean <olteanv@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Michal Simek <michal.simek@xilinx.com> [on zcu102-revA]
Diffstat (limited to 'test/dm/eth.c')
-rw-r--r--test/dm/eth.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/test/dm/eth.c b/test/dm/eth.c
index 1fddcaabb09..b58c9640a27 100644
--- a/test/dm/eth.c
+++ b/test/dm/eth.c
@@ -48,7 +48,7 @@ static int dm_test_eth_alias(struct unit_test_state *uts)
ut_assertok(net_loop(PING));
ut_asserteq_str("eth@10002000", env_get("ethact"));
- env_set("ethact", "eth1");
+ env_set("ethact", "eth6");
ut_assertok(net_loop(PING));
ut_asserteq_str("eth@10004000", env_get("ethact"));
@@ -105,7 +105,7 @@ static int dm_test_eth_act(struct unit_test_state *uts)
const char *ethname[DM_TEST_ETH_NUM] = {"eth@10002000", "eth@10003000",
"sbe5", "eth@10004000"};
const char *addrname[DM_TEST_ETH_NUM] = {"ethaddr", "eth5addr",
- "eth3addr", "eth1addr"};
+ "eth3addr", "eth6addr"};
char ethaddr[DM_TEST_ETH_NUM][18];
int i;
@@ -188,15 +188,15 @@ static int dm_test_eth_rotate(struct unit_test_state *uts)
/* Invalidate eth1's MAC address */
memset(ethaddr, '\0', sizeof(ethaddr));
- strncpy(ethaddr, env_get("eth1addr"), 17);
- /* Must disable access protection for eth1addr before clearing */
- env_set(".flags", "eth1addr");
- env_set("eth1addr", NULL);
+ strncpy(ethaddr, env_get("eth6addr"), 17);
+ /* Must disable access protection for eth6addr before clearing */
+ env_set(".flags", "eth6addr");
+ env_set("eth6addr", NULL);
retval = _dm_test_eth_rotate1(uts);
/* Restore the env */
- env_set("eth1addr", ethaddr);
+ env_set("eth6addr", ethaddr);
env_set("ethrotate", NULL);
if (!retval) {