diff options
author | Vladimir Oltean <vladimir.oltean@nxp.com> | 2022-04-15 17:46:24 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-04-20 11:34:34 +0200 |
commit | cf1c39d3b3a583c83fc7e077e1b3689b37187bd2 (patch) | |
tree | f508d0dc3acdbf057544fd3aaf521853624f2331 /net/dsa | |
parent | net: dsa: use dsa_tree_for_each_user_port in dsa_slave_change_mtu (diff) | |
download | linux-cf1c39d3b3a583c83fc7e077e1b3689b37187bd2.tar.xz linux-cf1c39d3b3a583c83fc7e077e1b3689b37187bd2.zip |
net: dsa: avoid one dsa_to_port() in dsa_slave_change_mtu
We could retrieve the cpu_dp pointer directly from the "dp" we already
have, no need to resort to dsa_to_port(ds, port).
This change also removes the need for an "int port", so that is also
deleted.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa')
-rw-r--r-- | net/dsa/slave.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index da234c4b7daa..3ff8647be619 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1807,10 +1807,9 @@ int dsa_slave_change_mtu(struct net_device *dev, int new_mtu) struct net_device *master = dsa_slave_to_master(dev); struct dsa_port *dp = dsa_slave_to_port(dev); struct dsa_slave_priv *p = netdev_priv(dev); + struct dsa_port *cpu_dp = dp->cpu_dp; struct dsa_switch *ds = p->dp->ds; struct dsa_port *other_dp; - struct dsa_port *cpu_dp; - int port = p->dp->index; int largest_mtu = 0; int new_master_mtu; int old_master_mtu; @@ -1843,8 +1842,6 @@ int dsa_slave_change_mtu(struct net_device *dev, int new_mtu) largest_mtu = slave_mtu; } - cpu_dp = dsa_to_port(ds, port)->cpu_dp; - mtu_limit = min_t(int, master->max_mtu, dev->max_mtu); old_master_mtu = master->mtu; new_master_mtu = largest_mtu + dsa_tag_protocol_overhead(cpu_dp->tag_ops); |