]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: dsa: remove family check around print_matrix() 22009/head
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Fri, 13 Feb 2026 20:35:44 +0000 (21:35 +0100)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 14 Feb 2026 18:59:37 +0000 (19:59 +0100)
Move the function into the config area to avoid family checks.
While we are here apply the new dsa function prefix.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22009
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/rtl83xx.h
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 8b72c00d667c8192ff27d784c2cd8655ef344a0b..5612ba8e403d6d3647b400f2ccd9e0bace32125e 100644 (file)
@@ -544,11 +544,7 @@ static int rtldsa_83xx_setup(struct dsa_switch *ds)
                        priv->r->set_static_move_action(i, true);
        }
 
-       if (priv->family_id == RTL8380_FAMILY_ID)
-               rtl838x_print_matrix();
-       else
-               rtl839x_print_matrix();
-
+       priv->r->print_matrix();
        rtldsa_83xx_init_stats(priv);
        rtldsa_init_counters(priv);
 
@@ -616,10 +612,7 @@ static int rtldsa_93xx_setup(struct dsa_switch *ds)
        if (priv->family_id == RTL9310_FAMILY_ID)
                rtldsa_931x_config_phy_ability_source(priv);
 
-       if (priv->family_id == RTL9300_FAMILY_ID)
-               rtl930x_print_matrix();
-       else if (priv->family_id == RTL9310_FAMILY_ID)
-               rtl931x_print_matrix();
+       priv->r->print_matrix();
 
        /* TODO: Initialize statistics */
        rtldsa_init_counters(priv);
index 75f7fccb9157dba432faf2b1f81ee3952b5f3109..07e235fe8b6beb8f9e528e75d7b9591f3cea3d02 100644 (file)
@@ -111,7 +111,7 @@ static enum template_field_id fixed_templates[N_FIXED_TEMPLATES][N_FIXED_FIELDS]
        },
 };
 
-void rtl838x_print_matrix(void)
+void rtldsa_838x_print_matrix(void)
 {
        unsigned volatile int *ptr8;
 
@@ -1720,6 +1720,7 @@ const struct rtldsa_config rtldsa_838x_cfg = {
        .l2_port_new_salrn = rtl838x_l2_port_new_salrn,
        .l2_port_new_sa_fwd = rtl838x_l2_port_new_sa_fwd,
        .get_mirror_config = rtldsa_838x_get_mirror_config,
+       .print_matrix = rtldsa_838x_print_matrix,
        .read_l2_entry_using_hash = rtl838x_read_l2_entry_using_hash,
        .write_l2_entry_using_hash = rtl838x_write_l2_entry_using_hash,
        .read_cam = rtl838x_read_cam,
index 6750fe94dfc3a825f7fd856de91ae133cbe185bf..ae9d61e319cf3ca1f75507f163a0a6d2a74726f0 100644 (file)
@@ -1301,6 +1301,7 @@ struct rtldsa_config {
                                    const struct flow_action_entry *act, bool ingress);
        int (*port_rate_police_del)(struct dsa_switch *ds, int port, struct flow_cls_offload *cls,
                                    bool ingress);
+       void (*print_matrix)(void);
        u64 (*read_l2_entry_using_hash)(u32 hash, u32 position, struct rtl838x_l2_entry *e);
        void (*write_l2_entry_using_hash)(u32 hash, u32 pos, struct rtl838x_l2_entry *e);
        u64 (*read_cam)(int idx, struct rtl838x_l2_entry *e);
index 13944f136c1528028ea5adea938c53c679f58844..ef7f4d45804a7496332f57e32401b6151215a488 100644 (file)
@@ -117,7 +117,7 @@ static enum template_field_id fixed_templates[N_FIXED_TEMPLATES][N_FIXED_FIELDS]
        },
 };
 
