From: Tobias Waldekranz <tobias@waldekranz.com>
To: Vladimir Oltean <olteanv@gmail.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 23:13:47 +0100 [thread overview]
Message-ID: <87h780kwro.fsf@waldekranz.com> (raw)
In-Reply-To: <20220314202040.f2r4pidcy6ws34qv@skbuf>
On Mon, Mar 14, 2022 at 22:20, Vladimir Oltean <olteanv@gmail.com> wrote:
> On Mon, Mar 14, 2022 at 09:01:12PM +0100, Tobias Waldekranz wrote:
>> On Mon, Mar 14, 2022 at 19:55, Vladimir Oltean <olteanv@gmail.com> wrote:
>> > On Mon, Mar 14, 2022 at 06:56:49PM +0200, Vladimir Oltean wrote:
>> >> > 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;
>> >>
>> >> Sadly this will break down because we don't have unwinding on error in
>> >> place (sorry). We'd end up with an unoffloaded bridge port with
>> >> partially synced bridge port attributes. Could you please add a patch
>> >> previous to this one that handles this, and unoffloads those on error?
>> >
>> > Actually I would rather rename the entire dsa_port_mst_enable() function
>> > to dsa_port_mst_validate() and move it to the beginning of dsa_port_bridge_join().
>> > This simplifies the unwinding that needs to take place quite a bit.
>>
>> Well you still need to unwind vlan filtering if setting the ageing time
>> fails, which is the most complicated one, right?
>
> Yes, but we can leave that for another day :)
>
> ...ergo
>
>> Should the unwinding patch still be part of this series then?
>
> no.
Agreed
>> Still, I agree that _validate is a better name, and then _bridge_join
>> seems like a more reasonable placement.
>>
>> While we're here, I actually made this a hard error in both scenarios
>> (but forgot to update the log - will do that in v4, depending on what we
>> decide here). There's a dilemma:
>>
>> - When reacting to the attribute event, i.e. changing the mode on a
>> member we're apart of, we _can't_ return -EOPNOTSUPP as it will be
>> ignored, which is why dsa_port_mst_validate (nee _enable) returns
>> -EINVAL.
>>
>> - When joining a bridge, we _must_ return -EOPNOTSUPP to trigger the
>> software fallback.
>>
>> Having something like this in dsa_port_bridge_join...
>>
>> err = dsa_port_mst_validate(dp);
>> if (err == -EINVAL)
>> return -EOPNOTSUPP;
>> else if (err)
>> return err;
>>
>> ...works I suppose, but feels somewhat awkwark. Any better ideas?
>
> What you can do is follow the model of dsa_switch_supports_uc_filtering(),
> and create a dsa_switch_supports_mst() which is called inside an
> "if br_mst_enabled(br)" check, and returns bool. When false, you could
> return -EINVAL or -EOPNOTSUPP, as appropriate.
>
> This is mostly fine, except for the pesky dsa_port_can_configure_learning(dp)
> check :) So while you could name it dsa_port_supports_mst() and pass it
> a dsa_port, the problem is that you can't put the implementation of this
> new dsa_port_supports_mst() next to dsa_switch_supports_uc_filtering()
> where it would be nice to sit for symmetry, because the latter is static
> inline and we're missing the definition of dsa_port_can_configure_learning().
> So.. the second best thing is to keep dsa_port_supports_mst() in the
> same place where dsa_port_mst_enable() currently is.
>
> What do you think?
I think that would mostly work. It would have to be positioned higher up
in the file though, so that it can be called from _bridge_join. Unless
we add a forward for it of course, but that seems to break with existing
conventions.
next prev parent reply other threads:[~2022-03-14 22:13 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 [this message]
2022-03-14 17:51 ` Vladimir Oltean
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=87h780kwro.fsf@waldekranz.com \
--to=tobias@waldekranz.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=olteanv@gmail.com \
--cc=petrm@nvidia.com \
--cc=razor@blackwall.org \
--cc=roopa@nvidia.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;
as well as URLs for NNTP newsgroup(s).