netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivan Vecera <ivecera@redhat.com>
To: Jiri Pirko <jiri@resnulli.us>, netdev@vger.kernel.org
Cc: davem@davemloft.net, idosch@mellanox.com, arkadis@mellanox.com,
	mlxsw@mellanox.com, roopa@cumulusnetworks.com,
	stephen@networkplumber.org, nikolay@cumulusnetworks.com
Subject: Re: [patch net-next v2 04/19] net: switchdev: Change notifier chain to be atomic
Date: Thu, 8 Jun 2017 11:30:39 +0200	[thread overview]
Message-ID: <6ca77a33-9c7c-6fbf-c6a0-3483cbc4f6e1@redhat.com> (raw)
In-Reply-To: <20170608064428.4785-5-jiri@resnulli.us>

On 8.6.2017 08:44, Jiri Pirko wrote:
> From: Arkadi Sharshevsky <arkadis@mellanox.com>
> 
> In order to use the switchdev notifier chain for FDB sync with the
> device it has to be changed to atomic. The is done because the bridge
> can learn new FDBs in atomic context.
> 
> Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
> Reviewed-by: Ido Schimmel <idosch@mellanox.com>
> Reviewed-by: Ivan Vecera <ivecera@redhat.com>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> ---
>  net/switchdev/switchdev.c | 30 ++++++------------------------
>  1 file changed, 6 insertions(+), 24 deletions(-)
> 
> diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
> index 8d40a7d..25dc67e 100644
> --- a/net/switchdev/switchdev.c
> +++ b/net/switchdev/switchdev.c
> @@ -571,24 +571,17 @@ int switchdev_port_obj_dump(struct net_device *dev, struct switchdev_obj *obj,
>  }
>  EXPORT_SYMBOL_GPL(switchdev_port_obj_dump);
>  
> -static RAW_NOTIFIER_HEAD(switchdev_notif_chain);
> +static ATOMIC_NOTIFIER_HEAD(switchdev_notif_chain);
>  
>  /**
>   *	register_switchdev_notifier - Register notifier
>   *	@nb: notifier_block
>   *
> - *	Register switch device notifier. This should be used by code
> - *	which needs to monitor events happening in particular device.
> - *	Return values are same as for atomic_notifier_chain_register().
> + *	Register switch device notifier.
>   */
>  int register_switchdev_notifier(struct notifier_block *nb)
>  {
> -	int err;
> -
> -	rtnl_lock();
> -	err = raw_notifier_chain_register(&switchdev_notif_chain, nb);
> -	rtnl_unlock();
> -	return err;
> +	return atomic_notifier_chain_register(&switchdev_notif_chain, nb);
>  }
>  EXPORT_SYMBOL_GPL(register_switchdev_notifier);
>  
> @@ -597,16 +590,10 @@ EXPORT_SYMBOL_GPL(register_switchdev_notifier);
>   *	@nb: notifier_block
>   *
>   *	Unregister switch device notifier.
> - *	Return values are same as for atomic_notifier_chain_unregister().
>   */
>  int unregister_switchdev_notifier(struct notifier_block *nb)
>  {
> -	int err;
> -
> -	rtnl_lock();
> -	err = raw_notifier_chain_unregister(&switchdev_notif_chain, nb);
> -	rtnl_unlock();
> -	return err;
> +	return atomic_notifier_chain_unregister(&switchdev_notif_chain, nb);
>  }
>  EXPORT_SYMBOL_GPL(unregister_switchdev_notifier);
>  
> @@ -616,18 +603,13 @@ EXPORT_SYMBOL_GPL(unregister_switchdev_notifier);
>   *	@dev: port device
>   *	@info: notifier information data
>   *
> - *	Call all network notifier blocks. This should be called by driver
> - *	when it needs to propagate hardware event.
> - *	Return values are same as for atomic_notifier_call_chain().
> - *	rtnl_lock must be held.
> + *	Call all network notifier blocks.
>   */
>  int call_switchdev_notifiers(unsigned long val, struct net_device *dev,
>  			     struct switchdev_notifier_info *info)
>  {
> -	ASSERT_RTNL();
> -
>  	info->dev = dev;
> -	return raw_notifier_call_chain(&switchdev_notif_chain, val, info);
> +	return atomic_notifier_call_chain(&switchdev_notif_chain, val, info);
>  }
>  EXPORT_SYMBOL_GPL(call_switchdev_notifiers);
>  
> 

