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>
Subject: Re: [PATCH net-next v2 01/12] net: bridge: multicast: Propagate br_mc_disabled_update() return
Date: Wed, 30 Jan 2019 07:36:59 +0000 [thread overview]
Message-ID: <20190130073656.GA22227@splinter> (raw)
In-Reply-To: <20190130005548.2212-2-f.fainelli@gmail.com>
On Tue, Jan 29, 2019 at 04:55:37PM -0800, Florian Fainelli wrote:
> Some Ethernet switches might not be able to support disabling multicast
> flooding globally when e.g: several bridges span the same physical
> device, propagate the return value of br_mc_disabled_update() such that
> this propagates correctly to user-space.
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> net/bridge/br_multicast.c | 23 ++++++++++++++++-------
> 1 file changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
> index 3aeff0895669..aff5e003d34f 100644
> --- a/net/bridge/br_multicast.c
> +++ b/net/bridge/br_multicast.c
> @@ -813,20 +813,22 @@ static void br_ip6_multicast_port_query_expired(struct timer_list *t)
> }
> #endif
>
> -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?
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.
> .u.mc_disabled = !value,
> };
>
> - switchdev_port_attr_set(dev, &attr);
> + return switchdev_port_attr_set(dev, &attr);
> }
>
> int br_multicast_add_port(struct net_bridge_port *port)
> {
> + int ret;
> +
> port->multicast_router = MDB_RTR_TYPE_TEMP_QUERY;
>
> timer_setup(&port->multicast_router_timer,
> @@ -837,8 +839,11 @@ int br_multicast_add_port(struct net_bridge_port *port)
> timer_setup(&port->ip6_own_query.timer,
> br_ip6_multicast_port_query_expired, 0);
> #endif
> - br_mc_disabled_update(port->dev,
> - br_opt_get(port->br, BROPT_MULTICAST_ENABLED));
> + ret = br_mc_disabled_update(port->dev,
> + br_opt_get(port->br,
> + BROPT_MULTICAST_ENABLED));
> + if (ret)
> + return ret;
>
> port->mcast_stats = netdev_alloc_pcpu_stats(struct bridge_mcast_stats);
> if (!port->mcast_stats)
> @@ -1937,12 +1942,16 @@ static void br_multicast_start_querier(struct net_bridge *br,
> int br_multicast_toggle(struct net_bridge *br, unsigned long val)
> {
> struct net_bridge_port *port;
> + int err = 0;
>
> spin_lock_bh(&br->multicast_lock);
> if (!!br_opt_get(br, BROPT_MULTICAST_ENABLED) == !!val)
> goto unlock;
>
> - br_mc_disabled_update(br->dev, val);
> + err = br_mc_disabled_update(br->dev, val);
> + if (err)
> + goto unlock;
> +
> br_opt_toggle(br, BROPT_MULTICAST_ENABLED, !!val);
> if (!br_opt_get(br, BROPT_MULTICAST_ENABLED))
> goto unlock;
> @@ -1957,7 +1966,7 @@ int br_multicast_toggle(struct net_bridge *br, unsigned long val)
> unlock:
> spin_unlock_bh(&br->multicast_lock);
>
> - return 0;
> + return err;
> }
>
> bool br_multicast_enabled(const struct net_device *dev)
> --
> 2.17.1
>
next prev parent reply other threads:[~2019-01-30 7:37 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 [this message]
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
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=20190130073656.GA22227@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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.