From mboxrd@z Thu Jan 1 00:00:00 1970 From: khc@pm.waw.pl (Krzysztof Halasa) Date: Mon, 31 May 2010 18:23:37 +0200 Subject: [PATCH] ixp4xx: Support the all multicast flag on the NPE devices. In-Reply-To: <19459.57149.428000.694558@pilspetsen.it.uu.se> (Mikael Pettersson's message of "Mon, 31 May 2010 18:09:33 +0200") References: <20100531131102.GA15870@riccoc20.at.omicron.at> <20100531153419.GA17317@riccoc20.at.omicron.at> <19459.57149.428000.694558@pilspetsen.it.uu.se> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Mikael Pettersson 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