Skip to content

Commit 46fbe5e

Browse files
viviendavem330
authored andcommitted
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: Vivien Didelot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b7666ef commit 46fbe5e

File tree

1 file changed

+3
-30
lines changed

1 file changed

+3
-30
lines changed

drivers/net/dsa/mv88e6xxx.c

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1718,10 +1718,6 @@ int mv88e6xxx_port_vlan_prepare(struct dsa_switch *ds, int port,
17181718
{
17191719
int err;
17201720

1721-
/* We reserve a few VLANs to isolate unbridged ports */
1722-
if (vlan->vid_end >= 4000)
1723-
return -EOPNOTSUPP;
1724-
17251721
/* If the requested port doesn't belong to the same bridge as the VLAN
17261722
* members, do not support it (yet) and fallback to software VLAN.
17271723
*/
@@ -1819,7 +1815,6 @@ int mv88e6xxx_port_vlan_del(struct dsa_switch *ds, int port,
18191815
const struct switchdev_obj_port_vlan *vlan)
18201816
{
18211817
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
1822-
const u16 defpvid = 4000 + ds->index * DSA_MAX_PORTS + port;
18231818
u16 pvid, vid;
18241819
int err = 0;
18251820

@@ -1835,8 +1830,7 @@ int mv88e6xxx_port_vlan_del(struct dsa_switch *ds, int port,
18351830
goto unlock;
18361831

18371832
if (vid == pvid) {
1838-
/* restore reserved VLAN ID */
1839-
err = _mv88e6xxx_port_pvid_set(ds, port, defpvid);
1833+
err = _mv88e6xxx_port_pvid_set(ds, port, 0);
18401834
if (err)
18411835
goto unlock;
18421836
}
@@ -2186,20 +2180,6 @@ int mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port)
21862180
return err;
21872181
}
21882182

2189-
static int mv88e6xxx_setup_port_default_vlan(struct dsa_switch *ds, int port)
2190-
{
2191-
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
2192-
const u16 pvid = 4000 + ds->index * DSA_MAX_PORTS + port;
2193-
int err;
2194-
2195-
mutex_lock(&ps->smi_mutex);
2196-
err = _mv88e6xxx_port_vlan_add(ds, port, pvid, true);
2197-
if (!err)
2198-
err = _mv88e6xxx_port_pvid_set(ds, port, pvid);
2199-
mutex_unlock(&ps->smi_mutex);
2200-
return err;
2201-
}
2202-
22032183
static void mv88e6xxx_bridge_work(struct work_struct *work)
22042184
{
22052185
struct mv88e6xxx_priv_state *ps;
@@ -2320,7 +2300,7 @@ static int mv88e6xxx_setup_port(struct dsa_switch *ds, int port)
23202300
}
23212301

23222302
/* Port Control 2: don't force a good FCS, set the maximum frame size to
2323-
* 10240 bytes, enable secure 802.1q tags, don't discard tagged or
2303+
* 10240 bytes, disable 802.1q tags checking, don't discard tagged or
23242304
* untagged frames on this port, do a destination address lookup on all
23252305
* received packets as usual, disable ARP mirroring and don't send a
23262306
* 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)
23452325
reg |= PORT_CONTROL_2_FORWARD_UNKNOWN;
23462326
}
23472327

2348-
reg |= PORT_CONTROL_2_8021Q_SECURE;
2328+
reg |= PORT_CONTROL_2_8021Q_DISABLED;
23492329

23502330
if (reg) {
23512331
ret = _mv88e6xxx_reg_write(ds, REG_PORT(port),
@@ -2474,13 +2454,6 @@ int mv88e6xxx_setup_ports(struct dsa_switch *ds)
24742454
ret = mv88e6xxx_setup_port(ds, i);
24752455
if (ret < 0)
24762456
return ret;
2477-
2478-
if (dsa_is_cpu_port(ds, i) || dsa_is_dsa_port(ds, i))
2479-
continue;
2480-
2481-
ret = mv88e6xxx_setup_port_default_vlan(ds, i);
2482-
if (ret < 0)
2483-
return ret;
24842457
}
24852458
return 0;
24862459
}

0 commit comments

Comments
 (0)