forked from mirror/openwrt
realtek: dsa: remove family check around print_matrix()
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>
This commit is contained in:
parent
baa433ffe9
commit
ca9e38963f
7 changed files with 16 additions and 20 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue