diff options
author | Birger Koblitz <git@birger-koblitz.de> | 2022-01-18 20:53:31 +0100 |
---|---|---|
committer | Daniel Golle <daniel@makrotopia.org> | 2022-02-17 15:21:47 +0000 |
commit | 9d396fc1e8a7068acaa34eef2f87409c16a209bd (patch) | |
tree | 4ebaddc4f60173614d82a14d6e7d74e3b85277fd /target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c | |
parent | f3c5e7ddcc365f66f9b21f3332a95d281a101303 (diff) | |
download | upstream-9d396fc1e8a7068acaa34eef2f87409c16a209bd.tar.gz upstream-9d396fc1e8a7068acaa34eef2f87409c16a209bd.tar.bz2 upstream-9d396fc1e8a7068acaa34eef2f87409c16a209bd.zip |
realtek: Add L2 aging configuration functions for all SoC families
Instead of a generic L2 aging configuration function with complex
logic, we implement an individual function for all SoC types.
Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
Diffstat (limited to 'target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c')
-rw-r--r-- | target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c index 863d36cd36..d8fabdc041 100644 --- a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c +++ b/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c @@ -1039,25 +1039,11 @@ static int rtl93xx_get_mac_eee(struct dsa_switch *ds, int port, return 0; } -/* - * Set Switch L2 Aging time, t is time in milliseconds - * t = 0: aging is disabled - */ -static int rtl83xx_set_l2aging(struct dsa_switch *ds, u32 t) +static int rtl83xx_set_ageing_time(struct dsa_switch *ds, unsigned int msec) { struct rtl838x_switch_priv *priv = ds->priv; - int t_max = priv->family_id == RTL8380_FAMILY_ID ? 0x7fffff : 0x1FFFFF; - /* Convert time in mseconds to internal value */ - if (t > 0x10000000) { /* Set to maximum */ - t = t_max; - } else { - if (priv->family_id == RTL8380_FAMILY_ID) - t = ((t * 625) / 1000 + 127) / 128; - else - t = (t * 5 + 2) / 3; - } - sw_w32(t, priv->r->l2_ctrl_1); + priv->r->set_ageing_time(msec); return 0; } @@ -2137,7 +2123,7 @@ const struct dsa_switch_ops rtl83xx_switch_ops = { .get_mac_eee = rtl83xx_get_mac_eee, .set_mac_eee = rtl83xx_set_mac_eee, - .set_ageing_time = rtl83xx_set_l2aging, + .set_ageing_time = rtl83xx_set_ageing_time, .port_bridge_join = rtl83xx_port_bridge_join, .port_bridge_leave = rtl83xx_port_bridge_leave, .port_stp_state_set = rtl83xx_port_stp_state_set, @@ -2190,7 +2176,7 @@ const struct dsa_switch_ops rtl930x_switch_ops = { .get_mac_eee = rtl93xx_get_mac_eee, .set_mac_eee = rtl83xx_set_mac_eee, - .set_ageing_time = rtl83xx_set_l2aging, + .set_ageing_time = rtl83xx_set_ageing_time, .port_bridge_join = rtl83xx_port_bridge_join, .port_bridge_leave = rtl83xx_port_bridge_leave, .port_stp_state_set = rtl83xx_port_stp_state_set, |