Commit 48d57b2e authored by Tobias Waldekranz's avatar Tobias Waldekranz Committed by Jakub Kicinski

net: bridge: mst: Add helper to check if MST is enabled

This is useful for switchdev drivers that might want to refuse to join
a bridge where MST is enabled, if the hardware can't support it.
Signed-off-by: default avatarTobias Waldekranz <tobias@waldekranz.com>
Reviewed-by: default avatarVladimir Oltean <olteanv@gmail.com>
Acked-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent cceac97a
...@@ -119,6 +119,7 @@ int br_vlan_get_info(const struct net_device *dev, u16 vid, ...@@ -119,6 +119,7 @@ int br_vlan_get_info(const struct net_device *dev, u16 vid,
struct bridge_vlan_info *p_vinfo); struct bridge_vlan_info *p_vinfo);
int br_vlan_get_info_rcu(const struct net_device *dev, u16 vid, int br_vlan_get_info_rcu(const struct net_device *dev, u16 vid,
struct bridge_vlan_info *p_vinfo); struct bridge_vlan_info *p_vinfo);
bool br_mst_enabled(const struct net_device *dev);
int br_mst_get_info(const struct net_device *dev, u16 msti, unsigned long *vids); int br_mst_get_info(const struct net_device *dev, u16 msti, unsigned long *vids);
#else #else
static inline bool br_vlan_enabled(const struct net_device *dev) static inline bool br_vlan_enabled(const struct net_device *dev)
...@@ -153,6 +154,11 @@ static inline int br_vlan_get_info_rcu(const struct net_device *dev, u16 vid, ...@@ -153,6 +154,11 @@ static inline int br_vlan_get_info_rcu(const struct net_device *dev, u16 vid,
return -EINVAL; return -EINVAL;
} }
static inline bool br_mst_enabled(const struct net_device *dev)
{
return false;
}
static inline int br_mst_get_info(const struct net_device *dev, u16 msti, static inline int br_mst_get_info(const struct net_device *dev, u16 msti,
unsigned long *vids) unsigned long *vids)
{ {
......
...@@ -13,6 +13,15 @@ ...@@ -13,6 +13,15 @@
DEFINE_STATIC_KEY_FALSE(br_mst_used); DEFINE_STATIC_KEY_FALSE(br_mst_used);
bool br_mst_enabled(const struct net_device *dev)
{
if (!netif_is_bridge_master(dev))
return false;
return br_opt_get(netdev_priv(dev), BROPT_MST_ENABLED);
}
EXPORT_SYMBOL_GPL(br_mst_enabled);
int br_mst_get_info(const struct net_device *dev, u16 msti, unsigned long *vids) int br_mst_get_info(const struct net_device *dev, u16 msti, unsigned long *vids)
{ {
const struct net_bridge_vlan_group *vg; const struct net_bridge_vlan_group *vg;
......
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