[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m3y6f0yr92.fsf@intrepid.localdomain>
Date: Mon, 31 May 2010 18:23:37 +0200
From: Krzysztof Halasa <khc@...waw.pl>
To: Mikael Pettersson <mikpe@...uu.se>
Cc: Richard Cochran <richardcochran@...il.com>, netdev@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH] ixp4xx: Support the all multicast flag on the NPE devices.
Mikael Pettersson <mikpe@...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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists