From: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
To: dev@dpdk.org
Cc: Shuanglin Wang <shuanglin.wang@broadcom.com>,
Kishore Padmanabha <kishore.padmanabha@broadcom.com>,
Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Subject: [PATCH 42/47] net/bnxt: tf_ulp: TFC support flow scale query for Thor2
Date: Fri, 30 Aug 2024 19:30:44 +0530 [thread overview]
Message-ID: <20240830140049.1715230-43-sriharsha.basavapatna@broadcom.com> (raw)
In-Reply-To: <20240830140049.1715230-1-sriharsha.basavapatna@broadcom.com>
From: Shuanglin Wang <shuanglin.wang@broadcom.com>
TFC supports the flow scale query feature for OVS application.
The resource usage(WC-TCAM) is tracked inside Thor2 firmware.
This patch is to query the wc-tcam usage info when adding/
deleting a flow. It is just for debugging purpose and disabled by
default.
Using the build flag -DTF_FLOW_SCALE_QUERY to enable it.
And users should use niccli to query the resource usage.
Signed-off-by: Shuanglin Wang <shuanglin.wang@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
---
drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c | 6 ++++++
drivers/net/bnxt/tf_ulp/ulp_flow_db.c | 9 +++++----
drivers/net/bnxt/tf_ulp/ulp_mapper.c | 26 ++++++++++++++++++++++++--
drivers/net/bnxt/tf_ulp/ulp_mapper.h | 5 +++++
4 files changed, 40 insertions(+), 6 deletions(-)
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c
index 9c9e206285..31ab61b512 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c
@@ -34,6 +34,7 @@
#include "ulp_ha_mgr.h"
#include "bnxt_tf_pmd_shim.h"
#include "ulp_template_db_tbl.h"
+#include "tfc_resources.h"
/* define to enable shared table scope */
#define TFC_SHARED_TBL_SCOPE_ENABLE 0
@@ -1052,6 +1053,11 @@ ulp_tfc_init(struct bnxt *bp,
}
}
+#ifdef TF_FLOW_SCALE_QUERY
+ /* Query resource statstics from firmware */
+ tfc_resc_usage_query_all(bp);
+#endif /* TF_FLOW_SCALE_QUERY */
+
BNXT_DRV_DBG(DEBUG, "ulp ctx has been initialized\n");
return rc;
diff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c
index 341c8c2dfe..8984808b67 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c
@@ -15,6 +15,7 @@
#include "ulp_tun.h"
#ifdef TF_FLOW_SCALE_QUERY
#include "tf_resources.h"
+#include "tfc_resources.h"
#endif /* TF_FLOW_SCALE_QUERY */
#define ULP_FLOW_DB_RES_DIR_BIT 31
@@ -963,11 +964,12 @@ ulp_flow_db_flush_flows(struct bnxt_ulp_context *ulp_ctx,
#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);
+ ulp_resc_usage_sync(ulp_ctx);
#endif
bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx);
@@ -1017,8 +1019,7 @@ ulp_flow_db_function_flow_flush(struct bnxt_ulp_context *ulp_ctx,
NULL);
}
#ifdef TF_FLOW_SCALE_QUERY
- tf_resc_resume_usage_update();
- tf_resc_usage_update_all(ulp_ctx->bp);
+ ulp_resc_usage_sync(ulp_ctx);
#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 5dfe72df17..c595e7cfc3 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
@@ -24,6 +24,7 @@
#include "bnxt_tf_pmd_shim.h"
#ifdef TF_FLOW_SCALE_QUERY
#include "tf_resources.h"
+#include "tfc_resources.h"
#endif /* TF_FLOW_SCALE_QUERY */
static uint8_t mapper_fld_zeros[16] = { 0 };
@@ -4322,7 +4323,7 @@ ulp_mapper_resources_free(struct bnxt_ulp_context *ulp_ctx,
#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);
+ ulp_resc_usage_sync(ulp_ctx);
#endif /* TF_FLOW_SCALE_QUERY */
return frc;
@@ -4475,7 +4476,7 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
}
#ifdef TF_FLOW_SCALE_QUERY
- tf_resc_usage_update_all(ulp_ctx->bp);
+ ulp_resc_usage_sync(ulp_ctx);
#endif /* TF_FLOW_SCALE_QUERY */
return rc;
@@ -4514,6 +4515,27 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx,
return rc;
}
+#ifdef TF_FLOW_SCALE_QUERY
+/* Sync resource usage state with firmware */
+int ulp_resc_usage_sync(struct bnxt_ulp_context *ulp_ctx)
+{
+ uint32_t dev_id;
+ if (unlikely(bnxt_ulp_cntxt_dev_id_get(ulp_ctx, &dev_id))) {
+ BNXT_DRV_DBG(ERR, "Invalid ulp context\n");
+ return -EINVAL;
+ }
+
+ if (dev_id == BNXT_ULP_DEVICE_ID_THOR) {
+ tf_resc_resume_usage_update();
+ tf_resc_usage_update_all(ulp_ctx->bp);
+ } else if (dev_id == BNXT_ULP_DEVICE_ID_THOR2) {
+ tfc_resc_usage_query_all(ulp_ctx->bp);
+ }
+
+ return 0;
+}
+#endif /* TF_FLOW_SCALE_QUERY */
+
int32_t
ulp_mapper_init(struct bnxt_ulp_context *ulp_ctx)
{
diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.h b/drivers/net/bnxt/tf_ulp/ulp_mapper.h
index 0f43e2a8b5..d2fc716232 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.h
@@ -302,4 +302,9 @@ ulp_mapper_init(struct bnxt_ulp_context *ulp_ctx);
void
ulp_mapper_deinit(struct bnxt_ulp_context *ulp_ctx);
+#ifdef TF_FLOW_SCALE_QUERY
+int32_t
+ulp_resc_usage_sync(struct bnxt_ulp_context *ulp_ctx);
+#endif /* TF_FLOW_SCALE_QUERY */
+
#endif /* _ULP_MAPPER_H_ */
--
2.39.3
next prev parent reply other threads:[~2024-08-30 13:56 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-30 14:00 [PATCH 00/47] TruFlow update " Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 01/47] net/bnxt: tf_core: fix wc tcam multi slice delete issue Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 02/47] net/bnxt: tf_core: tcam manager data corruption Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 03/47] net/bnxt: tf_core: External EM support cleanup Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 04/47] net/bnxt: tf_core: Thor TF EM key size check Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 05/47] net/bnxt: tf_core: flow scale improvement Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 06/47] net/bnxt: tf_core: TF support flow scale query Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 07/47] net/bnxt: tf_core: fix slice count in case of HA entry move Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 08/47] net/bnxt: tf_core: convert priority based TCAM manager to dynamic allocation Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 09/47] net/bnxt: tf_core: remove dead AFM code from session-based priority TCAM mgr Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 10/47] net/bnxt: tf_core: remove dead " Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 11/47] net/bnxt: tfc: support tf-core for Thor2 Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 12/47] net/bnxt: tf_ulp: add vxlan-gpe base support Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 13/47] net/bnxt: tf_ulp: add custom l2 etype tunnel support Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 14/47] net/bnxt: tf_ulp: add support for vf to vf flow offload Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 15/47] net/bnxt: tf_ulp: Wh+ mirroring support Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 16/47] net/bnxt: tf_ulp: miscellaneous fixes Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 17/47] net/bnxt: tf_ulp: support for Thor2 ulp layer Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 18/47] net/bnxt: tf_ulp: add support for overlapping flows Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 19/47] net/bnxt: tf_ulp: convert recipe table to dynamic memory Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 20/47] net/bnxt: tf_ulp: add feature bit support Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 21/47] net/bnxt: tf_ulp: add action read and clear support Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 22/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 23/47] net/bnxt: tf_ulp: VFR updates for Thor 2 Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 24/47] net/bnxt: tf_ulp: add support for tunnel flow stats Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 25/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 26/47] net/bnxt: tf_ulp: enable recipe id generation Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 27/47] net/bnxt: tf_ulp: fixed parent child db counters Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 28/47] net/bnxt: tf_ulp: modify return values to adhere to C coding standard Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 29/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 30/47] net/bnxt: tf_ulp: add mask defaults when mask is not specified Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 31/47] net/bnxt: tf_ulp: add jump action support Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 32/47] net/bnxt: tf_ulp: add support for flow priority Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 33/47] net/bnxt: tf_ulp: support for dynamic tunnel ports Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 34/47] net/bnxt: tf_ulp: add rte_mtr support for Thor2 Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 35/47] net/bnxt: tf_ulp: TF support flow scale query Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 36/47] net/bnxt: tf_ulp: add support for rss flow query to ULP Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 37/47] net/bnxt: tf_ulp: add track type feature to tables Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 38/47] net/bnxt: tf_ulp: inline utility functions and use likely/unlikely Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 39/47] net/bnxt: tf_ulp: switch ulp to use rte crc32 hash Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 40/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 41/47] net/bnxt: tf_ulp: support a few generic template items Sriharsha Basavapatna
2024-08-30 14:00 ` Sriharsha Basavapatna [this message]
2024-08-30 14:00 ` [PATCH 43/47] net/bnxt: tf_ulp: update template files Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 44/47] net/bnxt: tf_ulp: enable support for truflow feature configuration Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 45/47] net/bnxt: tf_ulp: support a few feature extensions Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 46/47] net/bnxt: update template files Sriharsha Basavapatna
2024-08-30 14:00 ` [PATCH 47/47] net/bnxt: tf_ulp: add stats cache for thor2 Sriharsha Basavapatna
2024-09-25 12:02 ` [PATCH 00/47] TruFlow update for Thor2 Ajit Khaparde
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=20240830140049.1715230-43-sriharsha.basavapatna@broadcom.com \
--to=sriharsha.basavapatna@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).