]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
net: dsa: microchip: ksz8795: Reject unsupported VLAN configuration
authorBen Hutchings <ben.hutchings@mind.be>
Mon, 16 Aug 2021 18:09:31 +0000 (20:09 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 24 Sep 2021 09:57:29 +0000 (11:57 +0200)
commit5d7478ef033e81bf192dc1be97578f34fa255fa5
tree394d10f0bcca2a2c5f4afadc7ed8ca44326b39a4
parent646677b1486da4d7635d543b0c05e91fde2d2ac1
net: dsa: microchip: ksz8795: Reject unsupported VLAN configuration

BugLink: https://bugs.launchpad.net/bugs/1943756
commit 8f4f58f88fe0d9bd591f21f53de7dbd42baeb3fa upstream.

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>
[bwh: Backport to 5.10:
 - This configuration has to be detected and rejected in the
   port_vlan_prepare operation
 - ksz8795_port_vlan_add() has to check again to decide whether to
   change the Tag Removal flag, so put the common condition in a
   separate function
 - Handle VID ranges]
Signed-off-by: Ben Hutchings <ben.hutchings@mind.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/net/dsa/microchip/ksz8795.c
drivers/net/dsa/microchip/ksz_common.h