8ad7ab472d4f9aebcca333e995c220b78fffe335
[openwrt/staging/linusw.git] /
1 From 4592538bfb0d5d3c3c8a1d7071724d081412ac91 Mon Sep 17 00:00:00 2001
2 From: Ansuel Smith <ansuelsmth@gmail.com>
3 Date: Mon, 22 Nov 2021 16:23:46 +0100
4 Subject: net: dsa: qca8k: add support for port fast aging
5
6 The switch supports fast aging by flushing any rule in the ARL
7 table for a specific port.
8
9 Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
10 Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
11 Signed-off-by: David S. Miller <davem@davemloft.net>
12 ---
13 drivers/net/dsa/qca8k.c | 11 +++++++++++
14 drivers/net/dsa/qca8k.h | 1 +
15 2 files changed, 12 insertions(+)
16
17 --- a/drivers/net/dsa/qca8k.c
18 +++ b/drivers/net/dsa/qca8k.c
19 @@ -1790,6 +1790,16 @@ qca8k_port_bridge_leave(struct dsa_switc
20 QCA8K_PORT_LOOKUP_MEMBER, BIT(cpu_port));
21 }
22
23 +static void
24 +qca8k_port_fast_age(struct dsa_switch *ds, int port)
25 +{
26 + struct qca8k_priv *priv = ds->priv;
27 +
28 + mutex_lock(&priv->reg_mutex);
29 + qca8k_fdb_access(priv, QCA8K_FDB_FLUSH_PORT, port);
30 + mutex_unlock(&priv->reg_mutex);
31 +}
32 +
33 static int
34 qca8k_port_enable(struct dsa_switch *ds, int port,
35 struct phy_device *phy)
36 @@ -2017,6 +2027,7 @@ static const struct dsa_switch_ops qca8k
37 .port_stp_state_set = qca8k_port_stp_state_set,
38 .port_bridge_join = qca8k_port_bridge_join,
39 .port_bridge_leave = qca8k_port_bridge_leave,
40 + .port_fast_age = qca8k_port_fast_age,
41 .port_fdb_add = qca8k_port_fdb_add,
42 .port_fdb_del = qca8k_port_fdb_del,
43 .port_fdb_dump = qca8k_port_fdb_dump,
44 --- a/drivers/net/dsa/qca8k.h
45 +++ b/drivers/net/dsa/qca8k.h
46 @@ -262,6 +262,7 @@ enum qca8k_fdb_cmd {
47 QCA8K_FDB_FLUSH = 1,
48 QCA8K_FDB_LOAD = 2,
49 QCA8K_FDB_PURGE = 3,
50 + QCA8K_FDB_FLUSH_PORT = 5,
51 QCA8K_FDB_NEXT = 6,
52 QCA8K_FDB_SEARCH = 7,
53 };