diff options
author | Vladimir Oltean <vladimir.oltean@nxp.com> | 2020-10-31 12:29:15 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2020-11-02 17:09:07 -0800 |
commit | 2f0402fedf20cc97b90837f6a9e2f5dc670afd4d (patch) | |
tree | 4b68b1c5e10b2f97738f4fbbd7d5fc4d2168ce32 /drivers/net/dsa | |
parent | be0576fed6d37d620d3d7dc416fc72677fd0f422 (diff) | |
download | linux-2f0402fedf20cc97b90837f6a9e2f5dc670afd4d.tar.bz2 |
net: mscc: ocelot: deny changing the native VLAN from the prepare phase
Put the preparation phase of switchdev VLAN objects to some good use,
and move the check we already had, for preventing the existence of more
than one egress-untagged VLAN per port, to the preparation phase of the
addition.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/dsa')
-rw-r--r-- | drivers/net/dsa/ocelot/felix.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index f791860d495f..3848f6bc922b 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -112,10 +112,21 @@ static void felix_bridge_leave(struct dsa_switch *ds, int port, ocelot_port_bridge_leave(ocelot, port, br); } -/* This callback needs to be present */ static int felix_vlan_prepare(struct dsa_switch *ds, int port, const struct switchdev_obj_port_vlan *vlan) { + struct ocelot *ocelot = ds->priv; + u16 vid, flags = vlan->flags; + int err; + + for (vid = vlan->vid_begin; vid <= vlan->vid_end; vid++) { + err = ocelot_vlan_prepare(ocelot, port, vid, + flags & BRIDGE_VLAN_INFO_PVID, + flags & BRIDGE_VLAN_INFO_UNTAGGED); + if (err) + return err; + } + return 0; } |