]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: dsa: rename tagged_ports to member_ports 19684/head
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Tue, 5 Aug 2025 18:02:26 +0000 (14:02 -0400)
committerHauke Mehrtens <hauke@hauke-m.de>
Fri, 8 Aug 2025 16:04:57 +0000 (18:04 +0200)
The current variables tagged_ports and untagged_ports suggest that
these are distinct and describe only the ports in each of these
configuration types.

That is wrong. The hardware is configured via member ports and
untagged ports. The first one being a superset of the second.
Rename the variables to reflect that.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/19684
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.c
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.h
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl839x.c
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl930x.c
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c

index 17a8b46f0c40cffe8429279e1dd122fb4cb319d1..fbb1a4ba2f7663bf8db9e93a6a94ddf1161ed820 100644 (file)
@@ -368,7 +368,7 @@ static void rtl83xx_vlan_setup(struct rtl838x_switch_priv *priv)
        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 */
+       info.member_ports = 0;          /* Initially no port members */
        if (priv->family_id == RTL9310_FAMILY_ID) {
                info.if_id = 0;
                info.multicast_grp_mask = 0;
@@ -388,7 +388,7 @@ static void rtl83xx_vlan_setup(struct rtl838x_switch_priv *priv)
         */
        for (int i = 0; i <= priv->cpu_port; i++) {
                rtl83xx_vlan_set_pvid(priv, i, 0);
-               info.tagged_ports |= BIT_ULL(i);
+               info.member_ports |= BIT_ULL(i);
        }
        priv->r->vlan_set_tagged(0, &info);
 
@@ -1922,19 +1922,19 @@ static int rtl83xx_vlan_prepare(struct dsa_switch *ds, int port,
 
        priv->r->vlan_tables_read(0, &info);
 
-       pr_debug("VLAN 0: Tagged ports %llx, untag %llx, profile %d, MC# %d, UC# %d, FID %x\n",
-               info.tagged_ports, info.untagged_ports, info.profile_id,
+       pr_debug("VLAN 0: Member ports %llx, untag %llx, profile %d, MC# %d, UC# %d, FID %x\n",
+               info.member_ports, info.untagged_ports, info.profile_id,
                info.hash_mc_fid, info.hash_uc_fid, info.fid);
 
        priv->r->vlan_tables_read(1, &info);
-       pr_debug("VLAN 1: Tagged ports %llx, untag %llx, profile %d, MC# %d, UC# %d, FID %x\n",
-               info.tagged_ports, info.untagged_ports, info.profile_id,
+       pr_debug("VLAN 1: Member ports %llx, untag %llx, profile %d, MC# %d, UC# %d, FID %x\n",
+               info.member_ports, info.untagged_ports, info.profile_id,
                info.hash_mc_fid, info.hash_uc_fid, info.fid);
        priv->r->vlan_set_untagged(1, info.untagged_ports);
        pr_debug("SET: Untagged ports, VLAN %d: %llx\n", 1, info.untagged_ports);
 
        priv->r->vlan_set_tagged(1, &info);
-       pr_debug("SET: Tagged ports, VLAN %d: %llx\n", 1, info.tagged_ports);
+       pr_debug("SET: Member ports, VLAN %d: %llx\n", 1, info.member_ports);
 
        return 0;
 }
@@ -1983,7 +1983,7 @@ static int rtl83xx_vlan_add(struct dsa_switch *ds, int port,
        priv->r->vlan_tables_read(vlan->vid, &info);
 
        /* new VLAN? */
-       if (!info.tagged_ports) {
+       if (!info.member_ports) {
                info.fid = 0;
                info.hash_mc_fid = false;
                info.hash_uc_fid = false;
@@ -1991,10 +1991,10 @@ static int rtl83xx_vlan_add(struct dsa_switch *ds, int port,
        }
 
        /* sanitize untagged_ports - must be a subset */
-       if (info.untagged_ports & ~info.tagged_ports)
+       if (info.untagged_ports & ~info.member_ports)
                info.untagged_ports = 0;
 
-       info.tagged_ports |= BIT_ULL(port);
+       info.member_ports |= BIT_ULL(port);
        if (vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED)
                info.untagged_ports |= BIT_ULL(port);
        else
@@ -2004,7 +2004,7 @@ static int rtl83xx_vlan_add(struct dsa_switch *ds, int port,
        pr_debug("Untagged ports, VLAN %d: %llx\n", vlan->vid, info.untagged_ports);
 
        priv->r->vlan_set_tagged(vlan->vid, &info);
-       pr_debug("Tagged ports, VLAN %d: %llx\n", vlan->vid, info.tagged_ports);
+       pr_debug("Member ports, VLAN %d: %llx\n", vlan->vid, info.member_ports);
 
        mutex_unlock(&priv->reg_mutex);
 
@@ -2041,13 +2041,13 @@ static int rtl83xx_vlan_del(struct dsa_switch *ds, int port,
 
        /* remove port from both tables */
        info.untagged_ports &= (~BIT_ULL(port));
-       info.tagged_ports &= (~BIT_ULL(port));
+       info.member_ports &= (~BIT_ULL(port));
 
        priv->r->vlan_set_untagged(vlan->vid, info.untagged_ports);
        pr_debug("Untagged ports, VLAN %d: %llx\n", vlan->vid, info.untagged_ports);
 
        priv->r->vlan_set_tagged(vlan->vid, &info);
-       pr_debug("Tagged ports, VLAN %d: %llx\n", vlan->vid, info.tagged_ports);
+       pr_debug("Member ports, VLAN %d: %llx\n", vlan->vid, info.member_ports);
 
        mutex_unlock(&priv->reg_mutex);
 
index ac4b9623181c303682acda168265830d13cf6a0d..e0c8d73fa4ff21509085f6e93f862409e671ec56 100644 (file)
@@ -155,9 +155,9 @@ static void rtl838x_vlan_tables_read(u32 vlan, struct rtl838x_vlan_info *info)
        struct table_reg *r = rtl_table_get(RTL8380_TBL_0, 0);
 
        rtl_table_read(r, vlan);
-       info->tagged_ports = sw_r32(rtl_table_data(r, 0));
+       info->member_ports = sw_r32(rtl_table_data(r, 0));
        v = sw_r32(rtl_table_data(r, 1));
-       pr_debug("VLAN_READ %d: %016llx %08x\n", vlan, info->tagged_ports, v);
+       pr_debug("VLAN_READ %d: %016llx %08x\n", vlan, info->member_ports, v);
        rtl_table_release(r);
 
        info->profile_id = v & 0x7;
@@ -178,7 +178,7 @@ static void rtl838x_vlan_set_tagged(u32 vlan, struct rtl838x_vlan_info *info)
        /* Access VLAN table (0) via register 0 */
        struct table_reg *r = rtl_table_get(RTL8380_TBL_0, 0);
 
-       sw_w32(info->tagged_ports, rtl_table_data(r, 0));
+       sw_w32(info->member_ports, rtl_table_data(r, 0));
 
        v = info->profile_id;
        v |= info->hash_mc_fid ? 0x8 : 0;
index 749440f70b5d4e92f589f204515d7afd2fe998d6..544f693883fca1b5da1f7bf9c53424c0c2c482c5 100644 (file)
@@ -709,7 +709,7 @@ struct rtl838x_pcs {
 
 struct rtl838x_vlan_info {
        u64 untagged_ports;
-       u64 tagged_ports;
+       u64 member_ports;
        u8 profile_id;
        bool hash_mc_fid;
        bool hash_uc_fid;
index cec6e27c37ea4599b21883e136a48f72f7bf8413..87ba9e0fbc11a8d8698b59c062f2f660b8d3e3da 100644 (file)
@@ -172,8 +172,8 @@ static void rtl839x_vlan_tables_read(u32 vlan, struct rtl838x_vlan_info *info)
        w = sw_r32(rtl_table_data(r, 2));
        rtl_table_release(r);
 
-       info->tagged_ports = u;
-       info->tagged_ports = (info->tagged_ports << 21) | ((v >> 11) & 0x1fffff);
+       info->member_ports = u;
+       info->member_ports = (info->member_ports << 21) | ((v >> 11) & 0x1fffff);
        info->profile_id = w >> 30 | ((v & 1) << 2);
        info->hash_mc_fid = !!(w & BIT(2));
        info->hash_uc_fid = !!(w & BIT(3));
@@ -196,8 +196,8 @@ static void rtl839x_vlan_set_tagged(u32 vlan, struct rtl838x_vlan_info *info)
        /* Access VLAN table (0) via register 0 */
        struct table_reg *r = rtl_table_get(RTL8390_TBL_0, 0);
 
-       u = info->tagged_ports >> 21;
-       v = info->tagged_ports << 11;
+       u = info->member_ports >> 21;
+       v = info->member_ports << 11;
        v |= ((u32)info->fid) << 3;
        v |= info->hash_uc_fid ? BIT(2) : 0;
        v |= info->hash_mc_fid ? BIT(1) : 0;
index dd1d3e5c1741801eb09dcdc85e7055a1b1c2632d..034b5c09f059d40c5cb03bd7930f62f06576daa3 100644 (file)
@@ -184,7 +184,7 @@ static void rtl930x_vlan_tables_read(u32 vlan, struct rtl838x_vlan_info *info)
        pr_debug("VLAN_READ %d: %08x %08x\n", vlan, v, w);
        rtl_table_release(r);
 
-       info->tagged_ports = v >> 3;
+       info->member_ports = v >> 3;
        info->profile_id = (w >> 24) & 7;
        info->hash_mc_fid = !!(w & BIT(27));
        info->hash_uc_fid = !!(w & BIT(28));
@@ -205,7 +205,7 @@ static void rtl930x_vlan_set_tagged(u32 vlan, struct rtl838x_vlan_info *info)
        /* Access VLAN table (1) via register 0 */
        struct table_reg *r = rtl_table_get(RTL9300_TBL_0, 1);
 
-       v = info->tagged_ports << 3;
+       v = info->member_ports << 3;
        v |= ((u32)info->fid) >> 3;
 
        w = ((u32)info->fid) << 29;
index a1d0101f47f93bd61d4e8332c5440d460ae5e2fb..5a623cd31b56006ab8583d474106eb9fcf3d7a4b 100644 (file)
@@ -198,7 +198,7 @@ static void rtl931x_vlan_tables_read(u32 vlan, struct rtl838x_vlan_info *info)
        rtl_table_release(r);
 
        pr_debug("VLAN_READ %d: %08x %08x %08x %08x\n", vlan, v, w, x, y);
-       info->tagged_ports = ((u64) v) << 25 | (w >> 7);
+       info->member_ports = ((u64) v) << 25 | (w >> 7);
        info->profile_id = (x >> 16) & 0xf;
        info->fid = w & 0x7f;                           /* AKA MSTI depending on context */
        info->hash_uc_fid = !!(x & BIT(31));
@@ -209,8 +209,8 @@ static void rtl931x_vlan_tables_read(u32 vlan, struct rtl838x_vlan_info *info)
                info->l2_tunnel_list_id = y >> 18;
        else
                info->l2_tunnel_list_id = -1;
-       pr_debug("%s read tagged %016llx, profile-id %d, uc %d, mc %d, intf-id %d\n", __func__,
-               info->tagged_ports, info->profile_id, info->hash_uc_fid, info->hash_mc_fid,
+       pr_debug("%s read member %016llx, profile-id %d, uc %d, mc %d, intf-id %d\n", __func__,
+               info->member_ports, info->profile_id, info->hash_uc_fid, info->hash_mc_fid,
                info->if_id);
 
        /* Read UNTAG table via table register 3 */
@@ -227,8 +227,8 @@ static void rtl931x_vlan_set_tagged(u32 vlan, struct rtl838x_vlan_info *info)
        struct table_reg *r;
        u32 v, w, x, y;
 
-       v = info->tagged_ports >> 25;
-       w = (info->tagged_ports & GENMASK(24, 0)) << 7;
+       v = info->member_ports >> 25;
+       w = (info->member_ports & GENMASK(24, 0)) << 7;
        w |= info->fid & 0x7f;
        x = info->hash_uc_fid ? BIT(31) : 0;
        x |= info->hash_mc_fid ? BIT(30) : 0;