|
|
@@ -7,6 +7,7 @@
|
|
|
* Copyright (c) 2021 Robert Marko <[email protected]>
|
|
|
*/
|
|
|
|
|
|
+#include <linux/bitfield.h>
|
|
|
#include <linux/version.h>
|
|
|
#include <linux/etherdevice.h>
|
|
|
#include <linux/if_bridge.h>
|
|
|
@@ -1330,6 +1331,35 @@ qca8k_port_bridge_leave(struct dsa_switch *ds, int port, struct net_device *br)
|
|
|
QCA8K_PORT_LOOKUP_MEMBER, BIT(cpu_port));
|
|
|
}
|
|
|
|
|
|
+void qca8k_port_fast_age(struct dsa_switch *ds, int port)
|
|
|
+{
|
|
|
+ struct qca8k_priv *priv = ds->priv;
|
|
|
+
|
|
|
+ mutex_lock(&priv->reg_mutex);
|
|
|
+ qca8k_fdb_access(priv, QCA8K_FDB_FLUSH_PORT, port);
|
|
|
+ mutex_unlock(&priv->reg_mutex);
|
|
|
+}
|
|
|
+
|
|
|
+int qca8k_set_ageing_time(struct dsa_switch *ds, unsigned int msecs)
|
|
|
+{
|
|
|
+ struct qca8k_priv *priv = ds->priv;
|
|
|
+ unsigned int secs = msecs / 1000;
|
|
|
+ u32 val;
|
|
|
+
|
|
|
+ /* AGE_TIME reg is set in 7s step */
|
|
|
+ val = secs / 7;
|
|
|
+
|
|
|
+ /* Handle case with 0 as val to NOT disable
|
|
|
+ * learning
|
|
|
+ */
|
|
|
+ if (!val)
|
|
|
+ val = 1;
|
|
|
+
|
|
|
+ return qca8k_rmw(priv, QCA8K_REG_ATU_CTRL,
|
|
|
+ QCA8K_ATU_AGE_TIME_MASK,
|
|
|
+ QCA8K_ATU_AGE_TIME(val));
|
|
|
+}
|
|
|
+
|
|
|
static int
|
|
|
qca8k_port_enable(struct dsa_switch *ds, int port,
|
|
|
struct phy_device *phy)
|
|
|
@@ -1509,6 +1539,7 @@ static const struct dsa_switch_ops qca8k_switch_ops = {
|
|
|
.get_strings = qca8k_get_strings,
|
|
|
.get_ethtool_stats = qca8k_get_ethtool_stats,
|
|
|
.get_sset_count = qca8k_get_sset_count,
|
|
|
+ .set_ageing_time = qca8k_set_ageing_time,
|
|
|
.get_mac_eee = qca8k_get_mac_eee,
|
|
|
.set_mac_eee = qca8k_set_mac_eee,
|
|
|
.port_enable = qca8k_port_enable,
|
|
|
@@ -1518,6 +1549,7 @@ static const struct dsa_switch_ops qca8k_switch_ops = {
|
|
|
.port_stp_state_set = qca8k_port_stp_state_set,
|
|
|
.port_bridge_join = qca8k_port_bridge_join,
|
|
|
.port_bridge_leave = qca8k_port_bridge_leave,
|
|
|
+ .port_fast_age = qca8k_port_fast_age,
|
|
|
.port_fdb_add = qca8k_port_fdb_add,
|
|
|
.port_fdb_del = qca8k_port_fdb_del,
|
|
|
.port_fdb_dump = qca8k_port_fdb_dump,
|