[PATCH] ixp4xx: Support the all multicast flag on the NPE devices.

Krzysztof Halasa khc at pm.waw.pl
Mon May 31 12:23:37 EDT 2010


Mikael Pettersson <mikpe at 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



More information about the linux-arm-kernel mailing list