netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ixp4xx: Support the all multicast flag on the NPE devices.
@ 2010-05-31 13:11 Richard Cochran
  2010-05-31 14:09 ` Krzysztof Halasa
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Cochran @ 2010-05-31 13:11 UTC (permalink / raw)
  To: Krzysztof Halasa; +Cc: netdev, linux-arm-kernel

This patch adds support for the IFF_ALLMULTI flag. Previously only the
IFF_PROMISC flag was supported.

Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
---
 drivers/net/arm/ixp4xx_eth.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/net/arm/ixp4xx_eth.c b/drivers/net/arm/ixp4xx_eth.c
index 6be8b09..5d35064 100644
--- a/drivers/net/arm/ixp4xx_eth.c
+++ b/drivers/net/arm/ixp4xx_eth.c
@@ -739,6 +739,17 @@ static void eth_set_mcast_list(struct net_device *dev)
 	struct dev_mc_list *mclist;
 	u8 diffs[ETH_ALEN], *addr;
 	int i;
+	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]);
+		}
+		__raw_writel(DEFAULT_RX_CNTRL0 | RX_CNTRL0_ADDR_FLTR_EN,
+			&port->regs->rx_control[0]);
+		return;
+	}
 
 	if ((dev->flags & IFF_PROMISC) || netdev_mc_empty(dev)) {
 		__raw_writel(DEFAULT_RX_CNTRL0 & ~RX_CNTRL0_ADDR_FLTR_EN,
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] ixp4xx: Support the all multicast flag on the NPE devices.
  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
  0 siblings, 1 reply; 7+ messages in thread
From: Krzysztof Halasa @ 2010-05-31 14:09 UTC (permalink / raw)
  To: Richard Cochran; +Cc: netdev, linux-arm-kernel

Richard Cochran <richardcochran@gmail.com> writes:

> This patch adds support for the IFF_ALLMULTI flag. Previously only the
> IFF_PROMISC flag was supported.
>
> Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
> ---
>  drivers/net/arm/ixp4xx_eth.c |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/arm/ixp4xx_eth.c b/drivers/net/arm/ixp4xx_eth.c
> index 6be8b09..5d35064 100644
> --- a/drivers/net/arm/ixp4xx_eth.c
> +++ b/drivers/net/arm/ixp4xx_eth.c
> @@ -739,6 +739,17 @@ static void eth_set_mcast_list(struct net_device *dev)
>  	struct dev_mc_list *mclist;
>  	u8 diffs[ETH_ALEN], *addr;
>  	int i;
> +	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]);
> +		}
> +		__raw_writel(DEFAULT_RX_CNTRL0 | RX_CNTRL0_ADDR_FLTR_EN,
> +			&port->regs->rx_control[0]);
> +		return;
> +	}

Looks good, though I'd prefer a bit of "const" and "static" in the
allmulti[] declaration. Would you please repost? TIA.
-- 
Krzysztof Halasa

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ixp4xx: Support the all multicast flag on the NPE devices.
  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:24     ` Krzysztof Halasa
  0 siblings, 2 replies; 7+ messages in thread
From: Richard Cochran @ 2010-05-31 15:34 UTC (permalink / raw)
  To: Krzysztof Halasa; +Cc: netdev, linux-arm-kernel

On Mon, May 31, 2010 at 04:09:13PM +0200, Krzysztof Halasa wrote:
> Looks good, though I'd prefer a bit of "const" and "static" in the
> allmulti[] declaration. Would you please repost? TIA.

Okay, here it is.

Thanks,
Richard

This patch adds support for the IFF_ALLMULTI flag. Previously only the
IFF_PROMISC flag was supported.

Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
---
 drivers/net/arm/ixp4xx_eth.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/net/arm/ixp4xx_eth.c b/drivers/net/arm/ixp4xx_eth.c
index 6be8b09..42b4361 100644
--- a/drivers/net/arm/ixp4xx_eth.c
+++ b/drivers/net/arm/ixp4xx_eth.c
@@ -739,6 +739,17 @@ static void eth_set_mcast_list(struct net_device *dev)
 	struct dev_mc_list *mclist;
 	u8 diffs[ETH_ALEN], *addr;
 	int i;
