DPDK patches and discussions
 help / color / mirror / Atom feed
From: Somnath Kotur <somnath.kotur@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com
Subject: [dpdk-dev] [PATCH 06/36] net/bnxt: support more resource functions in flow database
Date: Wed, 10 Jun 2020 12:27:03 +0530	[thread overview]
Message-ID: <20200610065733.18698-7-somnath.kotur@broadcom.com> (raw)
In-Reply-To: <20200610065733.18698-1-somnath.kotur@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>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@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 35a7f86..30a809a 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 ebca849..9037dc5 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 9531bed..437b055 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 0754e39..3be04e8 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 fcd80d9..4721177 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_template_db.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_template_db.h
@@ -196,14 +196,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.7.4


  parent reply	other threads:[~2020-06-10  7:03 UTC|newest]

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

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=20200610065733.18698-7-somnath.kotur@broadcom.com \
    --to=somnath.kotur@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.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).