netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Arkadi Sharshevsky <arkadis@mellanox.com>, netdev@vger.kernel.org
Cc: davem@davemloft.net, jiri@resnulli.us, ivecera@redhat.com,
	andrew@lunn.ch, vivien.didelot@savoirfairelinux.com,
	Woojung.Huh@microchip.com, stephen@networkplumber.org,
	mlxsw@mellanox.com
Subject: Re: [PATCH net-next RFC 04/12] net: dsa: Add ordered workqueue
Date: Wed, 5 Jul 2017 12:37:06 -0700	[thread overview]
Message-ID: <6db9cee1-8f2c-e086-55e6-d70b69c3824e@gmail.com> (raw)
In-Reply-To: <1499268990-19251-5-git-send-email-arkadis@mellanox.com>

On 07/05/2017 08:36 AM, Arkadi Sharshevsky wrote:
> This workqueue will be used for FDB add/del processing. It should
> be destroyed after all devices unregistered successfully.
> 
> Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
> ---
>  include/net/dsa.h |  1 +
>  net/dsa/dsa.c     | 13 +++++++++++++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/include/net/dsa.h b/include/net/dsa.h
> index f054d41..4835b0e 100644
> --- a/include/net/dsa.h
> +++ b/include/net/dsa.h
> @@ -451,6 +451,7 @@ void unregister_switch_driver(struct dsa_switch_driver *type);
>  struct mii_bus *dsa_host_dev_to_mii_bus(struct device *dev);
>  
>  struct net_device *dsa_dev_to_net_device(struct device *dev);
> +bool dsa_schedule_work(struct work_struct *work);

I'd move this to dsa_priv.h in net/dsa/ because it is not supposed to be
used by DSA drivers.

You may also consider squashing this into the next patch since in itself
it's not used just yet.

>  
>  /* Keep inline for faster access in hot path */
>  static inline bool netdev_uses_dsa(struct net_device *dev)
> diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
> index 416ac4e..9abe6dc 100644
> --- a/net/dsa/dsa.c
> +++ b/net/dsa/dsa.c
> @@ -271,10 +271,22 @@ static struct packet_type dsa_pack_type __read_mostly = {
>  	.func	= dsa_switch_rcv,
>  };
>  
> +static struct workqueue_struct *dsa_owq;
> +
> +bool dsa_schedule_work(struct work_struct *work)
> +{
> +	return queue_work(dsa_owq, work);
> +}
> +
>  static int __init dsa_init_module(void)
>  {
>  	int rc;
>  
> +	dsa_owq = alloc_ordered_workqueue("dsa_ordered",
> +					  WQ_MEM_RECLAIM);
> +	if (!dsa_owq)
> +		return -ENOMEM;
> +
>  	rc = dsa_slave_register_notifier();
>  	if (rc)
>  		return rc;
> @@ -294,6 +306,7 @@ static void __exit dsa_cleanup_module(void)
>  	dsa_slave_unregister_notifier();
>  	dev_remove_pack(&dsa_pack_type);
>  	dsa_legacy_unregister();
> +	destroy_workqueue(dsa_owq);
>  }
>  module_exit(dsa_cleanup_module);
>  
> 


-- 
Florian

  reply	other threads:[~2017-07-05 19:37 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-05 15:36 [PATCH net-next RFC 00/12] Change DSA's FDB API and perform switchdev cleanup Arkadi Sharshevsky
2017-07-05 15:36 ` [PATCH net-next RFC 01/12] net: dsa: Change DSA slave FDB API to be switchdev independent Arkadi Sharshevsky
2017-07-05 19:13   ` Florian Fainelli
2017-07-05 15:36 ` [PATCH net-next RFC 02/12] net: dsa: Remove prepare phase for FDB Arkadi Sharshevsky
2017-07-05 19:25   ` Florian Fainelli
2017-07-06 18:20   ` Vivien Didelot
2017-07-05 15:36 ` [PATCH net-next RFC 03/12] net: dsa: Remove switchdev dependency from DSA switch notifier chain Arkadi Sharshevsky
2017-07-05 19:26   ` Florian Fainelli
2017-07-06 18:42   ` Vivien Didelot
2017-07-05 15:36 ` [PATCH net-next RFC 04/12] net: dsa: Add ordered workqueue Arkadi Sharshevsky
2017-07-05 19:37   ` Florian Fainelli [this message]
2017-07-06 18:45     ` Vivien Didelot
2017-07-09 12:56       ` Arkadi Sharshevsky
2017-07-05 15:36 ` [PATCH net-next RFC 05/12] net: dsa: Add support for learning FDB through notification Arkadi Sharshevsky
2017-07-05 19:35   ` Florian Fainelli
2017-07-06 13:04     ` Arkadi Sharshevsky
2017-07-10 20:59       ` Vivien Didelot
2017-07-11 10:26         ` Arkadi Sharshevsky
2017-07-11 15:05           ` Nikolay Aleksandrov
2017-07-12 11:23             ` Arkadi Sharshevsky
2017-07-12 11:42               ` Nikolay Aleksandrov
2017-07-05 15:36 ` [PATCH net-next RFC 06/12] net: dsa: Remove support for FDB add/del via SELF Arkadi Sharshevsky
2017-07-05 15:36 ` [PATCH net-next RFC 07/12] net: dsa: Add support for querying supported bridge flags Arkadi Sharshevsky
2017-07-05 15:36 ` [PATCH net-next RFC 08/12] net: dsa: Remove support for bypass bridge port attributes/vlan set Arkadi Sharshevsky
2017-07-05 19:45   ` Florian Fainelli
2017-07-06 11:00     ` Arkadi Sharshevsky
2017-07-06 21:36       ` Florian Fainelli
2017-07-09 13:56         ` Arkadi Sharshevsky
2017-07-10 17:13     ` Vivien Didelot
2017-07-05 15:36 ` [PATCH net-next RFC 09/12] net: dsa: Remove redundant MDB dump support Arkadi Sharshevsky
2017-07-05 15:36 ` [PATCH net-next RFC 10/12] net: dsa: Move FDB dump implementation inside DSA Arkadi Sharshevsky
2017-07-10 19:36   ` Vivien Didelot
2017-07-11  8:32     ` Arkadi Sharshevsky
2017-07-05 15:36 ` [PATCH net-next RFC 11/12] net: bridge: Remove FDB deletion through switchdev object Arkadi Sharshevsky
2017-07-05 15:36 ` [PATCH net-next RFC 12/12] net: switchdev: Remove bridge bypass support from switchdev Arkadi Sharshevsky

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=6db9cee1-8f2c-e086-55e6-d70b69c3824e@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=Woojung.Huh@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=arkadis@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=ivecera@redhat.com \
    --cc=jiri@resnulli.us \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=vivien.didelot@savoirfairelinux.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).