DPDK patches and discussions
 help / color / mirror / Atom feed
From: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
To: dev@dpdk.org
Cc: Shuanglin Wang <shuanglin.wang@broadcom.com>,
	Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>,
	Kishore Padmanabha <kishore.padmanabha@broadcom.com>,
	Ajit Khaparde <ajit.khaparde@broadcom.com>
Subject: [PATCH v6 35/47] net/bnxt: tf_ulp: TF support flow scale query
Date: Mon, 21 Oct 2024 13:55:55 +0530	[thread overview]
Message-ID: <20241021082607.232829-36-sriharsha.basavapatna@broadcom.com> (raw)
In-Reply-To: <20241021082607.232829-1-sriharsha.basavapatna@broadcom.com>

From: Shuanglin Wang <shuanglin.wang@broadcom.com>

TF supports the flow scale query feature for OVS application.
The resource usage is tracked when opening a TF session
or adding/deleting a flow. The resources includes WC TCAM,
EM, Action, Counter, Meter, ACT_ENCAP, ACT_ENCAP, and SP_SMAC.
User can query the resource usage using niccli.

This feature is disabled by default. Using the build flag
-DTF_FLOW_SCALE_QUERY to enable it.

Improvement on flow scale query feature

Several improvements on flow scale query feature:
1. Some default rules require both RX and TX resources;
   need to update usage states on both direcitons.
2. Update resoure usage state for regular flows only.
3. Added a buffer dirty state to avoid unnecessary
   state sync with firmware.

Signed-off-by: Shuanglin Wang <shuanglin.wang@broadcom.com>
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c | 17 +++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_mapper.c  | 13 +++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c
index 79e2931e43..e7ac617d7a 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c
@@ -12,6 +12,9 @@
 #include "ulp_flow_db.h"
 #include "ulp_fc_mgr.h"
 #include "ulp_tun.h"
+#ifdef TF_FLOW_SCALE_QUERY
+#include "tf_resources.h"
+#endif /* TF_FLOW_SCALE_QUERY */
 
 #define ULP_FLOW_DB_RES_DIR_BIT		31
 #define ULP_FLOW_DB_RES_DIR_MASK	0x80000000
@@ -956,8 +959,15 @@ ulp_flow_db_flush_flows(struct bnxt_ulp_context *ulp_ctx,
 		return -EINVAL;
 	}
 
+#ifdef TF_FLOW_SCALE_QUERY
+	tf_resc_pause_usage_update();
+#endif
 	while (!ulp_flow_db_next_entry_get(flow_db, flow_type, &fid))
 		ulp_mapper_resources_free(ulp_ctx, flow_type, fid, NULL);
+#ifdef TF_FLOW_SCALE_QUERY
+	tf_resc_resume_usage_update();
+	tf_resc_usage_update_all(ulp_ctx->bp);
+#endif
 
 	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
 
@@ -994,6 +1004,9 @@ ulp_flow_db_function_flow_flush(struct bnxt_ulp_context *ulp_ctx,
 		return -EINVAL;
 	}
 
+#ifdef TF_FLOW_SCALE_QUERY
+	tf_resc_pause_usage_update();
+#endif
 	while (!ulp_flow_db_next_entry_get(flow_db, BNXT_ULP_FDB_TYPE_REGULAR,
 					   &flow_id)) {
 		if (flow_db->func_id_tbl[flow_id] == func_id)
@@ -1002,6 +1015,10 @@ ulp_flow_db_function_flow_flush(struct bnxt_ulp_context *ulp_ctx,
 						  flow_id,
 						  NULL);
 	}
+#ifdef TF_FLOW_SCALE_QUERY
+	tf_resc_resume_usage_update();
+	tf_resc_usage_update_all(ulp_ctx->bp);
+#endif
 	bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
 	return 0;
 }
diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
index 17e5b99562..3bf0307980 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
@@ -21,6 +21,9 @@
 #include "ulp_port_db.h"
 #include "ulp_ha_mgr.h"
 #include "bnxt_tf_pmd_shim.h"
+#ifdef TF_FLOW_SCALE_QUERY
+#include "tf_resources.h"
+#endif /* TF_FLOW_SCALE_QUERY */
 
 static uint8_t mapper_fld_zeros[16] = { 0 };
 
@@ -4315,6 +4318,12 @@ ulp_mapper_resources_free(struct bnxt_ulp_context *ulp_ctx,
 	if (rc)
 		frc = rc;
 
+#ifdef TF_FLOW_SCALE_QUERY
+	/* update for regular flows only */
+	if (flow_type == BNXT_ULP_FDB_TYPE_REGULAR)
+		tf_resc_usage_update_all(ulp_ctx->bp);
+#endif /* TF_FLOW_SCALE_QUERY */
+
 	return frc;
 }
 
@@ -4464,6 +4473,10 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
 			goto flow_error;
 	}
 
+#ifdef TF_FLOW_SCALE_QUERY
+	tf_resc_usage_update_all(ulp_ctx->bp);
+#endif /* TF_FLOW_SCALE_QUERY */
+
 	return rc;
 
 batch_error:
