Skip to content

Commit 3a24e12

Browse files
bwh-mindgregkh
authored andcommitted
net: dsa: microchip: ksz8795: Use software untagging on CPU port
commit 9130c2d upstream. On the CPU port, we can support both tagged and untagged VLANs at the same time by doing any necessary untagging in software rather than hardware. To enable that, keep the CPU port's Remove Tag flag cleared and set the dsa_switch::untag_bridge_pvid flag. Fixes: e66f840 ("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: adjust context] Signed-off-by: Ben Hutchings <ben.hutchings@mind.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 1e78179 commit 3a24e12

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

drivers/net/dsa/microchip/ksz8795.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,9 +812,11 @@ static bool ksz8795_port_vlan_changes_remove_tag(
812812
/* If a VLAN is added with untagged flag different from the
813813
* port's Remove Tag flag, we need to change the latter.
814814
* Ignore VID 0, which is always untagged.
815+
* Ignore CPU port, which will always be tagged.
815816
*/
816817
return untagged != p->remove_tag &&
817-
!(vlan->vid_begin == 0 && vlan->vid_end == 0);
818+
!(vlan->vid_begin == 0 && vlan->vid_end == 0) &&
819+
port != dev->cpu_port;
818820
}
819821

820822
int ksz8795_port_vlan_prepare(struct dsa_switch *ds, int port,
@@ -1325,6 +1327,11 @@ static int ksz8795_switch_init(struct ksz_device *dev)
13251327
/* set the real number of ports */
13261328
dev->ds->num_ports = dev->port_cnt + 1;
13271329

1330+
/* We rely on software untagging on the CPU port, so that we
1331+
* can support both tagged and untagged VLANs
1332+
*/
1333+
dev->ds->untag_bridge_pvid = true;
1334+
13281335
/* VLAN filtering is partly controlled by the global VLAN
13291336
* Enable flag
13301337
*/

0 commit comments

Comments
 (0)