aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <[email protected]>2021-10-05 19:47:03 +0000
committerDavid S. Miller <[email protected]>2021-10-06 14:08:11 +0000
commit1fbd19e10b735106fb91d4cb07095bc986a513aa (patch)
tree0e839f839b2debc65820b587827b92f6972d13fb
parentnet: dsa: rtl8366rb: Support disabling learning (diff)
downloadkernel-1fbd19e10b735106fb91d4cb07095bc986a513aa.tar.gz
kernel-1fbd19e10b735106fb91d4cb07095bc986a513aa.zip
net: dsa: rtl8366rb: Support fast aging
This implements fast aging per-port using the special "security" register, which will flush any learned L2 LUT entries on a port. The vendor API just enabled setting and clearing this bit, so we set it to age out any entries on the port and then we clear it again. Suggested-by: Vladimir Oltean <[email protected]> Cc: Mauri Sandberg <[email protected]> Cc: DENG Qingfang <[email protected]> Cc: Florian Fainelli <[email protected]> Reviewed-by: Alvin Šipraga <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Reviewed-by: Vladimir Oltean <[email protected]> Signed-off-by: David S. Miller <[email protected]>
-rw-r--r--drivers/net/dsa/rtl8366rb.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/net/dsa/rtl8366rb.c b/drivers/net/dsa/rtl8366rb.c
index b3056064b937..c78e4220ddd1 100644
--- a/drivers/net/dsa/rtl8366rb.c
+++ b/drivers/net/dsa/rtl8366rb.c
@@ -1308,6 +1308,19 @@ rtl8366rb_port_bridge_flags(struct dsa_switch *ds, int port,
return 0;
}
+static void
+rtl8366rb_port_fast_age(struct dsa_switch *ds, int port)
+{
+ struct realtek_smi *smi = ds->priv;
+
+ /* This will age out any learned L2 entries */
+ regmap_update_bits(smi->map, RTL8366RB_SECURITY_CTRL,
+ BIT(port), BIT(port));
+ /* Restore the normal state of things */
+ regmap_update_bits(smi->map, RTL8366RB_SECURITY_CTRL,
+ BIT(port), 0);
+}
+
static int rtl8366rb_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
{
struct realtek_smi *smi = ds->priv;
@@ -1720,6 +1733,7 @@ static const struct dsa_switch_ops rtl8366rb_switch_ops = {
.port_disable = rtl8366rb_port_disable,
.port_pre_bridge_flags = rtl8366rb_port_pre_bridge_flags,
.port_bridge_flags = rtl8366rb_port_bridge_flags,
+ .port_fast_age = rtl8366rb_port_fast_age,
.port_change_mtu = rtl8366rb_change_mtu,
.port_max_mtu = rtl8366rb_max_mtu,
};