mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
net: dsa: microchip: bypass dev_ops for FDB ageing operations
dsa_switch_ops :: set_ageing_time() goes through ksz_set_ageing_time(), further dispatched through ksz_dev_ops :: set_ageing_time(). Only ksz9477 and lan937x provide an implementation for this, so remove the (optional) method from ksz8463_switch_ops, ksz87xx_switch_ops, ksz88xx_switch_ops. Also, hook up ksz9477 and lan937x dsa_switch_ops directly to their respective implementations. Every switch family provides a dsa_switch_ops :: port_fast_age() implementation, which is dispatched through ksz_dev_ops :: flush_dyn_mac_table(). Remove the dev_ops indirection and connect the flush_dyn_mac_table() methods directly to their respective dsa_switch_ops. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: Bastien Curutchet (Schneider Electric) <bastien.curutchet@bootlin.com> Link: https://patch.msgid.link/20260512-clean-ksz-2nd-series-v1-2-c00f6ce037fa@bootlin.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
83ea7fd73b
commit
f27ae140c8
|
|
@ -1278,8 +1278,9 @@ static void ksz8_cfg_port_member(struct ksz_device *dev, int port, u8 member)
|
|||
ksz_pwrite8(dev, port, offset, data);
|
||||
}
|
||||
|
||||
static void ksz8_flush_dyn_mac_table(struct ksz_device *dev, int port)
|
||||
static void ksz8_flush_dyn_mac_table(struct dsa_switch *ds, int port)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
u8 learn[DSA_MAX_PORTS];
|
||||
int first, index, cnt;
|
||||
const u16 *regs;
|
||||
|
|
@ -2201,7 +2202,6 @@ const struct ksz_dev_ops ksz8463_dev_ops = {
|
|||
.setup = ksz8_setup,
|
||||
.get_port_addr = ksz8463_get_port_addr,
|
||||
.cfg_port_member = ksz8_cfg_port_member,
|
||||
.flush_dyn_mac_table = ksz8_flush_dyn_mac_table,
|
||||
.port_setup = ksz8_port_setup,
|
||||
.r_phy = ksz8463_r_phy,
|
||||
.w_phy = ksz8463_w_phy,
|
||||
|
|
@ -2233,7 +2233,6 @@ const struct ksz_dev_ops ksz87xx_dev_ops = {
|
|||
.setup = ksz8_setup,
|
||||
.get_port_addr = ksz8_get_port_addr,
|
||||
.cfg_port_member = ksz8_cfg_port_member,
|
||||
.flush_dyn_mac_table = ksz8_flush_dyn_mac_table,
|
||||
.port_setup = ksz8_port_setup,
|
||||
.r_phy = ksz8_r_phy,
|
||||
.w_phy = ksz8_w_phy,
|
||||
|
|
@ -2268,7 +2267,6 @@ const struct ksz_dev_ops ksz88xx_dev_ops = {
|
|||
.setup = ksz8_setup,
|
||||
.get_port_addr = ksz8_get_port_addr,
|
||||
.cfg_port_member = ksz8_cfg_port_member,
|
||||
.flush_dyn_mac_table = ksz8_flush_dyn_mac_table,
|
||||
.port_setup = ksz8_port_setup,
|
||||
.r_phy = ksz8_r_phy,
|
||||
.w_phy = ksz8_w_phy,
|
||||
|
|
@ -2309,7 +2307,6 @@ const struct dsa_switch_ops ksz8463_switch_ops = {
|
|||
.phy_write = ksz_phy_write16,
|
||||
.phylink_get_caps = ksz_phylink_get_caps,
|
||||
.port_setup = ksz_port_setup,
|
||||
.set_ageing_time = ksz_set_ageing_time,
|
||||
.get_strings = ksz_get_strings,
|
||||
.get_ethtool_stats = ksz_get_ethtool_stats,
|
||||
.get_sset_count = ksz_sset_count,
|
||||
|
|
@ -2322,7 +2319,7 @@ const struct dsa_switch_ops ksz8463_switch_ops = {
|
|||
.port_teardown = ksz_port_teardown,
|
||||
.port_pre_bridge_flags = ksz_port_pre_bridge_flags,
|
||||
.port_bridge_flags = ksz_port_bridge_flags,
|
||||
.port_fast_age = ksz_port_fast_age,
|
||||
.port_fast_age = ksz8_flush_dyn_mac_table,
|
||||
.port_vlan_filtering = ksz_port_vlan_filtering,
|
||||
.port_vlan_add = ksz_port_vlan_add,
|
||||
.port_vlan_del = ksz_port_vlan_del,
|
||||
|
|
@ -2370,7 +2367,6 @@ const struct dsa_switch_ops ksz87xx_switch_ops = {
|
|||
.phy_write = ksz_phy_write16,
|
||||
.phylink_get_caps = ksz_phylink_get_caps,
|
||||
.port_setup = ksz_port_setup,
|
||||
.set_ageing_time = ksz_set_ageing_time,
|
||||
.get_strings = ksz_get_strings,
|
||||
.get_ethtool_stats = ksz_get_ethtool_stats,
|
||||
.get_sset_count = ksz_sset_count,
|
||||
|
|
@ -2383,7 +2379,7 @@ const struct dsa_switch_ops ksz87xx_switch_ops = {
|
|||
.port_teardown = ksz_port_teardown,
|
||||
.port_pre_bridge_flags = ksz_port_pre_bridge_flags,
|
||||
.port_bridge_flags = ksz_port_bridge_flags,
|
||||
.port_fast_age = ksz_port_fast_age,
|
||||
.port_fast_age = ksz8_flush_dyn_mac_table,
|
||||
.port_vlan_filtering = ksz_port_vlan_filtering,
|
||||
.port_vlan_add = ksz_port_vlan_add,
|
||||
.port_vlan_del = ksz_port_vlan_del,
|
||||
|
|
@ -2431,7 +2427,6 @@ const struct dsa_switch_ops ksz88xx_switch_ops = {
|
|||
.phy_write = ksz_phy_write16,
|
||||
.phylink_get_caps = ksz_phylink_get_caps,
|
||||
.port_setup = ksz_port_setup,
|
||||
.set_ageing_time = ksz_set_ageing_time,
|
||||
.get_strings = ksz_get_strings,
|
||||
.get_ethtool_stats = ksz_get_ethtool_stats,
|
||||
.get_sset_count = ksz_sset_count,
|
||||
|
|
@ -2444,7 +2439,7 @@ const struct dsa_switch_ops ksz88xx_switch_ops = {
|
|||
.port_teardown = ksz_port_teardown,
|
||||
.port_pre_bridge_flags = ksz_port_pre_bridge_flags,
|
||||
.port_bridge_flags = ksz_port_bridge_flags,
|
||||
.port_fast_age = ksz_port_fast_age,
|
||||
.port_fast_age = ksz8_flush_dyn_mac_table,
|
||||
.port_vlan_filtering = ksz_port_vlan_filtering,
|
||||
.port_vlan_add = ksz_port_vlan_add,
|
||||
.port_vlan_del = ksz_port_vlan_del,
|
||||
|
|
|
|||
|
|
@ -604,8 +604,9 @@ void ksz9477_cfg_port_member(struct ksz_device *dev, int port, u8 member)
|
|||
ksz_pwrite32(dev, port, REG_PORT_VLAN_MEMBERSHIP__4, member);
|
||||
}
|
||||
|
||||
void ksz9477_flush_dyn_mac_table(struct ksz_device *dev, int port)
|
||||
void ksz9477_flush_dyn_mac_table(struct dsa_switch *ds, int port)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
const u16 *regs = dev->info->regs;
|
||||
u8 data;
|
||||
|
||||
|
|
@ -1170,8 +1171,9 @@ static void ksz9477_get_caps(struct ksz_device *dev, int port,
|
|||
}
|
||||
}
|
||||
|
||||
static int ksz9477_set_ageing_time(struct ksz_device *dev, unsigned int msecs)
|
||||
static int ksz9477_set_ageing_time(struct dsa_switch *ds, unsigned int msecs)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
u32 secs = msecs / 1000;
|
||||
u8 data, mult, value;
|
||||
u32 max_val;
|
||||
|
|
@ -1769,9 +1771,7 @@ const struct ksz_dev_ops ksz9477_dev_ops = {
|
|||
.setup = ksz9477_setup,
|
||||
.get_port_addr = ksz9477_get_port_addr,
|
||||
.cfg_port_member = ksz9477_cfg_port_member,
|
||||
.flush_dyn_mac_table = ksz9477_flush_dyn_mac_table,
|
||||
.port_setup = ksz9477_port_setup,
|
||||
.set_ageing_time = ksz9477_set_ageing_time,
|
||||
.r_phy = ksz9477_r_phy,
|
||||
.w_phy = ksz9477_w_phy,
|
||||
.r_mib_cnt = ksz9477_r_mib_cnt,
|
||||
|
|
@ -1813,7 +1813,7 @@ const struct dsa_switch_ops ksz9477_switch_ops = {
|
|||
.phy_write = ksz_phy_write16,
|
||||
.phylink_get_caps = ksz_phylink_get_caps,
|
||||
.port_setup = ksz_port_setup,
|
||||
.set_ageing_time = ksz_set_ageing_time,
|
||||
.set_ageing_time = ksz9477_set_ageing_time,
|
||||
.get_strings = ksz_get_strings,
|
||||
.get_ethtool_stats = ksz_get_ethtool_stats,
|
||||
.get_sset_count = ksz_sset_count,
|
||||
|
|
@ -1826,7 +1826,7 @@ const struct dsa_switch_ops ksz9477_switch_ops = {
|
|||
.port_teardown = ksz_port_teardown,
|
||||
.port_pre_bridge_flags = ksz_port_pre_bridge_flags,
|
||||
.port_bridge_flags = ksz_port_bridge_flags,
|
||||
.port_fast_age = ksz_port_fast_age,
|
||||
.port_fast_age = ksz9477_flush_dyn_mac_table,
|
||||
.port_vlan_filtering = ksz_port_vlan_filtering,
|
||||
.port_vlan_add = ksz_port_vlan_add,
|
||||
.port_vlan_del = ksz_port_vlan_del,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
u32 ksz9477_get_port_addr(int port, int offset);
|
||||
void ksz9477_cfg_port_member(struct ksz_device *dev, int port, u8 member);
|
||||
void ksz9477_flush_dyn_mac_table(struct ksz_device *dev, int port);
|
||||
void ksz9477_flush_dyn_mac_table(struct dsa_switch *ds, int port);
|
||||
void ksz9477_r_mib_cnt(struct ksz_device *dev, int port, u16 addr, u64 *cnt);
|
||||
void ksz9477_r_mib_pkt(struct ksz_device *dev, int port, u16 addr,
|
||||
u64 *dropped, u64 *cnt);
|
||||
|
|
|
|||
|
|
@ -3085,23 +3085,6 @@ void ksz_port_bridge_leave(struct dsa_switch *ds, int port,
|
|||
*/
|
||||
}
|
||||
|
||||
void ksz_port_fast_age(struct dsa_switch *ds, int port)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
|
||||
dev->dev_ops->flush_dyn_mac_table(dev, port);
|
||||
}
|
||||
|
||||
int ksz_set_ageing_time(struct dsa_switch *ds, unsigned int msecs)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
|
||||
if (!dev->dev_ops->set_ageing_time)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return dev->dev_ops->set_ageing_time(dev, msecs);
|
||||
}
|
||||
|
||||
int ksz_port_fdb_add(struct dsa_switch *ds, int port,
|
||||
const unsigned char *addr, u16 vid,
|
||||
struct dsa_db db)
|
||||
|
|
|
|||
|
|
@ -363,9 +363,7 @@ struct ksz_dev_ops {
|
|||
void (*teardown)(struct dsa_switch *ds);
|
||||
u32 (*get_port_addr)(int port, int offset);
|
||||
void (*cfg_port_member)(struct ksz_device *dev, int port, u8 member);
|
||||
void (*flush_dyn_mac_table)(struct ksz_device *dev, int port);
|
||||
void (*port_setup)(struct ksz_device *dev, int port, bool cpu_port);
|
||||
int (*set_ageing_time)(struct ksz_device *dev, unsigned int msecs);
|
||||
|
||||
/**
|
||||
* @mdio_bus_preinit: Function pointer to pre-initialize the MDIO bus
|
||||
|
|
@ -515,8 +513,6 @@ int ksz_port_vlan_add(struct dsa_switch *ds, int port,
|
|||
struct netlink_ext_ack *extack);
|
||||
int ksz_port_vlan_del(struct dsa_switch *ds, int port,
|
||||
const struct switchdev_obj_port_vlan *vlan);
|
||||
void ksz_port_fast_age(struct dsa_switch *ds, int port);
|
||||
int ksz_set_ageing_time(struct dsa_switch *ds, unsigned int msecs);
|
||||
int ksz_port_fdb_add(struct dsa_switch *ds, int port,
|
||||
const unsigned char *addr, u16 vid,
|
||||
struct dsa_db db);
|
||||
|
|
|
|||
|
|
@ -461,8 +461,9 @@ static int lan937x_change_mtu(struct ksz_device *dev, int port, int new_mtu)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lan937x_set_ageing_time(struct ksz_device *dev, unsigned int msecs)
|
||||
static int lan937x_set_ageing_time(struct dsa_switch *ds, unsigned int msecs)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
u8 data, mult, value8;
|
||||
bool in_msec = false;
|
||||
u32 max_val, value;
|
||||
|
|
@ -702,9 +703,7 @@ const struct ksz_dev_ops lan937x_dev_ops = {
|
|||
.teardown = lan937x_teardown,
|
||||
.get_port_addr = ksz9477_get_port_addr,
|
||||
.cfg_port_member = ksz9477_cfg_port_member,
|
||||
.flush_dyn_mac_table = ksz9477_flush_dyn_mac_table,
|
||||
.port_setup = lan937x_port_setup,
|
||||
.set_ageing_time = lan937x_set_ageing_time,
|
||||
.mdio_bus_preinit = lan937x_mdio_bus_preinit,
|
||||
.create_phy_addr_map = lan937x_create_phy_addr_map,
|
||||
.r_phy = lan937x_r_phy,
|
||||
|
|
@ -745,7 +744,7 @@ const struct dsa_switch_ops lan937x_switch_ops = {
|
|||
.phy_write = ksz_phy_write16,
|
||||
.phylink_get_caps = ksz_phylink_get_caps,
|
||||
.port_setup = ksz_port_setup,
|
||||
.set_ageing_time = ksz_set_ageing_time,
|
||||
.set_ageing_time = lan937x_set_ageing_time,
|
||||
.get_strings = ksz_get_strings,
|
||||
.get_ethtool_stats = ksz_get_ethtool_stats,
|
||||
.get_sset_count = ksz_sset_count,
|
||||
|
|
@ -758,7 +757,7 @@ const struct dsa_switch_ops lan937x_switch_ops = {
|
|||
.port_teardown = ksz_port_teardown,
|
||||
.port_pre_bridge_flags = ksz_port_pre_bridge_flags,
|
||||
.port_bridge_flags = ksz_port_bridge_flags,
|
||||
.port_fast_age = ksz_port_fast_age,
|
||||
.port_fast_age = ksz9477_flush_dyn_mac_table,
|
||||
.port_vlan_filtering = ksz_port_vlan_filtering,
|
||||
.port_vlan_add = ksz_port_vlan_add,
|
||||
.port_vlan_del = ksz_port_vlan_del,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user