Missing igmp_snooping for RTL8366S on wndr3700

I noticed that the wndr3700 build that uses the RTL8366S switch does NOT support igmp_snooping on the switch. I use IPTV and the performance suffers greatly on this missing implementation feature.

Is this missing on other systems that use the RTL8366S as well?

I did notice that a patch is available for over a year ago on GitHub https://gist.github.com/jonkerj/b35e3820a9797c83649d44e9a84626c4...

Is there a reason that its not incorporated in the standard build?
Can it be made available with the next release?

TeeZee.

The switch in my mt7621 device also doesn't support igmp snooping. A quick workaround is to create a separate vlan for each individual LAN Ethernet port on your router and bridge them all together in a software bridge. Linux software bridges support igmp snooping by default and can even be enabled from Luci. That way, you at least have igmp snooping for now, and you can do back to igmp snooping in the actual switch as soon as that is supported.

1 Like

I will see if that really helps as a workaround. The router has an internal 1GB switch so the overhead should not matter much in theory. And the physical network connections can manage... In practice only the wifi is seriously hit by the issue (i.e. nearly unusable when IP-TV is on). With or without vlans on the wifi. So i fear that the kernel snooping won;t help. But lets see.

WiFi is already bridged with your LAN and should thus support igmp snooping just fine. What does your current /etc/config/network file look like?

I tried to solve this problem when I got IP-TV. I noticed that WiFi (the router is used as switch / access point)went from 40/80 mbps to 2 mbps when switching on the TV. In the previous firmware Lede before current version i included " echo 1 >/sys/devices/virtual/net/br-lan/bridge/multicast_snooping" at startup script and thought it helped. With the latest firmware, this option is included in the settings, but I can't stop the WiFi going dead when IP-TV is switched on.

I have the WAN and LAN ports bridged and one wifi SSID bridged to the wan and one wifi ssid bridged to a vlan. Neither have any bandwidth when IP-TV comes on. Not sure how the switch is wired and if non snooping switch is involved...

Please post your /etc/config/network file so we can have a look at your configuration. Also, why are you bringing your WAN with WiFi? Could you give us an schematical overview of your network, so we can verify if it is properly configured?

diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366s.c b/target/linux/generic/files/drivers/net/phy/rtl8366s.c
index 3f458f9..5b81d9c 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8366s.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8366s.c
@@ -37,6 +37,7 @@
 #define RTL8366S_SGCR_MAX_LENGTH_1536		RTL8366S_SGCR_MAX_LENGTH(0x1)
 #define RTL8366S_SGCR_MAX_LENGTH_1552		RTL8366S_SGCR_MAX_LENGTH(0x2)
 #define RTL8366S_SGCR_MAX_LENGTH_16000		RTL8366S_SGCR_MAX_LENGTH(0x3)
+#define RTL8366S_SGCR_EN_IGMP			BIT(6)
 #define RTL8366S_SGCR_EN_VLAN			BIT(13)
 
 /* Port Enable Control register */
@@ -830,6 +831,35 @@ static int rtl8366s_sw_set_learning_enable(struct switch_dev *dev,
 	return 0;
 }
 
+static int rtl8366s_sw_get_igmp_enable(struct switch_dev *dev,
+					const struct switch_attr *attr,
+					struct switch_val *val)
+{
+	struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
+	u32 data;
+
+	rtl8366_smi_read_reg(smi, RTL8366S_SGCR, &data);
+	val->value.i = !!(data & RTL8366S_SGCR_EN_IGMP);
+
+	return 0;
+}
+
+
+static int rtl8366s_sw_set_igmp_enable(struct switch_dev *dev,
+					const struct switch_attr *attr,
+					struct switch_val *val)
+{
+	struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
+	int err = 0;
+
+	if (val->value.i)
+		REG_RMW(smi, RTL8366S_SGCR, RTL8366S_SGCR_EN_IGMP, RTL8366S_SGCR_EN_IGMP);
+	else
+		REG_RMW(smi, RTL8366S_SGCR, RTL8366S_SGCR_EN_IGMP, 0);
+
+	return 0;
+}
+
 static int rtl8366s_sw_get_green(struct switch_dev *dev,
 			      const struct switch_attr *attr,
 			      struct switch_val *val)
