From: Ben Warren <biggerbadderben@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] Inefficient code in NetLoop() ?
Date: Thu, 25 Sep 2008 23:09:49 -0700 [thread overview]
Message-ID: <48DC7CAD.9040502@gmail.com> (raw)
In-Reply-To: <20080912195058.8625324926@gemini.denx.de>
Wolfgang Denk wrote:
> 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?
>
>
Yes, it looks that way. Ripe for gutting.
> 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.
> 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.
> Best regards,
>
> Wolfgang Denk
>
>
regards,
Ben
next prev parent reply other threads:[~2008-09-26 6:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-12 19:50 [U-Boot] Inefficient code in NetLoop() ? Wolfgang Denk
2008-09-26 6:09 ` Ben Warren [this message]
2008-09-26 7:36 ` Wolfgang Denk
2008-09-26 7:55 ` Stefan Roese
2008-09-26 8:14 ` Rafal Jaworowski
2008-09-26 8:28 ` Wolfgang Denk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48DC7CAD.9040502@gmail.com \
--to=biggerbadderben@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.