aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/realtek/files-5.4/drivers/net/dsa/rtl83xx/dsa.c
diff options
context:
space:
mode:
authorBirger Koblitz <git@birger-koblitz.de>2021-05-01 16:36:32 +0200
committerPetr Štetiar <ynezz@true.cz>2021-05-07 07:05:16 +0200
commit4342d27ec90cd0988fd3e62ccefbe66f2e691372 (patch)
tree0c1488225ffd01cd63e4cdbd62177d22ab212ab7 /target/linux/realtek/files-5.4/drivers/net/dsa/rtl83xx/dsa.c
parentd4649942ad72a1b1db2595ace3620c1059fa3464 (diff)
downloadupstream-4342d27ec90cd0988fd3e62ccefbe66f2e691372.tar.gz
upstream-4342d27ec90cd0988fd3e62ccefbe66f2e691372.tar.bz2
upstream-4342d27ec90cd0988fd3e62ccefbe66f2e691372.zip
realtek: Setup all VLANs with default configurations
This sets up all VLANs with a default configuration on reset: - forward based on VLAN-ID and not the FID/MSTI - forward based on the inner VLAN-ID (not outer) Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
Diffstat (limited to 'target/linux/realtek/files-5.4/drivers/net/dsa/rtl83xx/dsa.c')
-rw-r--r--target/linux/realtek/files-5.4/drivers/net/dsa/rtl83xx/dsa.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/target/linux/realtek/files-5.4/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-5.4/drivers/net/dsa/rtl83xx/dsa.c
index 1e902a1d7a..40130c287a 100644
--- a/target/linux/realtek/files-5.4/drivers/net/dsa/rtl83xx/dsa.c
+++ b/target/linux/realtek/files-5.4/drivers/net/dsa/rtl83xx/dsa.c
@@ -153,6 +153,36 @@ static enum dsa_tag_protocol rtl83xx_get_tag_protocol(struct dsa_switch *ds, int
return DSA_TAG_PROTO_TRAILER;
}
+/*
+ * Initialize all VLANS
+ */
+static void rtl83xx_vlan_setup(struct rtl838x_switch_priv *priv)
+{
+ struct rtl838x_vlan_info info;
+ int i;
+
+ pr_info("In %s\n", __func__);
+
+ priv->r->vlan_profile_setup(0);
+ priv->r->vlan_profile_setup(1);
+ pr_info("UNKNOWN_MC_PMASK: %016llx\n", priv->r->read_mcast_pmask(UNKNOWN_MC_PMASK));
+ priv->r->vlan_profile_dump(0);
+
+ info.fid = 0; // Default Forwarding ID / MSTI
+ info.hash_uc_fid = false; // Do not build the L2 lookup hash with FID, but VID
+ info.hash_mc_fid = false; // Do the same for Multicast packets
+ info.profile_id = 0; // Use default Vlan Profile 0
+ info.tagged_ports = 0; // Initially no port members
+
+ // Initialize all vlans 0-4095
+ for (i = 0; i < MAX_VLANS; i ++)
+ priv->r->vlan_set_tagged(i, &info);
+
+ // Set forwarding action based on inner VLAN tag
+ for (i = 0; i < priv->cpu_port; i++)
+ priv->r->vlan_fwd_on_inner(i, true);
+}
+
static int rtl83xx_setup(struct dsa_switch *ds)
{
int i;
@@ -188,6 +218,8 @@ static int rtl83xx_setup(struct dsa_switch *ds)
rtl83xx_init_stats(priv);
+ rtl83xx_vlan_setup(priv);
+
ds->configure_vlan_while_not_filtering = true;
/* Enable MAC Polling PHY again */
@@ -228,6 +260,8 @@ static int rtl930x_setup(struct dsa_switch *ds)
// TODO: Initialize statistics
+ rtl83xx_vlan_setup(priv);
+
ds->configure_vlan_while_not_filtering = true;
rtl83xx_enable_phy_polling(priv);