Skip to contentSkip to conversation

introduce changes to support flow scaling

PATCH New Venkat Duvvuru 2 participants 12 messages Apr 25, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

cover introduce changes to support flow scaling

This patchset introduces changes to the action record allocation, flow database entry deletion, and hw flow cache updates. Action record allocation now allows the actions to scale with the flows. Additionally, resources attached to a flow database entry are now correctly released when the critical resource has not been added to the flow. Finally, the hw flow cache has a timer to periodically invalidate flow entries.

Farah Smith (1):
net/bnxt: action record external pool updates

Mike Baucom (3):
net/bnxt: reserve a flowdb resource function as invalid net/bnxt: ulp modifications for handling actions/index tables net/bnxt: ulp must set hw flow cache timer when allocating table scope

Shahaji Bhosle (1):
net/bnxt: add truflow flush-timer to alloc table scope API

 drivers/net/bnxt/tf_core/tf_core.c        |   3 -
 drivers/net/bnxt/tf_core/tf_core.h        |  21 +++--
 drivers/net/bnxt/tf_core/tf_msg.c         |   3 +
 drivers/net/bnxt/tf_core/tf_msg.h         |   1 +
 drivers/net/bnxt/tf_core/tf_rm.c          |   3 -
 drivers/net/bnxt/tf_core/tf_session.h     |   6 --
 drivers/net/bnxt/tf_core/tf_tbl.c         | 137 ++++++++++++------------------
 drivers/net/bnxt/tf_core/tf_tbl.h         |   4 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c        |   6 ++
 drivers/net/bnxt/tf_ulp/ulp_mapper.c      |  30 ++++---
 drivers/net/bnxt/tf_ulp/ulp_template_db.h |  15 ++--
 11 files changed, 106 insertions(+), 123 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/5 net/bnxt: reserve a flowdb resource function as invalid

From: Mike Baucom <[email protected]>

The resource function did not have a method of invalidating or indicating that a resource is uninitialized. Added an invalid enum so that processing works correctly for partially added flows.

---
 drivers/net/bnxt/tf_ulp/ulp_template_db.h | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_template_db.h +8 -7