@@ -1002,6 +1032,14 @@ static struct switch_attr rtl8366s_globals[] = {
 		.max = 1,
 	}, {
 		.type = SWITCH_TYPE_INT,
+		.name = "enable_igmp",
+		.description = "Enable IGMP mode",
+		.set = rtl8366s_sw_set_igmp_enable,
+		.get = rtl8366s_sw_get_igmp_enable,
+		.max = 1,
+		.ofs = 1
+	}, {
+		.type = SWITCH_TYPE_INT,
 		.name = "enable_vlan",
 		.description = "Enable VLAN mode",
 		.set = rtl8366_sw_set_vlan_enable,

I modified the patch. Compile passed, but I don't know if it works.
Use at your own risk.

Thank you for trying to help me out. I’ll give some more details in the evening.

To enable it, run swconfig dev switch0 set enable_igmp 1

Thanks!

It would be nice if this was added to the default distribution. Now I need set up the tool chain and compile my own... ;-(

Ok. It's been a while since I compiled an Openwrt image, so I can tryout LGA1150's patch only when I have time to setup all that git. So I'll tell you about my settings.

  1. I used two different routers (not simultaneously) that I have and both run Lede: A TP-Link TL-WR1043N/ND v2 and a NETGEAR WNDR3700. The TP-Link switch supports igmp-snooping, but WiFi dies 100% when multicast IP-TV is transported through it (i can see the switched ports easy down, so igmp-snooping really seems to work on the switch. The driver for Netgear switch does not support igmp-snooping, however it manages WiFi just a little bit better when IP-TV is on (say 5% WiFi throughput remains).
  2. I configure both routers as an access point & switch, where I use the Physical WAN port as a regular port. I put the upstream cable (to the router of my house) in the physical WAN port on both routers.
  3. The switch of the TP-Link router can add the physical WAN port. So I don't need to bridge them (the switch does). The Netgear has different physical connections; I bridge the WAN Port and the LAN (switch). [see schematic here under switch. https://wiki.openwrt.org/toh/netgear/wndr3700]
  4. I also use VLAN's, but they do not matter and are not involved in the IP-TV traffic except guest wifi.
  5. WIFI SSID LAN is bridged to LAN. WIFI SSID Guest is Bridged to a VLAN over the same router to the internet.

So, even though the WiFi is always bridged (and snooped), it starves when IP-TV is switched on.
So I am not even sure that fixing the switch witch igmp-snooping will fix the issue.

I could try block muticast on wifi (but I need it for zero config stuff). I could try isolating IP-TV with VLAN, but I need network access to settop box for starting youtube / netflix etc. with ipad.

So. Complex...

Could you still please post the output of the following command?

cat /etc/config/network

OK, this is my /etc/config/network

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix '`<my prefix here>`'

config interface 'lan'
        option type 'bridge'
        option proto 'dhcp'
        option stp '1'
        option igmp_snooping '1'
        option delegate '0'
        option ifname 'eth0.1 eth1'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'
        option blinkrate '2'
        option max_length '3'
        option enable_vlan4k '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0 1 2 3 5t'

config switch_port
        option device 'switch0'
        option port '1'
        option led '6'

config switch_port
        option device 'switch0'
        option port '2'
        option led '9'

config switch_port
        option device 'switch0'
        option port '5'
        option led '2'

config switch_vlan
        option device 'switch0'
        option ports '5t'
        option vlan '666'

config interface 'DMZ'
        option proto 'dhcp'
        option ifname 'eth1.666'
        option hostname 'NGRouter666'
        option type 'bridge'
        option igmp_snooping '1'
        option delegate '0'

config switch_vlan
        option device 'switch0'
        option vlan '222'
        option ports '5t'

According to a datasheet found on Google, the RTL8366S doesn't fully support IGMP snooping,

RTL8366S/SR supports IGMP v1/v2/v3 and MLD v1/v2 snooping. RTL8366S/SR can trap all IGMP
and MLD packets to CPU port. CPU processes these packets, gets the information of the IP multicast
groups for all ports, and writes proper multicast entry to lookup table through EEPROM SMI.

It can only forward IGMP packets to CPU port. Hence it's up to CPU to manage the multicast lookup table inside the switch, which would be way harder to implement.

As @Mushoz mentioned above, a workaround is to create a separate VLAN for your IPTV port and then bridge to br-lan . While IMHO the final solution is to use upstream RTL8366 DSA driver, where each LAN port can be directly managed like a physical NIC.

Ok. I’ll redo my VLANs and bridging and see if I can work around it.