aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/net/dsa/switch.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2020-04-21 09:36:03 -0700
committerTony Lindgren <tony@atomide.com>2020-04-21 09:36:03 -0700
commit175ae3ad59ab3459652bd2ae3bbc1785aeba1bf3 (patch)
treec7fd682de61e3c2a6cc3ba0e8881b99fafdf969c /net/dsa/switch.c
parentARM: dts: OMAP3: disable RNG on N950/N9 (diff)
parentARM: dts: dra7: Fix bus_dma_limit for PCIe (diff)
downloadwireguard-linux-175ae3ad59ab3459652bd2ae3bbc1785aeba1bf3.tar.xz
wireguard-linux-175ae3ad59ab3459652bd2ae3bbc1785aeba1bf3.zip
Merge branch 'fixes-v5.7' into fixes
Diffstat (limited to '')
-rw-r--r--net/dsa/switch.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/net/dsa/switch.c b/net/dsa/switch.c
index df4abe897ed6..f3c32ff552b3 100644
--- a/net/dsa/switch.c
+++ b/net/dsa/switch.c
@@ -52,6 +52,40 @@ static int dsa_switch_ageing_time(struct dsa_switch *ds,
return 0;
}
+static bool dsa_switch_mtu_match(struct dsa_switch *ds, int port,
+ struct dsa_notifier_mtu_info *info)
+{
+ if (ds->index == info->sw_index)
+ return (port == info->port) || dsa_is_dsa_port(ds, port);
+
+ if (!info->propagate_upstream)
+ return false;
+
+ if (dsa_is_dsa_port(ds, port) || dsa_is_cpu_port(ds, port))
+ return true;
+
+ return false;
+}
+
+static int dsa_switch_mtu(struct dsa_switch *ds,
+ struct dsa_notifier_mtu_info *info)
+{
+ int port, ret;
+
+ if (!ds->ops->port_change_mtu)
+ return -EOPNOTSUPP;
+
+ for (port = 0; port < ds->num_ports; port++) {
+ if (dsa_switch_mtu_match(ds, port, info)) {
+ ret = ds->ops->port_change_mtu(ds, port, info->mtu);
+ if (ret)
+ return ret;
+ }
+ }
+
+ return 0;
+}
+
static int dsa_switch_bridge_join(struct dsa_switch *ds,
struct dsa_notifier_bridge_info *info)
{
@@ -328,6 +362,9 @@ static int dsa_switch_event(struct notifier_block *nb,
case DSA_NOTIFIER_VLAN_DEL:
err = dsa_switch_vlan_del(ds, info);
break;
+ case DSA_NOTIFIER_MTU:
+ err = dsa_switch_mtu(ds, info);
+ break;
default:
err = -EOPNOTSUPP;
break;