net: dsa: microchip: ksz8795: Reject unsupported VLAN configuration
authorBen Hutchings <ben.hutchings@mind.be>
Mon, 9 Aug 2021 22:59:37 +0000 (00:59 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 10 Aug 2021 08:58:14 +0000 (09:58 +0100)
commit8f4f58f88fe0d9bd591f21f53de7dbd42baeb3fa
tree4c8e34317b2cf7662936ad0e1bebfb69d4a623e4
parentef3b02a1d79b691f9a354c4903cf1e6917e315f9
net: dsa: microchip: ksz8795: Reject unsupported VLAN configuration

The switches supported by ksz8795 only have a per-port flag for Tag
Removal.  This means it is not possible to support both tagged and
untagged VLANs on the same port.  Reject attempts to add a VLAN that
requires the flag to be changed, unless there are no VLANs currently
configured.

VID 0 is excluded from this check since it is untagged regardless of
the state of the flag.

On the CPU port we could support tagged and untagged VLANs at the same
time.  This will be enabled by a later patch.

Fixes: e66f840c08a2 ("net: dsa: ksz: Add Microchip KSZ8795 DSA driver")
Signed-off-by: Ben Hutchings <ben.hutchings@mind.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/microchip/ksz8795.c
drivers/net/dsa/microchip/ksz_common.h