From: Vladimir Oltean <olteanv@gmail.com>
To: Tobias Waldekranz <tobias@waldekranz.com>
Cc: davem@davemloft.net, kuba@kernel.org,
Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Jiri Pirko <jiri@resnulli.us>, Ivan Vecera <ivecera@redhat.com>,
Roopa Prabhu <roopa@nvidia.com>,
Nikolay Aleksandrov <razor@blackwall.org>,
Russell King <linux@armlinux.org.uk>,
Ido Schimmel <idosch@nvidia.com>, Petr Machata <petrm@nvidia.com>,
Cooper Lees <me@cooperlees.com>,
Matt Johnston <matt@codeconstruct.com.au>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
bridge@lists.linux-foundation.org
Subject: Re: [PATCH v3 net-next 09/14] net: dsa: Validate hardware support for MST
Date: Mon, 14 Mar 2022 19:51:18 +0200 [thread overview]
Message-ID: <20220314175118.w4plirtshhzgujn3@skbuf> (raw)
In-Reply-To: <20220314095231.3486931-10-tobias@waldekranz.com>
On Mon, Mar 14, 2022 at 10:52:26AM +0100, Tobias Waldekranz wrote:
> When joining a bridge where MST is enabled, we validate that the
> proper offloading support is in place, otherwise we fallback to
> software bridging.
>
> When then mode is changed on a bridge in which we are members, we
> refuse the change if offloading is not supported.
>
> At the moment we only check for configurable learning, but this will
> be further restricted as we support more MST related switchdev events.
>
> Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
> ---
> net/dsa/dsa_priv.h | 2 ++
> net/dsa/port.c | 20 ++++++++++++++++++++
> net/dsa/slave.c | 6 ++++++
> 3 files changed, 28 insertions(+)
>
> diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
> index f20bdd8ea0a8..2aba420696ef 100644
> --- a/net/dsa/dsa_priv.h
> +++ b/net/dsa/dsa_priv.h
> @@ -234,6 +234,8 @@ int dsa_port_vlan_filtering(struct dsa_port *dp, bool vlan_filtering,
> struct netlink_ext_ack *extack);
> bool dsa_port_skip_vlan_configuration(struct dsa_port *dp);
> int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock);
> +int dsa_port_mst_enable(struct dsa_port *dp, bool on,
> + struct netlink_ext_ack *extack);
> int dsa_port_mtu_change(struct dsa_port *dp, int new_mtu,
> bool targeted_match);
> int dsa_port_fdb_add(struct dsa_port *dp, const unsigned char *addr,
> diff --git a/net/dsa/port.c b/net/dsa/port.c
> index 58291df14cdb..1a17a0efa2fa 100644
> --- a/net/dsa/port.c
> +++ b/net/dsa/port.c
> @@ -240,6 +240,10 @@ static int dsa_port_switchdev_sync_attrs(struct dsa_port *dp,
> if (err && err != -EOPNOTSUPP)
> return err;
>
> + err = dsa_port_mst_enable(dp, br_mst_enabled(br), extack);
> + if (err && err != -EOPNOTSUPP)
> + return err;
The "err && err != -EOPNOTSUPP" scheme is in place for compatibility
with drivers that don't all support the bridge port attributes, but used
to work prior to dsa_port_switchdev_sync_attrs()'s existence.
I don't think this scheme is necessary for dsa_port_mst_enable(), you
can just return -EOPNOTSUPP and remove the special handling for this code.
> +
> return 0;
> }
>
> @@ -735,6 +739,22 @@ int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock)
> return 0;
> }
>
> +int dsa_port_mst_enable(struct dsa_port *dp, bool on,
> + struct netlink_ext_ack *extack)
> +{
> + struct dsa_switch *ds = dp->ds;
> +
> + if (!on)
> + return 0;
> +
> + if (!dsa_port_can_configure_learning(dp)) {
> + NL_SET_ERR_MSG_MOD(extack, "Hardware does not support MST");
> + return -EINVAL;
> + }
> +
> + return 0;
> +}
> +
> int dsa_port_pre_bridge_flags(const struct dsa_port *dp,
> struct switchdev_brport_flags flags,
> struct netlink_ext_ack *extack)
> diff --git a/net/dsa/slave.c b/net/dsa/slave.c
> index a61a7c54af20..333f5702ea4f 100644
> --- a/net/dsa/slave.c
> +++ b/net/dsa/slave.c
> @@ -463,6 +463,12 @@ static int dsa_slave_port_attr_set(struct net_device *dev, const void *ctx,
>
> ret = dsa_port_ageing_time(dp, attr->u.ageing_time);
> break;
> + case SWITCHDEV_ATTR_ID_BRIDGE_MST:
> + if (!dsa_port_offloads_bridge_dev(dp, attr->orig_dev))
> + return -EOPNOTSUPP;
> +
> + ret = dsa_port_mst_enable(dp, attr->u.mst, extack);
> + break;
> case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS:
> if (!dsa_port_offloads_bridge_port(dp, attr->orig_dev))
> return -EOPNOTSUPP;
> --
> 2.25.1
>
next prev parent reply other threads:[~2022-03-14 17:51 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-14 9:52 [PATCH v3 net-next 00/14] net: bridge: Multiple Spanning Trees Tobias Waldekranz
2022-03-14 9:52 ` [PATCH v3 net-next 01/14] net: bridge: mst: Multiple Spanning Tree (MST) mode Tobias Waldekranz
2022-03-14 10:37 ` Nikolay Aleksandrov
2022-03-14 11:09 ` Nikolay Aleksandrov
2022-03-14 12:31 ` kernel test robot
2022-03-14 16:43 ` kernel test robot
2022-03-14 9:52 ` [PATCH v3 net-next 02/14] net: bridge: mst: Allow changing a VLAN's MSTI Tobias Waldekranz
2022-03-14 10:45 ` Nikolay Aleksandrov
2022-03-14 9:52 ` [PATCH v3 net-next 03/14] net: bridge: mst: Support setting and reporting MST port states Tobias Waldekranz
2022-03-14 10:37 ` Nikolay Aleksandrov
2022-03-14 12:38 ` Tobias Waldekranz
2022-03-14 14:58 ` Vladimir Oltean
2022-03-14 15:42 ` Tobias Waldekranz
2022-03-14 9:52 ` [PATCH v3 net-next 04/14] net: bridge: mst: Notify switchdev drivers of MST mode changes Tobias Waldekranz
2022-03-14 9:52 ` [PATCH v3 net-next 05/14] net: bridge: mst: Notify switchdev drivers of VLAN MSTI migrations Tobias Waldekranz
2022-03-14 9:52 ` [PATCH v3 net-next 06/14] net: bridge: mst: Notify switchdev drivers of MST state changes Tobias Waldekranz
2022-03-14 9:52 ` [PATCH v3 net-next 07/14] net: bridge: mst: Add helper to map an MSTI to a VID set Tobias Waldekranz
2022-03-14 10:42 ` Nikolay Aleksandrov
2022-03-14 9:52 ` [PATCH v3 net-next 08/14] net: bridge: mst: Add helper to check if MST is enabled Tobias Waldekranz
2022-03-14 10:43 ` Nikolay Aleksandrov
2022-03-14 9:52 ` [PATCH v3 net-next 09/14] net: dsa: Validate hardware support for MST Tobias Waldekranz
2022-03-14 16:56 ` Vladimir Oltean
2022-03-14 17:55 ` Vladimir Oltean
2022-03-14 20:01 ` Tobias Waldekranz
2022-03-14 20:20 ` Vladimir Oltean
2022-03-14 22:13 ` Tobias Waldekranz
2022-03-14 17:51 ` Vladimir Oltean [this message]
2022-03-14 9:52 ` [PATCH v3 net-next 10/14] net: dsa: Pass VLAN MSTI migration notifications to driver Tobias Waldekranz
2022-03-14 17:07 ` Vladimir Oltean
2022-03-14 9:52 ` [PATCH v3 net-next 11/14] net: dsa: Handle MST state changes Tobias Waldekranz
2022-03-14 17:14 ` Vladimir Oltean
2022-03-14 9:52 ` [PATCH v3 net-next 12/14] net: dsa: mv88e6xxx: Disentangle STU from VTU Tobias Waldekranz
2022-03-14 9:52 ` [PATCH v3 net-next 13/14] net: dsa: mv88e6xxx: Export STU as devlink region Tobias Waldekranz
2022-03-14 9:52 ` [PATCH v3 net-next 14/14] net: dsa: mv88e6xxx: MST Offloading Tobias Waldekranz
2022-03-14 16:27 ` Vladimir Oltean
2022-03-14 21:57 ` Tobias Waldekranz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220314175118.w4plirtshhzgujn3@skbuf \
--to=olteanv@gmail.com \
--cc=andrew@lunn.ch \
--cc=bridge@lists.linux-foundation.org \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=idosch@nvidia.com \
--cc=ivecera@redhat.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=matt@codeconstruct.com.au \
--cc=me@cooperlees.com \
--cc=netdev@vger.kernel.org \
--cc=petrm@nvidia.com \
--cc=razor@blackwall.org \
--cc=roopa@nvidia.com \
--cc=tobias@waldekranz.com \
--cc=vivien.didelot@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox