DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: Kishore Padmanabha <kishore.padmanabha@broadcom.com>,
	Somnath Kotur <somnath.kotur@broadcom.com>
Subject: [dpdk-dev] [PATCH v4 03/25] net/bnxt: support more resource functions in flow database
Date: Sat, 27 Jun 2020 03:00:28 -0700
Message-ID: <20200627100050.19688-4-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20200627100050.19688-1-ajit.khaparde@broadcom.com>

From: Kishore Padmanabha <kishore.padmanabha@broadcom.com>

Added support to include more resource functions in the flow
database. The number of bits increased from 3 to 8 for storing
the resource function.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c     | 51 +++++++++++++++++------
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h     | 24 ++++++++---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c      | 13 ++----
 drivers/net/bnxt/tf_ulp/ulp_mapper.h      |  3 --
 drivers/net/bnxt/tf_ulp/ulp_template_db.h | 18 ++++----
 5 files changed, 71 insertions(+), 38 deletions(-)

diff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c
index 35a7f868a..30a809a8d 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c
@@ -16,6 +16,9 @@
 #define ULP_FLOW_DB_RES_FUNC_BITS	28
 #define ULP_FLOW_DB_RES_FUNC_MASK	0x70000000
 #define ULP_FLOW_DB_RES_NXT_MASK	0x0FFFFFFF
+#define ULP_FLOW_DB_RES_FUNC_UPPER	5
+#define ULP_FLOW_DB_RES_FUNC_NEED_LOWER	0x80
+#define ULP_FLOW_DB_RES_FUNC_LOWER_MASK	0x1F
 
 /* Macro to copy the nxt_resource_idx */
 #define ULP_FLOW_DB_RES_NXT_SET(dst, src)	{(dst) |= ((src) &\