-- 
2.39.3


  parent reply	other threads:[~2024-10-21  8:19 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-21  8:25 [PATCH v6 00/47] TruFlow update for Thor2 Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 01/47] net/bnxt: tf_core: fix wc tcam multi slice delete issue Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 02/47] net/bnxt: tf_core: tcam manager data corruption Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 03/47] net/bnxt: tf_core: External EM support cleanup Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 04/47] net/bnxt: tf_core: Thor TF EM key size check Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 05/47] net/bnxt: tf_core: flow scale improvement Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 06/47] net/bnxt: tf_core: TF support flow scale query Sriharsha Basavapatna
2024-10-21 16:09   ` Stephen Hemminger
2024-10-22 16:12     ` Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 07/47] net/bnxt: tf_core: fix slice count in case of HA entry move Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 08/47] net/bnxt: tf_core: convert priority based TCAM manager to dynamic allocation Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 09/47] net/bnxt: tf_core: remove dead AFM code from session-based priority TCAM mgr Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 10/47] net/bnxt: tf_core: remove dead " Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 11/47] net/bnxt: tfc: support tf-core for Thor2 Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 12/47] net/bnxt: tf_ulp: add vxlan-gpe base support Sriharsha Basavapatna
2024-10-21 15:54   ` Stephen Hemminger
2024-10-22 16:07     ` Sriharsha Basavapatna
2024-10-22 21:32       ` Ajit Khaparde
2024-10-23  0:44         ` Stephen Hemminger
2024-10-21  8:25 ` [PATCH v6 13/47] net/bnxt: tf_ulp: add custom l2 etype tunnel support Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 14/47] net/bnxt: tf_ulp: add support for vf to vf flow offload Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 15/47] net/bnxt: tf_ulp: Wh+ mirroring support Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 16/47] net/bnxt: tf_ulp: miscellaneous fixes Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 17/47] net/bnxt: tf_ulp: support for Thor2 ulp layer Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 18/47] net/bnxt: tf_ulp: add support for overlapping flows Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 19/47] net/bnxt: tf_ulp: convert recipe table to dynamic memory Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 20/47] net/bnxt: tf_ulp: add feature bit support Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 21/47] net/bnxt: tf_ulp: add action read and clear support Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 22/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 23/47] net/bnxt: tf_ulp: VFR updates for Thor 2 Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 24/47] net/bnxt: tf_ulp: add support for tunnel flow stats Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 25/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 26/47] net/bnxt: tf_ulp: enable recipe id generation Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 27/47] net/bnxt: tf_ulp: fixed parent child db counters Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 28/47] net/bnxt: tf_ulp: modify return values to adhere to C coding standard Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 29/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 30/47] net/bnxt: tf_ulp: add mask defaults when mask is not specified Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 31/47] net/bnxt: tf_ulp: add jump action support Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 32/47] net/bnxt: tf_ulp: add support for flow priority Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 33/47] net/bnxt: tf_ulp: support for dynamic tunnel ports Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 34/47] net/bnxt: tf_ulp: add rte_mtr support for Thor2 Sriharsha Basavapatna
2024-10-21  8:25 ` Sriharsha Basavapatna [this message]
2024-10-21  8:25 ` [PATCH v6 36/47] net/bnxt: tf_ulp: add support for rss flow query to ULP Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 37/47] net/bnxt: tf_ulp: add track type feature to tables Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 38/47] net/bnxt: tf_ulp: inline utility functions and use likely/unlikely Sriharsha Basavapatna
2024-10-21  8:25 ` [PATCH v6 39/47] net/bnxt: tf_ulp: switch ulp to use rte crc32 hash Sriharsha Basavapatna
2024-10-21  8:26 ` [PATCH v6 40/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-10-21  8:26 ` [PATCH v6 41/47] net/bnxt: tf_ulp: support a few generic template items Sriharsha Basavapatna
2024-10-21  8:26 ` [PATCH v6 42/47] net/bnxt: tf_ulp: TFC support flow scale query for Thor2 Sriharsha Basavapatna
2024-10-21  8:26 ` [PATCH v6 43/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-10-21  8:26 ` [PATCH v6 44/47] net/bnxt: tf_ulp: enable support for truflow feature configuration Sriharsha Basavapatna
2024-10-21  8:26 ` [PATCH v6 45/47] net/bnxt: tf_ulp: support a few feature extensions Sriharsha Basavapatna
2024-10-21  8:26 ` [PATCH v6 46/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-10-21  8:26 ` [PATCH v6 47/47] net/bnxt: tf_ulp: add stats cache for thor2 Sriharsha Basavapatna
2024-10-24  5:26 ` [PATCH v6 00/47] TruFlow update for Thor2 Ajit Khaparde
2024-10-28 12:58   ` Thomas Monjalon
2024-10-28 16:32     ` Sriharsha Basavapatna

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=20241021082607.232829-36-sriharsha.basavapatna@broadcom.com \
    --to=sriharsha.basavapatna@broadcom.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=kishore.padmanabha@broadcom.com \
    --cc=shuanglin.wang@broadcom.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).