mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
net: dsa: microchip: bypass dev_ops for change_mtu() operation
MTU changing is done through a common function that redirects the treatment to a specific ksz_dev_ops callback. This layer of indirection isn't needed since we now have a dsa_switch_ops struct for each switch family. Remove this indirection layer in MTU changing for KSZ switches, by directly connecting the ksz_dev_ops :: change_mtu() implementations to dsa_switch_ops. Remove the no longer used change_mtu() callback from ksz_dev_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-3-c00f6ce037fa@bootlin.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
f27ae140c8
commit
9f16bc5c73
|
|
@ -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))
|
||||
|
|
@ -2226,7 +2227,6 @@ const struct ksz_dev_ops ksz8463_dev_ops = {
|
|||
.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 = {
|
||||
|
|
@ -2257,7 +2257,6 @@ const struct ksz_dev_ops ksz87xx_dev_ops = {
|
|||
.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,
|
||||
|
|
@ -2291,7 +2290,6 @@ const struct ksz_dev_ops ksz88xx_dev_ops = {
|
|||
.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,
|
||||
|
|
@ -2332,7 +2330,7 @@ const struct dsa_switch_ops ksz8463_switch_ops = {
|
|||
.port_mirror_del = ksz_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,
|
||||
|
|
@ -2392,7 +2390,7 @@ const struct dsa_switch_ops ksz87xx_switch_ops = {
|
|||
.port_mirror_del = ksz_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,
|
||||
|
|
@ -2452,7 +2450,7 @@ const struct dsa_switch_ops ksz88xx_switch_ops = {
|
|||
.port_mirror_del = ksz_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))
|
||||
|
|
@ -1790,7 +1791,6 @@ const struct ksz_dev_ops ksz9477_dev_ops = {
|
|||
.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,
|
||||
|
|
@ -1839,7 +1839,7 @@ const struct dsa_switch_ops ksz9477_switch_ops = {
|
|||
.port_mirror_del = ksz_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,
|
||||
|
|
|
|||
|
|
@ -3342,16 +3342,6 @@ void ksz_port_mirror_del(struct dsa_switch *ds, int port,
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -434,7 +434,6 @@ struct ksz_dev_ops {
|
|||
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);
|
||||
|
|
@ -545,7 +544,6 @@ int ksz_port_mirror_add(struct dsa_switch *ds, int port,
|
|||
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;
|
||||
|
|
@ -725,7 +725,6 @@ const struct ksz_dev_ops lan937x_dev_ops = {
|
|||
.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,
|
||||
|
|
@ -770,7 +769,7 @@ const struct dsa_switch_ops lan937x_switch_ops = {
|
|||
.port_mirror_del = ksz_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