DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: Mike Baucom <michael.baucom@broadcom.com>,
	Kishore Padmanabha <kishore.padmanabha@broadcom.com>,
	Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Subject: [dpdk-dev] [PATCH v2 3/4] net/bnxt: ulp changes to handle action/index tables
Date: Sat, 25 Apr 2020 07:01:40 -0700	[thread overview]
Message-ID: <20200425140141.27947-4-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20200425140141.27947-1-ajit.khaparde@broadcom.com>

From: Mike Baucom <michael.baucom@broadcom.com>

The ulp required changes to properly call the index table management
routines and use the index for external memory indices.  The ulp no
longer has to account for stride as the tf_core returns the actual
offset, not a 0 based index.

Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c | 30 ++++++++++++++++++----------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
index dc7b7ca5e..9ea6fdba0 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
@@ -401,7 +401,7 @@ ulp_mapper_tcam_entry_free(struct bnxt_ulp_context *ulp  __rte_unused,
 }
 
 static inline int32_t
-ulp_mapper_index_entry_free(struct bnxt_ulp_context *ulp  __rte_unused,
+ulp_mapper_index_entry_free(struct bnxt_ulp_context *ulp,
 			    struct tf *tfp,
 			    struct ulp_flow_db_res_params *res)
 {
@@ -411,6 +411,12 @@ ulp_mapper_index_entry_free(struct bnxt_ulp_context *ulp  __rte_unused,
 		.idx	= (uint32_t)res->resource_hndl
 	};
 
+	/*
+	 * Just set the table scope, it will be ignored if not necessary
+	 * by the tf_free_tbl_entry
+	 */
+	bnxt_ulp_cntxt_tbl_scope_id_get(ulp, &fparms.tbl_scope_id);
+
 	return tf_free_tbl_entry(tfp, &fparms);
 }
 
@@ -805,6 +811,9 @@ ulp_mapper_action_alloc_and_set(struct bnxt_ulp_mapper_parms *parms,
 	int32_t					rc = 0;
 	int32_t trc;
 	uint64_t				idx;
+	uint32_t tbl_scope_id;
+
+	bnxt_ulp_cntxt_tbl_scope_id_get(parms->ulp_ctx, &tbl_scope_id);
 
 	/* Set the allocation parameters for the table*/
 	alloc_parms.dir = atbls->direction;
@@ -812,6 +821,7 @@ ulp_mapper_action_alloc_and_set(struct bnxt_ulp_mapper_parms *parms,
 	alloc_parms.search_enable = atbls->srch_b4_alloc;
 	alloc_parms.result = ulp_blob_data_get(blob,
 					       &alloc_parms.result_sz_in_bytes);
+	alloc_parms.tbl_scope_id = tbl_scope_id;
 	if (!alloc_parms.result) {
 		BNXT_TF_DBG(ERR, "blob is not populated\n");
 		return -EINVAL;
@@ -826,14 +836,10 @@ ulp_mapper_action_alloc_and_set(struct bnxt_ulp_mapper_parms *parms,
 	}
 
 	/* Need to calculate the idx for the result record */
-	/*
-	 * TBD: Need to get the stride from tflib instead of having to
-	 * understand the construction of the pointer
-	 */
 	uint64_t tmpidx = alloc_parms.idx;
 
 	if (atbls->table_type == TF_TBL_TYPE_EXT)
-		tmpidx = (alloc_parms.idx * TF_ACTION_RECORD_SZ) >> 4;
+		tmpidx = TF_ACT_REC_OFFSET_2_PTR(alloc_parms.idx);
 	else
 		tmpidx = alloc_parms.idx;
 
@@ -863,10 +869,7 @@ ulp_mapper_action_alloc_and_set(struct bnxt_ulp_mapper_parms *parms,
 		set_parm.data_sz_in_bytes = length / 8;
 
 		if (set_parm.type == TF_TBL_TYPE_EXT)
-			bnxt_ulp_cntxt_tbl_scope_id_get(parms->ulp_ctx,
-							&set_parm.tbl_scope_id);
-		else
-			set_parm.tbl_scope_id = 0;
+			set_parm.tbl_scope_id = tbl_scope_id;
 
 		/* set the table entry */
 		rc = tf_set_tbl_entry(parms->tfp, &set_parm);
@@ -1396,9 +1399,11 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	struct tf_alloc_tbl_entry_parms	aparms = { 0 };
 	struct tf_set_tbl_entry_parms	sparms = { 0 };
 	struct tf_free_tbl_entry_parms	free_parms = { 0 };
-
+	uint32_t tbl_scope_id;
 	struct tf *tfp = bnxt_ulp_cntxt_tfp_get(parms->ulp_ctx);
 
+	bnxt_ulp_cntxt_tbl_scope_id_get(parms->ulp_ctx, &tbl_scope_id);
+
 	if (!ulp_blob_init(&data, tbl->result_bit_size, parms->order)) {
 		BNXT_TF_DBG(ERR, "Failed initial index table blob\n");
 		return -EINVAL;
@@ -1427,6 +1432,7 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	aparms.search_enable	= tbl->srch_b4_alloc;
 	aparms.result		= ulp_blob_data_get(&data, &tmplen);
 	aparms.result_sz_in_bytes = ULP_SZ_BITS2BYTES(tbl->result_bit_size);
+	aparms.tbl_scope_id	= tbl_scope_id;
 
 	/* All failures after the alloc succeeds require a free */
 	rc = tf_alloc_tbl_entry(tfp, &aparms);
@@ -1454,6 +1460,7 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		sparms.data_sz_in_bytes =
 			ULP_SZ_BITS2BYTES(tbl->result_bit_size);
 		sparms.idx		= aparms.idx;
+		sparms.tbl_scope_id	= tbl_scope_id;
 
 		rc = tf_set_tbl_entry(tfp, &sparms);
 		if (rc) {
@@ -1494,6 +1501,7 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	free_parms.dir	= tbl->direction;
 	free_parms.type	= tbl->table_type;
 	free_parms.idx	= aparms.idx;
+	free_parms.tbl_scope_id = tbl_scope_id;
 
 	trc = tf_free_tbl_entry(tfp, &free_parms);
 	if (trc)
-- 
2.21.1 (Apple Git-122.3)


  parent reply	other threads:[~2020-04-25 14:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-25  3:47 [dpdk-dev] [PATCH 0/5] introduce changes to support flow scaling Venkat Duvvuru
2020-04-25  3:47 ` [dpdk-dev] [PATCH 1/5] net/bnxt: reserve a flowdb resource function as invalid Venkat Duvvuru
2020-04-25  3:47 ` [dpdk-dev] [PATCH 2/5] net/bnxt: action record external pool updates Venkat Duvvuru
2020-04-25  3:47 ` [dpdk-dev] [PATCH 3/5] net/bnxt: ulp modifications for handling actions/index tables Venkat Duvvuru
2020-04-25  3:47 ` [dpdk-dev] [PATCH 4/5] net/bnxt: add truflow flush-timer to alloc table scope API Venkat Duvvuru
2020-04-25  3:47 ` [dpdk-dev] [PATCH 5/5] net/bnxt: ulp must set hw flow cache timer when allocating table scope Venkat Duvvuru
2020-04-25 14:01 ` [dpdk-dev] [PATCH v2 0/4] introduce changes to support flow scaling Ajit Khaparde
2020-04-25 14:01   ` [dpdk-dev] [PATCH v2 1/4] net/bnxt: reserve a flowdb resource function as invalid Ajit Khaparde
2020-04-25 14:01   ` [dpdk-dev] [PATCH v2 2/4] net/bnxt: update action record external pool Ajit Khaparde
2020-04-25 14:01   ` Ajit Khaparde [this message]
2020-04-25 14:01   ` [dpdk-dev] [PATCH v2 4/4] net/bnxt: add truflow flush-timer to alloc table scope API Ajit Khaparde
2020-04-25 17:36   ` [dpdk-dev] [PATCH v2 0/4] introduce changes to support flow scaling 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=20200425140141.27947-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).