From: Wolfgang Denk Date: Fri, 12 Sep 2008 21:50:58 +0200 Subject: [U-Boot] Inefficient code in NetLoop() ? Message-ID: <20080912195058.8625324926@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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@denx.de All easy problems have already been solved.