net: dsa: microchip: ksz8795: Fix VLAN filtering
authorBen Hutchings <ben.hutchings@mind.be>
Mon, 9 Aug 2021 23:00:06 +0000 (01:00 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Aug 2021 06:59:12 +0000 (08:59 +0200)
commitdbfaf7a6a23a1fa06e83e3b7bec878ee85f5a5c6
treef06ae9263a3f86b007c5a892a892b35b2c33dc0b
parentccc1fe82c87858a0543fd5afa784086fe0512040
net: dsa: microchip: ksz8795: Fix VLAN filtering

[ Upstream commit 164844135a3f215d3018ee9d6875336beb942413 ]

Currently ksz8_port_vlan_filtering() sets or clears the VLAN Enable
hardware flag.  That controls discarding of packets with a VID that
has not been enabled for any port on the switch.

Since it is a global flag, set the dsa_switch::vlan_filtering_is_global
flag so that the DSA core understands this can't be controlled per
port.

When VLAN filtering is enabled, the switch should also discard packets
with a VID that's not enabled on the ingress port.  Set or clear each
external port's VLAN Ingress Filter flag in ksz8_port_vlan_filtering()
to make that happen.

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/dsa/microchip/ksz8795.c