[U-Boot] dm eth rotation is broken under some circumstances

Bin Meng bmeng.cn at gmail.com
Thu Sep 10 11:46:51 CEST 2015


Hi Joe,

I found under some circumstances the eth rotation functionality is broken.

Test scenario:

1). Say we have two ethernet devices, eth0 and eth1. Both devices are
not probed yet (or probe failed due to ethaddr and eth1addr not set)

Now we set the eth1addr to a valid MAC address, set ethact to NULL.
Test a "ping 10.10.0.100", it fails.

The supposed eth rotation should switch to eth1 for 'ping', right? But
debugging shows that eth1's probe routine never gets called (see log
below).

=> ping 10.10.0.100

Error: eth_designware#0 address not set.

Error: eth_designware#0 address not set.

Error: eth_designware#0 address not set.

Error: eth_designware#0 address not set.
No ethernet found.

Error: eth_designware#0 address not set.
ping failed; host 10.10.0.100 is not alive

2). The same test scenario above, but set ethact to eth1, we should
get "ping 10.10.0.100" successfully pinged. Unfortunately, it still
fails, reporting 'No ethernet found".

=> ping 10.10.0.100

Error: eth_designware#0 address not set.

Error: eth_designware#0 address not set.

Error: eth_designware#0 address not set.

Error: eth_designware#1 address not set.

Error: eth_designware#0 address not set.

Error: eth_designware#0 address not set.
No ethernet found.

Error: eth_designware#0 address not set.
ping failed; host 10.10.0.100 is not alive

This time eth1's probe routine gets called, but it still failed (see
log "Error: eth_designware#1 address not set.")

This is because with eth0 probe failure before, when eth1 get probed,
eth1's dev->seq will be set to 0 as it is the first ethernet device
seen by dm eth, so its corresponding MAC address is ethaddr, NOT
eth1addr. So its probe phase will still fail in eth_post_probe(), and
rotation does not work as expected. I think this "dev->seq" match to
"eth%daddr" is something we should think about with driver model
conversion.

So far the eth rotation seems worked pretty well if everything is good
(i.e. probe OK), but on some exception path like above two it does not
function as expected :(

Regards,
Bin


More information about the U-Boot mailing list