From: Ido Schimmel <idosch@mellanox.com>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"andrew@lunn.ch" <andrew@lunn.ch>,
"vivien.didelot@gmail.com" <vivien.didelot@gmail.com>,
"davem@davemloft.net" <davem@davemloft.net>,
Jiri Pirko <jiri@mellanox.com>,
"ilias.apalodimas@linaro.org" <ilias.apalodimas@linaro.org>,
"ivan.khoronzhuk@linaro.org" <ivan.khoronzhuk@linaro.org>,
"roopa@cumulusnetworks.com" <roopa@cumulusnetworks.com>,
"nikolay@cumulusnetworks.com" <nikolay@cumulusnetworks.com>,
Petr Machata <petrm@mellanox.com>
Subject: Re: [PATCH net-next v2 01/12] net: bridge: multicast: Propagate br_mc_disabled_update() return
Date: Sat, 2 Feb 2019 15:47:53 +0000 [thread overview]
Message-ID: <20190202154750.GA2864@splinter> (raw)
In-Reply-To: <061dca81-a5ed-1498-060a-1a7a0e0a1116@gmail.com>
On Thu, Jan 31, 2019 at 05:19:25PM -0800, Florian Fainelli wrote:
> On 1/30/19 11:50 PM, Ido Schimmel wrote:
> > On Wed, Jan 30, 2019 at 05:00:57PM -0800, Florian Fainelli wrote:
> >> On 1/29/19 11:36 PM, Ido Schimmel wrote:
> >>> On Tue, Jan 29, 2019 at 04:55:37PM -0800, Florian Fainelli wrote:
> >>>> -static void br_mc_disabled_update(struct net_device *dev, bool value)
> >>>> +static int br_mc_disabled_update(struct net_device *dev, bool value)
> >>>> {
> >>>> struct switchdev_attr attr = {
> >>>> .orig_dev = dev,
> >>>> .id = SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED,
> >>>> - .flags = SWITCHDEV_F_DEFER,
> >>>> + .flags = SWITCHDEV_F_DEFER | SWITCHDEV_F_SKIP_EOPNOTSUPP,
> >>>
> >>> Actually, since the operation is deferred I don't think the return value
> >>> from the driver is ever checked. Can you test it?
> >>
> >> You are right, you get a WARN() from switchdev_attr_port_set_now(), but
> >> this does not propagate back to the caller, so you can still create a
> >> bridge device and enslave a device successfully despite getting warnings
> >> on the console.
> >>
> >>>
> >>> I think it would be good to convert the attributes to use the switchdev
> >>> notifier like commit d17d9f5e5143 ("switchdev: Replace port obj add/del
> >>> SDO with a notification") did for objects. Then you can have your
> >>> listener veto the operation in the same context it is happening.
> >>
> >> Alright, working on it. Would you do that just for the attr_set, or for
> >> attr_get as well (to be symmetrical)?
> >
> > Yes, then we can get rid of switchdev_ops completely.
> >
>
> OK, so here is what I have so far:
>
> https://github.com/ffainelli/linux/pull/new/switchdev-attr
>
> although I am seeing some invalid context operations with DSA that I am
> debugging. Does this look like the right way to go from your perspective?
That was quick :)
I think I owe you some explanation as to why I even came up with the
idea. But before that, I have another idea how to solve your immediate
problem.
You can employ a similar trick to the one used to set bridge port flags
in br_switchdev_set_port_flag(). Like br_mc_disabled_update() it is also
called from an atomic context, so in order to allow drivers to veto
unsupported flags we introduced a new switchdev attribute:
'SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT'
The attribute is only used in get operations and never deferred. You can
introduce 'SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED_SUPPORT' and use it
before invoking 'SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED'.
Regarding the whole notifier business and switchdev in general. Using
the device chain to propagate various bridge port attributes is wrong.
We saw it multiple times in the past already. First with routes that
were converted to use notifiers because the switch needs to offload the
entire routing table and not only routes whose nexthop device is a
switch port. Then with FDB entries and recently also with VLANs in a
VLAN-aware bridge. See merge commit 02e1dbe402de ("Merge branch
'Pass-extack-to-SWITCHDEV_PORT_OBJ_ADD'") for more details.
This is also true for switchdev attributes since we might want to
support toggling of bridge port flags on a VXLAN device in the future.
For example, to allow selective flooding. Others might have more use
cases.
I want to use the opportunity to pick your brain (and others') about
more issues I see with switchdev and maybe reach some agreement and form
a plan. Just to be clear, it is not related to your patchset.
The prepare-commit model probably made sense in the beginning, but a few
years later I think we know better. At least in mlxsw we have multiple
places where we perform all the work in the prepare phase simply because
that without doing all the work we don't have a way to guarantee that
the commit phase will succeed. I'm not aware of other instances of this
model in the networking code, so I wonder why we need it in switchdev
and if we can simply remove it and simplify things.
Another issue is that I believe we can completely remove the switchdev
infrastructure as it basically boils down to bridge-specific notifiers.
If you look at where switchdev is actually used in the networking stack
while excluding the obvious suspects you get this:
$ git grep -i -n -e 'switchdev' -- 'net/*' ':!net/bridge/*' ':!net/dsa/*' ':!net/switchdev/'
net/8021q/vlan_dev.c:34:#include <net/switchdev.h>
net/Kconfig:240:source "net/switchdev/Kconfig"
net/Makefile:81:ifneq ($(CONFIG_NET_SWITCHDEV),)
net/Makefile:82:obj-y += switchdev/
net/core/net-sysfs.c:15:#include <net/switchdev.h>
net/core/net-sysfs.c:504: struct switchdev_attr attr = {
net/core/net-sysfs.c:506: .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
net/core/net-sysfs.c:507: .flags = SWITCHDEV_F_NO_RECURSE,
net/core/net-sysfs.c:510: ret = switchdev_port_attr_get(netdev, &attr);
net/core/rtnetlink.c:49:#include <net/switchdev.h>
net/core/rtnetlink.c:1150: struct switchdev_attr attr = {
net/core/rtnetlink.c:1152: .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
net/core/rtnetlink.c:1153: .flags = SWITCHDEV_F_NO_RECURSE,
net/core/rtnetlink.c:1156: err = switchdev_port_attr_get(dev, &attr);
net/core/skbuff.c:4925:#ifdef CONFIG_NET_SWITCHDEV
net/ipv4/ip_forward.c:72:#ifdef CONFIG_NET_SWITCHDEV
net/ipv4/ipmr.c:70:#include <net/switchdev.h>
net/ipv4/ipmr.c:841: struct switchdev_attr attr = {
net/ipv4/ipmr.c:842: .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
net/ipv4/ipmr.c:923: if (!switchdev_port_attr_get(dev, &attr)) {
net/ipv4/ipmr.c:1802:#ifdef CONFIG_NET_SWITCHDEV
net/ipv6/ip6_output.c:381:#ifdef CONFIG_NET_SWITCHDEV
These are all instances related to the use of parent ID. Why not add a
new ndo that will allow various users to query the parent ID of a
netdev? bond and team can return an error if their slaves don't all have
the same parent ID.
You then end up with basic constructs like notifiers and ndo invocations
and not with complex objects and attributes that are propagated via the
device chain with a prepare-commit model.
WDYT?
> --
> Florian
next prev parent reply other threads:[~2019-02-02 15:48 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-30 0:55 [PATCH net-next v2 00/12] net: dsa: management mode for bcm_sf2 Florian Fainelli
2019-01-30 0:55 ` [PATCH net-next v2 01/12] net: bridge: multicast: Propagate br_mc_disabled_update() return Florian Fainelli
2019-01-30 7:36 ` Ido Schimmel
2019-01-31 1:00 ` Florian Fainelli
2019-01-31 7:50 ` Ido Schimmel
2019-02-01 1:19 ` Florian Fainelli
2019-02-02 15:47 ` Ido Schimmel [this message]
2019-02-11 19:05 ` Florian Fainelli
2019-01-30 0:55 ` [PATCH net-next v2 02/12] net: dsa: b53: Fix default VLAN ID Florian Fainelli
2019-01-30 0:55 ` [PATCH net-next v2 03/12] net: dsa: b53: Properly account for VLAN filtering Florian Fainelli
2019-01-30 0:55 ` [PATCH net-next v2 04/12] net: systemport: Fix reception of BPDUs Florian Fainelli
2019-01-30 0:55 ` [PATCH net-next v2 05/12] net: dsa: b53: Define registers for IGMP snooping Florian Fainelli
2019-01-30 0:55 ` [PATCH net-next v2 06/12] net: dsa: b53: Add support for MDB Florian Fainelli
2019-01-30 0:55 ` [PATCH net-next v2 07/12] net: dsa: Add ability to program multicast filter for CPU port Florian Fainelli
2019-01-30 22:28 ` Vivien Didelot
2019-01-30 22:55 ` Florian Fainelli
2019-01-30 0:55 ` [PATCH net-next v2 08/12] net: dsa: Add ndo_vlan_rx_{add,kill}_vid implementation Florian Fainelli
2019-01-30 22:38 ` Vivien Didelot
2019-01-30 0:55 ` [PATCH net-next v2 09/12] net: dsa: Make VLAN filtering use DSA notifiers Florian Fainelli
2019-01-30 0:55 ` [PATCH net-next v2 10/12] net: dsa: Wire up multicast IGMP snooping attribute notification Florian Fainelli
2019-01-30 16:06 ` Andrew Lunn
2019-01-30 22:32 ` Florian Fainelli
2019-01-30 22:46 ` Andrew Lunn
2019-01-30 23:02 ` Florian Fainelli
2019-01-30 0:55 ` [PATCH net-next v2 11/12] net: dsa: b53: Add support for toggling IGMP snooping Florian Fainelli
2019-01-30 0:55 ` [PATCH net-next v2 12/12] net: dsa: bcm_sf2: Enable management mode Florian Fainelli
2019-01-30 7:38 ` [PATCH net-next v2 00/12] net: dsa: management mode for bcm_sf2 Ido Schimmel
2019-01-30 22:23 ` David Miller
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=20190202154750.GA2864@splinter \
--to=idosch@mellanox.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=ilias.apalodimas@linaro.org \
--cc=ivan.khoronzhuk@linaro.org \
--cc=jiri@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=nikolay@cumulusnetworks.com \
--cc=petrm@mellanox.com \
--cc=roopa@cumulusnetworks.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).