[U-Boot] Inefficient code in NetLoop() ?

Wolfgang Denk wd at denx.de
Fri Sep 12 21:50:58 CEST 2008


Dear Ben,

I just ran over this piece of code in NetLoop() [see "net/net.c"]:

 286 int
 287 NetLoop(proto_t protocol)
 288 {
 ...
 322         eth_halt();
 323 #ifdef CONFIG_NET_MULTI
 324         eth_set_current();
 325 #endif
 326         if (eth_init(bd) < 0) {
 327                 eth_halt();
 328                 return(-1);
 329         }

Am I reading this correctly that we  eth_halt()  and  eth_init()  the
network interface for each and every call to NetLoop?

This looks terribly inefficient to me - is there any rationale behind
this?

Also, the eth_set_current() checking should IMHO be done  just  once,
before  we  start  a  network  transfer,  or  when we actually switch
interfaces, but not for each and every call to NetLoop() ?

Best regards,

Wolfgang Denk

-- 
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
All easy problems have already been solved.


More information about the U-Boot mailing list