All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: Shawn Lin <shawn@dmp.com.tw>
Cc: Florian Fainelli <florian@openwrt.org>,
	netdev@vger.kernel.org,
	Marc Leclerc <marc-leclerc@signaturealpha.com>,
	Albert Chen <albert.chen@rdc.com.tw>,
	David Miller <davem@davemloft.net>
Subject: Re: [PATCH 1/2] r6040: fix multicast operations
Date: Tue, 26 Oct 2010 15:02:10 +0100	[thread overview]
Message-ID: <20101026140209.GY13095@decadent.org.uk> (raw)
In-Reply-To: <1287649654.1792.98.camel@shawn-desktop>

[-- Attachment #1: Type: text/plain, Size: 2236 bytes --]

On Thu, Oct 21, 2010 at 04:27:34PM +0800, Shawn Lin wrote:
[...]
> > > +	/* Use internal multicast address registers
> > > +	 * if the number of multicast addresses is not greater than MCAST_MAX.
> > > +	 */
> > > +	else if (netdev_mc_empty(dev)) {
> > > +		for (i = 0; i < MCAST_MAX ; i++) {
> > > +			iowrite16(0, ioaddr + MID_1L + 8 * i);
> > > +			iowrite16(0, ioaddr + MID_1M + 8 * i);
> > > +			iowrite16(0, ioaddr + MID_1H + 8 * i);
> > > +		}
> > > +	} else if (netdev_mc_count(dev) <= MCAST_MAX) {
> > > +		i = 0;
> > > +		netdev_for_each_mc_addr(ha, dev) {
> > > +			adrp = (u16 *) ha->addr;
> > > +			iowrite16(adrp[0], ioaddr + MID_1L + 8 * i);
> > > +			iowrite16(adrp[1], ioaddr + MID_1M + 8 * i);
> > > +			iowrite16(adrp[2], ioaddr + MID_1H + 8 * i);
> > > +			i++;
> > > +		}
> > 
> > What about the unused exact match entries?  And why is the empty case
> > special?
> 
> Unused exact match entries? I am not sure which entries are you
> mentioned.

If there are 1 or 2 addresses in the multicast list then some of the
exact match entries will be used and some will not.  But the loop
above does not clear the unused entries.

[...]
> 2) if (netdev_mc_count(dev) <= 3)
> There are two hardware features could be used to filter multicast
> frames:
[...]
> 3) if (netdev_mc_empty(dev))
> because we masked the multicast hash table flag before examine all
> conditions, we only need to clear the addresses in the three
> MAC/Multicast registers.
[...]

But why is this so different from the case of 1-3 addresses?  I would
write these two cases as:

else if (netdev_mc_count(dev) <= MCAST_MAX) {
	i = 0;
	netdev_for_each_mc_addr(ha, dev) {
		adrp = (u16 *) ha->addr;
		iowrite16(adrp[0], ioaddr + MID_1L + 8 * i);
		iowrite16(adrp[1], ioaddr + MID_1M + 8 * i);
		iowrite16(adrp[2], ioaddr + MID_1H + 8 * i);
		i++;
	}
	while (i < MCAST_MAX) {
		iowrite16(0, ioaddr + MID_1L + 8 * i);
		iowrite16(0, ioaddr + MID_1M + 8 * i);
		iowrite16(0, ioaddr + MID_1H + 8 * i);
		i++;
	}
} 

Ben.

-- 
Ben Hutchings
We get into the habit of living before acquiring the habit of thinking.
                                                              - Albert Camus

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 827 bytes --]

  reply	other threads:[~2010-10-26 14:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-20 21:09 [PATCH 1/2] r6040: fix multicast operations Florian Fainelli
2010-10-21  2:55 ` Ben Hutchings
2010-10-21  8:27   ` Shawn Lin
2010-10-26 14:02     ` Ben Hutchings [this message]
2010-10-27  1:19       ` Shawn Lin
2010-11-03 12:51 ` Shawn Lin
2010-11-04 10:04   ` Florian Fainelli
2010-11-11  8:39     ` Shawn Lin

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=20101026140209.GY13095@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=albert.chen@rdc.com.tw \
    --cc=davem@davemloft.net \
    --cc=florian@openwrt.org \
    --cc=marc-leclerc@signaturealpha.com \
    --cc=netdev@vger.kernel.org \
    --cc=shawn@dmp.com.tw \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.