net/eth: Don't issue warnings for offboard ethernet chips
Subsystems (3)
PATCH 1/1 net/eth: Don't issue warnings for offboard ethernet chips
When using an offboard ethernet chip such as e1000, it is highly likely that the driver has already read a valid MAC address from the onboard EEPROM. In that case, U-Boot should not issue a warning about the absence of an "eth*addr" value in the environment.
Since the calling code in drivers/usb/eth/usb_ether.c and net/eth.c cannot tell what the error really was, move the log messages down into the eth_write_hwaddr() code.
The code is further improved by the use of is_valid_ether_addr(), etc.
A properly configured HWW-1U-1A board is fixed from this output:
Net: e1000: 00:50:93:81:ff:8a
e1000: 00:50:93:81:ff:8b
owt0, owt1, peer, e1000#0 Warning: failed to set MAC address
, e1000#1
Warning: failed to set MAC address
To this:
Net: e1000: 00:50:93:81:ff:8a
e1000: 00:50:93:81:ff:8b
owt0, owt1, peer, e1000#0, e1000#1Furthermore, the log messages should avoid screwing up the "Net:" output formatting provided by the calling code, EG:
Net: eth0, eth1 [could not set MAC: 00:50:93:81:ff:8a], eth2
Finally, the code in the NE-2000 driver which was working around the spurious error messages from the core code can be removed.
--- drivers/net/ne2000_base.c | 17 +----------- drivers/usb/eth/usb_ether.c | 4 +-- net/eth.c | 56 ++++++++++++++++++++++++------------------ 3 files changed, 35 insertions(+), 42 deletions(-)
drivers/net/ne2000_base.c +2 -15
@@ -710,21 +710,8 @@ static int ne2k_setup_driver(struct eth_device *dev) nic.rx_buf_start =RX_START ; nic.rx_buf_end =RX_END ; -/* -* According to doc/README.enetaddr, drivers shall give priority -* to the MAC address value in the environment, so we do not read -* it from the prom or eeprom if it is specified in the environment. -*/ -if (!eth_getenv_enetaddr ("ethaddr" , dev->enetaddr)) { -/* If the MAC address is not in the environment, get it: */ -if (!get_prom (dev->enetaddr, nic.base))/* get MAC from prom */ -dp83902a_init (dev->enetaddr);/* fallback: seeprom */ -/* And write it into the environment otherwise eth_write_hwaddr -* returns -1 due to eth_getenv_enetaddr_by_index() failing, -* and this causes "Warning: failed to set MAC address", and -* cmd_bdinfo has no ethaddr value which it can show: */ -eth_setenv_enetaddr ("ethaddr" , dev->enetaddr); - } +if (!get_prom (dev->enetaddr, nic.base))/* get MAC from prom */ +dp83902a_init (dev->enetaddr);/* fallback: seeprom */ return 0 ; }
drivers/usb/eth/usb_ether.c +1 -3
@@ -103,9 +103,7 @@ static void probe_valid_drivers(struct usb_device *dev)* relies on it */ eth_register (eth); -if (eth_write_hwaddr (eth,"usbeth" , - usb_max_eth_dev -1 )) -puts ("Warning: failed to set MAC address\n" ); +eth_write_hwaddr (eth,"usbeth" , usb_max_eth_dev -1 );break ; } }
net/eth.c +32 -24
73 lines not on this page · raw message
Signature · 1 line
1.7.7.3
PATCH 1/1 net/eth: Don't issue warnings for offboard ethernet chips
Dear Kyle Moffett,
Quoted 4 lines · In message <[email protected]> you…
When using an offboard ethernet chip such as e1000, it is highly likely that the driver has already read a valid MAC address from the onboard EEPROM. In that case, U-Boot should not issue a warning about the absence of an "eth*addr" value in the environment.
Yes, it should. The rule is that then environment settings always have precedence, and if they are missing or contain different data than other sources for this inofmration, a waning shall be printed.
Quoted 9 lines
A properly configured HWW-1U-1A board is fixed from this output:
Net: e1000: 00:50:93:81:ff:8a
e1000: 00:50:93:81:ff:8b owt0, owt1, peer, e1000#0Warning: failed to set MAC address
, e1000#1
Warning: failed to set MAC address
Quoted 5 lines
To this:
Net: e1000: 00:50:93:81:ff:8a
e1000: 00:50:93:81:ff:8b owt0, owt1, peer, e1000#0, e1000#1
This is also not correct. There should never be any printing of the MAC addresses here.
The messages should be:
Net: owt0, owt1, peer, e1000#0, e1000#1
Quoted 4 lines
Furthermore, the log messages should avoid screwing up the "Net:" output formatting provided by the calling code, EG:
Net: eth0, eth1 [could not set MAC: 00:50:93:81:ff:8a], eth2
No. "could not set" is an error message, and deserves a separate line.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "What terrible way to die." "There are no good ways." -- Sulu and Kirk, "That Which Survives", stardate unknown
Moffett
PATCH 1/1 net/eth: Don't issue warnings for offboard ethernet chips
Quoted 10 lines · Wolfgang Denk
Dear Kyle Moffett,
Quoted 4 lines · In message <[email protected]> you…
When using an offboard ethernet chip such as e1000, it is highly likely that the driver has already read a valid MAC address from the onboard EEPROM. In that case, U-Boot should not issue a warning about the absence of an "eth*addr" value in the environment.
Yes, it should. The rule is that then environment settings always have precedence, and if they are missing or contain different data than other sources for this information, a waning shall be printed.
That is a problem for devices which are typically add-in PCI cards. In that case U-Boot can't be expected to have knowledge of what the MAC addresses should be, and it should just use the ROM attached to the card instead.
In our use case the e1000 chips are on a separate board attached via CompactPCI. U-Boot should not spontaneously start throwing errors just because the board was stuck into a different slot or replaced due to hardware failure.
I was careful to maintain the behavior that U-Boot will issue a warning if there is no usable MAC address or if the environment has a MAC address that does not match the board.
However, in the case that the board itself has a valid external MAC address and U-Boot does not even have an environment variable, it should not cause extra messages. Think about hot-pluggable USB net adapters where the detection order is nondeterministic.
Quoted 15 lines
Quoted 9 lines
A properly configured HWW-1U-1A board is fixed from this output:
Net: e1000: 00:50:93:81:ff:8a
e1000: 00:50:93:81:ff:8b owt0, owt1, peer, e1000#0Warning: failed to set MAC address
, e1000#1
Warning: failed to set MAC addressQuoted 5 lines
To this:
Net: e1000: 00:50:93:81:ff:8a
e1000: 00:50:93:81:ff:8b owt0, owt1, peer, e1000#0, e1000#1
Quoted 7 lines
This is also not correct. There should never be any printing of the MAC addresses here.
The messages should be:
Net: owt0, owt1, peer, e1000#0, e1000#1
The "e1000" driver has always done that. I can submit a separate patch to fix that if you would like.
Quoted 7 lines
Quoted 4 lines
Furthermore, the log messages should avoid screwing up the "Net:" output formatting provided by the calling code, EG:
Net: eth0, eth1 [could not set MAC: 00:50:93:81:ff:8a], eth2
No. "could not set" is an error message, and deserves a separate line.
Ok, I will respin the patch so that errors show up like this:
Net: eth0, eth1,
ERROR: Could not set MAC address: 00:50:93:81:ff:8a
eth2Is that OK?
Cheers,
Kyle Moffett
PATCH 1/1 net/eth: Don't issue warnings for offboard ethernet chips
Dear "Moffett, Kyle D",
Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 4 lines
Yes, it should. The rule is that then environment settings always have precedence, and if they are missing or contain different data than other sources for this information, a waning shall be printed.
That is a problem for devices which are typically add-in PCI cards. In that case U-Boot can't be expected to have knowledge of what the MAC addresses should be, and it should just use the ROM attached to the card instead.
The user can be expected to read the boot messages and adjust the environment if he wants to use the card's settinge. In any case, the user shall have the authority to overwrite the card's settings by defining any settings in the environment he wants.
Quoted 4 lines
In our use case the e1000 chips are on a separate board attached via CompactPCI. U-Boot should not spontaneously start throwing errors just because the board was stuck into a different slot or replaced due to hardware failure.
U-Boot does not throw errors if you have appropriate settings in the environment. The worst to happen is a warning thatt he MAC settings in U-Boot and on the card don't match.
Quoted 4 lines
However, in the case that the board itself has a valid external MAC address and U-Boot does not even have an environment variable, it should not cause extra messages. Think about hot-pluggable USB net adapters where the detection order is nondeterministic.
Yes, it should, because a mandatory environment variable is not set correctly.
Quoted 2 lines
The "e1000" driver has always done that. I can submit a separate patch to fix that if you would like.
Thats would be welcome, thanks.
Quoted 7 lines
Ok, I will respin the patch so that errors show up like this:
Net: eth0, eth1,
ERROR: Could not set MAC address: 00:50:93:81:ff:8a eth2Is that OK?
Yes, thanks.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Two wrongs don't make a right, but three rights make a left.