@@ -77,20 +80,32 @@ ulp_flow_db_active_flow_is_set(struct bnxt_ulp_flow_tbl	*flow_tbl,
  * returns none
  */
 static void
-ulp_flow_db_res_params_to_info(struct ulp_fdb_resource_info   *resource_info,
-			       struct ulp_flow_db_res_params  *params)
+ulp_flow_db_res_params_to_info(struct ulp_fdb_resource_info *resource_info,
+			       struct ulp_flow_db_res_params *params)
 {
+	uint32_t resource_func;
+
 	resource_info->nxt_resource_idx |= ((params->direction <<
 				      ULP_FLOW_DB_RES_DIR_BIT) &
 				     ULP_FLOW_DB_RES_DIR_MASK);
-	resource_info->nxt_resource_idx |= ((params->resource_func <<
+	resource_func = (params->resource_func >> ULP_FLOW_DB_RES_FUNC_UPPER);
+	resource_info->nxt_resource_idx |= ((resource_func <<
 					     ULP_FLOW_DB_RES_FUNC_BITS) &
 					    ULP_FLOW_DB_RES_FUNC_MASK);
 
+	if (params->resource_func & ULP_FLOW_DB_RES_FUNC_NEED_LOWER) {
+		/* Break the resource func into two parts */
+		resource_func = (params->resource_func &
+				 ULP_FLOW_DB_RES_FUNC_LOWER_MASK);
+		resource_info->resource_func_lower = resource_func;
+	}
+
+	/* Store the handle as 64bit only for EM table entries */
 	if (params->resource_func != BNXT_ULP_RESOURCE_FUNC_EM_TABLE) {
 		resource_info->resource_hndl = (uint32_t)params->resource_hndl;
 		resource_info->resource_type = params->resource_type;
-
+		resource_info->resource_sub_type = params->resource_sub_type;
+		resource_info->reserved = params->reserved;
 	} else {
 		resource_info->resource_em_handle = params->resource_hndl;
 	}
@@ -106,22 +121,34 @@ ulp_flow_db_res_params_to_info(struct ulp_fdb_resource_info   *resource_info,
  * returns none
  */
 static void
-ulp_flow_db_res_info_to_params(struct ulp_fdb_resource_info   *resource_info,
-			       struct ulp_flow_db_res_params  *params)
+ulp_flow_db_res_info_to_params(struct ulp_fdb_resource_info *resource_info,
+			       struct ulp_flow_db_res_params *params)
 {
+	uint8_t resource_func_upper;
+
 	memset(params, 0, sizeof(struct ulp_flow_db_res_params));
 	params->direction = ((resource_info->nxt_resource_idx &
 				 ULP_FLOW_DB_RES_DIR_MASK) >>
 				 ULP_FLOW_DB_RES_DIR_BIT);
-	params->resource_func = ((resource_info->nxt_resource_idx &
-				 ULP_FLOW_DB_RES_FUNC_MASK) >>
-				 ULP_FLOW_DB_RES_FUNC_BITS);
+	resource_func_upper = (((resource_info->nxt_resource_idx &
+				ULP_FLOW_DB_RES_FUNC_MASK) >>
+			       ULP_FLOW_DB_RES_FUNC_BITS) <<
+			       ULP_FLOW_DB_RES_FUNC_UPPER);
+
+	/* The reource func is split into upper and lower */
+	if (resource_func_upper & ULP_FLOW_DB_RES_FUNC_NEED_LOWER)
+		params->resource_func = (resource_func_upper |
+					 resource_info->resource_func_lower);
+	else
+		params->resource_func = resource_func_upper;
 
-	if (params->resource_func != BNXT_ULP_RESOURCE_FUNC_EM_TABLE) {
+	if (params->resource_func == BNXT_ULP_RESOURCE_FUNC_EM_TABLE) {
+		params->resource_hndl = resource_info->resource_em_handle;
+	} else if (params->resource_func & ULP_FLOW_DB_RES_FUNC_NEED_LOWER) {
 		params->resource_hndl = resource_info->resource_hndl;
 		params->resource_type = resource_info->resource_type;
-	} else {
-		params->resource_hndl = resource_info->resource_em_handle;
+		params->resource_sub_type = resource_info->resource_sub_type;
+		params->reserved = resource_info->reserved;
 	}
 }
 
diff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.h b/drivers/net/bnxt/tf_ulp/ulp_flow_db.h
index ebca84947..9037dc5f5 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.h
@@ -12,14 +12,24 @@
 #define BNXT_FLOW_DB_DEFAULT_NUM_FLOWS		128
 #define BNXT_FLOW_DB_DEFAULT_NUM_RESOURCES	5
 
-/* Structure for the flow database resource information. */
+/*
+ * Structure for the flow database resource information
+ * The below structure is based on the below paritions
+ * nxt_resource_idx = dir[31],resource_func_upper[30:28],nxt_resource_idx[27:0]
+ * If resource_func is EM_TBL then use resource_em_handle.
+ * Else the other part of the union is used and
+ * resource_func is resource_func_upper[30:28] << 5 | resource_func_lower
+ */
 struct ulp_fdb_resource_info {
 	/* Points to next resource in the chained list. */
-	uint32_t	nxt_resource_idx;
+	uint32_t			nxt_resource_idx;
 	union {
-		uint64_t	resource_em_handle;
+		uint64_t		resource_em_handle;
 		struct {
-			uint32_t	resource_type;
+			uint8_t		resource_func_lower;
+			uint8_t		resource_type;
+			uint8_t		resource_sub_type;
+			uint8_t		reserved;
 			uint32_t	resource_hndl;
 		};
 	};
@@ -59,9 +69,11 @@ struct bnxt_ulp_flow_db {
 struct ulp_flow_db_res_params {
 	enum tf_dir			direction;
 	enum bnxt_ulp_resource_func	resource_func;
+	uint8_t				resource_type;
+	uint8_t				resource_sub_type;
+	uint8_t				reserved;
+	uint8_t				critical_resource;
 	uint64_t			resource_hndl;
-	uint32_t			resource_type;
-	uint32_t			critical_resource;
 };
 
 /*
diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
index 88b514228..e60d9d572 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
@@ -292,9 +292,8 @@ ulp_mapper_cache_res_type_set(struct ulp_flow_db_res_params *res,
 			      uint16_t tbl_type,
 			      uint16_t tbl_id)
 {
-	res->resource_type =
-		((uint32_t)tbl_id << ULP_MAPPER_CACHE_RES_TBL_ID_SHFT) |
-		((uint32_t)tbl_type << ULP_MAPPER_CACHE_RES_TBL_TYPE_SHFT);
+	res->resource_type = tbl_type;
+	res->resource_sub_type = tbl_id;
 }
 
 /* Extracts the tbl_type and tbl_id from the 32bit resource type. */
@@ -303,12 +302,8 @@ ulp_mapper_cache_res_type_get(struct ulp_flow_db_res_params *res,
 			      uint16_t *tbl_type,
 			      uint16_t *tbl_id)
 {
-	*tbl_type = (uint16_t)((res->resource_type >>
-				ULP_MAPPER_CACHE_RES_TBL_TYPE_SHFT) &
-			       ULP_MAPPER_CACHE_RES_TBL_MASK);
-	*tbl_id = (uint16_t)((res->resource_type >>
-			      ULP_MAPPER_CACHE_RES_TBL_ID_SHFT) &
-			     ULP_MAPPER_CACHE_RES_TBL_MASK);
+	*tbl_type = res->resource_type;
+	*tbl_id = res->resource_sub_type;
 }
 
 static int32_t
diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.h b/drivers/net/bnxt/tf_ulp/ulp_mapper.h
index e794795c4..12633156a 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.h
@@ -17,9 +17,6 @@
 
 #define ULP_SZ_BITS2BYTES(x) (((x) + 7) / 8)
 #define ULP_IDENTS_INVALID ((uint16_t)0xffff)
-#define ULP_MAPPER_CACHE_RES_TBL_ID_SHFT 16
-#define ULP_MAPPER_CACHE_RES_TBL_TYPE_SHFT 0
-#define ULP_MAPPER_CACHE_RES_TBL_MASK ((uint32_t)0x0000ffff)
 
 /*
  * The cache table opcode is used to convey informat from the cache handler
diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db.h b/drivers/net/bnxt/tf_ulp/ulp_template_db.h
index 212068fc8..4e1836658 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_template_db.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_template_db.h
@@ -195,14 +195,16 @@ enum bnxt_ulp_regfile_index {
 };
 
 enum bnxt_ulp_resource_func {
-	BNXT_ULP_RESOURCE_FUNC_INVALID = 0,
-	BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE = 1,
-	BNXT_ULP_RESOURCE_FUNC_EM_TABLE = 2,
-	BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE = 3,
-	BNXT_ULP_RESOURCE_FUNC_CACHE_TABLE = 4,
-	BNXT_ULP_RESOURCE_FUNC_IDENTIFIER = 5,
-	BNXT_ULP_RESOURCE_FUNC_HW_FID = 6,
-	BNXT_ULP_RESOURCE_FUNC_LAST = 7
+	BNXT_ULP_RESOURCE_FUNC_INVALID = 0x00,
+	BNXT_ULP_RESOURCE_FUNC_EM_TABLE = 0x20,
+	BNXT_ULP_RESOURCE_FUNC_RSVD1 = 0x40,
+	BNXT_ULP_RESOURCE_FUNC_RSVD2 = 0x60,
+	BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE = 0x80,
+	BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE = 0x81,
+	BNXT_ULP_RESOURCE_FUNC_CACHE_TABLE = 0x82,
+	BNXT_ULP_RESOURCE_FUNC_IDENTIFIER = 0x83,
+	BNXT_ULP_RESOURCE_FUNC_IF_TABLE = 0x84,
+	BNXT_ULP_RESOURCE_FUNC_HW_FID = 0x85
 };
 
 enum bnxt_ulp_result_opc {
-- 
2.21.1 (Apple Git-122.3)


  parent reply	other threads:[~2020-06-27 10:01 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-12 12:49 [dpdk-dev] [PATCH v3 00/36] bnxt patches Somnath Kotur
2020-06-12 12:49 ` [dpdk-dev] [PATCH 01/36] net/bnxt: Makefile changes Somnath Kotur
2020-06-12 12:49 ` [dpdk-dev] [PATCH 02/36] net/bnxt: remove svif and vlan information from header bitmap Somnath Kotur
2020-06-12 12:49 ` [dpdk-dev] [PATCH 03/36] net/bnxt: add vfr flag to the mark manager Somnath Kotur
2020-06-12 12:49 ` [dpdk-dev] [PATCH 04/36] net/bnxt: support for mark action for LFID rules Somnath Kotur
2020-06-12 12:49 ` [dpdk-dev] [PATCH 05/36] net/bnxt: remove mem field from mapper class table Somnath Kotur
2020-06-12 12:49 ` [dpdk-dev] [PATCH 06/36] net/bnxt: support more resource functions in flow database Somnath Kotur
2020-06-12 12:49 ` [dpdk-dev] [PATCH 07/36] net/bnxt: rename the ulp action bitmap enumeration values Somnath Kotur
2020-06-12 12:49 ` [dpdk-dev] [PATCH 08/36] net/bnxt: add support for computed header field in result opcode Somnath Kotur
2020-06-12 12:49 ` [dpdk-dev] [PATCH 09/36] net/bnxt: updated compute field list and access macros Somnath Kotur
2020-06-12 12:49 ` [dpdk-dev] [PATCH 10/36] net/bnxt: extend default identifier list to be global resource list Somnath Kotur
2020-06-12 12:49 ` [dpdk-dev] [PATCH 11/36] net/bnxt: add resource sub type to class and action tables Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 12/36] net/bnxt: remove cache tbl id from the mapper class table Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 13/36] net/bnxt: move vfr flag from computed field list to " Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 14/36] net/bnxt: add support for action bitmap opcode in result field processing Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 15/36] net/bnxt: direction bit needs to be added to the action bitmap Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 16/36] net/bnxt: remove cache_tbl_id enums Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 17/36] net/bnxt: extend index table processing to process action templates Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 18/36] net/bnxt: use vport in the phy port act handler Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 19/36] net/bnxt: add enum to the critical resource Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 20/36] net/bnxt: rename regfile_wr_idx to regfile_idx Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 21/36] net/bnxt: remove unused enum in regfile index Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 22/36] net/bnxt: rename an enum in the " Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 23/36] net/bnxt: rename the enums in the bnxt_ulp_resource_sub_type Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 24/36] net/bnxt: add a devarg to set max flow count Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 25/36] net/bnxt: add support for vxlan encap and decap templates Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 26/36] net/bnxt: flow db api to get vf rep action record Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 27/36] net/bnxt: parse ipv6 vtc_flow field for more granularly Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 28/36] net/bnxt: remove the implicit bitset update for vnic action Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 29/36] net/bnxt: divide the ulp template db file to smaller modules Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 30/36] net/bnxt: unify the mapper opcodes into single enum Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 31/36] net/bnxt: change opcode for adding pad to setting zero for common usage Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH] net/bnxt: optimized key/mask/result fields to use set to zero opcode Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 33/36] net/bnxt: add support for internal exact match flows Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 34/36] net/bnxt: enable vfr flag processing with mark db opcode Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 35/36] net/bnxt: rename fields in the device params structure Somnath Kotur
2020-06-12 12:50 ` [dpdk-dev] [PATCH 36/36] net/bnxt: update ulp template database for new opcodes Somnath Kotur
2020-06-27 10:00 ` [dpdk-dev] [PATCH v4 00/25] bnxt patches Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 01/25] net/bnxt: changes to makefile Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 02/25] net/bnxt: remove fields from bitmap and mapper table Ajit Khaparde
2020-06-27 10:00   ` Ajit Khaparde [this message]
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 04/25] net/bnxt: add computed header field in result opcode Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 05/25] net/bnxt: update compute field list and access macros Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 06/25] net/bnxt: change default identifier to global resource Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 07/25] net/bnxt: add resource sub type to class and action tables Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 08/25] net/bnxt: remove cache tbl id from mapper class table Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 09/25] net/bnxt: add support for action bitmap opcode Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 10/25] net/bnxt: process action templates Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 11/25] net/bnxt: use vport in the phy port act handler Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 12/25] net/bnxt: add enum to the critical resource Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 13/25] net/bnxt: refactor and rename some fields and enums Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 14/25] net/bnxt: add a devarg to set max flow count Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 15/25] net/bnxt: add support for vxlan encap and decap templates Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 16/25] net/bnxt: flow db API to get VF rep action record Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 17/25] net/bnxt: modify IPV6 vtc flow field parsing Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 18/25] net/bnxt: remove the implicit bitset update for vnic action Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 19/25] net/bnxt: divide ulp template db file to smaller modules Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 20/25] net/bnxt: refactor the mapper opcodes Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 21/25] net/bnxt: add support for internal exact match flows Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 22/25] net/bnxt: add vfr flag to the mark manager Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 23/25] net/bnxt: support for mark action for LFID rules Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 24/25] net/bnxt: rename fields in the device params structure Ajit Khaparde
2020-06-27 10:00   ` [dpdk-dev] [PATCH v4 25/25] net/bnxt: update ulp template database for new opcodes Ajit Khaparde
2020-06-27 15:47   ` [dpdk-dev] [PATCH v4 00/25] bnxt patches Ajit Khaparde
2020-06-30  7:49     ` Ferruh Yigit

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=20200627100050.19688-4-ajit.khaparde@broadcom.com \
    --to=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=kishore.padmanabha@broadcom.com \
    --cc=somnath.kotur@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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git