rtl8366_smi: backport vlan fix from r22856
authorFelix Fietkau <nbd@openwrt.org>
Tue, 31 Aug 2010 19:05:33 +0000 (19:05 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 31 Aug 2010 19:05:33 +0000 (19:05 +0000)
SVN-Revision: 22857

target/linux/generic-2.6/files/drivers/net/phy/rtl8366_smi.c

index c827cd20eeab6ca5eda426ca7a452bd6bc87ca04..d3e6b25fec8874e7c0c16cd8a60d4c404deb3e6b 100644 (file)
@@ -905,6 +905,7 @@ int rtl8366_sw_set_vlan_ports(struct switch_dev *dev, struct switch_val *val)
        struct switch_port *port;
        u32 member = 0;
        u32 untag = 0;
+       int err;
        int i;
 
        if (!smi->ops->is_vlan_valid(smi, val->port_vlan))
@@ -916,6 +917,14 @@ int rtl8366_sw_set_vlan_ports(struct switch_dev *dev, struct switch_val *val)
 
                if (!(port->flags & BIT(SWITCH_PORT_FLAG_TAGGED)))
                        untag |= BIT(port->id);
+
+               /*
+                * To ensure that we have a valid MC entry for this VLAN,
+                * initialize the port VLAN ID here.
+                */
+               err = rtl8366_set_pvid(smi, port->id, val->port_vlan);
+               if (err < 0)
+                       return err;
        }
 
        return rtl8366_set_vlan(smi, val->port_vlan, member, untag, 0);