1 From 8eb13420eb9ab4a4e2ebd612bf5dc9dba0039236 Mon Sep 17 00:00:00 2001
2 From: Linus Walleij <linus.walleij@linaro.org>
3 Date: Tue, 5 Oct 2021 21:47:03 +0200
4 Subject: [PATCH 09/11] net: dsa: rtl8366rb: Support fast aging
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 This implements fast aging per-port using the special "security"
10 register, which will flush any learned L2 LUT entries on a port.
12 The vendor API just enabled setting and clearing this bit, so
13 we set it to age out any entries on the port and then we clear
16 Suggested-by: Vladimir Oltean <olteanv@gmail.com>
17 Cc: Mauri Sandberg <sandberg@mailfence.com>
18 Cc: DENG Qingfang <dqfext@gmail.com>
19 Cc: Florian Fainelli <f.fainelli@gmail.com>
20 Reviewed-by: Alvin Šipraga <alsi@bang-olufsen.dk>
21 Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
22 Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
23 Signed-off-by: David S. Miller <davem@davemloft.net>
25 drivers/net/dsa/rtl8366rb.c | 14 ++++++++++++++
26 1 file changed, 14 insertions(+)
28 --- a/drivers/net/dsa/rtl8366rb.c
29 +++ b/drivers/net/dsa/rtl8366rb.c
30 @@ -1308,6 +1308,19 @@ rtl8366rb_port_bridge_flags(struct dsa_s
35 +rtl8366rb_port_fast_age(struct dsa_switch *ds, int port)
37 + struct realtek_smi *smi = ds->priv;
39 + /* This will age out any learned L2 entries */
40 + regmap_update_bits(smi->map, RTL8366RB_SECURITY_CTRL,
41 + BIT(port), BIT(port));
42 + /* Restore the normal state of things */
43 + regmap_update_bits(smi->map, RTL8366RB_SECURITY_CTRL,
47 static int rtl8366rb_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
49 struct realtek_smi *smi = ds->priv;
50 @@ -1720,6 +1733,7 @@ static const struct dsa_switch_ops rtl83
51 .port_disable = rtl8366rb_port_disable,
52 .port_pre_bridge_flags = rtl8366rb_port_pre_bridge_flags,
53 .port_bridge_flags = rtl8366rb_port_bridge_flags,
54 + .port_fast_age = rtl8366rb_port_fast_age,
55 .port_change_mtu = rtl8366rb_change_mtu,
56 .port_max_mtu = rtl8366rb_max_mtu,