[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220317004229.dub2qoinhur76co7@skbuf>
Date: Thu, 17 Mar 2022 02:42:29 +0200
From: Vladimir Oltean <olteanv@...il.com>
To: Tobias Waldekranz <tobias@...dekranz.com>
Cc: davem@...emloft.net, kuba@...nel.org, Andrew Lunn <andrew@...n.ch>,
Vivien Didelot <vivien.didelot@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
Jiri Pirko <jiri@...nulli.us>,
Ivan Vecera <ivecera@...hat.com>,
Roopa Prabhu <roopa@...dia.com>,
Nikolay Aleksandrov <razor@...ckwall.org>,
Russell King <linux@...linux.org.uk>,
Petr Machata <petrm@...dia.com>,
Ido Schimmel <idosch@...dia.com>,
Matt Johnston <matt@...econstruct.com.au>,
Cooper Lees <me@...perlees.com>, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, bridge@...ts.linux-foundation.org
Subject: Re: [PATCH v5 net-next 08/15] net: bridge: mst: Add helper to check
if MST is enabled
On Wed, Mar 16, 2022 at 04:08:50PM +0100, Tobias Waldekranz wrote:
> 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: Tobias Waldekranz <tobias@...dekranz.com>
> ---
Reviewed-by: Vladimir Oltean <olteanv@...il.com>
> include/linux/if_bridge.h | 6 ++++++
> net/bridge/br_mst.c | 9 +++++++++
> 2 files changed, 15 insertions(+)
>
> diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
> index 1cf0cc46d90d..4efd5540279a 100644
> --- a/include/linux/if_bridge.h
> +++ b/include/linux/if_bridge.h
> @@ -119,6 +119,7 @@ int br_vlan_get_info(const struct net_device *dev, u16 vid,
> struct bridge_vlan_info *p_vinfo);
> int br_vlan_get_info_rcu(const struct net_device *dev, u16 vid,
> 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);
> #else
> 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,
> 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,
> unsigned long *vids)
> {
> diff --git a/net/bridge/br_mst.c b/net/bridge/br_mst.c
> index 00b36e629224..830a5746479f 100644
> --- a/net/bridge/br_mst.c
> +++ b/net/bridge/br_mst.c
> @@ -13,6 +13,15 @@
>
> 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)
> {
> const struct net_bridge_vlan_group *vg;
> --
> 2.25.1
>
Powered by blists - more mailing lists