[U-Boot] [PATCH v4] net: allow setting env enetaddr from net device setting

Joe Hershberger joe.hershberger at gmail.com
Wed Apr 4 17:06:12 CEST 2012


Hi Rob,

On Tue, Mar 6, 2012 at 9:03 PM, Rob Herring <robherring2 at gmail.com> wrote:
> From: Rob Herring <rob.herring at calxeda.com>
>
> If the net driver has setup a valid ethernet address and an ethernet
> address is not set in the environment already, then set the environment
> variables from the net driver setting.
>
> This enables pxe booting on boards which don't set ethaddr env variable.
>
> Signed-off-by: Rob Herring <rob.herring at calxeda.com>
> ---
> v4:
> - rewrite of documentation from Wolfgang
>
> v3:
> - print a warning if using mac address from the net device
>
> v2:
> - Re-wrote to always setup ethaddr env variables
>
>  doc/README.enetaddr |    6 +++++-
>  net/eth.c           |   21 ++++++++++++++++++---
>  2 files changed, 23 insertions(+), 4 deletions(-)

checkpatch.pl failures:

-------------------------------------

ERROR: trailing whitespace
#48: FILE: doc/README.enetaddr:38:
+   If the environment variable is not set, it will be initialized from $

WARNING: line over 80 characters
#80: FILE: net/eth.c:184:
+       if (!eth_getenv_enetaddr_by_index(base_name, eth_number,
env_enetaddr)) {

total: 1 errors, 1 warnings, 45 lines checked

NOTE: whitespace errors detected, you may wish to use scripts/cleanpatch or
      scripts/cleanfile

NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX
MULTISTATEMENT_MACRO_USE_DO_WHILE

U-Boot-v4-net-allow-setting-env-enetaddr-from-net-device-setting.patch
has style problems, please review.

----------------------

Also, it seems that just because the enetaddr was read from dev
(possibly from an eeprom or elsewhere) doesn't mean that the MAC
doesn't need you to call write_hwaddr().  I think you shouldn't return
0 if you use the net device's addr, but rather should make the if
(memcmp... into an else if.

-Joe


More information about the U-Boot mailing list