[OpenWrt-Devel] [PATCH] ar8216: Use IGMP Join and Fast Leave functions

Cristian Morales Vega cristian at samknows.com
Fri Dec 5 09:36:32 EST 2014


Avoids flooding the network with multicast data.

Signed-off-by: Cristian Morales Vega <cristian at samknows.com>
---
Since I guess not all the switches support this... Good idea? Is some OpenWRT
package expecting to receive the multicast packages?
At the very least you lose the capacity of using iptables to play with the packets.

 target/linux/generic/files/drivers/net/phy/ar8216.c | 13 ++++++++++++-
 target/linux/generic/files/drivers/net/phy/ar8216.h | 11 +++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c
index 558b9f7..6583d8d 100644
--- a/target/linux/generic/files/drivers/net/phy/ar8216.c
+++ b/target/linux/generic/files/drivers/net/phy/ar8216.c
@@ -1690,7 +1690,6 @@ ar8327_init_globals(struct ar8xxx_priv *priv)
 
 	/* forward multicast and broadcast frames to CPU */
 	t = (AR8327_PORTS_ALL << AR8327_FWD_CTRL1_UC_FLOOD_S) |
-	    (AR8327_PORTS_ALL << AR8327_FWD_CTRL1_MC_FLOOD_S) |
 	    (AR8327_PORTS_ALL << AR8327_FWD_CTRL1_BC_FLOOD_S);
 	priv->write(priv, AR8327_REG_FWD_CTRL1, t);
 
@@ -1710,6 +1709,18 @@ ar8327_init_globals(struct ar8xxx_priv *priv)
 	     AR8327_EEE_CTRL_DISABLE_PHY(3) |
 	     AR8327_EEE_CTRL_DISABLE_PHY(4);
 	priv->write(priv, AR8327_REG_EEE_CTRL, t);
+
+	/* Enable IGMP Join/Leave */
+	t = AR8327_IGMP_JOIN_LEAVE0 |
+	    AR8327_IGMP_JOIN_LEAVE1 |
+	    AR8327_IGMP_JOIN_LEAVE2 |
+	    AR8327_IGMP_JOIN_LEAVE3;
+	priv->write(priv, AR8327_REG_FRAM_ACK_CTRL0, t);
+	t = AR8327_IGMP_JOIN_LEAVE4 |
+	    AR8327_IGMP_JOIN_LEAVE5 |
+	    AR8327_IGMP_JOIN_LEAVE6;
+	t |= AR8327_IGMP_V3; /* Look _also_ for IGMPv3 */
+	priv->write(priv, AR8327_REG_FRAM_ACK_CTRL1, t);
 }
 
 static void
diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.h b/target/linux/generic/files/drivers/net/phy/ar8216.h
index f6df7c8..871134d 100644
--- a/target/linux/generic/files/drivers/net/phy/ar8216.h
+++ b/target/linux/generic/files/drivers/net/phy/ar8216.h
@@ -364,6 +364,17 @@
 #define AR8327_REG_EEE_CTRL			0x100
 #define   AR8327_EEE_CTRL_DISABLE_PHY(_i)	BIT(4 + (_i) * 2)
 
+#define AR8327_REG_FRAM_ACK_CTRL0		0x210
+#define   AR8327_IGMP_JOIN_LEAVE0		BITS(1, 2)
+#define   AR8327_IGMP_JOIN_LEAVE1		BITS(9, 2)
+#define   AR8327_IGMP_JOIN_LEAVE2		BITS(17, 2)
+#define   AR8327_IGMP_JOIN_LEAVE3		BITS(25, 2)
+#define AR8327_REG_FRAM_ACK_CTRL1		0x214
+#define   AR8327_IGMP_JOIN_LEAVE4		BITS(1, 2)
+#define   AR8327_IGMP_JOIN_LEAVE5		BITS(9, 2)
+#define   AR8327_IGMP_JOIN_LEAVE6		BITS(17, 2)
+#define   AR8327_IGMP_V3			BIT(24)
+
 #define AR8327_REG_PORT_VLAN0(_i)		(0x420 + (_i) * 0x8)
 #define   AR8327_PORT_VLAN0_DEF_SVID		BITS(0, 12)
 #define   AR8327_PORT_VLAN0_DEF_SVID_S		0
-- 
1.9.3
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list