index a5606bd..e6065d2 100644
@@ -204,13 +204,14 @@ enum bnxt_ulp_regfile_index {
 };
 
 enum bnxt_ulp_resource_func {
-	BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE = 0,
-	BNXT_ULP_RESOURCE_FUNC_EM_TABLE = 1,
-	BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE = 2,
-	BNXT_ULP_RESOURCE_FUNC_CACHE_TABLE = 3,
-	BNXT_ULP_RESOURCE_FUNC_IDENTIFIER = 4,
-	BNXT_ULP_RESOURCE_FUNC_HW_FID = 5,
-	BNXT_ULP_RESOURCE_FUNC_LAST = 6
+	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
 };
 
 enum bnxt_ulp_result_opc {
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/5 net/bnxt: action record external pool updates

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

- Added support variable sized action records
- Additional error checking on table scope params
- Single external pool supported per direction
- Changed to return action record pointer
- Allows action pool to fully utilize the number of flows

---
 drivers/net/bnxt/tf_core/tf_core.c    |   3 -
 drivers/net/bnxt/tf_core/tf_core.h    |  15 ++--
 drivers/net/bnxt/tf_core/tf_rm.c      |   3 -
 drivers/net/bnxt/tf_core/tf_session.h |   6 --
 drivers/net/bnxt/tf_core/tf_tbl.c     | 136 +++++++++++++---------------------
 drivers/net/bnxt/tf_core/tf_tbl.h     |   4 +-
 6 files changed, 62 insertions(+), 105 deletions(-)
drivers/net/bnxt/tf_core/tf_core.c +0 -3
index fc7d638..cf9f36a 100644
@@ -175,9 +175,6 @@ tf_open_session(struct tf                    *tfp,
 	/* Setup hash seeds */
 	tf_seeds_init(session);
 
-	/* Initialize external pool data structures */
-	tf_init_tbl_pool(session);
-
 	session->ref_count++;
 
 	/* Return session ID */
drivers/net/bnxt/tf_core/tf_core.h +9 -6
index 6a1f3a1..4b60973 100644
@@ -83,7 +83,7 @@ enum tf_mem {
 
 /** EEM record AR helper
  *
- * Helpers to handle the Action Record Pointer in the EEM Record Entry.
+ * Helper to handle the Action Record Pointer in the EEM Record Entry.
  *
  * Convert absolute offset to action record pointer in EEM record entry
  * Convert action record pointer in EEM record entry to absolute offset
@@ -91,8 +91,6 @@ enum tf_mem {
 #define TF_ACT_REC_OFFSET_2_PTR(offset) ((offset) >> 4)
 #define TF_ACT_REC_PTR_2_OFFSET(offset) ((offset) << 4)
 
-#define TF_ACT_REC_INDEX_2_OFFSET(idx) ((idx) << 9)
-
 /*
  * Helper Macros
  */
@@ -943,8 +941,6 @@ enum tf_tbl_type {
 	 * scope. Internal types are not.
 	 */
 	TF_TBL_TYPE_EXT,
-	/** Future - external pool of size0 entries */
-	TF_TBL_TYPE_EXT_0,
 	TF_TBL_TYPE_MAX
 };
 
@@ -960,6 +956,10 @@ struct tf_alloc_tbl_entry_parms {
 	 */
 	enum tf_tbl_type type;
 	/**
+	 * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
+	 */
+	uint32_t tbl_scope_id;
+	/**
 	 * [in] Enable search for matching entry. If the table type is
 	 * internal the shadow copy will be searched before
 	 * alloc. Session must be configured with shadow copy enabled.
@@ -1029,6 +1029,10 @@ struct tf_free_tbl_entry_parms {
 	 */
 	enum tf_tbl_type type;
 	/**
+	 * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
+	 */
+	uint32_t tbl_scope_id;
+	/**
 	 * [in] Index to free
 	 */
 	uint32_t idx;
@@ -1070,7 +1074,6 @@ int tf_free_tbl_entry(struct tf *tfp,
 struct tf_set_tbl_entry_parms {
 	/**
 	 * [in] Table scope identifier
-	 *
 	 */
 	uint32_t tbl_scope_id;
 	/**
drivers/net/bnxt/tf_core/tf_rm.c +0 -3
index a5e96f29..38b1e71 100644
@@ -3104,7 +3104,6 @@ tf_rm_lookup_tbl_type_pool(struct tf_session *tfs,
 		break;
 	/* No bitalloc pools for these types */
 	case TF_TBL_TYPE_EXT:
-	case TF_TBL_TYPE_EXT_0:
 	default:
 		break;
 	}
@@ -3211,7 +3210,6 @@ tf_rm_convert_tbl_type(enum tf_tbl_type type,
 	case TF_TBL_TYPE_ACT_MODIFY_IPV6_SRC:
 	case TF_TBL_TYPE_VNIC_SVIF:
 	case TF_TBL_TYPE_EXT:   /* No pools for this type */
-	case TF_TBL_TYPE_EXT_0: /* No pools for this type */
 	default:
 		*hcapi_type = -1;
 		rc = -EOPNOTSUPP;
@@ -3277,7 +3275,6 @@ tf_rm_convert_index(struct tf_session *tfs,
 	/* Not yet supported */
 	case TF_TBL_TYPE_VNIC_SVIF:
 	case TF_TBL_TYPE_EXT:   /* No pools for this type */
-	case TF_TBL_TYPE_EXT_0: /* No pools for this type */
 	default:
 		return -EOPNOTSUPP;
 	}
drivers/net/bnxt/tf_core/tf_session.h +0 -6
index fed34f1..50ef2d5 100644
@@ -289,12 +289,6 @@ struct tf_session {
 
 	/** Table scope array */
 	struct tf_tbl_scope_cb tbl_scopes[TF_NUM_TBL_SCOPE];
-
-	/** Each external pool is associated with a single table scope
-	 *  For each external pool store the associated table scope in
-	 *  this data structure
-	 */
-	uint32_t ext_pool_2_scope[TF_DIR_MAX][TF_EXT_POOL_CNT_MAX];
 };
 
 #endif /* _TF_SESSION_H_ */
drivers/net/bnxt/tf_core/tf_tbl.c +51 -85

279 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tbl.h +2 -2
index 5d3ea71..bdc6288 100644
@@ -72,8 +72,8 @@ struct tf_tbl_scope_cb {
 	int index;
 	struct tf_em_ctx_mem_info  em_ctx_info[TF_DIR_MAX];
 	struct tf_em_caps          em_caps[TF_DIR_MAX];
-	struct stack               ext_pool[TF_DIR_MAX][TF_EXT_POOL_CNT_MAX];
-	uint32_t              *ext_pool_mem[TF_DIR_MAX][TF_EXT_POOL_CNT_MAX];
+	struct stack               ext_act_pool[TF_DIR_MAX];
+	uint32_t                  *ext_act_pool_mem[TF_DIR_MAX];
 };
 
 /** Hardware Page sizes supported for EEM: 4K, 8K, 64K, 256K, 1M, 2M, 4M, 1G.
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/5 net/bnxt: ulp modifications for handling actions/index tables

In reply to Venkat Duvvuru

From: Mike Baucom <[email protected]>

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.

---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_mapper.c +19 -11
index dc7b7ca..9ea6fdb 100644
@@ -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)
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/5 net/bnxt: add truflow flush-timer to alloc table scope API

In reply to Venkat Duvvuru

From: Shahaji Bhosle <[email protected]>

Updated the params list to include flush timer, this will allow users to set the HW flush timer value in 10th of second. Setting 0 will disable the pending cache flush feature.

---
 drivers/net/bnxt/tf_core/tf_core.h | 6 ++++++
 drivers/net/bnxt/tf_core/tf_msg.c  | 3 +++
 drivers/net/bnxt/tf_core/tf_msg.h  | 1 +
 drivers/net/bnxt/tf_core/tf_tbl.c  | 1 +
 4 files changed, 11 insertions(+)
drivers/net/bnxt/tf_core/tf_core.h +6 -0
index 4b60973..1eedd80 100644
@@ -561,6 +561,12 @@ struct tf_alloc_tbl_scope_parms {
 	 */
 	uint32_t tx_tbl_if_id;
 	/**
+	 * [in] Flush pending HW cached flows every 1/10th of value
+	 * set in seconds, both idle and active flows are flushed
+	 * from the HW cache. If set to 0, this feature will be disabled.
+	 */
+	uint8_t hw_flow_cache_flush_timer;
+	/**
 	 * [out] table scope identifier
 	 */
 	uint32_t tbl_scope_id;
drivers/net/bnxt/tf_core/tf_msg.c +3 -0
index bdf8f15..beecafd 100644
@@ -978,6 +978,7 @@ int tf_msg_em_cfg(struct tf *tfp,
 		  uint16_t   key1_ctx_id,
 		  uint16_t   record_ctx_id,
 		  uint16_t   efc_ctx_id,
+		  uint8_t    flush_interval,
 		  int        dir)
 {
 	int rc;
@@ -993,6 +994,8 @@ int tf_msg_em_cfg(struct tf *tfp,
 	req.flags = tfp_cpu_to_le_32(flags);
 	req.num_entries = tfp_cpu_to_le_32(num_entries);
 
+	req.flush_interval = flush_interval;
+
 	req.key0_ctx_id = tfp_cpu_to_le_16(key0_ctx_id);
 	req.key1_ctx_id = tfp_cpu_to_le_16(key1_ctx_id);
 	req.record_ctx_id = tfp_cpu_to_le_16(record_ctx_id);
drivers/net/bnxt/tf_core/tf_msg.h +1 -0
index b8d8c1e..030d188 100644
@@ -152,6 +152,7 @@ int tf_msg_em_cfg(struct tf *tfp,
 		  uint16_t      key1_ctx_id,
 		  uint16_t      record_ctx_id,
 		  uint16_t      efc_ctx_id,
+		  uint8_t       flush_interval,
 		  int           dir);
 
 /**
drivers/net/bnxt/tf_core/tf_tbl.c +1 -0
index 236affe..93f387e 100644
@@ -1500,6 +1500,7 @@ tf_alloc_eem_tbl_scope(struct tf *tfp,
 				   em_tables[KEY1_TABLE].ctx_id,
 				   em_tables[RECORD_TABLE].ctx_id,
 				   em_tables[EFC_TABLE].ctx_id,
+				   parms->hw_flow_cache_flush_timer,
 				   dir);
 		if (rc) {
 			PMD_DRV_LOG(ERR,
Signature · 1 line
2.7.4
#5 lore raw

PATCH 5/5 net/bnxt: ulp must set hw flow cache timer when allocating table scope

In reply to Venkat Duvvuru

From: Mike Baucom <[email protected]>

The tf_alloc_tbl_scope API now accepts a timer interval for flushing the hw flow cache. The flush timer is necessary in order to refresh the flow table.

---
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +6 -0
index f8047f0..a9cc92d 100644
@@ -121,6 +121,12 @@ bnxt_init_tbl_scope_parms(struct bnxt *bp,
 	else
 		dparms = bnxt_ulp_device_params_get(dev_id);
 
+	/*
+	 * Set the flush timer for EEM entries. The value is in 100ms intervals,
+	 * so 100 is 10s.
+	 */
+	params->hw_flow_cache_flush_timer = 100;
+
 	if (!dparms) {
 		params->rx_max_key_sz_in_bits = BNXT_ULP_DFLT_RX_MAX_KEY;
 		params->rx_max_action_entry_sz_in_bits =
Signature · 1 line
2.7.4
#6 lore raw

v2 cover introduce changes to support flow scaling

In reply to Venkat Duvvuru

This patchset introduces changes to the action record allocation, flow database entry deletion, and hw flow cache updates. Action record allocation now allows the actions to scale with the flows. Additionally, resources attached to a flow database entry are now correctly released when the critical resource has not been added to the flow. Finally, the hw flow cache has a timer to periodically invalidate flow entries.

v1->v2:
Squashed patches 4 & 5 into single patch.

Farah Smith (1):
net/bnxt: update action record external pool

Mike Baucom (2):
net/bnxt: reserve a flowdb resource function as invalid net/bnxt: ulp changes to handle action/index tables

Shahaji Bhosle (1):
net/bnxt: add truflow flush-timer to alloc table scope API

 drivers/net/bnxt/tf_core/tf_core.c        |   3 -
 drivers/net/bnxt/tf_core/tf_core.h        |  21 +++-
 drivers/net/bnxt/tf_core/tf_msg.c         |   3 +
 drivers/net/bnxt/tf_core/tf_msg.h         |   1 +
 drivers/net/bnxt/tf_core/tf_rm.c          |   3 -
 drivers/net/bnxt/tf_core/tf_session.h     |   6 -
 drivers/net/bnxt/tf_core/tf_tbl.c         | 137 ++++++++--------------
 drivers/net/bnxt/tf_core/tf_tbl.h         |   4 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c        |   6 +
 drivers/net/bnxt/tf_ulp/ulp_mapper.c      |  30 +++--
 drivers/net/bnxt/tf_ulp/ulp_template_db.h |  15 +--
 11 files changed, 106 insertions(+), 123 deletions(-)
Signature · 1 line
2.21.1 (Apple Git-122.3)
#7 lore raw

PATCH v2 1/4 net/bnxt: reserve a flowdb resource function as invalid

From: Mike Baucom <[email protected]>

The resource function did not have a method of invalidating or indicating that a resource is uninitialized. Added an invalid enum so that processing works correctly for partially added flows.

---
 drivers/net/bnxt/tf_ulp/ulp_template_db.h | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_template_db.h +8 -7
index a5606bdc4..e6065d2fb 100644
@@ -204,13 +204,14 @@ enum bnxt_ulp_regfile_index {
 };
 
 enum bnxt_ulp_resource_func {
-	BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE = 0,
-	BNXT_ULP_RESOURCE_FUNC_EM_TABLE = 1,
-	BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE = 2,
-	BNXT_ULP_RESOURCE_FUNC_CACHE_TABLE = 3,
-	BNXT_ULP_RESOURCE_FUNC_IDENTIFIER = 4,
-	BNXT_ULP_RESOURCE_FUNC_HW_FID = 5,
-	BNXT_ULP_RESOURCE_FUNC_LAST = 6
+	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
 };
 
 enum bnxt_ulp_result_opc {
Signature · 1 line
2.21.1 (Apple Git-122.3)
#8 lore raw

PATCH v2 2/4 net/bnxt: update action record external pool

In reply to Ajit Khaparde

From: Farah Smith <[email protected]>

- Added support variable sized action records
- Additional error checking on table scope params
- Single external pool supported per direction
- Changed to return action record pointer
- Allows action pool to fully utilize the number of flows

---
 drivers/net/bnxt/tf_core/tf_core.c    |   3 -
 drivers/net/bnxt/tf_core/tf_core.h    |  15 +--
 drivers/net/bnxt/tf_core/tf_rm.c      |   3 -
 drivers/net/bnxt/tf_core/tf_session.h |   6 --
 drivers/net/bnxt/tf_core/tf_tbl.c     | 136 ++++++++++----------------
 drivers/net/bnxt/tf_core/tf_tbl.h     |   4 +-
 6 files changed, 62 insertions(+), 105 deletions(-)
drivers/net/bnxt/tf_core/tf_core.c +0 -3
index fc7d6381f..cf9f36adb 100644
@@ -175,9 +175,6 @@ tf_open_session(struct tf                    *tfp,
 	/* Setup hash seeds */
 	tf_seeds_init(session);
 
-	/* Initialize external pool data structures */
-	tf_init_tbl_pool(session);
-
 	session->ref_count++;
 
 	/* Return session ID */
drivers/net/bnxt/tf_core/tf_core.h +9 -6
index 6a1f3a106..4b60973ee 100644
@@ -83,7 +83,7 @@ enum tf_mem {
 
 /** EEM record AR helper
  *
- * Helpers to handle the Action Record Pointer in the EEM Record Entry.
+ * Helper to handle the Action Record Pointer in the EEM Record Entry.
  *
  * Convert absolute offset to action record pointer in EEM record entry
  * Convert action record pointer in EEM record entry to absolute offset
@@ -91,8 +91,6 @@ enum tf_mem {
 #define TF_ACT_REC_OFFSET_2_PTR(offset) ((offset) >> 4)
 #define TF_ACT_REC_PTR_2_OFFSET(offset) ((offset) << 4)
 
-#define TF_ACT_REC_INDEX_2_OFFSET(idx) ((idx) << 9)
-
 /*
  * Helper Macros
  */
@@ -943,8 +941,6 @@ enum tf_tbl_type {
 	 * scope. Internal types are not.
 	 */
 	TF_TBL_TYPE_EXT,
-	/** Future - external pool of size0 entries */
-	TF_TBL_TYPE_EXT_0,
 	TF_TBL_TYPE_MAX
 };
 
@@ -959,6 +955,10 @@ struct tf_alloc_tbl_entry_parms {
 	 * [in] Type of the allocation
 	 */
 	enum tf_tbl_type type;
+	/**
+	 * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
+	 */
+	uint32_t tbl_scope_id;
 	/**
 	 * [in] Enable search for matching entry. If the table type is
 	 * internal the shadow copy will be searched before
@@ -1028,6 +1028,10 @@ struct tf_free_tbl_entry_parms {
 	 * [in] Type of the allocation type
 	 */
 	enum tf_tbl_type type;
+	/**
+	 * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT)
+	 */
+	uint32_t tbl_scope_id;
 	/**
 	 * [in] Index to free
 	 */
@@ -1070,7 +1074,6 @@ int tf_free_tbl_entry(struct tf *tfp,
 struct tf_set_tbl_entry_parms {
 	/**
 	 * [in] Table scope identifier
-	 *
 	 */
 	uint32_t tbl_scope_id;
 	/**
drivers/net/bnxt/tf_core/tf_rm.c +0 -3
index a5e96f29b..38b1e71cd 100644
@@ -3104,7 +3104,6 @@ tf_rm_lookup_tbl_type_pool(struct tf_session *tfs,
 		break;
 	/* No bitalloc pools for these types */
 	case TF_TBL_TYPE_EXT:
-	case TF_TBL_TYPE_EXT_0:
 	default:
 		break;
 	}
@@ -3211,7 +3210,6 @@ tf_rm_convert_tbl_type(enum tf_tbl_type type,
 	case TF_TBL_TYPE_ACT_MODIFY_IPV6_SRC:
 	case TF_TBL_TYPE_VNIC_SVIF:
 	case TF_TBL_TYPE_EXT:   /* No pools for this type */
-	case TF_TBL_TYPE_EXT_0: /* No pools for this type */
 	default:
 		*hcapi_type = -1;
 		rc = -EOPNOTSUPP;
@@ -3277,7 +3275,6 @@ tf_rm_convert_index(struct tf_session *tfs,
 	/* Not yet supported */
 	case TF_TBL_TYPE_VNIC_SVIF:
 	case TF_TBL_TYPE_EXT:   /* No pools for this type */
-	case TF_TBL_TYPE_EXT_0: /* No pools for this type */
 	default:
 		return -EOPNOTSUPP;
 	}
drivers/net/bnxt/tf_core/tf_session.h +0 -6
index fed34f146..50ef2d530 100644
@@ -289,12 +289,6 @@ struct tf_session {
 
 	/** Table scope array */
 	struct tf_tbl_scope_cb tbl_scopes[TF_NUM_TBL_SCOPE];
-
-	/** Each external pool is associated with a single table scope
-	 *  For each external pool store the associated table scope in
-	 *  this data structure
-	 */
-	uint32_t ext_pool_2_scope[TF_DIR_MAX][TF_EXT_POOL_CNT_MAX];
 };
 
 #endif /* _TF_SESSION_H_ */
drivers/net/bnxt/tf_core/tf_tbl.c +51 -85

279 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tbl.h +2 -2
index 5d3ea71f4..bdc6288ee 100644
@@ -72,8 +72,8 @@ struct tf_tbl_scope_cb {
 	int index;
 	struct tf_em_ctx_mem_info  em_ctx_info[TF_DIR_MAX];
 	struct tf_em_caps          em_caps[TF_DIR_MAX];
-	struct stack               ext_pool[TF_DIR_MAX][TF_EXT_POOL_CNT_MAX];
-	uint32_t              *ext_pool_mem[TF_DIR_MAX][TF_EXT_POOL_CNT_MAX];
+	struct stack               ext_act_pool[TF_DIR_MAX];
+	uint32_t                  *ext_act_pool_mem[TF_DIR_MAX];
 };
 
 /** Hardware Page sizes supported for EEM: 4K, 8K, 64K, 256K, 1M, 2M, 4M, 1G.
Signature · 1 line
2.21.1 (Apple Git-122.3)
#9 lore raw

PATCH v2 3/4 net/bnxt: ulp changes to handle action/index tables

In reply to Ajit Khaparde

From: Mike Baucom <[email protected]>

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.

---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c | 30 ++++++++++++++++++----------
 1 file changed, 19 insertions(+), 11 deletions(-)
drivers/net/bnxt/tf_ulp/ulp_mapper.c +19 -11
index dc7b7ca5e..9ea6fdba0 100644
@@ -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)
Signature · 1 line
2.21.1 (Apple Git-122.3)
#10 lore raw

PATCH v2 4/4 net/bnxt: add truflow flush-timer to alloc table scope API

In reply to Ajit Khaparde

From: Shahaji Bhosle <[email protected]>

Updated the params list to include flush timer, this will allow users to set the HW flush timer value in 10th of second. Setting 0 will disable the pending cache flush feature.

---
 drivers/net/bnxt/tf_core/tf_core.h | 6 ++++++
 drivers/net/bnxt/tf_core/tf_msg.c  | 3 +++
 drivers/net/bnxt/tf_core/tf_msg.h  | 1 +
 drivers/net/bnxt/tf_core/tf_tbl.c  | 1 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 6 ++++++
 5 files changed, 17 insertions(+)
drivers/net/bnxt/tf_core/tf_core.h +6 -0
index 4b60973ee..1eedd80e7 100644
@@ -560,6 +560,12 @@ struct tf_alloc_tbl_scope_parms {
 	 * [in] Brd4 only receive table access interface id
 	 */
 	uint32_t tx_tbl_if_id;
+	/**
+	 * [in] Flush pending HW cached flows every 1/10th of value
+	 * set in seconds, both idle and active flows are flushed
+	 * from the HW cache. If set to 0, this feature will be disabled.
+	 */
+	uint8_t hw_flow_cache_flush_timer;
 	/**
 	 * [out] table scope identifier
 	 */
drivers/net/bnxt/tf_core/tf_msg.c +3 -0
index bdf8f155f..beecafdeb 100644
@@ -978,6 +978,7 @@ int tf_msg_em_cfg(struct tf *tfp,
 		  uint16_t   key1_ctx_id,
 		  uint16_t   record_ctx_id,
 		  uint16_t   efc_ctx_id,
+		  uint8_t    flush_interval,
 		  int        dir)
 {
 	int rc;
@@ -993,6 +994,8 @@ int tf_msg_em_cfg(struct tf *tfp,
 	req.flags = tfp_cpu_to_le_32(flags);
 	req.num_entries = tfp_cpu_to_le_32(num_entries);
 
+	req.flush_interval = flush_interval;
+
 	req.key0_ctx_id = tfp_cpu_to_le_16(key0_ctx_id);
 	req.key1_ctx_id = tfp_cpu_to_le_16(key1_ctx_id);
 	req.record_ctx_id = tfp_cpu_to_le_16(record_ctx_id);
drivers/net/bnxt/tf_core/tf_msg.h +1 -0
index b8d8c1ede..030d1881e 100644
@@ -152,6 +152,7 @@ int tf_msg_em_cfg(struct tf *tfp,
 		  uint16_t      key1_ctx_id,
 		  uint16_t      record_ctx_id,
 		  uint16_t      efc_ctx_id,
+		  uint8_t       flush_interval,
 		  int           dir);
 
 /**
drivers/net/bnxt/tf_core/tf_tbl.c +1 -0
index 236affe25..93f387e86 100644
@@ -1500,6 +1500,7 @@ tf_alloc_eem_tbl_scope(struct tf *tfp,
 				   em_tables[KEY1_TABLE].ctx_id,
 				   em_tables[RECORD_TABLE].ctx_id,
 				   em_tables[EFC_TABLE].ctx_id,
+				   parms->hw_flow_cache_flush_timer,
 				   dir);
 		if (rc) {
 			PMD_DRV_LOG(ERR,
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +6 -0
index f8047f0d6..a9cc92d34 100644
@@ -121,6 +121,12 @@ bnxt_init_tbl_scope_parms(struct bnxt *bp,
 	else
 		dparms = bnxt_ulp_device_params_get(dev_id);
 
+	/*
+	 * Set the flush timer for EEM entries. The value is in 100ms intervals,
+	 * so 100 is 10s.
+	 */
+	params->hw_flow_cache_flush_timer = 100;
+
 	if (!dparms) {
 		params->rx_max_key_sz_in_bits = BNXT_ULP_DFLT_RX_MAX_KEY;
 		params->rx_max_action_entry_sz_in_bits =
Signature · 1 line
2.21.1 (Apple Git-122.3)
#11 lore raw
In reply to Ajit Khaparde
Quoted 11 lines · Ajit Khaparde

This patchset introduces changes to the action record allocation, flow database entry deletion, and hw flow cache updates. Action record allocation now allows the actions to scale with the flows. Additionally, resources attached to a flow database entry are now correctly released when the critical resource has not been added to the flow. Finally, the hw flow cache has a timer to periodically invalidate flow entries.

v1->v2:
Squashed patches 4 & 5 into single patch.

Applied to dpdk-next-net-brcm.

Quoted 28 lines

Farah Smith (1):
net/bnxt: update action record external pool

Mike Baucom (2):
net/bnxt: reserve a flowdb resource function as invalid net/bnxt: ulp changes to handle action/index tables

Shahaji Bhosle (1):
net/bnxt: add truflow flush-timer to alloc table scope API

 drivers/net/bnxt/tf_core/tf_core.c        |   3 -
 drivers/net/bnxt/tf_core/tf_core.h        |  21 +++-
 drivers/net/bnxt/tf_core/tf_msg.c         |   3 +
 drivers/net/bnxt/tf_core/tf_msg.h         |   1 +
 drivers/net/bnxt/tf_core/tf_rm.c          |   3 -
 drivers/net/bnxt/tf_core/tf_session.h     |   6 -
 drivers/net/bnxt/tf_core/tf_tbl.c         | 137 ++++++++--------------
 drivers/net/bnxt/tf_core/tf_tbl.h         |   4 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c        |   6 +
 drivers/net/bnxt/tf_ulp/ulp_mapper.c      |  30 +++--
 drivers/net/bnxt/tf_ulp/ulp_template_db.h |  15 +--
 11 files changed, 106 insertions(+), 123 deletions(-)

--
2.21.1 (Apple Git-122.3)