netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Ido Schimmel <idosch@mellanox.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 01/14] net: bridge: multicast: Propagate br_mc_disabled_update() return
Date: Thu, 17 Jan 2019 11:27:18 -0800	[thread overview]
Message-ID: <89a9019b-2adc-1806-c893-297e603a73c9@gmail.com> (raw)
In-Reply-To: <20190117134738.GA20176@splinter>

On 1/17/19 5:47 AM, Ido Schimmel wrote:
> On Wed, Jan 16, 2019 at 12:00:49PM -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 | 19 ++++++++++++++-----
>>  1 file changed, 14 insertions(+), 5 deletions(-)
>>
>> diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
>> index 3aeff0895669..09fc92541873 100644
>> --- a/net/bridge/br_multicast.c
>> +++ b/net/bridge/br_multicast.c
>> @@ -813,7 +813,7 @@ 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,
>> @@ -822,11 +822,13 @@ static void br_mc_disabled_update(struct net_device *dev, bool value)
>>  		.u.mc_disabled = !value,
>>  	};
>>  
>> -	switchdev_port_attr_set(dev, &attr);
>> +	return switchdev_port_attr_set(dev, &attr);
> 
> Did you test this for veth? If switchdev ops are not defined, this
> returns -EOPNOTSUPP. See __br_vlan_filter_toggle() for reference

I did not, good catch, I will add a check on -EOPNOTSUPP and silence
that error code:

if (err && err != -ENOTSUPP)
	return err;

> 
>>  }
>>  
>>  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;
>>  
>>  	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;
> 
> You never return the error

Huh, indeed, thanks!
-- 
Florian

  reply	other threads:[~2019-01-17 19:27 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-16 20:00 [PATCH net-next 00/14] net: dsa: management mode for bcm_sf2 Florian Fainelli
2019-01-16 20:00 ` [PATCH net-next 01/14] net: bridge: multicast: Propagate br_mc_disabled_update() return Florian Fainelli
2019-01-17 13:47   ` Ido Schimmel
2019-01-17 19:27     ` Florian Fainelli [this message]
2019-01-16 20:00 ` [PATCH net-next 02/14] net: dsa: b53: Fix default VLAN ID Florian Fainelli
2019-01-16 20:00 ` [PATCH net-next 03/14] net: dsa: b53: Properly account for VLAN filtering Florian Fainelli
2019-01-17 16:36   ` Vivien Didelot
2019-01-17 17:48     ` Florian Fainelli
2019-01-17 18:47       ` Vivien Didelot
2019-01-17 19:06         ` Florian Fainelli
2019-01-16 20:00 ` [PATCH net-next 04/14] net: systemport: Fix reception of BPDUs Florian Fainelli
2019-01-16 20:00 ` [PATCH net-next 05/14] net: dsa: b53: Define registers for IGMP snooping Florian Fainelli
2019-01-16 20:00 ` [PATCH net-next 06/14] net: dsa: b53: Add support for MDB Florian Fainelli
2019-01-16 20:00 ` [PATCH net-next 07/14] net: dsa: Add ability to program multicast filter for CPU port Florian Fainelli
2019-01-16 20:00 ` [PATCH net-next 08/14] net: dsa: Add ndo_vlan_rx_{add,kill}_vid implementation Florian Fainelli
2019-01-16 20:00 ` [PATCH net-next 09/14] net: bridge: Propagate MC addresses with VID through switchdev Florian Fainelli
2019-01-17 14:05   ` Ido Schimmel
2019-01-17 19:17     ` Florian Fainelli
2019-01-18 10:43       ` Ido Schimmel
2019-01-18 11:41       ` Ido Schimmel
2019-01-18 21:48         ` Florian Fainelli
2019-01-19 13:55           ` Ido Schimmel
2019-01-20  3:22             ` Florian Fainelli
2019-01-21  8:41               ` Ido Schimmel
2019-01-21  8:46         ` Jiri Pirko
2019-01-16 20:00 ` [PATCH net-next 10/14] net: vlan: " Florian Fainelli
2019-01-17 14:49   ` Ido Schimmel
2019-01-17 19:12     ` Florian Fainelli
2019-01-21  9:13       ` Ido Schimmel
2019-01-21  9:17         ` Ilias Apalodimas
2019-01-22 11:30         ` Ivan Khoronzhuk
2019-01-22 11:39       ` Ivan Khoronzhuk
2019-01-16 20:00 ` [PATCH net-next 11/14] net: dsa: Make VLAN filtering use DSA notifiers Florian Fainelli
2019-01-16 20:01 ` [PATCH net-next 12/14] net: dsa: Wire up multicast IGMP snooping attribute notification Florian Fainelli
2019-01-17 18:36   ` Vivien Didelot
2019-01-17 19:07     ` Florian Fainelli
2019-01-16 20:01 ` [PATCH net-next 13/14] net: dsa: b53: Add support for toggling IGMP snooping Florian Fainelli
2019-01-16 20:01 ` [PATCH net-next 14/14] net: dsa: bcm_sf2: Enable management mode Florian Fainelli

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=89a9019b-2adc-1806-c893-297e603a73c9@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=idosch@mellanox.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 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).