mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yevhen Orlov <yevhen.orlov@plvision.eu>
To: netdev@vger.kernel.org
Cc: Volodymyr Mytnyk <volodymyr.mytnyk@plvision.eu>,
	Taras Chornyi <taras.chornyi@plvision.eu>,
	Mickey Rachamim <mickeyr@marvell.com>,
	Serhiy Pshyk <serhiy.pshyk@plvision.eu>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Stephen Hemminger <stephen@networkplumber.org>,
	linux-kernel@vger.kernel.org,
	Yevhen Orlov <yevhen.orlov@plvision.eu>,
	Taras Chornyi <tchornyi@marvell.com>,
	Oleksandr Mazur <oleksandr.mazur@plvision.eu>
Subject: [PATCH net-next v3 4/9] net: marvell: prestera: add delayed wq and flush wq on deinit
Date: Tue, 23 Aug 2022 03:10:42 +0300	[thread overview]
Message-ID: <20220823001047.24784-5-yevhen.orlov@plvision.eu> (raw)
In-Reply-To: <20220823001047.24784-1-yevhen.orlov@plvision.eu>

Flushing workqueues ensures, that no more pending works, related to just
unregistered or deinitialized notifiers. After that we can free memory.

Delayed wq will be used for neighbours in next patches.

Co-developed-by: Taras Chornyi <tchornyi@marvell.com>
Signed-off-by: Taras Chornyi <tchornyi@marvell.com>
Co-developed-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
Signed-off-by: Yevhen Orlov <yevhen.orlov@plvision.eu>
---
 drivers/net/ethernet/marvell/prestera/prestera.h      |  2 ++
 drivers/net/ethernet/marvell/prestera/prestera_main.c | 11 +++++++++++
 .../net/ethernet/marvell/prestera/prestera_router.c   |  1 +
 3 files changed, 14 insertions(+)

diff --git a/drivers/net/ethernet/marvell/prestera/prestera.h b/drivers/net/ethernet/marvell/prestera/prestera.h
index 2994e0a6e5ec..a3a112f5c09e 100644
--- a/drivers/net/ethernet/marvell/prestera/prestera.h
+++ b/drivers/net/ethernet/marvell/prestera/prestera.h
@@ -357,6 +357,8 @@ int prestera_port_cfg_mac_write(struct prestera_port *port,
 struct prestera_port *prestera_port_dev_lower_find(struct net_device *dev);
 
 void prestera_queue_work(struct work_struct *work);
+void prestera_queue_delayed_work(struct delayed_work *work, unsigned long delay);
+void prestera_queue_drain(void);
 
 int prestera_port_learning_set(struct prestera_port *port, bool learn_enable);
 int prestera_port_uc_flood_set(struct prestera_port *port, bool flood);
diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c
index ea5bd5069826..ad50b9618535 100644
--- a/drivers/net/ethernet/marvell/prestera/prestera_main.c
+++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c
@@ -35,6 +35,17 @@ void prestera_queue_work(struct work_struct *work)
 	queue_work(prestera_owq, work);
 }
 
+void prestera_queue_delayed_work(struct delayed_work *work, unsigned long delay)
+{
+	queue_delayed_work(prestera_wq, work, delay);
+}
+
+void prestera_queue_drain(void)
+{
+	drain_workqueue(prestera_wq);
+	drain_workqueue(prestera_owq);
+}
+
 int prestera_port_learning_set(struct prestera_port *port, bool learn)
 {
 	return prestera_hw_port_learning_set(port, learn);
diff --git a/drivers/net/ethernet/marvell/prestera/prestera_router.c b/drivers/net/ethernet/marvell/prestera/prestera_router.c
index 41955c7f8323..db327ab4a072 100644
--- a/drivers/net/ethernet/marvell/prestera/prestera_router.c
+++ b/drivers/net/ethernet/marvell/prestera/prestera_router.c
@@ -643,6 +643,7 @@ void prestera_router_fini(struct prestera_switch *sw)
 	unregister_fib_notifier(&init_net, &sw->router->fib_nb);
 	unregister_inetaddr_notifier(&sw->router->inetaddr_nb);
 	unregister_inetaddr_validator_notifier(&sw->router->inetaddr_valid_nb);
+	prestera_queue_drain();
 
 	prestera_k_arb_abort(sw);
 
-- 
2.17.1


  parent reply	other threads:[~2022-08-23  0:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-23  0:10 [PATCH net-next v3 0/9] net: marvell: prestera: add nexthop routes offloading Yevhen Orlov
2022-08-23  0:10 ` [PATCH net-next v3 1/9] net: marvell: prestera: Add router nexthops ABI Yevhen Orlov
2022-08-23  0:10 ` [PATCH net-next v3 2/9] net: marvell: prestera: Add cleanup of allocated fib_nodes Yevhen Orlov
2022-08-23  0:10 ` [PATCH net-next v3 3/9] net: marvell: prestera: Add strict cleanup of fib arbiter Yevhen Orlov
2022-08-23  0:10 ` Yevhen Orlov [this message]
2022-08-23  0:10 ` [PATCH net-next v3 5/9] net: marvell: prestera: Add length macros for prestera_ip_addr Yevhen Orlov
2022-08-23  0:10 ` [PATCH net-next v3 6/9] net: marvell: prestera: Add heplers to interact with fib_notifier_info Yevhen Orlov
2022-08-23  0:10 ` [PATCH net-next v3 7/9] net: marvell: prestera: add stub handler neighbour events Yevhen Orlov
2022-08-23  0:10 ` [PATCH net-next v3 8/9] net: marvell: prestera: Add neighbour cache accounting Yevhen Orlov
2022-08-23  0:10 ` [PATCH net-next v3 9/9] net: marvell: prestera: Propogate nh state from hw to kernel Yevhen Orlov
2022-08-23  1:45 ` [PATCH net-next v3 0/9] net: marvell: prestera: add nexthop routes offloading Jakub Kicinski

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=20220823001047.24784-5-yevhen.orlov@plvision.eu \
    --to=yevhen.orlov@plvision.eu \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mickeyr@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=oleksandr.mazur@plvision.eu \
    --cc=pabeni@redhat.com \
    --cc=serhiy.pshyk@plvision.eu \
    --cc=stephen@networkplumber.org \
    --cc=taras.chornyi@plvision.eu \
    --cc=tchornyi@marvell.com \
    --cc=volodymyr.mytnyk@plvision.eu \
    /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

all inboxes | Powered by JetHome®