From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: Kishore Padmanabha <kishore.padmanabha@broadcom.com>,
Michael Baucom <michael.baucom@broadcom.com>,
Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Subject: [dpdk-dev] [PATCH v2 03/12] net/bnxt: add flow database resource iteration API
Date: Fri, 17 Apr 2020 09:19:11 -0700 [thread overview]
Message-ID: <20200417161920.85858-4-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20200417161920.85858-1-ajit.khaparde@broadcom.com>
From: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
This API can be used to iterate individual resource
functions in the flow database.
Reviewed-by: Michael Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
---
drivers/net/bnxt/tf_ulp/ulp_flow_db.c | 66 ++++++++++++++++++++++++++-
drivers/net/bnxt/tf_ulp/ulp_flow_db.h | 17 +++++++
2 files changed, 82 insertions(+), 1 deletion(-)
diff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c
index e99e94ab7..9e7f9f5e3 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c
@@ -560,7 +560,71 @@ int32_t ulp_flow_db_fid_free(struct bnxt_ulp_context *ulp_ctxt,
return 0;
}
-/** Get the flow database entry iteratively
+/*
+ * Get the flow database entry details
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * tbl_idx [in] Specify it is regular or default flow
+ * fid [in] The index to the flow entry
+ * nxt_idx [in/out] the index to the next entry
+ * params [out] The contents to be copied into params.
+ *
+ * returns 0 on success and negative on failure.
+ */
+int32_t ulp_flow_db_resource_get(struct bnxt_ulp_context *ulp_ctxt,
+ enum bnxt_ulp_flow_db_tables tbl_idx,
+ uint32_t fid,
+ uint32_t *nxt_idx,
+ struct ulp_flow_db_res_params *params)
+{
+ struct bnxt_ulp_flow_db *flow_db;
+ struct bnxt_ulp_flow_tbl *flow_tbl;
+ struct ulp_fdb_resource_info *nxt_resource, *fid_resource;
+
+ flow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctxt);
+ if (!flow_db) {
+ BNXT_TF_DBG(ERR, "Invalid Arguments\n");
+ return -EINVAL;
+ }
+
+ if (tbl_idx >= BNXT_ULP_FLOW_TABLE_MAX) {
+ BNXT_TF_DBG(ERR, "Invalid table index\n");
+ return -EINVAL;
+ }
+
+ flow_tbl = &flow_db->flow_tbl[tbl_idx];
+
+ /* check for limits of fid */
+ if (fid >= flow_tbl->num_flows || !fid) {
+ BNXT_TF_DBG(ERR, "Invalid flow index\n");
+ return -EINVAL;
+ }
+
+ /* check if the flow is active or not */
+ if (!ulp_flow_db_active_flow_is_set(flow_tbl, fid)) {
+ BNXT_TF_DBG(ERR, "flow does not exist\n");
+ return -EINVAL;
+ }
+
+ if (!*nxt_idx) {
+ fid_resource = &flow_tbl->flow_resources[fid];
+ ulp_flow_db_res_info_to_params(fid_resource, params);
+ ULP_FLOW_DB_RES_NXT_SET(*nxt_idx,
+ fid_resource->nxt_resource_idx);
+ } else {
+ nxt_resource = &flow_tbl->flow_resources[*nxt_idx];
+ ulp_flow_db_res_info_to_params(nxt_resource, params);
+ *nxt_idx = 0;
+ ULP_FLOW_DB_RES_NXT_SET(*nxt_idx,
+ nxt_resource->nxt_resource_idx);
+ }
+
+ /* all good, return success */
+ return 0;
+}
+
+/*
+ * Get the flow database entry iteratively
*
* flow_tbl [in] Ptr to flow table
* fid [in/out] The index to the flow entry
diff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.h b/drivers/net/bnxt/tf_ulp/ulp_flow_db.h
index 543541565..5361dd025 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.h
@@ -142,6 +142,23 @@ int32_t ulp_flow_db_fid_free(struct bnxt_ulp_context *ulp_ctxt,
enum bnxt_ulp_flow_db_tables tbl_idx,
uint32_t fid);
+/*
+ *Get the flow database entry details
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * tbl_idx [in] Specify it is regular or default flow
+ * fid [in] The index to the flow entry
+ * nxt_idx [in/out] the index to the next entry
+ * params [out] The contents to be copied into params.
+ *
+ * returns 0 on success and negative on failure.
+ */
+int32_t ulp_flow_db_resource_get(struct bnxt_ulp_context *ulp_ctxt,
+ enum bnxt_ulp_flow_db_tables tbl_idx,
+ uint32_t fid,
+ uint32_t *nxt_idx,
+ struct ulp_flow_db_res_params *params);
+
/*
* Flush all flows in the flow database.
*
--
2.21.1 (Apple Git-122.3)
next prev parent reply other threads:[~2020-04-17 16:19 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-15 14:49 [dpdk-dev] [PATCH 00/11] enhancements to host based flow table management Venkat Duvvuru
2020-04-15 14:49 ` [dpdk-dev] [PATCH 01/11] net/bnxt: SVIF changes for dpdk port id Venkat Duvvuru
2020-04-15 14:49 ` [dpdk-dev] [PATCH 02/11] net/bnxt: allow usage of more resources in flow db Venkat Duvvuru
2020-04-15 14:49 ` [dpdk-dev] [PATCH 03/11] net/bnxt: Added flow database resource iteration API Venkat Duvvuru
2020-04-15 14:49 ` [dpdk-dev] [PATCH 04/11] net/bnxt: added type of resource name to debug messages Venkat Duvvuru
2020-04-15 14:49 ` [dpdk-dev] [PATCH 05/11] net/bnxt: aggregated ulp rte parser arguments to single structure Venkat Duvvuru
2020-04-15 14:49 ` [dpdk-dev] [PATCH 06/11] net/bnxt: aggregated ulp mapper create " Venkat Duvvuru
2020-04-15 14:49 ` [dpdk-dev] [PATCH 07/11] net/bnxt: use hashing for flow template matching Venkat Duvvuru
2020-04-15 14:49 ` [dpdk-dev] [PATCH 08/11] net/bnxt: addition of session and function flow flush Venkat Duvvuru
2020-04-15 14:49 ` [dpdk-dev] [PATCH 09/11] net/bnxt: default identifiers added to ulp mapper Venkat Duvvuru
2020-04-15 14:49 ` [dpdk-dev] [PATCH 10/11] net/bnxt: cache table type added for tcam lookups Venkat Duvvuru
2020-04-15 14:49 ` [dpdk-dev] [PATCH 11/11] net/bnxt: addition of the port database Venkat Duvvuru
2020-04-17 16:19 ` [dpdk-dev] [PATCH v2 00/12] enhancements to host based flow table management Ajit Khaparde
2020-04-17 16:19 ` [dpdk-dev] [PATCH v2 01/12] net/bnxt: add SVIF changes for dpdk port id Ajit Khaparde
2020-04-17 16:19 ` [dpdk-dev] [PATCH v2 02/12] net/bnxt: allow usage of more resources in flow db Ajit Khaparde
2020-04-17 16:19 ` Ajit Khaparde [this message]
2020-04-17 16:19 ` [dpdk-dev] [PATCH v2 04/12] net/bnxt: add resource name type to debug messages Ajit Khaparde
2020-04-17 16:19 ` [dpdk-dev] [PATCH v2 05/12] net/bnxt: aggregate ulp rte parser arguments Ajit Khaparde
2020-04-17 16:19 ` [dpdk-dev] [PATCH v2 06/12] net/bnxt: aggregate ulp mapper create arguments Ajit Khaparde
2020-04-17 16:19 ` [dpdk-dev] [PATCH v2 07/12] net/bnxt: use hashing for flow template match Ajit Khaparde
2020-04-17 16:19 ` [dpdk-dev] [PATCH v2 08/12] net/bnxt: add session and function flow flush Ajit Khaparde
2020-04-17 16:19 ` [dpdk-dev] [PATCH v2 09/12] net/bnxt: add default identifiers to ulp mapper Ajit Khaparde
2020-04-17 16:19 ` [dpdk-dev] [PATCH v2 10/12] net/bnxt: add cache table type for TCAM lookup Ajit Khaparde
2020-04-17 16:19 ` [dpdk-dev] [PATCH v2 11/12] net/bnxt: add port database Ajit Khaparde
2020-04-17 16:19 ` [dpdk-dev] [PATCH v2 12/12] net/bnxt: remove redefinition of page size Ajit Khaparde
2020-04-17 21:00 ` [dpdk-dev] [PATCH v2 00/12] enhancements to host based flow table management 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=20200417161920.85858-4-ajit.khaparde@broadcom.com \
--to=ajit.khaparde@broadcom.com \
--cc=dev@dpdk.org \
--cc=kishore.padmanabha@broadcom.com \
--cc=michael.baucom@broadcom.com \
--cc=venkatkumar.duvvuru@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).