Commit 46fbe5e5 authored by Vivien Didelot's avatar Vivien Didelot Committed by David S. Miller

net: dsa: mv88e6xxx: remove reserved VLANs

Now that ports isolation is correctly configured when joining or leaving
a bridge, there is no need to rely on reserved VLANs to isolate
unbridged ports anymore. Thus remove them, and disable 802.1Q on setup.

This restores the expected behavior of hardware bridging for systems
without 802.1Q or VLAN filtering enabled.
Signed-off-by: default avatarVivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b7666efe
...@@ -1718,10 +1718,6 @@ int mv88e6xxx_port_vlan_prepare(struct dsa_switch *ds, int port, ...@@ -1718,10 +1718,6 @@ int mv88e6xxx_port_vlan_prepare(struct dsa_switch *ds, int port,
{ {
int err; int err;
/* We reserve a few VLANs to isolate unbridged ports */
if (vlan->vid_end >= 4000)
return -EOPNOTSUPP;
/* If the requested port doesn't belong to the same bridge as the VLAN /* If the requested port doesn't belong to the same bridge as the VLAN
* members, do not support it (yet) and fallback to software VLAN. * members, do not support it (yet) and fallback to software VLAN.
*/ */
...@@ -1819,7 +1815,6 @@ int mv88e6xxx_port_vlan_del(struct dsa_switch *ds, int port, ...@@ -1819,7 +1815,6 @@ int mv88e6xxx_port_vlan_del(struct dsa_switch *ds, int port,
const struct switchdev_obj_port_vlan *vlan) const struct switchdev_obj_port_vlan *vlan)
{ {
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
const u16 defpvid = 4000 + ds->index * DSA_MAX_PORTS + port;
u16 pvid, vid; u16 pvid, vid;
int err = 0; int err = 0;
...@@ -1835,8 +1830,7 @@ int mv88e6xxx_port_vlan_del(struct dsa_switch *ds, int port, ...@@ -1835,8 +1830,7 @@ int mv88e6xxx_port_vlan_del(struct dsa_switch *ds, int port,
goto unlock; goto unlock;
if (vid == pvid) { if (vid == pvid) {
/* restore reserved VLAN ID */ err = _mv88e6xxx_port_pvid_set(ds, port, 0);
err = _mv88e6xxx_port_pvid_set(ds, port, defpvid);
if (err) if (err)
goto unlock; goto unlock;
} }
...@@ -2186,20 +2180,6 @@ int mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port) ...@@ -2186,20 +2180,6 @@ int mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port)
return err; return err;
} }
static int mv88e6xxx_setup_port_default_vlan(struct dsa_switch *ds, int port)
{
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
const u16 pvid = 4000 + ds->index * DSA_MAX_PORTS + port;
int err;
mutex_lock(&ps->smi_mutex);
err = _mv88e6xxx_port_vlan_add(ds, port, pvid, true);
if (!err)
err = _mv88e6xxx_port_pvid_set(ds, port, pvid);
mutex_unlock(&ps->smi_mutex);
return err;
}
static void mv88e6xxx_bridge_work(struct work_struct *work) static void mv88e6xxx_bridge_work(struct work_struct *work)
{ {
struct mv88e6xxx_priv_state *ps; struct mv88e6xxx_priv_state *ps;
...@@ -2320,7 +2300,7 @@ static int mv88e6xxx_setup_port(struct dsa_switch *ds, int port) ...@@ -2320,7 +2300,7 @@ static int mv88e6xxx_setup_port(struct dsa_switch *ds, int port)
} }
/* Port Control 2: don't force a good FCS, set the maximum frame size to /* Port Control 2: don't force a good FCS, set the maximum frame size to
* 10240 bytes, enable secure 802.1q tags, don't discard tagged or * 10240 bytes, disable 802.1q tags checking, don't discard tagged or
* untagged frames on this port, do a destination address lookup on all * untagged frames on this port, do a destination address lookup on all
* received packets as usual, disable ARP mirroring and don't send a * received packets as usual, disable ARP mirroring and don't send a
* copy of all transmitted/received frames on this port to the CPU. * copy of all transmitted/received frames on this port to the CPU.
...@@ -2345,7 +2325,7 @@ static int mv88e6xxx_setup_port(struct dsa_switch *ds, int port) ...@@ -2345,7 +2325,7 @@ static int mv88e6xxx_setup_port(struct dsa_switch *ds, int port)
reg |= PORT_CONTROL_2_FORWARD_UNKNOWN; reg |= PORT_CONTROL_2_FORWARD_UNKNOWN;
} }
reg |= PORT_CONTROL_2_8021Q_SECURE; reg |= PORT_CONTROL_2_8021Q_DISABLED;
if (reg) { if (reg) {
ret = _mv88e6xxx_reg_write(ds, REG_PORT(port), ret = _mv88e6xxx_reg_write(ds, REG_PORT(port),
...@@ -2474,13 +2454,6 @@ int mv88e6xxx_setup_ports(struct dsa_switch *ds) ...@@ -2474,13 +2454,6 @@ int mv88e6xxx_setup_ports(struct dsa_switch *ds)
ret = mv88e6xxx_setup_port(ds, i); ret = mv88e6xxx_setup_port(ds, i);
if (ret < 0) if (ret < 0)
return ret; return ret;
if (dsa_is_cpu_port(ds, i) || dsa_is_dsa_port(ds, i))
continue;
ret = mv88e6xxx_setup_port_default_vlan(ds, i);
if (ret < 0)
return ret;
} }
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment