From: Eli Carter <eli.carter@inet.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: "Richard B. Johnson" <root@chaos.analogic.com>,
tsbogend@alpha.franken.de, Peter Missel <P.Missel@sbs-or.de>,
linux-kernel@vger.kernel.org, Eli Carter <eli.carter@inet.com>
Subject: Re: [PATCH] pcnet32.c: MAC address may be in CSR registers
Date: Thu, 15 Feb 2001 09:55:34 -0600 [thread overview]
Message-ID: <3A8BFBF6.B99CFFF5@inet.com> (raw)
In-Reply-To: <E14TBm9-0006VH-00@the-village.bc.nu>
Alan Cox wrote:
>
> > +int is_valid_ether_addr( char* address )
> > +{
> > + int i,isvalid=0;
> > + for( i=0; i<6; i++)
> > + isvalid |= address[i];
> > + return isvalid && !(address[0]&1);
> > +}
>
> static and why not
oops, I *meant* static... doesn't gcc do mind reading? ;) (I had
static in the declaration, but forgot it on the definition.)
> static inline int is_valid_ea(u8 *addr)
> {
> return memcmp(addr, "\000\000\000\000\000\000", 6) && !(addr[0]&1);
> }
>
> That all assembles to nice inline code 8)
Hmm... well, if we're going for _those_ optimizations, shouldn't it be:
return !(addr[0]&1) && memcmp(addr, "\000\000\000\000\000\000", 6);
so we do the cheaper test first and thus possibly avoid needing to do
the more expensive test? :)
Tell ya what, put that in <linux/etherdevice.h> (if that's the right
place) and then everyone can use it. ;) (I'd rather keep the longer
function name... "ea" isn't very helpful to the newer hackers among
us...)
> Looks ok to me, Im picking holes now
:) That's encouraging. I still feel like I'm scaling the learning
curve, and I'm feeling rather "green".
Peter pointed out that the contents of the CSR12-14 registers are
initialized from the EEPROM, so reading the EEPROM is superfluous--we
should just read the CSRs and not read the EEPROM. I think he has a
point, so I'll make that change and submit yet another patch pair.
Alan, do you want me to put your inline version in <linux/etherdevice.h>
while I'm at it, or what?
Comments?
Eli
--------------------. Rule of Accuracy: When working toward
Eli Carter | the solution of a problem, it always
eli.carter@inet.com `--------------------- helps if you know the answer.
next prev parent reply other threads:[~2001-02-15 15:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-02-14 21:49 [PATCH] pcnet32.c: MAC address may be in CSR registers Eli Carter
2001-02-14 23:50 ` Eli Carter
2001-02-14 23:55 ` Alan Cox
2001-02-15 15:55 ` Eli Carter [this message]
2001-02-15 16:49 ` Alan Cox
2001-02-15 19:16 ` Eli Carter
2001-02-15 20:31 ` Eli Carter
2001-02-15 13:42 ` Richard B. Johnson
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=3A8BFBF6.B99CFFF5@inet.com \
--to=eli.carter@inet.com \
--cc=P.Missel@sbs-or.de \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=root@chaos.analogic.com \
--cc=tsbogend@alpha.franken.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox