netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>
Cc: Saeed Mahameed <saeedm@nvidia.com>,
	netdev@vger.kernel.org, Tariq Toukan <tariqt@nvidia.com>,
	Yevgeny Kliteynik <kliteyn@nvidia.com>,
	Erez Shitrit <erezsh@nvidia.com>, Alex Vesker <valex@nvidia.com>
Subject: [net-next 04/15] net/mlx5: DR, Add memory statistics for domain object
Date: Thu, 20 Apr 2023 18:38:39 -0700	[thread overview]
Message-ID: <20230421013850.349646-5-saeed@kernel.org> (raw)
In-Reply-To: <20230421013850.349646-1-saeed@kernel.org>

From: Yevgeny Kliteynik <kliteyn@nvidia.com>

Add counters for number of buddies that are currently in use per domain
per buddy type (STE, MODIFY-HEADER, MODIFY-PATTERN).

Signed-off-by: Erez Shitrit <erezsh@nvidia.com>
Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Reviewed-by: Alex Vesker <valex@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/steering/dr_dbg.c | 7 +++++--
 .../ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c    | 8 +++++++-
 .../net/ethernet/mellanox/mlx5/core/steering/dr_types.h   | 3 +++
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_dbg.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_dbg.c
index 552c7857ca1f..7e36e1062139 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_dbg.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_dbg.c
@@ -633,7 +633,7 @@ dr_dump_domain(struct seq_file *file, struct mlx5dr_domain *dmn)
 	u64 domain_id = DR_DBG_PTR_TO_ID(dmn);
 	int ret;
 
-	seq_printf(file, "%d,0x%llx,%d,0%x,%d,%u.%u.%u,%s,%d\n",
+	seq_printf(file, "%d,0x%llx,%d,0%x,%d,%u.%u.%u,%s,%d,%u,%u,%u\n",
 		   DR_DUMP_REC_TYPE_DOMAIN,
 		   domain_id, dmn->type, dmn->info.caps.gvmi,
 		   dmn->info.supp_sw_steering,
@@ -641,7 +641,10 @@ dr_dump_domain(struct seq_file *file, struct mlx5dr_domain *dmn)
 		   LINUX_VERSION_MAJOR, LINUX_VERSION_PATCHLEVEL,
 		   LINUX_VERSION_SUBLEVEL,
 		   pci_name(dmn->mdev->pdev),
-		   0); /* domain flags */
+		   0, /* domain flags */
+		   dmn->num_buddies[DR_ICM_TYPE_STE],
+		   dmn->num_buddies[DR_ICM_TYPE_MODIFY_ACTION],
+		   dmn->num_buddies[DR_ICM_TYPE_MODIFY_HDR_PTRN]);
 
 	ret = dr_dump_domain_info(file, &dmn->info, domain_id);
 	if (ret < 0)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c
index 19e9b4d78454..0b5af9f3f605 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c
@@ -288,6 +288,8 @@ static int dr_icm_buddy_create(struct mlx5dr_icm_pool *pool)
 	/* add it to the -start- of the list in order to search in it first */
 	list_add(&buddy->list_node, &pool->buddy_mem_list);
 
+	pool->dmn->num_buddies[pool->icm_type]++;
+
 	return 0;
 
 err_cleanup_buddy:
@@ -301,13 +303,17 @@ static int dr_icm_buddy_create(struct mlx5dr_icm_pool *pool)
 
 static void dr_icm_buddy_destroy(struct mlx5dr_icm_buddy_mem *buddy)
 {
+	enum mlx5dr_icm_type icm_type = buddy->pool->icm_type;
+
 	dr_icm_pool_mr_destroy(buddy->icm_mr);
 
 	mlx5dr_buddy_cleanup(buddy);
 
-	if (buddy->pool->icm_type == DR_ICM_TYPE_STE)
+	if (icm_type == DR_ICM_TYPE_STE)
 		dr_icm_buddy_cleanup_ste_cache(buddy);
 
+	buddy->pool->dmn->num_buddies[icm_type]--;
+
 	kvfree(buddy);
 }
 
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h
index 37b7b1a79f93..678a993ab053 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h
@@ -72,6 +72,7 @@ enum mlx5dr_icm_type {
 	DR_ICM_TYPE_STE,
 	DR_ICM_TYPE_MODIFY_ACTION,
 	DR_ICM_TYPE_MODIFY_HDR_PTRN,
+	DR_ICM_TYPE_MAX,
 };
 
 static inline enum mlx5dr_icm_chunk_size
@@ -955,6 +956,8 @@ struct mlx5dr_domain {
 	struct list_head dbg_tbl_list;
 	struct mlx5dr_dbg_dump_info dump_info;
 	struct xarray definers_xa;
+	/* memory management statistics */
+	u32 num_buddies[DR_ICM_TYPE_MAX];
 };
 
 struct mlx5dr_table_rx_tx {
-- 
2.39.2


  parent reply	other threads:[~2023-04-21  1:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-21  1:38 [pull request][net-next 00/15] mlx5 updates 2023-04-20 Saeed Mahameed
2023-04-21  1:38 ` [net-next 01/15] net/mlx5: DR, Fix dumping of legacy modify_hdr in debug dump Saeed Mahameed
2023-04-22  4:10   ` patchwork-bot+netdevbpf
2023-04-21  1:38 ` [net-next 02/15] net/mlx5: DR, Calculate sync threshold of each pool according to its type Saeed Mahameed
2023-04-21  1:38 ` [net-next 03/15] net/mlx5: DR, Add more info in domain dbg dump Saeed Mahameed
2023-04-21  1:38 ` Saeed Mahameed [this message]
2023-04-21  1:38 ` [net-next 05/15] Revert "net/mlx5: Expose steering dropped packets counter" Saeed Mahameed
2023-04-21  1:38 ` [net-next 06/15] Revert "net/mlx5: Expose vnic diagnostic counters for eswitch managed vports" Saeed Mahameed
2023-04-21  1:38 ` [net-next 07/15] net/mlx5: Add vnic devlink health reporter to PFs/VFs Saeed Mahameed
2023-04-21  1:38 ` [net-next 08/15] net/mlx5e: Add vnic devlink health reporter to representors Saeed Mahameed
2023-04-21  1:38 ` [net-next 09/15] net/mlx5e: RX, Fix releasing page_pool pages twice for striding RQ Saeed Mahameed
2023-04-21  1:38 ` [net-next 10/15] net/mlx5e: RX, Fix XDP_TX page release for legacy rq nonlinear case Saeed Mahameed
2023-04-21  1:38 ` [net-next 11/15] net/mlx5e: RX, Hook NAPIs to page pools Saeed Mahameed
2023-04-21  2:13   ` Jakub Kicinski
2023-04-24 11:59     ` Dragos Tatulea
2023-04-21  1:38 ` [net-next 12/15] net/mlx5: Include linux/pci.h for pci_msix_can_alloc_dyn() Saeed Mahameed
2023-04-21  1:38 ` [net-next 13/15] net/mlx5: E-Switch, Remove redundant dev arg from mlx5_esw_vport_alloc() Saeed Mahameed
2023-04-21  1:38 ` [net-next 14/15] net/mlx5: E-Switch, Remove unused mlx5_esw_offloads_vport_metadata_set() Saeed Mahameed
2023-04-21  1:38 ` [net-next 15/15] net/mlx5: Update op_mode to op_mod for port selection Saeed Mahameed

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=20230421013850.349646-5-saeed@kernel.org \
    --to=saeed@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=erezsh@nvidia.com \
    --cc=kliteyn@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    --cc=valex@nvidia.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).