From: Wolfgang Denk Date: Fri, 26 Sep 2008 09:36:53 +0200 Subject: [U-Boot] Inefficient code in NetLoop() ? In-Reply-To: <48DC7CAD.9040502@gmail.com> References: <20080912195058.8625324926@gemini.denx.de> <48DC7CAD.9040502@gmail.com> Message-ID: <20080926073653.15DEE248CD@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 Warren, In message <48DC7CAD.9040502@gmail.com> you wrote: > > > Am I reading this correctly that we eth_halt() and eth_init() the > > network interface for each and every call to NetLoop? > > Yes, it looks that way. Ripe for gutting. I didn't have much time to look into the code, so I'm just speculating - maybe this is needed for switching interfaces in case of errors? > > This looks terribly inefficient to me - is there any rationale behind > > this? > > Probably, but it escapes me. It most certainly predates my involvement > in this project. I should know, but if I ever understood that part of the code, I have completely forgotten about it ;-) > > 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() ? > > Maybe, but eth_set_current() is pretty lightweight. NetLoop is only > called when we start a network transfer, so this doesn't seem too > egregious. It could definitely stand to be refactored. Do you plan to have a closer look on this in some near future? 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 Unix: Some say the learning curve is steep, but you only have to climb it once. - Karl Lehenbauer