summaryrefslogtreecommitdiffstats
path: root/net/bridge
diff options
context:
space:
mode:
authorTobias Waldekranz <tobias@waldekranz.com>2022-03-16 16:08:46 +0100
committerJakub Kicinski <kuba@kernel.org>2022-03-18 00:49:57 +0100
commit87c167bb94ee3fd49569d4aa2038b9b8840d906f (patch)
treef492b6a5f6b63cff7c66b52cd3ceaf69ba8d5022 /net/bridge
parentnet: bridge: mst: Support setting and reporting MST port states (diff)
downloadlinux-87c167bb94ee3fd49569d4aa2038b9b8840d906f.tar.xz
linux-87c167bb94ee3fd49569d4aa2038b9b8840d906f.zip
net: bridge: mst: Notify switchdev drivers of MST mode changes
Trigger a switchdev event whenever the bridge's MST mode is enabled/disabled. This allows constituent ports to either perform any required hardware config, or refuse the change if it not supported. Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com> Acked-by: Nikolay Aleksandrov <razor@blackwall.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/bridge')
-rw-r--r--net/bridge/br_mst.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/net/bridge/br_mst.c b/net/bridge/br_mst.c
index 5c1831c73fc2..43ca6b97c5c3 100644
--- a/net/bridge/br_mst.c
+++ b/net/bridge/br_mst.c
@@ -7,6 +7,7 @@
*/
#include <linux/kernel.h>
+#include <net/switchdev.h>
#include "br_private.h"
@@ -102,8 +103,14 @@ void br_mst_vlan_init_state(struct net_bridge_vlan *v)
int br_mst_set_enabled(struct net_bridge *br, bool on,
struct netlink_ext_ack *extack)
{
+ struct switchdev_attr attr = {
+ .id = SWITCHDEV_ATTR_ID_BRIDGE_MST,
+ .orig_dev = br->dev,
+ .u.mst = on,
+ };
struct net_bridge_vlan_group *vg;
struct net_bridge_port *p;
+ int err;
list_for_each_entry(p, &br->port_list, list) {
vg = nbp_vlan_group(p);
@@ -119,6 +126,10 @@ int br_mst_set_enabled(struct net_bridge *br, bool on,
if (br_opt_get(br, BROPT_MST_ENABLED) == on)
return 0;
+ err = switchdev_port_attr_set(br->dev, &attr, extack);
+ if (err && err != -EOPNOTSUPP)
+ return err;
+
if (on)
static_branch_enable(&br_mst_used);
else