netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Gavi Teitz <gavi@mellanox.com>, Roi Dayan <roid@mellanox.com>,
	Vlad Buslov <vladbu@mellanox.com>,
	Saeed Mahameed <saeedm@mellanox.com>
Subject: [net-next 16/16] net/mlx5: Fix the order of fc_stats cleanup
Date: Thu, 15 Aug 2019 19:10:17 +0000	[thread overview]
Message-ID: <20190815190911.12050-17-saeedm@mellanox.com> (raw)
In-Reply-To: <20190815190911.12050-1-saeedm@mellanox.com>

From: Gavi Teitz <gavi@mellanox.com>

Previously, mlx5_cleanup_fc_stats() would cleanup the flow counter
pool beofre releasing all the counters to it, which would result in
flow counter bulks not getting freed. Resolve this by changing the
order in which elements of fc_stats are cleaned up, so that the flow
counter pool is cleaned up after all the counters are released.

Also move cleanup actions for freeing the bulk query memory and
destroying the idr to the end of mlx5_cleanup_fc_stats().

Signed-off-by: Gavi Teitz <gavi@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Vlad Buslov <vladbu@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c
index 1804cf3c3814..ab69effb056d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c
@@ -402,21 +402,20 @@ void mlx5_cleanup_fc_stats(struct mlx5_core_dev *dev)
 	struct mlx5_fc *counter;
 	struct mlx5_fc *tmp;
 
-	mlx5_fc_pool_cleanup(&fc_stats->fc_pool);
 	cancel_delayed_work_sync(&dev->priv.fc_stats.work);
 	destroy_workqueue(dev->priv.fc_stats.wq);
 	dev->priv.fc_stats.wq = NULL;
 
-	kfree(fc_stats->bulk_query_out);
-
-	idr_destroy(&fc_stats->counters_idr);
-
 	tmplist = llist_del_all(&fc_stats->addlist);
 	llist_for_each_entry_safe(counter, tmp, tmplist, addlist)
 		mlx5_fc_release(dev, counter);
 
 	list_for_each_entry_safe(counter, tmp, &fc_stats->counters, list)
 		mlx5_fc_release(dev, counter);
+
+	mlx5_fc_pool_cleanup(&fc_stats->fc_pool);
+	idr_destroy(&fc_stats->counters_idr);
+	kfree(fc_stats->bulk_query_out);
 }
 
 int mlx5_fc_query(struct mlx5_core_dev *dev, struct mlx5_fc *counter,
-- 
2.21.0


      parent reply	other threads:[~2019-08-15 19:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-15 19:09 [pull request][net-next 00/16] Mellanox, mlx5 devlink RX health reporters Saeed Mahameed
2019-08-15 19:09 ` [net-next 01/16] net/mlx5e: Rename reporter header file Saeed Mahameed
2019-08-15 19:09 ` [net-next 02/16] net/mlx5e: Change naming convention for reporter's functions Saeed Mahameed
2019-08-15 19:09 ` [net-next 03/16] net/mlx5e: Generalize tx reporter's functionality Saeed Mahameed
2019-08-15 19:09 ` [net-next 04/16] net/mlx5e: Extend tx diagnose function Saeed Mahameed
2019-08-15 19:09 ` [net-next 05/16] net/mlx5e: Extend tx reporter diagnostics output Saeed Mahameed
2019-08-15 19:09 ` [net-next 06/16] net/mlx5e: Add cq info to tx reporter diagnose Saeed Mahameed
2019-08-15 19:10 ` [net-next 07/16] net/mlx5e: Add helper functions for reporter's basics Saeed Mahameed
2019-08-15 19:10 ` [net-next 08/16] net/mlx5e: Add support to rx reporter diagnose Saeed Mahameed
2019-08-15 19:10 ` [net-next 09/16] net/mlx5e: Split open/close ICOSQ into stages Saeed Mahameed
2019-08-15 19:10 ` [net-next 10/16] net/mlx5e: Report and recover from CQE error on ICOSQ Saeed Mahameed
2019-08-15 19:10 ` [net-next 11/16] net/mlx5e: Report and recover from rx timeout Saeed Mahameed
2019-08-17 19:48   ` David Miller
2019-08-15 19:10 ` [net-next 12/16] net/mlx5e: RX, Handle CQE with error at the earliest stage Saeed Mahameed
2019-08-15 19:10 ` [net-next 13/16] net/mlx5e: Report and recover from CQE with error on RQ Saeed Mahameed
2019-08-15 19:10 ` [net-next 14/16] Documentation: net: mlx5: Devlink health documentation updates Saeed Mahameed
2019-08-15 19:10 ` [net-next 15/16] net/mlx5e: Fix deallocation of non-fully init encap entries Saeed Mahameed
2019-08-15 19:10 ` Saeed Mahameed [this message]

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=20190815190911.12050-17-saeedm@mellanox.com \
    --to=saeedm@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=gavi@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=roid@mellanox.com \
    --cc=vladbu@mellanox.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).