Skip to content

Commit

Permalink
rtl83xx: dsa: reset PVID to 1 instead of 0
Browse files Browse the repository at this point in the history
Before, PVID is reset for all ports and goes out of bounds. Also, PVID
is later changed by dsa configuration by `ip link` and `bridge vlan`
commands, this does not change the CPU port PVID and CPU PVID stays 0.
It does not allow sending packets from OpenWrt to any connected devices
unless default configuration is changed

This change iterates up to and including cpu_port and sets default PVID
to 1. For lan* ports PVID can be configured with `ip link` and `bridge
vlan` commands

Acked-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
  • Loading branch information
0xharshal authored and svanheule committed Jan 9, 2024
1 parent da495c4 commit e691e2b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ static void rtl83xx_vlan_setup(struct rtl838x_switch_priv *priv)
priv->r->vlan_set_tagged(i, &info);

/* reset PVIDs; defaults to 1 on reset */
for (int i = 0; i <= priv->ds->num_ports; i++) {
priv->r->vlan_port_pvid_set(i, PBVLAN_TYPE_INNER, 0);
priv->r->vlan_port_pvid_set(i, PBVLAN_TYPE_OUTER, 0);
for (int i = 0; i <= priv->cpu_port; i++) {
priv->r->vlan_port_pvid_set(i, PBVLAN_TYPE_INNER, 1);
priv->r->vlan_port_pvid_set(i, PBVLAN_TYPE_OUTER, 1);
priv->r->vlan_port_pvidmode_set(i, PBVLAN_TYPE_INNER, PBVLAN_MODE_UNTAG_AND_PRITAG);
priv->r->vlan_port_pvidmode_set(i, PBVLAN_TYPE_OUTER, PBVLAN_MODE_UNTAG_AND_PRITAG);
}
Expand Down

0 comments on commit e691e2b

Please sign in to comment.