Title: [4072] trunk/drivers/net/bfin_mac.c: Patch [#3780]
bf537 MAC multicast hash filtering patch
- Revision
- 4072
- Author
- cooloney
- Date
- 2007-12-27 01:32:58 -0600 (Thu, 27 Dec 2007)
Log Message
Patch [#3780] bf537 MAC multicast hash filtering patch
he bf537 Ethernet MAC driver in the 2007R1.1-RC3 kernel (and the
current kernel) do not implement multicast hash filtering. This
is a performance problem if you have lots of multicast on your network.
This patch plugs the right bits into the multicast hash registers.
Signed-off-by: Aidan Williams <[EMAIL PROTECTED]>
Diffstat
bfin_mac.c | 42 +++++++++++++++++++++++++++++++++++++++++-
1 files changed, 41 insertions(+), 1 deletion(-)
Modified Paths
Diff
Modified: trunk/drivers/net/bfin_mac.c (4071 => 4072)
--- trunk/drivers/net/bfin_mac.c 2007-12-26 09:01:41 UTC (rev 4071)
+++ trunk/drivers/net/bfin_mac.c 2007-12-27 07:32:58 UTC (rev 4072)
@@ -11,6 +11,7 @@
* Description:
*
* Modified:
+ * 2006-12-19 Aidan Williams, multicast hash support
* Copyright 2004-2006 Analog Devices Inc.
*
* Bugs: Enter bugs at http://blackfin.uclinux.org/
@@ -819,6 +820,39 @@
return &lp->stats;
}
+static void bf537mac_multicast_hash(struct net_device *dev)
+{
+ u32 emac_hashhi, emac_hashlo;
+ struct dev_mc_list *dmi = dev->mc_list;
+ char *addrs;
+ int i;
+ u32 crc;
+
+ emac_hashhi = emac_hashlo = 0;
+
+ for (i = 0; i < dev->mc_count; i++) {
+ addrs = dmi->dmi_addr;
+ dmi = dmi->next;
+
+ /* skip non-multicast addresses */
+ if (!(*addrs & 1))
+ continue;
+
+ crc = ether_crc(ETH_ALEN, addrs);
+ crc >>= 26;
+
+ if (crc & 0x20)
+ emac_hashhi |= 1 << (crc & 0x1f);
+ else
+ emac_hashlo |= 1 << (crc & 0x1f);
+ }
+
+ bfin_write_EMAC_HASHHI(emac_hashhi);
+ bfin_write_EMAC_HASHLO(emac_hashlo);
+
+ return;
+}
+
/*
* This routine will, depending on the values passed to it,
* either make it accept multicast packets, go into
@@ -834,11 +868,17 @@
sysctl = bfin_read_EMAC_OPMODE();
sysctl |= RAF;
bfin_write_EMAC_OPMODE(sysctl);
- } else if (dev->flags & IFF_ALLMULTI || dev->mc_count) {
+ } else if (dev->flags & IFF_ALLMULTI) {
/* accept all multicast */
sysctl = bfin_read_EMAC_OPMODE();
sysctl |= PAM;
bfin_write_EMAC_OPMODE(sysctl);
+ } else if (dev->mc_count) {
+ /* set up multicast hash table */
+ sysctl = bfin_read_EMAC_OPMODE();
+ sysctl |= HM;
+ bfin_write_EMAC_OPMODE(sysctl);
+ bf537mac_multicast_hash(dev);
} else {
/* clear promisc or multicast mode */
sysctl = bfin_read_EMAC_OPMODE();
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
http://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits