public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@mellanox•com>
To: John Fastabend <john.fastabend@gmail•com>
Cc: Jiri Pirko <jiri@resnulli•us>, <netdev@vger•kernel.org>,
	<davem@davemloft•net>, <eladr@mellanox•com>,
	<yotamg@mellanox•com>, <ogerlitz@mellanox•com>,
	<j.vosburgh@gmail•com>, <vfalico@gmail•com>,
	<gospo@cumulusnetworks•com>, <dsa@cumulusnetworks•com>,
	<nikolay@cumulusnetworks•com>, <pjonnala@broadcom•com>,
	<f.fainelli@gmail•com>, <sfeldma@gmail•com>,
	<roopa@cumulusnetworks•com>, <andrew@lunn•ch>
Subject: Re: [patch net-next v2 01/28] net: dev: Check CHANGEUPPER notifier return value
Date: Thu, 3 Dec 2015 10:25:00 +0200	[thread overview]
Message-ID: <20151203082500.GB3075@colbert.mtl.com> (raw)
In-Reply-To: <565F7CD2.2080207@gmail.com>

Thu, Dec 03, 2015 at 01:20:50AM IST, john.fastabend@gmail•com wrote:
>On 15-12-02 12:07 PM, Jiri Pirko wrote:
>> From: Ido Schimmel <idosch@mellanox•com>
>> 
>> switchdev drivers reflect the newly requested topology to hardware when
>> CHANGEUPPER is received, after software links were already formed.
>> However, the operation can fail and user will not be notified, as the
>> return value of the notifier is not checked.
>> 
>> Add this check and rollback software links if necessary.
>> 
>> Signed-off-by: Ido Schimmel <idosch@mellanox•com>
>> Signed-off-by: Jiri Pirko <jiri@mellanox•com>
>> ---
>> v1->v2:
>> -new patch
>> ---
>>  net/core/dev.c | 7 +++++--
>>  1 file changed, 5 insertions(+), 2 deletions(-)
>> 
>> diff --git a/net/core/dev.c b/net/core/dev.c
>> index 5df6cbc..df33f82 100644
>> --- a/net/core/dev.c
>> +++ b/net/core/dev.c
>> @@ -5490,8 +5490,11 @@ static int __netdev_upper_dev_link(struct net_device *dev,
>>  			goto rollback_lower_mesh;
>>  	}
>>  
>> -	call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev,
>> -				      &changeupper_info.info);
>> +	ret = call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev,
>> +					    &changeupper_info.info);
>> +	if (ret)
>> +		goto rollback_lower_mesh;
>> +
>
>hmm small nit (take it or leave it) but I think it would be more
>correct if this was
>
>	if (ret == NOTIFY_BAD)
>		goto rollback_lower_mesh;
>
>It seems that NOTIFY_DONE, NOTIFY_OK and NOTIFY_STOP_MASK would be
>valid return codes that don't indicate an error. However seeing I
>couldn't find any cases of NOTIFY_OK/NOTIFY_STOP_MASK from the
>CHANGEUPPER event it doesn't matter in practice.
>

Hi,

It's actually not a small nit. I forgot to call 'notifier_to_errno' and
then check its retrun value instead that of the notifier. This would
return 0 for NOTIFY_{DONE,OK,STOP_MASK} and -1 for NOTIFY_BAD.

Thank you.

>Thanks,
>John
>
>>  	return 0;
>>  
>>  rollback_lower_mesh:
>> 
>

  parent reply	other threads:[~2015-12-03  8:25 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-02 20:07 [patch net-next v2 00/28] bonding/team offload + mlxsw implementation Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 01/28] net: dev: Check CHANGEUPPER notifier return value Jiri Pirko
2015-12-02 20:23   ` Nikolay Aleksandrov
2015-12-02 23:20   ` John Fastabend
2015-12-03  6:37     ` Or Gerlitz
2015-12-03  8:25     ` Ido Schimmel [this message]
2015-12-02 20:07 ` [patch net-next v2 02/28] net: Add support for CHANGEUPPER notifier error injection Jiri Pirko
2015-12-02 20:23   ` Nikolay Aleksandrov
2015-12-02 20:07 ` [patch net-next v2 03/28] bonding: add 802.3ad support for 100G speeds Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 04/28] net: add netif_is_team_master helper Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 05/28] net: add netif_is_team_port helper Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 06/28] net: add netif_is_lag_master helper Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 07/28] net: add netif_is_lag_port helper Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 08/28] net: propagate upper priv via netdev_master_upper_dev_link Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 09/28] net: add possibility to pass information about upper device via notifier Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 10/28] net: add info struct for LAG changeupper Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 11/28] team: fill-up LAG changeupper info struct and pass it along Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 12/28] bonding: " Jiri Pirko
2015-12-02 20:27   ` Nikolay Aleksandrov
2015-12-02 20:07 ` [patch net-next v2 13/28] net: introduce change lower state notifier Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 14/28] net: introduce lower state changed info structure for LAG lowers Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 15/28] team: rtnl_lock for options set Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 16/28] team: implement lower state change propagation Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 17/28] bonding: allow notifications for bond_set_slave_link_state Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 18/28] bonding: implement lower state change propagation Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 19/28] bonding: set inactive flags on release Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 20/28] mlxsw: spectrum: Add set_rx_mode ndo stub Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 21/28] mlxsw: core: Add support for packets received from LAG port Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 22/28] mlxsw: pci: Implement LAG processing for received packets Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 23/28] mlxsw: reg: Add link aggregation configuration registers definitions Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 24/28] mlxsw: reg: Add definition of LAG unicast record for SFD register Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 25/28] mlxsw: reg: Add definition of LAG unicast record for SFN register Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 26/28] mlxsw: spectrum: Implement LAG port join/leave Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 27/28] mlxsw: spectrum: Implement FDB add/remove/dump for LAG Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 28/28] mlxsw: spectrum: Implement LAG tx enabled lower state change Jiri Pirko
2015-12-02 22:53 ` [patch net-next v2 00/28] bonding/team offload + mlxsw implementation Jiri Pirko
2015-12-02 23:38   ` David Miller
2015-12-03  8:21     ` Jiri Pirko

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=20151203082500.GB3075@colbert.mtl.com \
    --to=idosch@mellanox$(echo .)com \
    --cc=andrew@lunn$(echo .)ch \
    --cc=davem@davemloft$(echo .)net \
    --cc=dsa@cumulusnetworks$(echo .)com \
    --cc=eladr@mellanox$(echo .)com \
    --cc=f.fainelli@gmail$(echo .)com \
    --cc=gospo@cumulusnetworks$(echo .)com \
    --cc=j.vosburgh@gmail$(echo .)com \
    --cc=jiri@resnulli$(echo .)us \
    --cc=john.fastabend@gmail$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=nikolay@cumulusnetworks$(echo .)com \
    --cc=ogerlitz@mellanox$(echo .)com \
    --cc=pjonnala@broadcom$(echo .)com \
    --cc=roopa@cumulusnetworks$(echo .)com \
    --cc=sfeldma@gmail$(echo .)com \
    --cc=vfalico@gmail$(echo .)com \
    --cc=yotamg@mellanox$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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