From: Krzysztof Halasa <khc@pm.waw.pl>
To: Mikael Pettersson <mikpe@it.uu.se>
Cc: Richard Cochran <richardcochran@gmail.com>,
netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] ixp4xx: Support the all multicast flag on the NPE devices.
Date: Mon, 31 May 2010 18:23:37 +0200 [thread overview]
Message-ID: <m3y6f0yr92.fsf@intrepid.localdomain> (raw)
In-Reply-To: <19459.57149.428000.694558@pilspetsen.it.uu.se> (Mikael Pettersson's message of "Mon, 31 May 2010 18:09:33 +0200")
Mikael Pettersson <mikpe@it.uu.se> writes:
> > + static const u8 allmulti[] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 };
> > +
> > + if (dev->flags & IFF_ALLMULTI) {
> > + for (i = 0; i < ETH_ALEN; i++) {
> > + __raw_writel(allmulti[i], &port->regs->mcast_addr[i]);
> > + __raw_writel(allmulti[i], &port->regs->mcast_mask[i]);
>
> Seems a bit excessive to define a lookup table for a computation
> that amounts to nothing more than "i ? 0 : 1".
>
> Something like the following would IMO be cleaner:
>
> if (...) {
> for (...) {
> u8 multi = i ? 0x00 : 0x01;
> __raw_writel(multi, ...);
> ...
> }
> }
Well... cleaner = easier to understand?
I don't think so, the array is clearly a MAC address (mask) and the
"i ? 0x00 : 0x01" (which one could simply write as "!i") requires some
additional attention.
It's a slow "admin" path so an unmeasurable speedup doesn't mean
anything.
--
Krzysztof Halasa
next prev parent reply other threads:[~2010-05-31 16:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-31 13:11 [PATCH] ixp4xx: Support the all multicast flag on the NPE devices Richard Cochran
2010-05-31 14:09 ` Krzysztof Halasa
2010-05-31 15:34 ` Richard Cochran
2010-05-31 16:09 ` Mikael Pettersson
2010-05-31 16:23 ` Krzysztof Halasa [this message]
2010-05-31 16:24 ` Krzysztof Halasa
2010-06-01 7:18 ` David Miller
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=m3y6f0yr92.fsf@intrepid.localdomain \
--to=khc@pm.waw.pl \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mikpe@it.uu.se \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
/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