All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@linux-foundation.org>
To: Adrian Bunk <bunk@stusta.de>
Cc: netdev@vger.kernel.org
Subject: [PATCH 2/6] sky2: allow multicast pause frames
Date: Fri, 23 Feb 2007 15:10:44 -0800	[thread overview]
Message-ID: <20070223231353.272040000@linux-foundation.org> (raw)
In-Reply-To: 20070223231042.860031000@linux-foundation.org

[-- Attachment #1: sky2-pause-mc-addr.patch --]
[-- Type: text/plain, Size: 1919 bytes --]

The 802 standard allows pause frames to be either unicast or multicast.
Switches seem to send unicast frames, but on a direct link, other boards send
multicast pause.  Unless the filter bit is set, these pause frames get
dropped.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>

---
 drivers/net/sky2.c |   20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

--- linux-2.6.16.y.orig/drivers/net/sky2.c	2007-02-23 14:44:52.000000000 -0800
+++ linux-2.6.16.y/drivers/net/sky2.c	2007-02-23 14:44:54.000000000 -0800
@@ -2686,6 +2686,14 @@
 	return 0;
 }
 
+static void inline sky2_add_filter(u8 filter[8], const u8 *addr)
+{
+	u32 bit;
+
+	bit = ether_crc(ETH_ALEN, addr) & 63;
+	filter[bit >> 3] |= 1 << (bit & 7);
+}
+
 static void sky2_set_multicast(struct net_device *dev)
 {
 	struct sky2_port *sky2 = netdev_priv(dev);
@@ -2694,6 +2702,7 @@
 	struct dev_mc_list *list = dev->mc_list;
 	u16 reg;
 	u8 filter[8];
+	static const u8 pause_mc_addr[ETH_ALEN] = { 0x1, 0x80, 0xc2, 0x0, 0x0, 0x1 };
 
 	memset(filter, 0, sizeof(filter));
 
@@ -2704,16 +2713,17 @@
 		reg &= ~(GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA);
 	else if ((dev->flags & IFF_ALLMULTI) || dev->mc_count > 16)	/* all multicast */
 		memset(filter, 0xff, sizeof(filter));
-	else if (dev->mc_count == 0)	/* no multicast */
+	else if (dev->mc_count == 0 && !sky2->rx_pause)	/* no multicast */
 		reg &= ~GM_RXCR_MCF_ENA;
 	else {
 		int i;
 		reg |= GM_RXCR_MCF_ENA;
 
-		for (i = 0; list && i < dev->mc_count; i++, list = list->next) {
-			u32 bit = ether_crc(ETH_ALEN, list->dmi_addr) & 0x3f;
-			filter[bit / 8] |= 1 << (bit % 8);
-		}
+		if (sky2->rx_pause)
+			sky2_add_filter(filter, pause_mc_addr);
+
+		for (i = 0; list && i < dev->mc_count; i++, list = list->next)
+			sky2_add_filter(filter, list->dmi_addr);
 	}
 
 	gma_write16(hw, port, GM_MC_ADDR_H1,

--
Stephen Hemminger <shemminger@linux-foundation.org>


  parent reply	other threads:[~2007-02-23 23:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-23 23:10 [PATCH 0/6] more sky2 patches for 2.6.16.42-rc1 Stephen Hemminger
2007-02-23 23:10 ` [PATCH 1/6] sky2: fix ram buffer allocation settings Stephen Hemminger
2007-02-23 23:10 ` Stephen Hemminger [this message]
2007-02-23 23:10 ` [PATCH 3/6] sky2: fix for use on big endian Stephen Hemminger
2007-02-23 23:10 ` [PATCH 4/6] sky2: more stats Stephen Hemminger
2007-02-23 23:10 ` [PATCH 5/6] sky2: add more pci ids Stephen Hemminger
2007-02-23 23:10 ` [PATCH 6/6] sky2: email and version change Stephen Hemminger
2007-02-26 14:35 ` [PATCH 0/6] more sky2 patches for 2.6.16.42-rc1 Adrian Bunk

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=20070223231353.272040000@linux-foundation.org \
    --to=shemminger@linux-foundation.org \
    --cc=bunk@stusta.de \
    --cc=netdev@vger.kernel.org \
    /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.