mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
Merge branch 'net-dsa-microchip-remove-unnecessary-ksz_dev_ops-callbacks'
Bastien Curutchet says: ==================== net: dsa: microchip: Remove unnecessary ksz_dev_ops callbacks [part] This series continues the rework of the KSZ driver initiated by a previous series (see [1]), following the discussion we had here [2]. The KSZ driver got way too convoluted over time because it uses a common framework to handle more than 20 switches split in 5 families (see below table) +----------+---------+---------+---------+---------+---------+ | Family | KSZ8463 | KSZ87xx | KSZ88xx | KSZ9477 | LAN937X | +----------+---------+---------+---------+---------+---------+ | Switches | KSZ8463 | KSZ8795 | KSZ88X3 | KSZ8563 | LAN9370 | | | | KSZ8794 | KSZ8864 | KSZ9477 | LAN9371 | | | | KSZ8765 | KSZ8895 | KSZ9896 | LAN9372 | | | | | | KSZ9897 | LAN9373 | | | | | | KSZ9893 | LAN9374 | | | | | | KSZ9563 | | | | | | | KSZ8567 | | | | | | | KSZ9567 | | | | | | | LAN9646 | | +----------+---------+---------+---------+---------+---------+ The previous series ([1]) replaced the unique dsa_swicth_ops struct used by all the KSZ families with one dsa_switch_ops struct for each family. These dsa_switch_ops structs still rely on common functions that redirect the calls to ksz_dev_ops operations which are custom to each switch family. Many of hese ksz_dev_ops callbacks have a direct equivalent in the struct dsa_switch_ops. This series directly connects the implementations of these ksz_dev_ops operations to the relevant dsa_switch_ops attribute to get rid of one unnecessary level of indirection. ==================== Link: https://patch.msgid.link/20260512-clean-ksz-2nd-series-v1-0-c00f6ce037fa@bootlin.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
674822432a
|
|
@ -188,8 +188,9 @@ static int ksz8795_change_mtu(struct ksz_device *dev, int frame_size)
|
|||
return ksz_rmw8(dev, REG_SW_CTRL_2, SW_LEGAL_PACKET_DISABLE, ctrl2);
|
||||
}
|
||||
|
||||
static int ksz8_change_mtu(struct ksz_device *dev, int port, int mtu)
|
||||
static int ksz8_change_mtu(struct dsa_switch *ds, int port, int mtu)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
u16 frame_size;
|
||||
|
||||
if (!dsa_is_cpu_port(dev->ds, port))
|
||||
|
|
@ -1278,8 +1279,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;
|
||||
|
|
@ -1313,9 +1315,10 @@ static void ksz8_flush_dyn_mac_table(struct ksz_device *dev, int port)
|
|||
}
|
||||
}
|
||||
|
||||
static int ksz8_fdb_dump(struct ksz_device *dev, int port,
|
||||
static int ksz8_fdb_dump(struct dsa_switch *ds, int port,
|
||||
dsa_fdb_dump_cb_t *cb, void *data)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
u8 mac[ETH_ALEN];
|
||||
u8 src_port, fid;
|
||||
u16 entries = 0;
|
||||
|
|
@ -1418,35 +1421,37 @@ static int ksz8_del_sta_mac(struct ksz_device *dev, int port,
|
|||
return ksz8_w_sta_mac_table(dev, index, &alu);
|
||||
}
|
||||
|
||||
static int ksz8_mdb_add(struct ksz_device *dev, int port,
|
||||
static int ksz8_mdb_add(struct dsa_switch *ds, int port,
|
||||
const struct switchdev_obj_port_mdb *mdb,
|
||||
struct dsa_db db)
|
||||
{
|
||||
return ksz8_add_sta_mac(dev, port, mdb->addr, mdb->vid);
|
||||
return ksz8_add_sta_mac(ds->priv, port, mdb->addr, mdb->vid);
|
||||
}
|
||||
|
||||
static int ksz8_mdb_del(struct ksz_device *dev, int port,
|
||||
static int ksz8_mdb_del(struct dsa_switch *ds, int port,
|
||||
const struct switchdev_obj_port_mdb *mdb,
|
||||
struct dsa_db db)
|
||||
{
|
||||
return ksz8_del_sta_mac(dev, port, mdb->addr, mdb->vid);
|
||||
return ksz8_del_sta_mac(ds->priv, port, mdb->addr, mdb->vid);
|
||||
}
|
||||
|
||||
static int ksz8_fdb_add(struct ksz_device *dev, int port,
|
||||
static int ksz8_fdb_add(struct dsa_switch *ds, int port,
|
||||
const unsigned char *addr, u16 vid, struct dsa_db db)
|
||||
{
|
||||
return ksz8_add_sta_mac(dev, port, addr, vid);
|
||||
return ksz8_add_sta_mac(ds->priv, port, addr, vid);
|
||||
}
|
||||
|
||||
static int ksz8_fdb_del(struct ksz_device *dev, int port,
|
||||
static int ksz8_fdb_del(struct dsa_switch *ds, int port,
|
||||
const unsigned char *addr, u16 vid, struct dsa_db db)
|
||||
{
|
||||
return ksz8_del_sta_mac(dev, port, addr, vid);
|
||||
return ksz8_del_sta_mac(ds->priv, port, addr, vid);
|
||||
}
|
||||
|
||||
static int ksz8_port_vlan_filtering(struct ksz_device *dev, int port, bool flag,
|
||||
static int ksz8_port_vlan_filtering(struct dsa_switch *ds, int port, bool flag,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
|
||||
if (ksz_is_ksz88x3(dev) || ksz_is_ksz8463(dev))
|
||||
return -ENOTSUPP;
|
||||
|
||||
|
|
@ -1474,11 +1479,12 @@ static void ksz8_port_enable_pvid(struct ksz_device *dev, int port, bool state)
|
|||
}
|
||||
}
|
||||
|
||||
static int ksz8_port_vlan_add(struct ksz_device *dev, int port,
|
||||
static int ksz8_port_vlan_add(struct dsa_switch *ds, int port,
|
||||
const struct switchdev_obj_port_vlan *vlan,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED;
|
||||
struct ksz_device *dev = ds->priv;
|
||||
struct ksz_port *p = &dev->ports[port];
|
||||
u16 data, new_pvid = 0;
|
||||
u8 fid, member, valid;
|
||||
|
|
@ -1546,11 +1552,12 @@ static int ksz8_port_vlan_add(struct ksz_device *dev, int port,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ksz8_port_vlan_del(struct ksz_device *dev, int port,
|
||||
static int ksz8_port_vlan_del(struct dsa_switch *ds, int port,
|
||||
const struct switchdev_obj_port_vlan *vlan)
|
||||
{
|
||||
u16 data, pvid;
|
||||
struct ksz_device *dev = ds->priv;
|
||||
u8 fid, member, valid;
|
||||
u16 data, pvid;
|
||||
|
||||
if (ksz_is_ksz88x3(dev) || ksz_is_ksz8463(dev))
|
||||
return -ENOTSUPP;
|
||||
|
|
@ -1578,10 +1585,11 @@ static int ksz8_port_vlan_del(struct ksz_device *dev, int port,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ksz8_port_mirror_add(struct ksz_device *dev, int port,
|
||||
static int ksz8_port_mirror_add(struct dsa_switch *ds, int port,
|
||||
struct dsa_mall_mirror_tc_entry *mirror,
|
||||
bool ingress, struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
int offset = P_MIRROR_CTRL;
|
||||
|
||||
if (ksz_is_ksz8463(dev))
|
||||
|
|
@ -1604,9 +1612,10 @@ static int ksz8_port_mirror_add(struct ksz_device *dev, int port,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void ksz8_port_mirror_del(struct ksz_device *dev, int port,
|
||||
static void ksz8_port_mirror_del(struct dsa_switch *ds, int port,
|
||||
struct dsa_mall_mirror_tc_entry *mirror)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
int offset = P_MIRROR_CTRL;
|
||||
u8 data;
|
||||
|
||||
|
|
@ -1986,9 +1995,11 @@ static int ksz8_setup(struct dsa_switch *ds)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void ksz8_get_caps(struct ksz_device *dev, int port,
|
||||
struct phylink_config *config)
|
||||
static void ksz8_phylink_get_caps(struct dsa_switch *ds, int port,
|
||||
struct phylink_config *config)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
|
||||
config->mac_capabilities = MAC_10 | MAC_100;
|
||||
|
||||
/* Silicon Errata Sheet (DS80000830A):
|
||||
|
|
@ -2002,6 +2013,8 @@ static void ksz8_get_caps(struct ksz_device *dev, int port,
|
|||
/* Asym pause is not supported on KSZ8863 and KSZ8873 */
|
||||
if (!ksz_is_ksz88x3(dev))
|
||||
config->mac_capabilities |= MAC_ASYM_PAUSE;
|
||||
|
||||
ksz_phylink_get_caps(ds, port, config);
|
||||
}
|
||||
|
||||
static u32 ksz8_get_port_addr(int port, int offset)
|
||||
|
|
@ -2201,7 +2214,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,
|
||||
|
|
@ -2210,30 +2222,17 @@ const struct ksz_dev_ops ksz8463_dev_ops = {
|
|||
.r_mib_stat64 = ksz88xx_r_mib_stats64,
|
||||
.freeze_mib = ksz8_freeze_mib,
|
||||
.port_init_cnt = ksz8_port_init_cnt,
|
||||
.fdb_dump = ksz8_fdb_dump,
|
||||
.fdb_add = ksz8_fdb_add,
|
||||
.fdb_del = ksz8_fdb_del,
|
||||
.mdb_add = ksz8_mdb_add,
|
||||
.mdb_del = ksz8_mdb_del,
|
||||
.vlan_filtering = ksz8_port_vlan_filtering,
|
||||
.vlan_add = ksz8_port_vlan_add,
|
||||
.vlan_del = ksz8_port_vlan_del,
|
||||
.mirror_add = ksz8_port_mirror_add,
|
||||
.mirror_del = ksz8_port_mirror_del,
|
||||
.get_caps = ksz8_get_caps,
|
||||
.config_cpu_port = ksz8_config_cpu_port,
|
||||
.enable_stp_addr = ksz8_enable_stp_addr,
|
||||
.reset = ksz8_reset_switch,
|
||||
.init = ksz8_switch_init,
|
||||
.exit = ksz8_switch_exit,
|
||||
.change_mtu = ksz8_change_mtu,
|
||||
};
|
||||
|
||||
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,
|
||||
|
|
@ -2242,23 +2241,11 @@ const struct ksz_dev_ops ksz87xx_dev_ops = {
|
|||
.r_mib_stat64 = ksz_r_mib_stats64,
|
||||
.freeze_mib = ksz8_freeze_mib,
|
||||
.port_init_cnt = ksz8_port_init_cnt,
|
||||
.fdb_dump = ksz8_fdb_dump,
|
||||
.fdb_add = ksz8_fdb_add,
|
||||
.fdb_del = ksz8_fdb_del,
|
||||
.mdb_add = ksz8_mdb_add,
|
||||
.mdb_del = ksz8_mdb_del,
|
||||
.vlan_filtering = ksz8_port_vlan_filtering,
|
||||
.vlan_add = ksz8_port_vlan_add,
|
||||
.vlan_del = ksz8_port_vlan_del,
|
||||
.mirror_add = ksz8_port_mirror_add,
|
||||
.mirror_del = ksz8_port_mirror_del,
|
||||
.get_caps = ksz8_get_caps,
|
||||
.config_cpu_port = ksz8_config_cpu_port,
|
||||
.enable_stp_addr = ksz8_enable_stp_addr,
|
||||
.reset = ksz8_reset_switch,
|
||||
.init = ksz8_switch_init,
|
||||
.exit = ksz8_switch_exit,
|
||||
.change_mtu = ksz8_change_mtu,
|
||||
.pme_write8 = ksz8_pme_write8,
|
||||
.pme_pread8 = ksz8_pme_pread8,
|
||||
.pme_pwrite8 = ksz8_pme_pwrite8,
|
||||
|
|
@ -2268,7 +2255,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,
|
||||
|
|
@ -2277,23 +2263,11 @@ const struct ksz_dev_ops ksz88xx_dev_ops = {
|
|||
.r_mib_stat64 = ksz88xx_r_mib_stats64,
|
||||
.freeze_mib = ksz8_freeze_mib,
|
||||
.port_init_cnt = ksz8_port_init_cnt,
|
||||
.fdb_dump = ksz8_fdb_dump,
|
||||
.fdb_add = ksz8_fdb_add,
|
||||
.fdb_del = ksz8_fdb_del,
|
||||
.mdb_add = ksz8_mdb_add,
|
||||
.mdb_del = ksz8_mdb_del,
|
||||
.vlan_filtering = ksz8_port_vlan_filtering,
|
||||
.vlan_add = ksz8_port_vlan_add,
|
||||
.vlan_del = ksz8_port_vlan_del,
|
||||
.mirror_add = ksz8_port_mirror_add,
|
||||
.mirror_del = ksz8_port_mirror_del,
|
||||
.get_caps = ksz8_get_caps,
|
||||
.config_cpu_port = ksz8_config_cpu_port,
|
||||
.enable_stp_addr = ksz8_enable_stp_addr,
|
||||
.reset = ksz8_reset_switch,
|
||||
.init = ksz8_switch_init,
|
||||
.exit = ksz8_switch_exit,
|
||||
.change_mtu = ksz8_change_mtu,
|
||||
.pme_write8 = ksz8_pme_write8,
|
||||
.pme_pread8 = ksz8_pme_pread8,
|
||||
.pme_pwrite8 = ksz8_pme_pwrite8,
|
||||
|
|
@ -2307,9 +2281,8 @@ const struct dsa_switch_ops ksz8463_switch_ops = {
|
|||
.teardown = ksz_teardown,
|
||||
.phy_read = ksz_phy_read16,
|
||||
.phy_write = ksz_phy_write16,
|
||||
.phylink_get_caps = ksz_phylink_get_caps,
|
||||
.phylink_get_caps = ksz8_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,20 +2295,20 @@ 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_vlan_filtering = ksz_port_vlan_filtering,
|
||||
.port_vlan_add = ksz_port_vlan_add,
|
||||
.port_vlan_del = ksz_port_vlan_del,
|
||||
.port_fdb_dump = ksz_port_fdb_dump,
|
||||
.port_fdb_add = ksz_port_fdb_add,
|
||||
.port_fdb_del = ksz_port_fdb_del,
|
||||
.port_mdb_add = ksz_port_mdb_add,
|
||||
.port_mdb_del = ksz_port_mdb_del,
|
||||
.port_mirror_add = ksz_port_mirror_add,
|
||||
.port_mirror_del = ksz_port_mirror_del,
|
||||
.port_fast_age = ksz8_flush_dyn_mac_table,
|
||||
.port_vlan_filtering = ksz8_port_vlan_filtering,
|
||||
.port_vlan_add = ksz8_port_vlan_add,
|
||||
.port_vlan_del = ksz8_port_vlan_del,
|
||||
.port_fdb_dump = ksz8_fdb_dump,
|
||||
.port_fdb_add = ksz8_fdb_add,
|
||||
.port_fdb_del = ksz8_fdb_del,
|
||||
.port_mdb_add = ksz8_mdb_add,
|
||||
.port_mdb_del = ksz8_mdb_del,
|
||||
.port_mirror_add = ksz8_port_mirror_add,
|
||||
.port_mirror_del = ksz8_port_mirror_del,
|
||||
.get_stats64 = ksz_get_stats64,
|
||||
.get_pause_stats = ksz_get_pause_stats,
|
||||
.port_change_mtu = ksz_change_mtu,
|
||||
.port_change_mtu = ksz8_change_mtu,
|
||||
.port_max_mtu = ksz_max_mtu,
|
||||
.get_wol = ksz_get_wol,
|
||||
.set_wol = ksz_set_wol,
|
||||
|
|
@ -2368,9 +2341,8 @@ const struct dsa_switch_ops ksz87xx_switch_ops = {
|
|||
.teardown = ksz_teardown,
|
||||
.phy_read = ksz_phy_read16,
|
||||
.phy_write = ksz_phy_write16,
|
||||
.phylink_get_caps = ksz_phylink_get_caps,
|
||||
.phylink_get_caps = ksz8_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,20 +2355,20 @@ 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_vlan_filtering = ksz_port_vlan_filtering,
|
||||
.port_vlan_add = ksz_port_vlan_add,
|
||||
.port_vlan_del = ksz_port_vlan_del,
|
||||
.port_fdb_dump = ksz_port_fdb_dump,
|
||||
.port_fdb_add = ksz_port_fdb_add,
|
||||
.port_fdb_del = ksz_port_fdb_del,
|
||||
.port_mdb_add = ksz_port_mdb_add,
|
||||
.port_mdb_del = ksz_port_mdb_del,
|
||||
.port_mirror_add = ksz_port_mirror_add,
|
||||
.port_mirror_del = ksz_port_mirror_del,
|
||||
.port_fast_age = ksz8_flush_dyn_mac_table,
|
||||
.port_vlan_filtering = ksz8_port_vlan_filtering,
|
||||
.port_vlan_add = ksz8_port_vlan_add,
|
||||
.port_vlan_del = ksz8_port_vlan_del,
|
||||
.port_fdb_dump = ksz8_fdb_dump,
|
||||
.port_fdb_add = ksz8_fdb_add,
|
||||
.port_fdb_del = ksz8_fdb_del,
|
||||
.port_mdb_add = ksz8_mdb_add,
|
||||
.port_mdb_del = ksz8_mdb_del,
|
||||
.port_mirror_add = ksz8_port_mirror_add,
|
||||
.port_mirror_del = ksz8_port_mirror_del,
|
||||
.get_stats64 = ksz_get_stats64,
|
||||
.get_pause_stats = ksz_get_pause_stats,
|
||||
.port_change_mtu = ksz_change_mtu,
|
||||
.port_change_mtu = ksz8_change_mtu,
|
||||
.port_max_mtu = ksz_max_mtu,
|
||||
.get_wol = ksz_get_wol,
|
||||
.set_wol = ksz_set_wol,
|
||||
|
|
@ -2429,9 +2401,8 @@ const struct dsa_switch_ops ksz88xx_switch_ops = {
|
|||
.teardown = ksz_teardown,
|
||||
.phy_read = ksz_phy_read16,
|
||||
.phy_write = ksz_phy_write16,
|
||||
.phylink_get_caps = ksz_phylink_get_caps,
|
||||
.phylink_get_caps = ksz8_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,20 +2415,20 @@ 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_vlan_filtering = ksz_port_vlan_filtering,
|
||||
.port_vlan_add = ksz_port_vlan_add,
|
||||
.port_vlan_del = ksz_port_vlan_del,
|
||||
.port_fdb_dump = ksz_port_fdb_dump,
|
||||
.port_fdb_add = ksz_port_fdb_add,
|
||||
.port_fdb_del = ksz_port_fdb_del,
|
||||
.port_mdb_add = ksz_port_mdb_add,
|
||||
.port_mdb_del = ksz_port_mdb_del,
|
||||
.port_mirror_add = ksz_port_mirror_add,
|
||||
.port_mirror_del = ksz_port_mirror_del,
|
||||
.port_fast_age = ksz8_flush_dyn_mac_table,
|
||||
.port_vlan_filtering = ksz8_port_vlan_filtering,
|
||||
.port_vlan_add = ksz8_port_vlan_add,
|
||||
.port_vlan_del = ksz8_port_vlan_del,
|
||||
.port_fdb_dump = ksz8_fdb_dump,
|
||||
.port_fdb_add = ksz8_fdb_add,
|
||||
.port_fdb_del = ksz8_fdb_del,
|
||||
.port_mdb_add = ksz8_mdb_add,
|
||||
.port_mdb_del = ksz8_mdb_del,
|
||||
.port_mirror_add = ksz8_port_mirror_add,
|
||||
.port_mirror_del = ksz8_port_mirror_del,
|
||||
.get_stats64 = ksz_get_stats64,
|
||||
.get_pause_stats = ksz_get_pause_stats,
|
||||
.port_change_mtu = ksz_change_mtu,
|
||||
.port_change_mtu = ksz8_change_mtu,
|
||||
.port_max_mtu = ksz_max_mtu,
|
||||
.get_wol = ksz_get_wol,
|
||||
.set_wol = ksz_set_wol,
|
||||
|
|
|
|||
|
|
@ -45,8 +45,9 @@ static void ksz9477_port_cfg32(struct ksz_device *dev, int port, int offset,
|
|||
bits, set ? bits : 0);
|
||||
}
|
||||
|
||||
static int ksz9477_change_mtu(struct ksz_device *dev, int port, int mtu)
|
||||
static int ksz9477_change_mtu(struct dsa_switch *ds, int port, int mtu)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
u16 frame_size;
|
||||
|
||||
if (!dsa_is_cpu_port(dev->ds, port))
|
||||
|
|
@ -604,8 +605,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;
|
||||
|
||||
|
|
@ -627,9 +629,11 @@ void ksz9477_flush_dyn_mac_table(struct ksz_device *dev, int port)
|
|||
}
|
||||
}
|
||||
|
||||
int ksz9477_port_vlan_filtering(struct ksz_device *dev, int port,
|
||||
int ksz9477_port_vlan_filtering(struct dsa_switch *ds, int port,
|
||||
bool flag, struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
|
||||
if (flag) {
|
||||
ksz_port_cfg(dev, port, REG_PORT_LUE_CTRL,
|
||||
PORT_VLAN_LOOKUP_VID_0, true);
|
||||
|
|
@ -643,12 +647,13 @@ int ksz9477_port_vlan_filtering(struct ksz_device *dev, int port,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int ksz9477_port_vlan_add(struct ksz_device *dev, int port,
|
||||
int ksz9477_port_vlan_add(struct dsa_switch *ds, int port,
|
||||
const struct switchdev_obj_port_vlan *vlan,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
u32 vlan_table[3];
|
||||
bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED;
|
||||
struct ksz_device *dev = ds->priv;
|
||||
u32 vlan_table[3];
|
||||
int err;
|
||||
|
||||
err = ksz9477_get_vlan_table(dev, vlan->vid, vlan_table);
|
||||
|
|
@ -679,10 +684,11 @@ int ksz9477_port_vlan_add(struct ksz_device *dev, int port,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int ksz9477_port_vlan_del(struct ksz_device *dev, int port,
|
||||
int ksz9477_port_vlan_del(struct dsa_switch *ds, int port,
|
||||
const struct switchdev_obj_port_vlan *vlan)
|
||||
{
|
||||
bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED;
|
||||
struct ksz_device *dev = ds->priv;
|
||||
u32 vlan_table[3];
|
||||
u16 pvid;
|
||||
|
||||
|
|
@ -712,9 +718,10 @@ int ksz9477_port_vlan_del(struct ksz_device *dev, int port,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int ksz9477_fdb_add(struct ksz_device *dev, int port,
|
||||
int ksz9477_fdb_add(struct dsa_switch *ds, int port,
|
||||
const unsigned char *addr, u16 vid, struct dsa_db db)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
u32 alu_table[4];
|
||||
u32 data;
|
||||
int ret = 0;
|
||||
|
|
@ -768,9 +775,10 @@ int ksz9477_fdb_add(struct ksz_device *dev, int port,
|
|||
return ret;
|
||||
}
|
||||
|
||||
int ksz9477_fdb_del(struct ksz_device *dev, int port,
|
||||
int ksz9477_fdb_del(struct dsa_switch *ds, int port,
|
||||
const unsigned char *addr, u16 vid, struct dsa_db db)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
u32 alu_table[4];
|
||||
u32 data;
|
||||
int ret = 0;
|
||||
|
|
@ -857,13 +865,14 @@ static void ksz9477_convert_alu(struct alu_struct *alu, u32 *alu_table)
|
|||
alu->mac[5] = alu_table[3] & 0xFF;
|
||||
}
|
||||
|
||||
int ksz9477_fdb_dump(struct ksz_device *dev, int port,
|
||||
int ksz9477_fdb_dump(struct dsa_switch *ds, int port,
|
||||
dsa_fdb_dump_cb_t *cb, void *data)
|
||||
{
|
||||
int ret = 0;
|
||||
u32 ksz_data;
|
||||
u32 alu_table[4];
|
||||
struct ksz_device *dev = ds->priv;
|
||||
struct alu_struct alu;
|
||||
u32 alu_table[4];
|
||||
u32 ksz_data;
|
||||
int ret = 0;
|
||||
int timeout;
|
||||
|
||||
mutex_lock(&dev->alu_mutex);
|
||||
|
|
@ -911,9 +920,10 @@ int ksz9477_fdb_dump(struct ksz_device *dev, int port,
|
|||
return ret;
|
||||
}
|
||||
|
||||
int ksz9477_mdb_add(struct ksz_device *dev, int port,
|
||||
int ksz9477_mdb_add(struct dsa_switch *ds, int port,
|
||||
const struct switchdev_obj_port_mdb *mdb, struct dsa_db db)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
u32 static_table[4];
|
||||
const u8 *shifts;
|
||||
const u32 *masks;
|
||||
|
|
@ -990,16 +1000,17 @@ int ksz9477_mdb_add(struct ksz_device *dev, int port,
|
|||
return err;
|
||||
}
|
||||
|
||||
int ksz9477_mdb_del(struct ksz_device *dev, int port,
|
||||
int ksz9477_mdb_del(struct dsa_switch *ds, int port,
|
||||
const struct switchdev_obj_port_mdb *mdb, struct dsa_db db)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
u32 static_table[4];
|
||||
u32 mac_hi, mac_lo;
|
||||
const u8 *shifts;
|
||||
const u32 *masks;
|
||||
u32 data;
|
||||
int index;
|
||||
int ret = 0;
|
||||
u32 mac_hi, mac_lo;
|
||||
int index;
|
||||
u32 data;
|
||||
|
||||
shifts = dev->info->shifts;
|
||||
masks = dev->info->masks;
|
||||
|
|
@ -1069,10 +1080,11 @@ int ksz9477_mdb_del(struct ksz_device *dev, int port,
|
|||
return ret;
|
||||
}
|
||||
|
||||
int ksz9477_port_mirror_add(struct ksz_device *dev, int port,
|
||||
int ksz9477_port_mirror_add(struct dsa_switch *ds, int port,
|
||||
struct dsa_mall_mirror_tc_entry *mirror,
|
||||
bool ingress, struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
u8 data;
|
||||
int p;
|
||||
|
||||
|
|
@ -1108,9 +1120,10 @@ int ksz9477_port_mirror_add(struct ksz_device *dev, int port,
|
|||
return 0;
|
||||
}
|
||||
|
||||
void ksz9477_port_mirror_del(struct ksz_device *dev, int port,
|
||||
void ksz9477_port_mirror_del(struct dsa_switch *ds, int port,
|
||||
struct dsa_mall_mirror_tc_entry *mirror)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
bool in_use = false;
|
||||
u8 data;
|
||||
int p;
|
||||
|
|
@ -1152,9 +1165,11 @@ static phy_interface_t ksz9477_get_interface(struct ksz_device *dev, int port)
|
|||
return interface;
|
||||
}
|
||||
|
||||
static void ksz9477_get_caps(struct ksz_device *dev, int port,
|
||||
struct phylink_config *config)
|
||||
static void ksz9477_phylink_get_caps(struct dsa_switch *ds, int port,
|
||||
struct phylink_config *config)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
|
||||
config->mac_capabilities = MAC_10 | MAC_100 | MAC_ASYM_PAUSE |
|
||||
MAC_SYM_PAUSE;
|
||||
|
||||
|
|
@ -1168,10 +1183,13 @@ static void ksz9477_get_caps(struct ksz_device *dev, int port,
|
|||
config->supported_interfaces,
|
||||
p->pcs->supported_interfaces);
|
||||
}
|
||||
|
||||
ksz_phylink_get_caps(ds, port, config);
|
||||
}
|
||||
|
||||
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 +1787,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,
|
||||
|
|
@ -1779,18 +1795,6 @@ const struct ksz_dev_ops ksz9477_dev_ops = {
|
|||
.r_mib_stat64 = ksz_r_mib_stats64,
|
||||
.freeze_mib = ksz9477_freeze_mib,
|
||||
.port_init_cnt = ksz9477_port_init_cnt,
|
||||
.vlan_filtering = ksz9477_port_vlan_filtering,
|
||||
.vlan_add = ksz9477_port_vlan_add,
|
||||
.vlan_del = ksz9477_port_vlan_del,
|
||||
.mirror_add = ksz9477_port_mirror_add,
|
||||
.mirror_del = ksz9477_port_mirror_del,
|
||||
.get_caps = ksz9477_get_caps,
|
||||
.fdb_dump = ksz9477_fdb_dump,
|
||||
.fdb_add = ksz9477_fdb_add,
|
||||
.fdb_del = ksz9477_fdb_del,
|
||||
.mdb_add = ksz9477_mdb_add,
|
||||
.mdb_del = ksz9477_mdb_del,
|
||||
.change_mtu = ksz9477_change_mtu,
|
||||
.pme_write8 = ksz_write8,
|
||||
.pme_pread8 = ksz_pread8,
|
||||
.pme_pwrite8 = ksz_pwrite8,
|
||||
|
|
@ -1811,9 +1815,9 @@ const struct dsa_switch_ops ksz9477_switch_ops = {
|
|||
.teardown = ksz_teardown,
|
||||
.phy_read = ksz_phy_read16,
|
||||
.phy_write = ksz_phy_write16,
|
||||
.phylink_get_caps = ksz_phylink_get_caps,
|
||||
.phylink_get_caps = ksz9477_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,20 +1830,20 @@ 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_vlan_filtering = ksz_port_vlan_filtering,
|
||||
.port_vlan_add = ksz_port_vlan_add,
|
||||
.port_vlan_del = ksz_port_vlan_del,
|
||||
.port_fdb_dump = ksz_port_fdb_dump,
|
||||
.port_fdb_add = ksz_port_fdb_add,
|
||||
.port_fdb_del = ksz_port_fdb_del,
|
||||
.port_mdb_add = ksz_port_mdb_add,
|
||||
.port_mdb_del = ksz_port_mdb_del,
|
||||
.port_mirror_add = ksz_port_mirror_add,
|
||||
.port_mirror_del = ksz_port_mirror_del,
|
||||
.port_fast_age = ksz9477_flush_dyn_mac_table,
|
||||
.port_vlan_filtering = ksz9477_port_vlan_filtering,
|
||||
.port_vlan_add = ksz9477_port_vlan_add,
|
||||
.port_vlan_del = ksz9477_port_vlan_del,
|
||||
.port_fdb_dump = ksz9477_fdb_dump,
|
||||
.port_fdb_add = ksz9477_fdb_add,
|
||||
.port_fdb_del = ksz9477_fdb_del,
|
||||
.port_mdb_add = ksz9477_mdb_add,
|
||||
.port_mdb_del = ksz9477_mdb_del,
|
||||
.port_mirror_add = ksz9477_port_mirror_add,
|
||||
.port_mirror_del = ksz9477_port_mirror_del,
|
||||
.get_stats64 = ksz_get_stats64,
|
||||
.get_pause_stats = ksz_get_pause_stats,
|
||||
.port_change_mtu = ksz_change_mtu,
|
||||
.port_change_mtu = ksz9477_change_mtu,
|
||||
.port_max_mtu = ksz_max_mtu,
|
||||
.get_wol = ksz_get_wol,
|
||||
.set_wol = ksz_set_wol,
|
||||
|
|
|
|||
|
|
@ -13,35 +13,35 @@
|
|||
|
||||
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);
|
||||
void ksz9477_freeze_mib(struct ksz_device *dev, int port, bool freeze);
|
||||
void ksz9477_port_init_cnt(struct ksz_device *dev, int port);
|
||||
int ksz9477_port_vlan_filtering(struct ksz_device *dev, int port,
|
||||
int ksz9477_port_vlan_filtering(struct dsa_switch *ds, int port,
|
||||
bool flag, struct netlink_ext_ack *extack);
|
||||
int ksz9477_port_vlan_add(struct ksz_device *dev, int port,
|
||||
int ksz9477_port_vlan_add(struct dsa_switch *ds, int port,
|
||||
const struct switchdev_obj_port_vlan *vlan,
|
||||
struct netlink_ext_ack *extack);
|
||||
int ksz9477_port_vlan_del(struct ksz_device *dev, int port,
|
||||
int ksz9477_port_vlan_del(struct dsa_switch *ds, int port,
|
||||
const struct switchdev_obj_port_vlan *vlan);
|
||||
int ksz9477_port_mirror_add(struct ksz_device *dev, int port,
|
||||
int ksz9477_port_mirror_add(struct dsa_switch *ds, int port,
|
||||
struct dsa_mall_mirror_tc_entry *mirror,
|
||||
bool ingress, struct netlink_ext_ack *extack);
|
||||
void ksz9477_port_mirror_del(struct ksz_device *dev, int port,
|
||||
void ksz9477_port_mirror_del(struct dsa_switch *ds, int port,
|
||||
struct dsa_mall_mirror_tc_entry *mirror);
|
||||
int ksz9477_errata_monitor(struct ksz_device *dev, int port,
|
||||
u64 tx_late_col);
|
||||
int ksz9477_fdb_dump(struct ksz_device *dev, int port,
|
||||
int ksz9477_fdb_dump(struct dsa_switch *ds, int port,
|
||||
dsa_fdb_dump_cb_t *cb, void *data);
|
||||
int ksz9477_fdb_add(struct ksz_device *dev, int port,
|
||||
int ksz9477_fdb_add(struct dsa_switch *ds, int port,
|
||||
const unsigned char *addr, u16 vid, struct dsa_db db);
|
||||
int ksz9477_fdb_del(struct ksz_device *dev, int port,
|
||||
int ksz9477_fdb_del(struct dsa_switch *ds, int port,
|
||||
const unsigned char *addr, u16 vid, struct dsa_db db);
|
||||
int ksz9477_mdb_add(struct ksz_device *dev, int port,
|
||||
int ksz9477_mdb_add(struct dsa_switch *ds, int port,
|
||||
const struct switchdev_obj_port_mdb *mdb, struct dsa_db db);
|
||||
int ksz9477_mdb_del(struct ksz_device *dev, int port,
|
||||
int ksz9477_mdb_del(struct dsa_switch *ds, int port,
|
||||
const struct switchdev_obj_port_mdb *mdb, struct dsa_db db);
|
||||
int ksz9477_enable_stp_addr(struct ksz_device *dev);
|
||||
void ksz9477_port_queue_split(struct ksz_device *dev, int port);
|
||||
|
|
|
|||
|
|
@ -1995,9 +1995,6 @@ void ksz_phylink_get_caps(struct dsa_switch *ds, int port,
|
|||
config->supported_interfaces);
|
||||
}
|
||||
|
||||
if (dev->dev_ops->get_caps)
|
||||
dev->dev_ops->get_caps(dev, port, config);
|
||||
|
||||
if (ds->ops->support_eee && ds->ops->support_eee(ds, port)) {
|
||||
memcpy(config->lpi_interfaces, config->supported_interfaces,
|
||||
sizeof(config->lpi_interfaces));
|
||||
|
|
@ -3085,82 +3082,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)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
|
||||
if (!dev->dev_ops->fdb_add)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return dev->dev_ops->fdb_add(dev, port, addr, vid, db);
|
||||
}
|
||||
|
||||
int ksz_port_fdb_del(struct dsa_switch *ds, int port,
|
||||
const unsigned char *addr,
|
||||
u16 vid, struct dsa_db db)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
|
||||
if (!dev->dev_ops->fdb_del)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return dev->dev_ops->fdb_del(dev, port, addr, vid, db);
|
||||
}
|
||||
|
||||
int ksz_port_fdb_dump(struct dsa_switch *ds, int port,
|
||||
dsa_fdb_dump_cb_t *cb, void *data)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
|
||||
if (!dev->dev_ops->fdb_dump)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return dev->dev_ops->fdb_dump(dev, port, cb, data);
|
||||
}
|
||||
|
||||
int ksz_port_mdb_add(struct dsa_switch *ds, int port,
|
||||
const struct switchdev_obj_port_mdb *mdb,
|
||||
struct dsa_db db)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
|
||||
if (!dev->dev_ops->mdb_add)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return dev->dev_ops->mdb_add(dev, port, mdb, db);
|
||||
}
|
||||
|
||||
int ksz_port_mdb_del(struct dsa_switch *ds, int port,
|
||||
const struct switchdev_obj_port_mdb *mdb,
|
||||
struct dsa_db db)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
|
||||
if (!dev->dev_ops->mdb_del)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return dev->dev_ops->mdb_del(dev, port, mdb, db);
|
||||
}
|
||||
|
||||
static int ksz9477_set_default_prio_queue_mapping(struct ksz_device *dev,
|
||||
int port)
|
||||
{
|
||||
|
|
@ -3304,71 +3225,6 @@ int ksz_port_bridge_flags(struct dsa_switch *ds, int port,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int ksz_port_vlan_filtering(struct dsa_switch *ds, int port,
|
||||
bool flag, struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
|
||||
if (!dev->dev_ops->vlan_filtering)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return dev->dev_ops->vlan_filtering(dev, port, flag, extack);
|
||||
}
|
||||
|
||||
int ksz_port_vlan_add(struct dsa_switch *ds, int port,
|
||||
const struct switchdev_obj_port_vlan *vlan,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
|
||||
if (!dev->dev_ops->vlan_add)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return dev->dev_ops->vlan_add(dev, port, vlan, extack);
|
||||
}
|
||||
|
||||
int ksz_port_vlan_del(struct dsa_switch *ds, int port,
|
||||
const struct switchdev_obj_port_vlan *vlan)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
|
||||
if (!dev->dev_ops->vlan_del)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return dev->dev_ops->vlan_del(dev, port, vlan);
|
||||
}
|
||||
|
||||
int ksz_port_mirror_add(struct dsa_switch *ds, int port,
|
||||
struct dsa_mall_mirror_tc_entry *mirror,
|
||||
bool ingress, struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
|
||||
if (!dev->dev_ops->mirror_add)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return dev->dev_ops->mirror_add(dev, port, mirror, ingress, extack);
|
||||
}
|
||||
|
||||
void ksz_port_mirror_del(struct dsa_switch *ds, int port,
|
||||
struct dsa_mall_mirror_tc_entry *mirror)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
|
||||
if (dev->dev_ops->mirror_del)
|
||||
dev->dev_ops->mirror_del(dev, port, mirror);
|
||||
}
|
||||
|
||||
int ksz_change_mtu(struct dsa_switch *ds, int port, int mtu)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
|
||||
if (!dev->dev_ops->change_mtu)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return dev->dev_ops->change_mtu(dev, port, mtu);
|
||||
}
|
||||
|
||||
int ksz_max_mtu(struct dsa_switch *ds, int port)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -410,33 +408,6 @@ struct ksz_dev_ops {
|
|||
void (*r_mib_pkt)(struct ksz_device *dev, int port, u16 addr,
|
||||
u64 *dropped, u64 *cnt);
|
||||
void (*r_mib_stat64)(struct ksz_device *dev, int port);
|
||||
int (*vlan_filtering)(struct ksz_device *dev, int port,
|
||||
bool flag, struct netlink_ext_ack *extack);
|
||||
int (*vlan_add)(struct ksz_device *dev, int port,
|
||||
const struct switchdev_obj_port_vlan *vlan,
|
||||
struct netlink_ext_ack *extack);
|
||||
int (*vlan_del)(struct ksz_device *dev, int port,
|
||||
const struct switchdev_obj_port_vlan *vlan);
|
||||
int (*mirror_add)(struct ksz_device *dev, int port,
|
||||
struct dsa_mall_mirror_tc_entry *mirror,
|
||||
bool ingress, struct netlink_ext_ack *extack);
|
||||
void (*mirror_del)(struct ksz_device *dev, int port,
|
||||
struct dsa_mall_mirror_tc_entry *mirror);
|
||||
int (*fdb_add)(struct ksz_device *dev, int port,
|
||||
const unsigned char *addr, u16 vid, struct dsa_db db);
|
||||
int (*fdb_del)(struct ksz_device *dev, int port,
|
||||
const unsigned char *addr, u16 vid, struct dsa_db db);
|
||||
int (*fdb_dump)(struct ksz_device *dev, int port,
|
||||
dsa_fdb_dump_cb_t *cb, void *data);
|
||||
int (*mdb_add)(struct ksz_device *dev, int port,
|
||||
const struct switchdev_obj_port_mdb *mdb,
|
||||
struct dsa_db db);
|
||||
int (*mdb_del)(struct ksz_device *dev, int port,
|
||||
const struct switchdev_obj_port_mdb *mdb,
|
||||
struct dsa_db db);
|
||||
void (*get_caps)(struct ksz_device *dev, int port,
|
||||
struct phylink_config *config);
|
||||
int (*change_mtu)(struct ksz_device *dev, int port, int mtu);
|
||||
int (*pme_write8)(struct ksz_device *dev, u32 reg, u8 value);
|
||||
int (*pme_pread8)(struct ksz_device *dev, int port, int offset,
|
||||
u8 *data);
|
||||
|
|
@ -444,11 +415,6 @@ struct ksz_dev_ops {
|
|||
u8 data);
|
||||
void (*freeze_mib)(struct ksz_device *dev, int port, bool freeze);
|
||||
void (*port_init_cnt)(struct ksz_device *dev, int port);
|
||||
void (*phylink_mac_link_up)(struct ksz_device *dev, int port,
|
||||
unsigned int mode,
|
||||
phy_interface_t interface,
|
||||
struct phy_device *phydev, int speed,
|
||||
int duplex, bool tx_pause, bool rx_pause);
|
||||
void (*setup_rgmii_delay)(struct ksz_device *dev, int port);
|
||||
int (*tc_cbs_set_cinc)(struct ksz_device *dev, int port, u32 val);
|
||||
void (*config_cpu_port)(struct dsa_switch *ds);
|
||||
|
|
@ -513,29 +479,6 @@ int ksz_port_pre_bridge_flags(struct dsa_switch *ds, int port,
|
|||
int ksz_port_bridge_flags(struct dsa_switch *ds, int port,
|
||||
struct switchdev_brport_flags flags,
|
||||
struct netlink_ext_ack *extack);
|
||||
int ksz_port_vlan_filtering(struct dsa_switch *ds, int port,
|
||||
bool flag, struct netlink_ext_ack *extack);
|
||||
int ksz_port_vlan_add(struct dsa_switch *ds, int port,
|
||||
const struct switchdev_obj_port_vlan *vlan,
|
||||
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);
|
||||
int ksz_port_fdb_del(struct dsa_switch *ds, int port,
|
||||
const unsigned char *addr,
|
||||
u16 vid, struct dsa_db db);
|
||||
int ksz_port_fdb_dump(struct dsa_switch *ds, int port,
|
||||
dsa_fdb_dump_cb_t *cb, void *data);
|
||||
int ksz_port_mdb_add(struct dsa_switch *ds, int port,
|
||||
const struct switchdev_obj_port_mdb *mdb,
|
||||
struct dsa_db db);
|
||||
int ksz_port_mdb_del(struct dsa_switch *ds, int port,
|
||||
const struct switchdev_obj_port_mdb *mdb,
|
||||
struct dsa_db db);
|
||||
|
||||
void ksz_phylink_get_caps(struct dsa_switch *ds, int port,
|
||||
struct phylink_config *config);
|
||||
|
|
@ -549,12 +492,6 @@ void ksz_phylink_mac_link_down(struct phylink_config *config,
|
|||
unsigned int mode,
|
||||
phy_interface_t interface);
|
||||
|
||||
int ksz_port_mirror_add(struct dsa_switch *ds, int port,
|
||||
struct dsa_mall_mirror_tc_entry *mirror,
|
||||
bool ingress, struct netlink_ext_ack *extack);
|
||||
void ksz_port_mirror_del(struct dsa_switch *ds, int port,
|
||||
struct dsa_mall_mirror_tc_entry *mirror);
|
||||
int ksz_change_mtu(struct dsa_switch *ds, int port, int mtu);
|
||||
int ksz_max_mtu(struct dsa_switch *ds, int port);
|
||||
|
||||
bool ksz_support_eee(struct dsa_switch *ds, int port);
|
||||
|
|
|
|||
|
|
@ -430,9 +430,9 @@ static void lan937x_config_cpu_port(struct dsa_switch *ds)
|
|||
}
|
||||
}
|
||||
|
||||
static int lan937x_change_mtu(struct ksz_device *dev, int port, int new_mtu)
|
||||
static int lan937x_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
|
||||
{
|
||||
struct dsa_switch *ds = dev->ds;
|
||||
struct ksz_device *dev = ds->priv;
|
||||
int ret;
|
||||
|
||||
new_mtu += VLAN_ETH_HLEN + ETH_FCS_LEN;
|
||||
|
|
@ -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;
|
||||
|
|
@ -574,9 +575,11 @@ static void lan937x_set_rgmii_rx_delay(struct ksz_device *dev, int port)
|
|||
lan937x_set_tune_adj(dev, port, REG_PORT_XMII_CTRL_4, val);
|
||||
}
|
||||
|
||||
static void lan937x_phylink_get_caps(struct ksz_device *dev, int port,
|
||||
static void lan937x_phylink_get_caps(struct dsa_switch *ds, int port,
|
||||
struct phylink_config *config)
|
||||
{
|
||||
struct ksz_device *dev = ds->priv;
|
||||
|
||||
config->mac_capabilities = MAC_100FD;
|
||||
|
||||
if (dev->info->supports_rgmii[port]) {
|
||||
|
|
@ -587,6 +590,8 @@ static void lan937x_phylink_get_caps(struct ksz_device *dev, int port,
|
|||
config->mac_capabilities |= MAC_ASYM_PAUSE | MAC_SYM_PAUSE |
|
||||
MAC_100HD | MAC_10;
|
||||
}
|
||||
|
||||
ksz_phylink_get_caps(ds, port, config);
|
||||
}
|
||||
|
||||
static void lan937x_setup_rgmii_delay(struct ksz_device *dev, int port)
|
||||
|
|
@ -702,9 +707,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,
|
||||
|
|
@ -714,19 +717,7 @@ const struct ksz_dev_ops lan937x_dev_ops = {
|
|||
.r_mib_stat64 = ksz_r_mib_stats64,
|
||||
.freeze_mib = ksz9477_freeze_mib,
|
||||
.port_init_cnt = ksz9477_port_init_cnt,
|
||||
.vlan_filtering = ksz9477_port_vlan_filtering,
|
||||
.vlan_add = ksz9477_port_vlan_add,
|
||||
.vlan_del = ksz9477_port_vlan_del,
|
||||
.mirror_add = ksz9477_port_mirror_add,
|
||||
.mirror_del = ksz9477_port_mirror_del,
|
||||
.get_caps = lan937x_phylink_get_caps,
|
||||
.setup_rgmii_delay = lan937x_setup_rgmii_delay,
|
||||
.fdb_dump = ksz9477_fdb_dump,
|
||||
.fdb_add = ksz9477_fdb_add,
|
||||
.fdb_del = ksz9477_fdb_del,
|
||||
.mdb_add = ksz9477_mdb_add,
|
||||
.mdb_del = ksz9477_mdb_del,
|
||||
.change_mtu = lan937x_change_mtu,
|
||||
.config_cpu_port = lan937x_config_cpu_port,
|
||||
.tc_cbs_set_cinc = lan937x_tc_cbs_set_cinc,
|
||||
.enable_stp_addr = ksz9477_enable_stp_addr,
|
||||
|
|
@ -743,9 +734,9 @@ const struct dsa_switch_ops lan937x_switch_ops = {
|
|||
.teardown = ksz_teardown,
|
||||
.phy_read = ksz_phy_read16,
|
||||
.phy_write = ksz_phy_write16,
|
||||
.phylink_get_caps = ksz_phylink_get_caps,
|
||||
.phylink_get_caps = lan937x_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,20 +749,20 @@ 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_vlan_filtering = ksz_port_vlan_filtering,
|
||||
.port_vlan_add = ksz_port_vlan_add,
|
||||
.port_vlan_del = ksz_port_vlan_del,
|
||||
.port_fdb_dump = ksz_port_fdb_dump,
|
||||
.port_fdb_add = ksz_port_fdb_add,
|
||||
.port_fdb_del = ksz_port_fdb_del,
|
||||
.port_mdb_add = ksz_port_mdb_add,
|
||||
.port_mdb_del = ksz_port_mdb_del,
|
||||
.port_mirror_add = ksz_port_mirror_add,
|
||||
.port_mirror_del = ksz_port_mirror_del,
|
||||
.port_fast_age = ksz9477_flush_dyn_mac_table,
|
||||
.port_vlan_filtering = ksz9477_port_vlan_filtering,
|
||||
.port_vlan_add = ksz9477_port_vlan_add,
|
||||
.port_vlan_del = ksz9477_port_vlan_del,
|
||||
.port_fdb_dump = ksz9477_fdb_dump,
|
||||
.port_fdb_add = ksz9477_fdb_add,
|
||||
.port_fdb_del = ksz9477_fdb_del,
|
||||
.port_mdb_add = ksz9477_mdb_add,
|
||||
.port_mdb_del = ksz9477_mdb_del,
|
||||
.port_mirror_add = ksz9477_port_mirror_add,
|
||||
.port_mirror_del = ksz9477_port_mirror_del,
|
||||
.get_stats64 = ksz_get_stats64,
|
||||
.get_pause_stats = ksz_get_pause_stats,
|
||||
.port_change_mtu = ksz_change_mtu,
|
||||
.port_change_mtu = lan937x_change_mtu,
|
||||
.port_max_mtu = ksz_max_mtu,
|
||||
.get_wol = ksz_get_wol,
|
||||
.set_wol = ksz_set_wol,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user