Commit be6ff966 authored by Vladimir Oltean's avatar Vladimir Oltean Committed by David S. Miller

net: dsa: don't emit targeted cross-chip notifiers for MTU change

A cross-chip notifier with "targeted_match=true" is one that matches
only the local port of the switch that emitted it. In other words,
passing through the cross-chip notifier layer serves no purpose.

Eliminate this concept by calling directly ds->ops->port_change_mtu
instead of emitting a targeted cross-chip notifier. This leaves the
DSA_NOTIFIER_MTU event being emitted only for MTU updates on the CPU
port, which need to be reflected also across all DSA links.
Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4715029f
...@@ -100,7 +100,6 @@ struct dsa_notifier_vlan_info { ...@@ -100,7 +100,6 @@ struct dsa_notifier_vlan_info {
/* DSA_NOTIFIER_MTU */ /* DSA_NOTIFIER_MTU */
struct dsa_notifier_mtu_info { struct dsa_notifier_mtu_info {
const struct dsa_port *dp; const struct dsa_port *dp;
bool targeted_match;
int mtu; int mtu;
}; };
...@@ -231,8 +230,7 @@ int dsa_port_mst_enable(struct dsa_port *dp, bool on, ...@@ -231,8 +230,7 @@ int dsa_port_mst_enable(struct dsa_port *dp, bool on,
struct netlink_ext_ack *extack); struct netlink_ext_ack *extack);
int dsa_port_vlan_msti(struct dsa_port *dp, int dsa_port_vlan_msti(struct dsa_port *dp,
const struct switchdev_vlan_msti *msti); const struct switchdev_vlan_msti *msti);
int dsa_port_mtu_change(struct dsa_port *dp, int new_mtu, int dsa_port_mtu_change(struct dsa_port *dp, int new_mtu);
bool targeted_match);
int dsa_port_fdb_add(struct dsa_port *dp, const unsigned char *addr, int dsa_port_fdb_add(struct dsa_port *dp, const unsigned char *addr,
u16 vid); u16 vid);
int dsa_port_fdb_del(struct dsa_port *dp, const unsigned char *addr, int dsa_port_fdb_del(struct dsa_port *dp, const unsigned char *addr,
......
...@@ -930,12 +930,10 @@ int dsa_port_vlan_msti(struct dsa_port *dp, ...@@ -930,12 +930,10 @@ int dsa_port_vlan_msti(struct dsa_port *dp,
return ds->ops->vlan_msti_set(ds, *dp->bridge, msti); return ds->ops->vlan_msti_set(ds, *dp->bridge, msti);
} }
int dsa_port_mtu_change(struct dsa_port *dp, int new_mtu, int dsa_port_mtu_change(struct dsa_port *dp, int new_mtu)
bool targeted_match)
{ {
struct dsa_notifier_mtu_info info = { struct dsa_notifier_mtu_info info = {
.dp = dp, .dp = dp,
.targeted_match = targeted_match,
.mtu = new_mtu, .mtu = new_mtu,
}; };
......
...@@ -1859,15 +1859,14 @@ int dsa_slave_change_mtu(struct net_device *dev, int new_mtu) ...@@ -1859,15 +1859,14 @@ int dsa_slave_change_mtu(struct net_device *dev, int new_mtu)
goto out_master_failed; goto out_master_failed;
/* We only need to propagate the MTU of the CPU port to /* We only need to propagate the MTU of the CPU port to
* upstream switches, so create a non-targeted notifier which * upstream switches, so emit a notifier which updates them.
* updates all switches.
*/ */
err = dsa_port_mtu_change(cpu_dp, cpu_mtu, false); err = dsa_port_mtu_change(cpu_dp, cpu_mtu);
if (err) if (err)
goto out_cpu_failed; goto out_cpu_failed;
} }
err = dsa_port_mtu_change(dp, new_mtu, true); err = ds->ops->port_change_mtu(ds, dp->index, new_mtu);
if (err) if (err)
goto out_port_failed; goto out_port_failed;
...@@ -1880,8 +1879,7 @@ int dsa_slave_change_mtu(struct net_device *dev, int new_mtu) ...@@ -1880,8 +1879,7 @@ int dsa_slave_change_mtu(struct net_device *dev, int new_mtu)
out_port_failed: out_port_failed:
if (new_master_mtu != old_master_mtu) if (new_master_mtu != old_master_mtu)
dsa_port_mtu_change(cpu_dp, old_master_mtu - dsa_port_mtu_change(cpu_dp, old_master_mtu -
dsa_tag_protocol_overhead(cpu_dp->tag_ops), dsa_tag_protocol_overhead(cpu_dp->tag_ops));
false);
out_cpu_failed: out_cpu_failed:
if (new_master_mtu != old_master_mtu) if (new_master_mtu != old_master_mtu)
dev_set_mtu(master, old_master_mtu); dev_set_mtu(master, old_master_mtu);
......
...@@ -49,19 +49,7 @@ static int dsa_switch_ageing_time(struct dsa_switch *ds, ...@@ -49,19 +49,7 @@ static int dsa_switch_ageing_time(struct dsa_switch *ds,
static bool dsa_port_mtu_match(struct dsa_port *dp, static bool dsa_port_mtu_match(struct dsa_port *dp,
struct dsa_notifier_mtu_info *info) struct dsa_notifier_mtu_info *info)
{ {
if (dp == info->dp) return dp == info->dp || dsa_port_is_dsa(dp) || dsa_port_is_cpu(dp);
return true;
/* Do not propagate to other switches in the tree if the notifier was
* targeted for a single switch.
*/
if (info->targeted_match)
return false;
if (dsa_port_is_dsa(dp) || dsa_port_is_cpu(dp))
return true;
return false;
} }
static int dsa_switch_mtu(struct dsa_switch *ds, static int dsa_switch_mtu(struct dsa_switch *ds,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment