]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: dsa: move port_ignore constant to config 22026/head
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Sat, 14 Feb 2026 20:33:54 +0000 (21:33 +0100)
committerRobert Marko <robimarko@gmail.com>
Mon, 16 Feb 2026 14:48:22 +0000 (15:48 +0100)
Device specific constants belong into the config structure.
No need to initialize them manually during probing within a
family_id switch statement. Although there are lots of constants
that need to be converted start with port_ignore as a simple one.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22026
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.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 8a69ef35b24d9c7277e1d51be5e64722a7ee60a1..7b03831a82a15aae59f5cbd9b0c6cc9daf518098 100644 (file)
@@ -575,7 +575,7 @@ static int rtl83xx_l2_nexthop_add(struct rtl838x_switch_priv *priv, struct rtl83
                e.block_sa = false;
                e.suspended = false;
                e.age = 0;                      /* With port-ignore */
-               e.port = priv->port_ignore;
+               e.port = priv->r->port_ignore;
                u64_to_ether_addr(nh->mac, &e.mac[0]);
        }
        e.next_hop = true;
@@ -665,7 +665,7 @@ static int rtl83xx_l3_nexthop_update(struct rtl838x_switch_priv *priv,  __be32 i
                pr_debug("Route with id %d to %pI4 / %d\n", r->id, &r->dst_ip, r->prefix_len);
 
                r->nh.mac = r->nh.gw = mac;
-               r->nh.port = priv->port_ignore;
+               r->nh.port = priv->r->port_ignore;
                r->nh.id = r->id;
 
                /* Do we need to explicitly add a DMAC entry with the route's nh index? */
@@ -1097,7 +1097,7 @@ static int rtldsa_fib4_add(struct rtl838x_switch_priv *priv,
                        int slot;
 
                        route->nh.mac = mac;
-                       route->nh.port = priv->port_ignore;
+                       route->nh.port = priv->r->port_ignore;
                        route->attr.valid = true;
                        route->attr.action = ROUTE_ACT_TRAP2CPU;
                        route->attr.type = 0;
@@ -1418,7 +1418,6 @@ static int rtl83xx_sw_probe(struct platform_device *pdev)
                priv->l2_bucket_size = 4;
                priv->n_mst = 64;
                priv->n_pie_blocks = 12;
-               priv->port_ignore = 0x1f;
                priv->n_counters = 128;
                break;
        case RTL8390_FAMILY_ID:
@@ -1433,7 +1432,6 @@ static int rtl83xx_sw_probe(struct platform_device *pdev)
                priv->l2_bucket_size = 4;
                priv->n_mst = 256;
                priv->n_pie_blocks = 18;
-               priv->port_ignore = 0x3f;
                priv->n_counters = 1024;
                break;
        case RTL9300_FAMILY_ID:
@@ -1449,7 +1447,6 @@ static int rtl83xx_sw_probe(struct platform_device *pdev)
                priv->l2_bucket_size = 8;
                priv->n_mst = 64;
                priv->n_pie_blocks = 16;
-               priv->port_ignore = 0x3f;
                priv->n_counters = 2048;
                break;
        case RTL9310_FAMILY_ID:
@@ -1465,7 +1462,6 @@ static int rtl83xx_sw_probe(struct platform_device *pdev)
                priv->l2_bucket_size = 8;
                priv->n_mst = 128;
                priv->n_pie_blocks = 16;
-               priv->port_ignore = 0x3f;
                priv->n_counters = 2048;
                break;
        }
index 07e235fe8b6beb8f9e528e75d7b9591f3cea3d02..3a594db0587dccf94df6c64f5a1fea5246922b49 100644 (file)
@@ -1700,6 +1700,7 @@ const struct rtldsa_config rtldsa_838x_cfg = {
        .isr_port_link_sts_chg = RTL838X_ISR_PORT_LINK_STS_CHG,
        .imr_port_link_sts_chg = RTL838X_IMR_PORT_LINK_STS_CHG,
        .imr_glb = RTL838X_IMR_GLB,
+       .port_ignore = 0x1f,
        .vlan_tables_read = rtl838x_vlan_tables_read,
        .vlan_set_tagged = rtl838x_vlan_set_tagged,
        .vlan_set_untagged = rtl838x_vlan_set_untagged,
index ae9d61e319cf3ca1f75507f163a0a6d2a74726f0..4435d5758d2137004e9ff0ea3d437e248b730643 100644 (file)
@@ -1273,6 +1273,7 @@ struct rtldsa_config {
        int isr_port_link_sts_chg;
        int imr_port_link_sts_chg;
        int imr_glb;
+       u8 port_ignore;
        void (*vlan_tables_read)(u32 vlan, struct rtl838x_vlan_info *info);
        void (*vlan_set_tagged)(u32 vlan, struct rtl838x_vlan_info *info);
        void (*vlan_set_untagged)(u32 vlan, u64 portmask);
@@ -1360,7 +1361,6 @@ struct rtl838x_switch_priv {
        u8 cpu_port;
        u8 port_mask;
        u8 port_width;
-       u8 port_ignore;
        u64 irq_mask;
        u32 fib_entries;
        int l2_bucket_size;
index ef7f4d45804a7496332f57e32401b6151215a488..a78c981c215b355bd282788a198eed6f0da9eed6 100644 (file)
@@ -1640,6 +1640,7 @@ const struct rtldsa_config rtldsa_839x_cfg = {
        .isr_port_link_sts_chg = RTL839X_ISR_PORT_LINK_STS_CHG,
        .imr_port_link_sts_chg = RTL839X_IMR_PORT_LINK_STS_CHG,
        .imr_glb = RTL839X_IMR_GLB,
+       .port_ignore = 0x3f,
        .vlan_tables_read = rtl839x_vlan_tables_read,
        .vlan_set_tagged = rtl839x_vlan_set_tagged,
        .vlan_set_untagged = rtl839x_vlan_set_untagged,
index 508f8c4212bc81f511d5e480aa704dbda257e43f..308fdfd0001f55acc7014f178583997a6f5354a0 100644 (file)
@@ -2645,6 +2645,7 @@ const struct rtldsa_config rtldsa_930x_cfg = {
        .isr_port_link_sts_chg = RTL930X_ISR_PORT_LINK_STS_CHG,
        .imr_port_link_sts_chg = RTL930X_IMR_PORT_LINK_STS_CHG,
        .imr_glb = RTL930X_IMR_GLB,
+       .port_ignore = 0x3f,
        .vlan_tables_read = rtl930x_vlan_tables_read,
        .vlan_set_tagged = rtl930x_vlan_set_tagged,
        .vlan_set_untagged = rtl930x_vlan_set_untagged,
index 2488a2abca7efccf28fbcd885008336447f20ebf..b367436beee7b6b3994cfa6b91542835418fd850 100644 (file)
@@ -1830,6 +1830,7 @@ const struct rtldsa_config rtldsa_931x_cfg = {
        .isr_port_link_sts_chg = RTL931X_ISR_PORT_LINK_STS_CHG,
        .imr_port_link_sts_chg = RTL931X_IMR_PORT_LINK_STS_CHG,
        /* imr_glb does not exist on RTL931X */
+       .port_ignore = 0x3f,
        .vlan_tables_read = rtl931x_vlan_tables_read,
        .vlan_set_tagged = rtl931x_vlan_set_tagged,
        .vlan_set_untagged = rtl931x_vlan_set_untagged,