diff options
author | Joe Hershberger <joe.hershberger@ni.com> | 2015-03-22 17:09:16 -0500 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-04-18 11:11:13 -0600 |
commit | e58780dcb7b8656ebc2dd6ba6d0da728bc65bf40 (patch) | |
tree | 68b6448131caeaa7d02a88cfbb1116e56f3b679b /test/dm/eth.c | |
parent | bfacad7da11711231ca59717c0a8bc7317c5bb28 (diff) | |
download | u-boot-e58780dcb7b8656ebc2dd6ba6d0da728bc65bf40.tar.gz u-boot-e58780dcb7b8656ebc2dd6ba6d0da728bc65bf40.tar.bz2 u-boot-e58780dcb7b8656ebc2dd6ba6d0da728bc65bf40.zip |
dm: eth: Add support for aliases
Allow network devices to be referred to as "eth0" instead of
"eth@12345678" when specified in ethact.
Add tests to verify this behavior.
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/dm/eth.c')
-rw-r--r-- | test/dm/eth.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/dm/eth.c b/test/dm/eth.c index 04ccf49820..5688b71de0 100644 --- a/test/dm/eth.c +++ b/test/dm/eth.c @@ -36,3 +36,27 @@ static int dm_test_eth(struct dm_test_state *dms) return 0; } DM_TEST(dm_test_eth, DM_TESTF_SCAN_FDT); + +static int dm_test_eth_alias(struct dm_test_state *dms) +{ + NetPingIP = string_to_ip("1.1.2.2"); + setenv("ethact", "eth0"); + ut_assertok(NetLoop(PING)); + ut_asserteq_str("eth@10002000", getenv("ethact")); + + setenv("ethact", "eth1"); + ut_assertok(NetLoop(PING)); + ut_asserteq_str("eth@10004000", getenv("ethact")); + + /* Expected to fail since eth2 is not defined in the device tree */ + setenv("ethact", "eth2"); + ut_assertok(NetLoop(PING)); + ut_asserteq_str("eth@10002000", getenv("ethact")); + + setenv("ethact", "eth5"); + ut_assertok(NetLoop(PING)); + ut_asserteq_str("eth@10003000", getenv("ethact")); + + return 0; +} +DM_TEST(dm_test_eth_alias, DM_TESTF_SCAN_FDT); |