rtl8366_smi: when setting VLAN ports, always initialize the PVID to ensure that the...
authorFelix Fietkau <nbd@openwrt.org>
Tue, 31 Aug 2010 19:04:02 +0000 (19:04 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 31 Aug 2010 19:04:02 +0000 (19:04 +0000)
SVN-Revision: 22856

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

index 9b70a9282a9b322e3ceba8a99da3d0f2a0250d26..dc83ba7d420113e919eb72e9d0ea17d769f3b8b5 100644 (file)
@@ -946,6 +946,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))
@@ -957,6 +958,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);