-void rtl839x_print_matrix(void)
+void rtldsa_839x_print_matrix(void)
 {
        volatile u64 *ptr9;
 
@@ -1663,6 +1663,7 @@ const struct rtldsa_config rtldsa_839x_cfg = {
        .l2_port_new_salrn = rtl839x_l2_port_new_salrn,
        .l2_port_new_sa_fwd = rtl839x_l2_port_new_sa_fwd,
        .get_mirror_config = rtldsa_839x_get_mirror_config,
+       .print_matrix = rtldsa_839x_print_matrix,
        .read_l2_entry_using_hash = rtl839x_read_l2_entry_using_hash,
        .write_l2_entry_using_hash = rtl839x_write_l2_entry_using_hash,
        .read_cam = rtl839x_read_cam,
index 8d89e135cdf926aace781d0aa3a3a0afdb5fa7f5..cee99686709cd864903bbec6fdae23a423a7e0bc 100644 (file)
@@ -158,25 +158,25 @@ int rtl838x_set_egress_rate(struct rtl838x_switch_priv *priv, int port, u32 rate
 u32 rtl838x_hash(struct rtl838x_switch_priv *priv, u64 seed);
 irqreturn_t rtl838x_switch_irq(int irq, void *dev_id);
 void rtl838x_vlan_profile_dump(int index);
-void rtl838x_print_matrix(void);
+void rtldsa_838x_print_matrix(void);
 
 /* RTL839x-specific */
 u32 rtl839x_hash(struct rtl838x_switch_priv *priv, u64 seed);
 irqreturn_t rtl839x_switch_irq(int irq, void *dev_id);
 void rtl839x_vlan_profile_dump(int index);
 void rtl839x_exec_tbl2_cmd(u32 cmd);
-void rtl839x_print_matrix(void);
+void rtldsa_839x_print_matrix(void);
 
 /* RTL930x-specific */
 u32 rtl930x_hash(struct rtl838x_switch_priv *priv, u64 seed);
 irqreturn_t rtldsa_930x_switch_irq(int irq, void *dev_id);
 irqreturn_t rtl839x_switch_irq(int irq, void *dev_id);
 void rtl930x_vlan_profile_dump(int index);
-void rtl930x_print_matrix(void);
+void rtldsa_930x_print_matrix(void);
 
 /* RTL931x-specific */
 irqreturn_t rtl931x_switch_irq(int irq, void *dev_id);
-void rtl931x_print_matrix(void);
+void rtldsa_931x_print_matrix(void);
 void rtldsa_931x_config_phy_ability_source(struct rtl838x_switch_priv *priv);
 
 int rtl83xx_lag_add(struct dsa_switch *ds, int group, int port, struct netdev_lag_upper_info *info);
@@ -194,8 +194,6 @@ void rtl839x_set_egress_queue(int port, int queue);
 void rtl9300_dump_debug(void);
 void rtl930x_pie_rule_dump_raw(u32 r[]);
 
-void rtl931x_print_matrix(void);
-
 extern const struct dsa_switch_ops rtldsa_83xx_switch_ops;
 extern const struct dsa_switch_ops rtldsa_93xx_switch_ops;
 
index b079e63c70e66e018c63780f47e4e30c1c74efae..508f8c4212bc81f511d5e480aa704dbda257e43f 100644 (file)
@@ -124,7 +124,7 @@ static enum template_field_id fixed_templates[N_FIXED_TEMPLATES][N_FIXED_FIELDS]
        },
 };
 
-void rtl930x_print_matrix(void)
+void rtldsa_930x_print_matrix(void)
 {
        struct table_reg *r = rtl_table_get(RTL9300_TBL_0, 6);
 
@@ -867,7 +867,7 @@ void rtl9300_dump_debug(void)
        }
        pr_debug("# %08x %08x %08x %08x %08x\n",
                 sw_r32(r), sw_r32(r + 4), sw_r32(r + 8), sw_r32(r + 12), sw_r32(r + 16));
-       rtl930x_print_matrix();
+       rtldsa_930x_print_matrix();
        pr_debug("RTL930X_L2_PORT_SABLK_CTRL: %08x, RTL930X_L2_PORT_DABLK_CTRL %08x\n",
                 sw_r32(RTL930X_L2_PORT_SABLK_CTRL), sw_r32(RTL930X_L2_PORT_DABLK_CTRL)
 
@@ -2662,6 +2662,7 @@ const struct rtldsa_config rtldsa_930x_cfg = {
        .get_mirror_config = rtldsa_930x_get_mirror_config,
        .port_rate_police_add = rtldsa_930x_port_rate_police_add,
        .port_rate_police_del = rtldsa_930x_port_rate_police_del,
+       .print_matrix = rtldsa_930x_print_matrix,
        .read_l2_entry_using_hash = rtl930x_read_l2_entry_using_hash,
        .write_l2_entry_using_hash = rtl930x_write_l2_entry_using_hash,
        .read_cam = rtl930x_read_cam,
index dbf51adfd27f6c239a25a24eec5deea73e54b818..2488a2abca7efccf28fbcd885008336447f20ebf 100644 (file)
@@ -385,7 +385,7 @@ irqreturn_t rtl931x_switch_irq(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-void rtl931x_print_matrix(void)
+void rtldsa_931x_print_matrix(void)
 {
        struct table_reg *r = rtl_table_get(RTL9310_TBL_2, 1);
 
@@ -1845,6 +1845,7 @@ const struct rtldsa_config rtldsa_931x_cfg = {
        .get_mirror_config = rtldsa_931x_get_mirror_config,
        .port_rate_police_add = rtldsa_931x_port_rate_police_add,
        .port_rate_police_del = rtldsa_931x_port_rate_police_del,
+       .print_matrix = rtldsa_931x_print_matrix,
        .read_l2_entry_using_hash = rtl931x_read_l2_entry_using_hash,
        .write_l2_entry_using_hash = rtl931x_write_l2_entry_using_hash,
        .read_cam = rtl931x_read_cam,