Reviewed-by: Ivan Vecera <ivecera@redhat.com>

  reply	other threads:[~2017-06-08  9:30 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-08  6:44 [patch net-next v2 00/19] Remove support from bridge bypass for mlxsw/rocker drivers Jiri Pirko
2017-06-08  6:44 ` [patch net-next v2 01/19] net: switchdev: Add support for querying supported bridge flags by hardware Jiri Pirko
2017-06-08  9:30   ` Ivan Vecera
2017-06-08  6:44 ` [patch net-next v2 02/19] net: bridge: Add support for offloading port attributes Jiri Pirko
2017-06-08  9:24   ` Nikolay Aleksandrov
2017-06-08  9:29   ` Ivan Vecera
2017-06-08  6:44 ` [patch net-next v2 03/19] net: bridge: Add support for calling FDB external learning under rcu Jiri Pirko
2017-06-08  6:44 ` [patch net-next v2 04/19] net: switchdev: Change notifier chain to be atomic Jiri Pirko
2017-06-08  9:30   ` Ivan Vecera [this message]
2017-06-08  6:44 ` [patch net-next v2 05/19] net: bridge: Add support for notifying devices about FDB add/del Jiri Pirko
2017-06-08  9:25   ` Nikolay Aleksandrov
2017-06-08  9:30   ` Ivan Vecera
2017-06-08  6:44 ` [patch net-next v2 06/19] net: bridge: Receive notification about successful FDB offload Jiri Pirko
2017-06-08  6:44 ` [patch net-next v2 07/19] mlxsw: spectrum: Remove support for bridge FDB learning sync Jiri Pirko
2017-06-08  6:44 ` [patch net-next v2 08/19] mlxsw: spectrum_switchdev: Add support for querying supported bridge flags Jiri Pirko
2017-06-08  6:44 ` [patch net-next v2 09/19] mlxsw: spectrum: Remove support for bypass bridge port attributes/vlan set Jiri Pirko
2017-06-08  6:44 ` [patch net-next v2 10/19] mlxsw: spectrum_switchdev: Change switchdev notifier API Jiri Pirko
2017-06-08  6:44 ` [patch net-next v2 11/19] mlxsw: spectrum_switchdev: Add support for learning FDB through notification Jiri Pirko
2017-06-08  6:44 ` [patch net-next v2 12/19] mlxsw: spectrum: Remove support for bridge bypass FDB add/del Jiri Pirko
2017-06-08  6:44 ` [patch net-next v2 13/19] net: Remove support for bridge bypass ndos from stacked devices Jiri Pirko
2017-06-08  6:44 ` [patch net-next v2 14/19] rocker: Remove support for bridge FDB learning sync Jiri Pirko
2017-06-08  6:44 ` [patch net-next v2 15/19] rocker: Add support for querying supported bridge flags Jiri Pirko
2017-06-08  6:44 ` [patch net-next v2 16/19] rocker: Change world_ops API and implementation to be switchdev independant Jiri Pirko
2017-06-08  6:44 ` [patch net-next v2 17/19] rocker: Add support for learning FDB through notification Jiri Pirko
2017-06-08  6:44 ` [patch net-next v2 18/19] rocker: Remove support for bypass bridge port attributes/vlan set Jiri Pirko
2017-06-08  6:44 ` [patch net-next v2 19/19] rocker: Remove support bridge bypass FDB Jiri Pirko
2017-06-08 18:17 ` [patch net-next v2 00/19] Remove support from bridge bypass for mlxsw/rocker drivers 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=6ca77a33-9c7c-6fbf-c6a0-3483cbc4f6e1@redhat.com \
    --to=ivecera@redhat.com \
    --cc=arkadis@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=idosch@mellanox.com \
    --cc=jiri@resnulli.us \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@cumulusnetworks.com \
    --cc=roopa@cumulusnetworks.com \
    --cc=stephen@networkplumber.org \
    /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).