+	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]);
+		}
+		__raw_writel(DEFAULT_RX_CNTRL0 | RX_CNTRL0_ADDR_FLTR_EN,
+			&port->regs->rx_control[0]);
+		return;
+	}
 
 	if ((dev->flags & IFF_PROMISC) || netdev_mc_empty(dev)) {
 		__raw_writel(DEFAULT_RX_CNTRL0 & ~RX_CNTRL0_ADDR_FLTR_EN,
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] ixp4xx: Support the all multicast flag on the NPE devices.
  2010-05-31 15:34   ` Richard Cochran
@ 2010-05-31 16:09     ` Mikael Pettersson
  2010-05-31 16:23       ` Krzysztof Halasa
  2010-05-31 16:24     ` Krzysztof Halasa
  1 sibling, 1 reply; 7+ messages in thread
From: Mikael Pettersson @ 2010-05-31 16:09 UTC (permalink / raw)
  To: Richard Cochran; +Cc: Krzysztof Halasa, netdev, linux-arm-kernel

Richard Cochran writes:
 > On Mon, May 31, 2010 at 04:09:13PM +0200, Krzysztof Halasa wrote:
 > > Looks good, though I'd prefer a bit of "const" and "static" in the
 > > allmulti[] declaration. Would you please repost? TIA.
 > 
 > Okay, here it is.
 > 
 > Thanks,
 > Richard
 > 
 > This patch adds support for the IFF_ALLMULTI flag. Previously only the
 > IFF_PROMISC flag was supported.
 > 
 > Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
 > ---
 >  drivers/net/arm/ixp4xx_eth.c |   11 +++++++++++
 >  1 files changed, 11 insertions(+), 0 deletions(-)
 > 
 > diff --git a/drivers/net/arm/ixp4xx_eth.c b/drivers/net/arm/ixp4xx_eth.c
 > index 6be8b09..42b4361 100644
 > --- a/drivers/net/arm/ixp4xx_eth.c
 > +++ b/drivers/net/arm/ixp4xx_eth.c
 > @@ -739,6 +739,17 @@ static void eth_set_mcast_list(struct net_device *dev)
 >  	struct dev_mc_list *mclist;
 >  	u8 diffs[ETH_ALEN], *addr;
 >  	int i;
 > +	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, ...);
			...
		}
	}

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ixp4xx: Support the all multicast flag on the NPE devices.
  2010-05-31 16:09     ` Mikael Pettersson
@ 2010-05-31 16:23       ` Krzysztof Halasa
  0 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Halasa @ 2010-05-31 16:23 UTC (permalink / raw)
  To: Mikael Pettersson; +Cc: Richard Cochran, netdev, linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ixp4xx: Support the all multicast flag on the NPE devices.
  2010-05-31 15:34   ` Richard Cochran
  2010-05-31 16:09     ` Mikael Pettersson
@ 2010-05-31 16:24     ` Krzysztof Halasa
  2010-06-01  7:18       ` David Miller
  1 sibling, 1 reply; 7+ messages in thread
From: Krzysztof Halasa @ 2010-05-31 16:24 UTC (permalink / raw)
  To: Richard Cochran; +Cc: netdev, linux-arm-kernel

Richard Cochran <richardcochran@gmail.com> writes:

> This patch adds support for the IFF_ALLMULTI flag. Previously only the
> IFF_PROMISC flag was supported.
>
> Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
> ---
>  drivers/net/arm/ixp4xx_eth.c |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/arm/ixp4xx_eth.c b/drivers/net/arm/ixp4xx_eth.c
> index 6be8b09..42b4361 100644
> --- a/drivers/net/arm/ixp4xx_eth.c
> +++ b/drivers/net/arm/ixp4xx_eth.c
> @@ -739,6 +739,17 @@ static void eth_set_mcast_list(struct net_device *dev)
>  	struct dev_mc_list *mclist;
>  	u8 diffs[ETH_ALEN], *addr;
>  	int i;
> +	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]);
> +		}
> +		__raw_writel(DEFAULT_RX_CNTRL0 | RX_CNTRL0_ADDR_FLTR_EN,
> +			&port->regs->rx_control[0]);
> +		return;
> +	}
>  
>  	if ((dev->flags & IFF_PROMISC) || netdev_mc_empty(dev)) {
>  		__raw_writel(DEFAULT_RX_CNTRL0 & ~RX_CNTRL0_ADDR_FLTR_EN,

Acked-By: Krzysztof Halasa <khc@pm.waw.pl>
-- 
Krzysztof Halasa

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ixp4xx: Support the all multicast flag on the NPE devices.
  2010-05-31 16:24     ` Krzysztof Halasa
@ 2010-06-01  7:18       ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2010-06-01  7:18 UTC (permalink / raw)
  To: khc; +Cc: richardcochran, netdev, linux-arm-kernel

From: Krzysztof Halasa <khc@pm.waw.pl>
Date: Mon, 31 May 2010 18:24:09 +0200

> Richard Cochran <richardcochran@gmail.com> writes:
> 
>> This patch adds support for the IFF_ALLMULTI flag. Previously only the
>> IFF_PROMISC flag was supported.
>>
>> Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
 ...
> Acked-By: Krzysztof Halasa <khc@pm.waw.pl>

Applied.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-06-01  7:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2010-05-31 16:24     ` Krzysztof Halasa
2010-06-01  7:18       ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).