diff options
Diffstat (limited to 'drivers/net/dsa/mv88e6xxx.c')
-rw-r--r-- | drivers/net/dsa/mv88e6xxx.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c index cf34681af4f6..512c8c0be1b4 100644 --- a/drivers/net/dsa/mv88e6xxx.c +++ b/drivers/net/dsa/mv88e6xxx.c | |||
@@ -1555,7 +1555,7 @@ static int _mv88e6xxx_port_vlan_del(struct dsa_switch *ds, int port, u16 vid) | |||
1555 | 1555 | ||
1556 | if (vlan.vid != vid || !vlan.valid || | 1556 | if (vlan.vid != vid || !vlan.valid || |
1557 | vlan.data[port] == GLOBAL_VTU_DATA_MEMBER_TAG_NON_MEMBER) | 1557 | vlan.data[port] == GLOBAL_VTU_DATA_MEMBER_TAG_NON_MEMBER) |
1558 | return -ENOENT; | 1558 | return -EOPNOTSUPP; |
1559 | 1559 | ||
1560 | vlan.data[port] = GLOBAL_VTU_DATA_MEMBER_TAG_NON_MEMBER; | 1560 | vlan.data[port] = GLOBAL_VTU_DATA_MEMBER_TAG_NON_MEMBER; |
1561 | 1561 | ||
@@ -1582,6 +1582,7 @@ int mv88e6xxx_port_vlan_del(struct dsa_switch *ds, int port, | |||
1582 | const struct switchdev_obj_port_vlan *vlan) | 1582 | const struct switchdev_obj_port_vlan *vlan) |
1583 | { | 1583 | { |
1584 | struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); | 1584 | struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); |
1585 | const u16 defpvid = 4000 + ds->index * DSA_MAX_PORTS + port; | ||
1585 | u16 pvid, vid; | 1586 | u16 pvid, vid; |
1586 | int err = 0; | 1587 | int err = 0; |
1587 | 1588 | ||
@@ -1597,7 +1598,8 @@ int mv88e6xxx_port_vlan_del(struct dsa_switch *ds, int port, | |||
1597 | goto unlock; | 1598 | goto unlock; |
1598 | 1599 | ||
1599 | if (vid == pvid) { | 1600 | if (vid == pvid) { |
1600 | err = _mv88e6xxx_port_pvid_set(ds, port, 0); | 1601 | /* restore reserved VLAN ID */ |
1602 | err = _mv88e6xxx_port_pvid_set(ds, port, defpvid); | ||
1601 | if (err) | 1603 | if (err) |
1602 | goto unlock; | 1604 | goto unlock; |
1603 | } | 1605 | } |
@@ -1889,26 +1891,20 @@ unlock: | |||
1889 | 1891 | ||
1890 | int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port, u32 members) | 1892 | int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port, u32 members) |
1891 | { | 1893 | { |
1892 | struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); | 1894 | return 0; |
1893 | const u16 pvid = 4000 + ds->index * DSA_MAX_PORTS + port; | ||
1894 | int err; | ||
1895 | |||
1896 | /* The port joined a bridge, so leave its reserved VLAN */ | ||
1897 | mutex_lock(&ps->smi_mutex); | ||
1898 | err = _mv88e6xxx_port_vlan_del(ds, port, pvid); | ||
1899 | if (!err) | ||
1900 | err = _mv88e6xxx_port_pvid_set(ds, port, 0); | ||
1901 | mutex_unlock(&ps->smi_mutex); | ||
1902 | return err; | ||
1903 | } | 1895 | } |
1904 | 1896 | ||
1905 | int mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port, u32 members) | 1897 | int mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port, u32 members) |
1906 | { | 1898 | { |
1899 | return 0; | ||
1900 | } | ||
1901 | |||
1902 | static int mv88e6xxx_setup_port_default_vlan(struct dsa_switch *ds, int port) | ||
1903 | { | ||
1907 | struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); | 1904 | struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); |
1908 | const u16 pvid = 4000 + ds->index * DSA_MAX_PORTS + port; | 1905 | const u16 pvid = 4000 + ds->index * DSA_MAX_PORTS + port; |
1909 | int err; | 1906 | int err; |
1910 | 1907 | ||
1911 | /* The port left the bridge, so join its reserved VLAN */ | ||
1912 | mutex_lock(&ps->smi_mutex); | 1908 | mutex_lock(&ps->smi_mutex); |
1913 | err = _mv88e6xxx_port_vlan_add(ds, port, pvid, true); | 1909 | err = _mv88e6xxx_port_vlan_add(ds, port, pvid, true); |
1914 | if (!err) | 1910 | if (!err) |
@@ -2192,8 +2188,7 @@ int mv88e6xxx_setup_ports(struct dsa_switch *ds) | |||
2192 | if (dsa_is_cpu_port(ds, i) || dsa_is_dsa_port(ds, i)) | 2188 | if (dsa_is_cpu_port(ds, i) || dsa_is_dsa_port(ds, i)) |
2193 | continue; | 2189 | continue; |
2194 | 2190 | ||
2195 | /* setup the unbridged state */ | 2191 | ret = mv88e6xxx_setup_port_default_vlan(ds, i); |
2196 | ret = mv88e6xxx_port_bridge_leave(ds, i, 0); | ||
2197 | if (ret < 0) | 2192 | if (ret < 0) |
2198 | return ret; | 2193 | return ret; |
2199 | } | 2194 | } |