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>
This commit is contained in:
parent
122c29486e
commit
87c167bb94
|
@ -27,6 +27,7 @@ enum switchdev_attr_id {
|
||||||
SWITCHDEV_ATTR_ID_BRIDGE_VLAN_PROTOCOL,
|
SWITCHDEV_ATTR_ID_BRIDGE_VLAN_PROTOCOL,
|
||||||
SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED,
|
SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED,
|
||||||
SWITCHDEV_ATTR_ID_BRIDGE_MROUTER,
|
SWITCHDEV_ATTR_ID_BRIDGE_MROUTER,
|
||||||
|
SWITCHDEV_ATTR_ID_BRIDGE_MST,
|
||||||
SWITCHDEV_ATTR_ID_MRP_PORT_ROLE,
|
SWITCHDEV_ATTR_ID_MRP_PORT_ROLE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -48,6 +49,7 @@ struct switchdev_attr {
|
||||||
clock_t ageing_time; /* BRIDGE_AGEING_TIME */
|
clock_t ageing_time; /* BRIDGE_AGEING_TIME */
|
||||||
bool vlan_filtering; /* BRIDGE_VLAN_FILTERING */
|
bool vlan_filtering; /* BRIDGE_VLAN_FILTERING */
|
||||||
u16 vlan_protocol; /* BRIDGE_VLAN_PROTOCOL */
|
u16 vlan_protocol; /* BRIDGE_VLAN_PROTOCOL */
|
||||||
|
bool mst; /* BRIDGE_MST */
|
||||||
bool mc_disabled; /* MC_DISABLED */
|
bool mc_disabled; /* MC_DISABLED */
|
||||||
u8 mrp_port_role; /* MRP_PORT_ROLE */
|
u8 mrp_port_role; /* MRP_PORT_ROLE */
|
||||||
} u;
|
} u;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
|
#include <net/switchdev.h>
|
||||||
|
|
||||||
#include "br_private.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,
|
int br_mst_set_enabled(struct net_bridge *br, bool on,
|
||||||
struct netlink_ext_ack *extack)
|
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_vlan_group *vg;
|
||||||
struct net_bridge_port *p;
|
struct net_bridge_port *p;
|
||||||
|
int err;
|
||||||
|
|
||||||
list_for_each_entry(p, &br->port_list, list) {
|
list_for_each_entry(p, &br->port_list, list) {
|
||||||
vg = nbp_vlan_group(p);
|
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)
|
if (br_opt_get(br, BROPT_MST_ENABLED) == on)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err = switchdev_port_attr_set(br->dev, &attr, extack);
|
||||||
|
if (err && err != -EOPNOTSUPP)
|
||||||
|
return err;
|
||||||
|
|
||||||
if (on)
|
if (on)
|
||||||
static_branch_enable(&br_mst_used);
|
static_branch_enable(&br_mst_used);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue