Skip to contentSkip to conversation

enhancements to host based flow table management

PATCH Superseded Venkat Duvvuru 6 participants 83 messages Sep 1, 2021 – Sep 29, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover enhancements to host based flow table management

This patch set adds support for new offload features/enhancments for Thor adapters like VF representor support, new flow matches/actions & dynamic SRAM manager support.

Farah Smith (4):
net/bnxt: tf core index table updates
net/bnxt: add Thor SRAM mgr model
net/bnxt: tf core SRAM Manager
net/bnxt: sram manager shared session

Jay Ding (1):
net/bnxt: add flow meter drop counter support

Kishore Padmanabha (6):
net/bnxt: add flow templates support for Thor net/bnxt: add support for tunnel offloads net/bnxt: add support for dynamic encap action net/bnxt: add wild card TCAM byte order for Thor net/bnxt: add flow templates for Thor net/bnxt: add enhancements to TF ULP

Peter Spreadborough (1):
net/bnxt: enable dpool allocator

Randy Schacher (1):
net/bnxt: dynamically allocate space for EM defrag function

Venkat Duvvuru (1):
net/bnxt: add support for testpmd co-existence

 drivers/net/bnxt/bnxt.h                       |     3 +
 drivers/net/bnxt/bnxt_ethdev.c                |    56 +
 drivers/net/bnxt/tf_core/cfa_resource_types.h |     5 +-
 drivers/net/bnxt/tf_core/dpool.c              |    38 +-
 drivers/net/bnxt/tf_core/ll.c                 |     3 +
 drivers/net/bnxt/tf_core/ll.h                 |    50 +-
 drivers/net/bnxt/tf_core/meson.build          |     2 +
 drivers/net/bnxt/tf_core/tf_core.c            |   169 +-
 drivers/net/bnxt/tf_core/tf_core.h            |   159 +-
 drivers/net/bnxt/tf_core/tf_device.c          |    40 +-
 drivers/net/bnxt/tf_core/tf_device.h          |   137 +-
 drivers/net/bnxt/tf_core/tf_device_p4.c       |    77 +-
 drivers/net/bnxt/tf_core/tf_device_p4.h       |    50 +-
 drivers/net/bnxt/tf_core/tf_device_p58.c      |   112 +-
 drivers/net/bnxt/tf_core/tf_device_p58.h      |    70 +-
 drivers/net/bnxt/tf_core/tf_em.h              |    10 -
 drivers/net/bnxt/tf_core/tf_em_common.c       |     4 +
 .../net/bnxt/tf_core/tf_em_hash_internal.c    |    34 -
 drivers/net/bnxt/tf_core/tf_em_internal.c     |   185 +-
 drivers/net/bnxt/tf_core/tf_msg.c             |     2 +-
 drivers/net/bnxt/tf_core/tf_rm.c              |   180 +-
 drivers/net/bnxt/tf_core/tf_rm.h              |    62 +-
 drivers/net/bnxt/tf_core/tf_session.c         |    56 +
 drivers/net/bnxt/tf_core/tf_session.h         |    58 +-
 drivers/net/bnxt/tf_core/tf_sram_mgr.c        |   971 +
 drivers/net/bnxt/tf_core/tf_sram_mgr.h        |   317 +
 drivers/net/bnxt/tf_core/tf_tbl.c             |   259 +-
 drivers/net/bnxt/tf_core/tf_tbl.h             |    87 +-
 drivers/net/bnxt/tf_core/tf_tbl_sram.c        |   747 +
 drivers/net/bnxt/tf_core/tf_tbl_sram.h        |   154 +
 drivers/net/bnxt/tf_core/tf_tcam.c            |    16 +-
 drivers/net/bnxt/tf_core/tf_tcam.h            |     7 +
 drivers/net/bnxt/tf_core/tf_tcam_shared.c     |    28 +-
 drivers/net/bnxt/tf_core/tf_util.c            |    12 +
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |    10 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |    51 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |    20 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |   226 +-
 .../bnxt/tf_ulp/generic_templates/meson.build |    17 +-
 .../generic_templates/ulp_template_db_act.c   |     2 +-
 .../generic_templates/ulp_template_db_class.c | 12109 +++-
 .../generic_templates/ulp_template_db_enum.h  |   618 +-
 .../generic_templates/ulp_template_db_field.h |   767 +-
 .../generic_templates/ulp_template_db_tbl.c   |  2757 +-
 .../ulp_template_db_thor_act.c                |  5079 +-
 .../ulp_template_db_thor_class.c              | 45573 ++++++++++++++--
 .../ulp_template_db_wh_plus_act.c             |  1700 +-
 .../ulp_template_db_wh_plus_class.c           |  8329 ++-
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c       |     4 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |    48 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h          |     8 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |   678 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |    68 +-
 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c         |     9 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   448 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |    10 +-
 drivers/net/bnxt/tf_ulp/ulp_matcher.c         |    13 +
 drivers/net/bnxt/tf_ulp/ulp_port_db.c         |    15 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c |    31 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |   663 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |    12 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |    32 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.c             |   521 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.h             |    89 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |    71 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |    27 +-
 meson_options.txt                             |     2 +
 67 files changed, 71213 insertions(+), 12954 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_sram_mgr.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_sram_mgr.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_tbl_sram.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_tbl_sram.h
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/14 net/bnxt: tf core index table updates

From: Farah Smith <[email protected]>

Remove unused shadow table functionality.

---
 drivers/net/bnxt/tf_core/tf_core.c       |  65 --------------
 drivers/net/bnxt/tf_core/tf_core.h       | 103 +----------------------
 drivers/net/bnxt/tf_core/tf_device.h     |  22 -----
 drivers/net/bnxt/tf_core/tf_device_p4.c  |   2 -
 drivers/net/bnxt/tf_core/tf_device_p58.c |   2 -
 drivers/net/bnxt/tf_core/tf_em_common.c  |   4 +
 drivers/net/bnxt/tf_core/tf_tbl.c        |  21 -----
 drivers/net/bnxt/tf_core/tf_tbl.h        |  72 ----------------
 drivers/net/bnxt/tf_ulp/ulp_mapper.c     |   3 +-
 9 files changed, 7 insertions(+), 287 deletions(-)
drivers/net/bnxt/tf_core/tf_core.c +0 -65
index 97e6165e92..5458f76e2d 100644
@@ -1105,71 +1105,6 @@ tf_alloc_tbl_entry(struct tf *tfp,
 	return 0;
 }
 
-int
-tf_search_tbl_entry(struct tf *tfp,
-		    struct tf_search_tbl_entry_parms *parms)
-{
-	int rc;
-	struct tf_session *tfs;
-	struct tf_dev_info *dev;
-	struct tf_tbl_alloc_search_parms sparms;
-
-	TF_CHECK_PARMS2(tfp, parms);
-
-	/* Retrieve the session information */
-	rc = tf_session_get_session(tfp, &tfs);
-	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "%s: Failed to lookup session, rc:%s\n",
-			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
-		return rc;
-	}
-
-	/* Retrieve the device information */
-	rc = tf_session_get_device(tfs, &dev);
-	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "%s: Failed to lookup device, rc:%s\n",
-			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
-		return rc;
-	}
-
-	if (dev->ops->tf_dev_alloc_search_tbl == NULL) {
-		rc = -EOPNOTSUPP;
-		TFP_DRV_LOG(ERR,
-			    "%s: Operation not supported, rc:%s\n",
-			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
-		return rc;
-	}
-
-	memset(&sparms, 0, sizeof(struct tf_tbl_alloc_search_parms));
-	sparms.dir = parms->dir;
-	sparms.type = parms->type;
-	sparms.result = parms->result;
-	sparms.result_sz_in_bytes = parms->result_sz_in_bytes;
-	sparms.alloc = parms->alloc;
-	sparms.tbl_scope_id = parms->tbl_scope_id;
-	rc = dev->ops->tf_dev_alloc_search_tbl(tfp, &sparms);
-	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "%s: TBL allocation failed, rc:%s\n",
-			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
-		return rc;
-	}
-
-	/* Return the outputs from the search */
-	parms->hit = sparms.hit;
-	parms->search_status = sparms.search_status;
-	parms->ref_cnt = sparms.ref_cnt;
-	parms->idx = sparms.idx;
-
-	return 0;
-}
-
 int
 tf_free_tbl_entry(struct tf *tfp,
 		  struct tf_free_tbl_entry_parms *parms)
drivers/net/bnxt/tf_core/tf_core.h +2 -101

122 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device.h +0 -22
index da3f541685..b43cfc6925 100644
@@ -347,28 +347,6 @@ struct tf_dev_ops {
 	int (*tf_dev_free_ext_tbl)(struct tf *tfp,
 				   struct tf_tbl_free_parms *parms);
 
-	/**
-	 * Searches for the specified table type element in a shadow DB.
-	 *
-	 * This API searches for the specified table type element in a
-	 * device specific shadow DB. If the element is found the
-	 * reference count for the element is updated. If the element
-	 * is not found a new element is allocated from the table type
-	 * DB and then inserted into the shadow DB.
-	 *
-	 * [in] tfp
-	 *   Pointer to TF handle
-	 *
-	 * [in] parms
-	 *   Pointer to table allocation and search parameters
-	 *
-	 * Returns
-	 *   - (0) if successful.
-	 *   - (-EINVAL) on failure.
-	 */
-	int (*tf_dev_alloc_search_tbl)(struct tf *tfp,
-				       struct tf_tbl_alloc_search_parms *parms);
-
 	/**
 	 * Sets the specified table type element.
 	 *
drivers/net/bnxt/tf_core/tf_device_p4.c +0 -2
index 971fab7bda..2e7ccec123 100644
@@ -236,7 +236,6 @@ const struct tf_dev_ops tf_dev_ops_p4_init = {
 	.tf_dev_alloc_tbl = NULL,
 	.tf_dev_free_ext_tbl = NULL,
 	.tf_dev_free_tbl = NULL,
-	.tf_dev_alloc_search_tbl = NULL,
 	.tf_dev_set_tbl = NULL,
 	.tf_dev_set_ext_tbl = NULL,
 	.tf_dev_get_tbl = NULL,
@@ -282,7 +281,6 @@ const struct tf_dev_ops tf_dev_ops_p4 = {
 	.tf_dev_alloc_ext_tbl = tf_tbl_ext_alloc,
 	.tf_dev_free_tbl = tf_tbl_free,
 	.tf_dev_free_ext_tbl = tf_tbl_ext_free,
-	.tf_dev_alloc_search_tbl = tf_tbl_alloc_search,
 	.tf_dev_set_tbl = tf_tbl_set,
 	.tf_dev_set_ext_tbl = tf_tbl_ext_common_set,
 	.tf_dev_get_tbl = tf_tbl_get,
drivers/net/bnxt/tf_core/tf_device_p58.c +0 -2
index 6bbc5e21e9..ce4d8c661f 100644
@@ -280,7 +280,6 @@ const struct tf_dev_ops tf_dev_ops_p58_init = {
 	.tf_dev_alloc_tbl = NULL,
 	.tf_dev_free_ext_tbl = NULL,
 	.tf_dev_free_tbl = NULL,
-	.tf_dev_alloc_search_tbl = NULL,
 	.tf_dev_set_tbl = NULL,
 	.tf_dev_set_ext_tbl = NULL,
 	.tf_dev_get_tbl = NULL,
@@ -326,7 +325,6 @@ const struct tf_dev_ops tf_dev_ops_p58 = {
 	.tf_dev_alloc_ext_tbl = tf_tbl_ext_alloc,
 	.tf_dev_free_tbl = tf_tbl_free,
 	.tf_dev_free_ext_tbl = tf_tbl_ext_free,
-	.tf_dev_alloc_search_tbl = tf_tbl_alloc_search,
 	.tf_dev_set_tbl = tf_tbl_set,
 	.tf_dev_set_ext_tbl = tf_tbl_ext_common_set,
 	.tf_dev_get_tbl = tf_tbl_get,
drivers/net/bnxt/tf_core/tf_em_common.c +4 -0
index 812ccb0d29..3bdfc14e05 100644
@@ -23,6 +23,10 @@
 
 #include "bnxt.h"
 
+
+/** Invalid table scope id */
+#define TF_TBL_SCOPE_INVALID 0xffffffff
+
 /* Number of pointers per page_size */
 #define MAX_PAGE_PTRS(page_size)  ((page_size) / sizeof(void *))
 
drivers/net/bnxt/tf_core/tf_tbl.c +0 -21
index ced59130b2..e77399c6bd 100644
@@ -26,11 +26,6 @@
 
 struct tf;
 
-/**
- * Table Shadow DBs
- */
-static void *shadow_tbl_db[TF_DIR_MAX];
-
 /**
  * Shadow init flag, set on bind and cleared on unbind
  */
@@ -327,22 +322,6 @@ tf_tbl_free(struct tf *tfp __rte_unused,
 	return 0;
 }
 
-int
-tf_tbl_alloc_search(struct tf *tfp,
-		    struct tf_tbl_alloc_search_parms *parms)
-{
-	int rc = 0;
-	TF_CHECK_PARMS2(tfp, parms);
-
-	if (!shadow_init || !shadow_tbl_db[parms->dir]) {
-		TFP_DRV_LOG(ERR, "%s: Shadow TBL not initialized.\n",
-			    tf_dir_2_str(parms->dir));
-		return -EINVAL;
-	}
-
-	return rc;
-}
-
 int
 tf_tbl_set(struct tf *tfp,
 	   struct tf_tbl_set_parms *parms)
drivers/net/bnxt/tf_core/tf_tbl.h +0 -72

90 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.c +1 -2
index 871dbad0fe..f3a60cc880 100644
@@ -189,13 +189,12 @@ ulp_mapper_resource_index_tbl_alloc(struct bnxt_ulp_context *ulp_ctx,
 
 	aparms.type = glb_res->resource_type;
 	aparms.dir = glb_res->direction;
-	aparms.search_enable = 0;
 	aparms.tbl_scope_id = tbl_scope_id;
 
 	/* Allocate the index tbl using tf api */
 	rc = tf_alloc_tbl_entry(tfp, &aparms);
 	if (rc) {
-		BNXT_TF_DBG(ERR, "Failed to alloc identifier [%s][%d]\n",
+		BNXT_TF_DBG(ERR, "Failed to alloc index table [%s][%d]\n",
 			    tf_dir_2_str(aparms.dir), aparms.type);
 		return rc;
 	}
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/14 net/bnxt: enable dpool allocator

In reply to Venkat Duvvuru

From: Peter Spreadborough <[email protected]>

Enable dynamic entry allocator for EM SRAM entries. Deprecate static entry allocator code.

---
 drivers/net/bnxt/tf_core/tf_device_p58.c      |   4 -
 drivers/net/bnxt/tf_core/tf_em.h              |  10 -
 .../net/bnxt/tf_core/tf_em_hash_internal.c    |  34 ----
 drivers/net/bnxt/tf_core/tf_em_internal.c     | 180 +-----------------
 4 files changed, 1 insertion(+), 227 deletions(-)
drivers/net/bnxt/tf_core/tf_device_p58.c +0 -4
index ce4d8c661f..808dcb1f77 100644
@@ -348,11 +348,7 @@ const struct tf_dev_ops tf_dev_ops_p58 = {
 	.tf_dev_get_tcam_resc_info = tf_tcam_get_resc_info,
 	.tf_dev_insert_int_em_entry = tf_em_hash_insert_int_entry,
 	.tf_dev_delete_int_em_entry = tf_em_hash_delete_int_entry,
-#if (TF_EM_ALLOC == 1)
 	.tf_dev_move_int_em_entry = tf_em_move_int_entry,
-#else
-	.tf_dev_move_int_em_entry = NULL,
-#endif
 	.tf_dev_insert_ext_em_entry = NULL,
 	.tf_dev_delete_ext_em_entry = NULL,
 	.tf_dev_get_em_resc_info = tf_em_get_resc_info,
drivers/net/bnxt/tf_core/tf_em.h +0 -10
index 568071ad8c..074c128651 100644
@@ -13,16 +13,6 @@
 
 #include "hcapi_cfa_defs.h"
 
-/**
- * TF_EM_ALLOC
- *
- * 0: Use stack allocator with fixed sized entries
- *    (default).
- * 1: Use dpool allocator with variable size
- *    entries.
- */
-#define TF_EM_ALLOC 0
-
 #define TF_EM_MIN_ENTRIES     (1 << 15) /* 32K */
 #define TF_EM_MAX_ENTRIES     (1 << 27) /* 128M */
 
drivers/net/bnxt/tf_core/tf_em_hash_internal.c +0 -34
index 098e8af07e..60273a798c 100644
@@ -22,9 +22,7 @@
 /**
  * EM Pool
  */
-#if (TF_EM_ALLOC == 1)
 #include "dpool.h"
-#endif
 
 /**
  * Insert EM internal entry API
@@ -41,11 +39,7 @@ tf_em_hash_insert_int_entry(struct tf *tfp,
 	uint16_t rptr_index = 0;
 	uint8_t rptr_entry = 0;
 	uint8_t num_of_entries = 0;
-#if (TF_EM_ALLOC == 1)
 	struct dpool *pool;
-#else
-	struct stack *pool;
-#endif
 	uint32_t index;
 	uint32_t key0_hash;
 	uint32_t key1_hash;
@@ -62,7 +56,6 @@ tf_em_hash_insert_int_entry(struct tf *tfp,
 	rc = tf_session_get_device(tfs, &dev);
 	if (rc)
 		return rc;
-#if (TF_EM_ALLOC == 1)
 	pool = (struct dpool *)tfs->em_pool[parms->dir];
 	index = dpool_alloc(pool,
 			    parms->em_record_sz_in_bits / 128,
@@ -74,16 +67,6 @@ tf_em_hash_insert_int_entry(struct tf *tfp,
 			    tf_dir_2_str(parms->dir));
 		return -1;
 	}
-#else
-	pool = (struct stack *)tfs->em_pool[parms->dir];
-	rc = stack_pop(pool, &index);
-	if (rc) {
-		PMD_DRV_LOG(ERR,
-			    "%s, EM entry index allocation failed\n",
-			    tf_dir_2_str(parms->dir));
-		return rc;
-	}
-#endif
 
 	if (dev->ops->tf_dev_cfa_key_hash == NULL)
 		return -EINVAL;
@@ -103,11 +86,7 @@ tf_em_hash_insert_int_entry(struct tf *tfp,
 						  &num_of_entries);
 	if (rc) {
 		/* Free the allocated index before returning */
-#if (TF_EM_ALLOC == 1)
 		dpool_free(pool, index);
-#else
-		stack_push(pool, index);
-#endif
 		return -1;
 	}
 
@@ -128,9 +107,7 @@ tf_em_hash_insert_int_entry(struct tf *tfp,
 				     rptr_index,
 				     rptr_entry,
 				     0);
-#if (TF_EM_ALLOC == 1)
 	dpool_set_entry_data(pool, index, parms->flow_handle);
-#endif
 	return 0;
 }
 
@@ -146,11 +123,7 @@ tf_em_hash_delete_int_entry(struct tf *tfp,
 {
 	int rc = 0;
 	struct tf_session *tfs;
-#if (TF_EM_ALLOC == 1)
 	struct dpool *pool;
-#else
-	struct stack *pool;
-#endif
 	/* Retrieve the session information */
 	rc = tf_session_get_session(tfp, &tfs);
 	if (rc) {
@@ -165,19 +138,13 @@ tf_em_hash_delete_int_entry(struct tf *tfp,
 
 	/* Return resource to pool */
 	if (rc == 0) {
-#if (TF_EM_ALLOC == 1)
 		pool = (struct dpool *)tfs->em_pool[parms->dir];
 		dpool_free(pool, parms->index);
-#else
-		pool = (struct stack *)tfs->em_pool[parms->dir];
-		stack_push(pool, parms->index);
-#endif
 	}
 
 	return rc;
 }
 
-#if (TF_EM_ALLOC == 1)
 /** Move EM internal entry API
  *
  * returns:
@@ -212,4 +179,3 @@ tf_em_move_int_entry(struct tf *tfp,
 
 	return rc;
 }
-#endif
drivers/net/bnxt/tf_core/tf_em_internal.c +1 -179

258 lines not on this page · raw message

Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/14 net/bnxt: add flow meter drop counter support

In reply to Venkat Duvvuru

From: Jay Ding <[email protected]>

- Add flow meter drop counter support for Thor.

---
 drivers/net/bnxt/tf_core/cfa_resource_types.h |  5 +-
 drivers/net/bnxt/tf_core/tf_core.h            |  8 +-
 drivers/net/bnxt/tf_core/tf_device_p58.c      |  1 +
 drivers/net/bnxt/tf_core/tf_device_p58.h      | 14 ++++
 drivers/net/bnxt/tf_core/tf_tbl.c             | 74 +++++++++++--------
 drivers/net/bnxt/tf_core/tf_util.c            |  2 +
 6 files changed, 68 insertions(+), 36 deletions(-)
drivers/net/bnxt/tf_core/cfa_resource_types.h +3 -2
index cbab0d0078..36a55d4e17 100644
@@ -104,10 +104,11 @@
 #define CFA_RESOURCE_TYPE_P58_WC_FKB             0x12UL
 /* VEB TCAM */
 #define CFA_RESOURCE_TYPE_P58_VEB_TCAM           0x13UL
+/* Metadata */
+#define CFA_RESOURCE_TYPE_P58_METADATA           0x14UL
 /* Meter drop counter */
 #define CFA_RESOURCE_TYPE_P58_METER_DROP_CNT     0x15UL
-#define CFA_RESOURCE_TYPE_P58_LAST               CFA_RESOURCE_TYPE_P58_METER_DROP_CNT
-
+#define CFA_RESOURCE_TYPE_P58_LAST              CFA_RESOURCE_TYPE_P58_METER_DROP_CNT
 
 /* Multicast Group */
 #define CFA_RESOURCE_TYPE_P45_MCG                 0x0UL
drivers/net/bnxt/tf_core/tf_core.h +6 -2
index 7e0cdf7e0d..af8d13bd7e 100644
@@ -283,9 +283,9 @@ enum tf_tbl_type {
 	TF_TBL_TYPE_ACT_MODIFY_32B,
 	/** TH 64B Modify Record */
 	TF_TBL_TYPE_ACT_MODIFY_64B,
-	/** (Future) Meter Profiles */
+	/** Meter Profiles */
 	TF_TBL_TYPE_METER_PROF,
-	/** (Future) Meter Instance */
+	/** Meter Instance */
 	TF_TBL_TYPE_METER_INST,
 	/** Wh+/SR/Th Mirror Config */
 	TF_TBL_TYPE_MIRROR_CONFIG,
@@ -301,6 +301,8 @@ enum tf_tbl_type {
 	TF_TBL_TYPE_EM_FKB,
 	/** TH WC Flexible Key builder */
 	TF_TBL_TYPE_WC_FKB,
+	/** Meter Drop Counter */
+	TF_TBL_TYPE_METER_DROP_CNT,
 
 	/* External */
 
@@ -2194,6 +2196,8 @@ enum tf_global_config_type {
 	TF_TUNNEL_ENCAP,  /**< Tunnel Encap Config(TECT) */
 	TF_ACTION_BLOCK,  /**< Action Block Config(ABCR) */
 	TF_COUNTER_CFG,   /**< Counter Configuration (CNTRS_CTRL) */
+	TF_METER_CFG,     /**< Meter Config(ACTP4_FMTCR) */
+	TF_METER_INTERVAL_CFG, /**< Meter Interval Config(FMTCR_INTERVAL)  */
 	TF_GLOBAL_CFG_TYPE_MAX
 };
 
drivers/net/bnxt/tf_core/tf_device_p58.c +1 -0
index 808dcb1f77..a492c62bff 100644
@@ -43,6 +43,7 @@ const char *tf_resource_str_p58[CFA_RESOURCE_TYPE_P58_LAST + 1] = {
 	[CFA_RESOURCE_TYPE_P58_EM_FKB]             = "em_fkb  ",
 	[CFA_RESOURCE_TYPE_P58_WC_FKB]             = "wc_fkb  ",
 	[CFA_RESOURCE_TYPE_P58_VEB_TCAM]           = "veb     ",
+	[CFA_RESOURCE_TYPE_P58_METADATA]           = "metadata",
 };
 
 /**
drivers/net/bnxt/tf_core/tf_device_p58.h +14 -0
index 66b0f4e983..8c2e07aa34 100644
@@ -75,10 +75,18 @@ struct tf_rm_element_cfg tf_tbl_p58[TF_TBL_TYPE_MAX] = {
 		TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_METER,
 		0, 0, 0
 	},
+	[TF_TBL_TYPE_METER_DROP_CNT] = {
+		TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_METER_DROP_CNT,
+		0, 0, 0
+	},
 	[TF_TBL_TYPE_MIRROR_CONFIG] = {
 		TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_MIRROR,
 		0, 0, 0
 	},
+	[TF_TBL_TYPE_METADATA] = {
+		TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_METADATA,
+		0, 0, 0
+	},
 	/* Policy - ARs in bank 1 */
 	[TF_TBL_TYPE_FULL_ACT_RECORD] = {
 		.cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_PARENT,
@@ -194,5 +202,11 @@ struct tf_global_cfg_cfg tf_global_cfg_p58[TF_GLOBAL_CFG_TYPE_MAX] = {
 	[TF_COUNTER_CFG] = {
 		TF_GLOBAL_CFG_CFG_HCAPI, TF_COUNTER_CFG
 	},
+	[TF_METER_CFG] = {
+		TF_GLOBAL_CFG_CFG_HCAPI, TF_METER_CFG
+	},
+	[TF_METER_INTERVAL_CFG] = {
+		TF_GLOBAL_CFG_CFG_HCAPI, TF_METER_INTERVAL_CFG
+	},
 };
 #endif /* _TF_DEVICE_P58_H_ */
drivers/net/bnxt/tf_core/tf_tbl.c +42 -32

88 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_util.c +2 -0
index e712816209..d100399d0a 100644
@@ -112,6 +112,8 @@ tf_tbl_type_2_str(enum tf_tbl_type tbl_type)
 		return "WC Flexible Key Builder";
 	case TF_TBL_TYPE_EXT:
 		return "External";
+	case TF_TBL_TYPE_METER_DROP_CNT:
+		return "Meter drop counter";
 	default:
 		return "Invalid tbl type";
 	}
Signature · 1 line
2.17.1
#4 lore raw

PATCH 4/14 net/bnxt: add Thor SRAM mgr model

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

Add dynamic SRAM manager allocation support.

---
 drivers/net/bnxt/tf_core/ll.c             |   3 +
 drivers/net/bnxt/tf_core/ll.h             |  50 +-
 drivers/net/bnxt/tf_core/meson.build      |   2 +
 drivers/net/bnxt/tf_core/tf_core.c        | 104 ++-
 drivers/net/bnxt/tf_core/tf_core.h        |  48 +-
 drivers/net/bnxt/tf_core/tf_device.c      |  40 +-
 drivers/net/bnxt/tf_core/tf_device.h      | 133 ++-
 drivers/net/bnxt/tf_core/tf_device_p4.c   |  75 +-
 drivers/net/bnxt/tf_core/tf_device_p4.h   |  50 +-
 drivers/net/bnxt/tf_core/tf_device_p58.c  | 105 ++-
 drivers/net/bnxt/tf_core/tf_device_p58.h  |  60 +-
 drivers/net/bnxt/tf_core/tf_msg.c         |   2 +-
 drivers/net/bnxt/tf_core/tf_rm.c          |  46 +-
 drivers/net/bnxt/tf_core/tf_rm.h          |  62 +-
 drivers/net/bnxt/tf_core/tf_session.c     |  56 ++
 drivers/net/bnxt/tf_core/tf_session.h     |  58 +-
 drivers/net/bnxt/tf_core/tf_sram_mgr.c    | 971 ++++++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_sram_mgr.h    | 317 +++++++
 drivers/net/bnxt/tf_core/tf_tbl.c         | 186 +----
 drivers/net/bnxt/tf_core/tf_tbl.h         |  15 +-
 drivers/net/bnxt/tf_core/tf_tbl_sram.c    | 713 ++++++++++++++++
 drivers/net/bnxt/tf_core/tf_tbl_sram.h    | 154 ++++
 drivers/net/bnxt/tf_core/tf_tcam.c        |  10 +-
 drivers/net/bnxt/tf_core/tf_tcam.h        |   7 +
 drivers/net/bnxt/tf_core/tf_tcam_shared.c |  28 +-
 drivers/net/bnxt/tf_core/tf_util.c        |  10 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c        |  23 +
 meson_options.txt                         |   2 +
 28 files changed, 2978 insertions(+), 352 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_sram_mgr.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_sram_mgr.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_tbl_sram.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_tbl_sram.h
drivers/net/bnxt/tf_core/ll.c +3 -0
index cd168a7970..f2bdff6b9e 100644
@@ -13,6 +13,7 @@ void ll_init(struct ll *ll)
 {
 	ll->head = NULL;
 	ll->tail = NULL;
+	ll->cnt = 0;
 }
 
 /* insert entry in linked list */
@@ -30,6 +31,7 @@ void ll_insert(struct ll *ll,
 		entry->next->prev = entry;
 		ll->head = entry->next->prev;
 	}
+	ll->cnt++;
 }
 
 /* delete entry from linked list */
@@ -49,4 +51,5 @@ void ll_delete(struct ll *ll,
 		entry->prev->next = entry->next;
 		entry->next->prev = entry->prev;
 	}
+	ll->cnt--;
 }
drivers/net/bnxt/tf_core/ll.h +49 -1

72 lines not on this page · raw message

drivers/net/bnxt/tf_core/meson.build +2 -0
index f28e77ec2e..b7333a431b 100644
@@ -16,6 +16,8 @@ sources += files(
         'stack.c',
         'tf_rm.c',
         'tf_tbl.c',
+	'tf_tbl_sram.c',
+	'tf_sram_mgr.c',
         'tf_em_common.c',
         'tf_em_host.c',
         'tf_em_internal.c',
drivers/net/bnxt/tf_core/tf_core.c +65 -39

173 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_core.h +26 -22

95 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device.c +34 -6
index 498e668b16..25a7166bbb 100644
@@ -11,10 +11,14 @@
 #include "tf_rm.h"
 #ifdef TF_TCAM_SHARED
 #include "tf_tcam_shared.h"
+#include "tf_tbl_sram.h"
 #endif /* TF_TCAM_SHARED */
 
 struct tf;
 
+/* Number of slices per row for WC TCAM */
+uint16_t g_wc_num_slices_per_row = TF_WC_TCAM_1_SLICE_PER_ROW;
+
 /* Forward declarations */
 static int tf_dev_unbind_p4(struct tf *tfp);
 static int tf_dev_unbind_p58(struct tf *tfp);
@@ -83,7 +87,8 @@ static int
 tf_dev_bind_p4(struct tf *tfp,
 	       bool shadow_copy,
 	       struct tf_session_resources *resources,
-	       struct tf_dev_info *dev_handle)
+	       struct tf_dev_info *dev_handle,
+	       enum tf_wc_num_slice wc_num_slices)
 {
 	int rc;
 	int frc;
@@ -131,7 +136,6 @@ tf_dev_bind_p4(struct tf *tfp,
 	if (rsv_cnt) {
 		tbl_cfg.num_elements = TF_TBL_TYPE_MAX;
 		tbl_cfg.cfg = tf_tbl_p4;
-		tbl_cfg.shadow_copy = shadow_copy;
 		tbl_cfg.resources = resources;
 		rc = tf_tbl_bind(tfp, &tbl_cfg);
 		if (rc) {
@@ -151,6 +155,7 @@ tf_dev_bind_p4(struct tf *tfp,
 		tcam_cfg.cfg = tf_tcam_p4;
 		tcam_cfg.shadow_copy = shadow_copy;
 		tcam_cfg.resources = resources;
+		tcam_cfg.wc_num_slices = wc_num_slices;
 #ifdef TF_TCAM_SHARED
 		rc = tf_tcam_shared_bind(tfp, &tcam_cfg);
 #else /* !TF_TCAM_SHARED */
@@ -369,7 +374,8 @@ static int
 tf_dev_bind_p58(struct tf *tfp,
 		bool shadow_copy,
 		struct tf_session_resources *resources,
-		struct tf_dev_info *dev_handle)
+		struct tf_dev_info *dev_handle,
+		enum tf_wc_num_slice wc_num_slices)
 {
 	int rc;
 	int frc;
@@ -414,7 +420,6 @@ tf_dev_bind_p58(struct tf *tfp,
 	if (rsv_cnt) {
 		tbl_cfg.num_elements = TF_TBL_TYPE_MAX;
 		tbl_cfg.cfg = tf_tbl_p58;
-		tbl_cfg.shadow_copy = shadow_copy;
 		tbl_cfg.resources = resources;
 		rc = tf_tbl_bind(tfp, &tbl_cfg);
 		if (rc) {
@@ -423,6 +428,13 @@ tf_dev_bind_p58(struct tf *tfp,
 			goto fail;
 		}
 		no_rsv_flag = false;
+
+		rc = tf_tbl_sram_bind(tfp);
+		if (rc) {
+			TFP_DRV_LOG(ERR,
+				    "SRAM table initialization failure\n");
+			goto fail;
+		}
 	}
 
 	rsv_cnt = tf_dev_reservation_check(TF_TCAM_TBL_TYPE_MAX,
@@ -433,6 +445,7 @@ tf_dev_bind_p58(struct tf *tfp,
 		tcam_cfg.cfg = tf_tcam_p58;
 		tcam_cfg.shadow_copy = shadow_copy;
 		tcam_cfg.resources = resources;
+		tcam_cfg.wc_num_slices = wc_num_slices;
 #ifdef TF_TCAM_SHARED
 		rc = tf_tcam_shared_bind(tfp, &tcam_cfg);
 #else /* !TF_TCAM_SHARED */
@@ -565,6 +578,18 @@ tf_dev_unbind_p58(struct tf *tfp)
 		fail = true;
 	}
 
+	/* Unbind the SRAM table prior to table as the table manager
+	 * owns and frees the table DB while the SRAM table manager owns
+	 * and manages it's internal data structures.  SRAM table manager
+	 * relies on the table rm_db to exist.
+	 */
+	rc = tf_tbl_sram_unbind(tfp);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "Device unbind failed, SRAM table\n");
+		fail = true;
+	}
+
 	rc = tf_tbl_unbind(tfp);
 	if (rc) {
 		TFP_DRV_LOG(INFO,
@@ -606,6 +631,7 @@ tf_dev_bind(struct tf *tfp __rte_unused,
 	    enum tf_device_type type,
 	    bool shadow_copy,
 	    struct tf_session_resources *resources,
+	    uint16_t wc_num_slices,
 	    struct tf_dev_info *dev_handle)
 {
 	switch (type) {
@@ -615,13 +641,15 @@ tf_dev_bind(struct tf *tfp __rte_unused,
 		return tf_dev_bind_p4(tfp,
 				      shadow_copy,
 				      resources,
-				      dev_handle);
+				      dev_handle,
+				      wc_num_slices);
 	case TF_DEVICE_TYPE_THOR:
 		dev_handle->type = type;
 		return tf_dev_bind_p58(tfp,
 				       shadow_copy,
 				       resources,
-				       dev_handle);
+				       dev_handle,
+				       wc_num_slices);
 	default:
 		TFP_DRV_LOG(ERR,
 			    "No such device\n");
drivers/net/bnxt/tf_core/tf_device.h +132 -1

187 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p4.c +70 -5

141 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p4.h +25 -25

140 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p58.c +95 -10

183 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p58.h +30 -30

188 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_msg.c +1 -1
index e07d9168be..0fbb2fe837 100644
@@ -2231,7 +2231,7 @@ tf_msg_get_if_tbl_entry(struct tf *tfp,
 	if (rc != 0)
 		return rc;
 
-	tfp_memcpy(params->data, resp.data, req.size);
+	tfp_memcpy(&params->data[0], resp.data, req.size);
 
 	return 0;
 }
drivers/net/bnxt/tf_core/tf_rm.c +43 -3

95 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_rm.h +36 -26

114 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_session.c +56 -0

72 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_session.h +55 -3

88 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_sram_mgr.c new file +971 -0

971 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_sram_mgr.h new file +317 -0

317 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tbl.c +40 -146

14 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tbl.h +1 -14
index 7e1107ffe7..2483718e5d 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_core/tf_tbl_sram.c new file +713 -0

713 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tbl_sram.h new file +154 -0

154 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tcam.c +4 -6
index 45206c5992..806af3070a 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_core/tf_tcam.h +7 -0
index bed17af6ae..b1e7a92b0b 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_core/tf_tcam_shared.c +14 -14
index 83b6fbd5fb..c120c6f577 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_core/tf_util.c +10 -0
index d100399d0a..c1b9be0755 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/bnxt_ulp.c +23 -0
index dbf85e4eda..183bae66c5 100644

Lines of this file are not shown. View the raw message.

meson_options.txt +2 -0
index 0e92734c49..f686e6d92a 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

#5 lore raw

PATCH 5/14 net/bnxt: add flow templates support for Thor

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

Template adds non-VFR based support for testpmd with:
matches to include
- DMAC, SIP, DIP, Proto, Sport, Dport
- SIP, DIP, Proto, Sport, Dport
actions:
- count, drop

---
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |   6 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |  36 +++---
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |  12 ++
 .../bnxt/tf_ulp/generic_templates/meson.build |  17 ++-
 .../ulp_template_db_thor_class.c              |   1 -
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |   2 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         | 122 +++++++++++++++++-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |  26 +++-
 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c         |   5 +
 drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c          |   2 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          | 111 +++++++++++++++-
 drivers/net/bnxt/tf_ulp/ulp_matcher.c         |  13 ++
 drivers/net/bnxt/tf_ulp/ulp_port_db.c         |  15 ++-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |   9 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.c             |  20 +++
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |   8 +-
 16 files changed, 356 insertions(+), 49 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_tf_common.h +6 -0
index f59da41e54..e0ebed3fed 100644
@@ -13,6 +13,12 @@
 
 #define BNXT_TF_DBG(lvl, fmt, args...)	PMD_DRV_LOG(lvl, fmt, ## args)
 
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#define BNXT_TF_INF(fmt, args...)	PMD_DRV_LOG(INFO, fmt, ## args)
+#else
+#define BNXT_TF_INF(fmt, args...)
+#endif
+
 #define BNXT_ULP_EM_FLOWS			8192
 #define BNXT_ULP_1M_FLOWS			1000000
 #define BNXT_EEM_RX_GLOBAL_ID_MASK		(BNXT_ULP_1M_FLOWS - 1)
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +15 -21
index 183bae66c5..475c7a6cdf 100644
@@ -698,6 +698,11 @@ ulp_eem_tbl_scope_init(struct bnxt *bp)
 			    rc);
 		return rc;
 	}
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+	BNXT_TF_DBG(DEBUG, "TableScope=0x%0x %d\n",
+		    params.tbl_scope_id,
+		    params.tbl_scope_id);
+#endif
 	rc = bnxt_ulp_cntxt_tbl_scope_id_set(bp->ulp_ctx, params.tbl_scope_id);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Unable to set table scope id\n");
@@ -825,6 +830,8 @@ ulp_ctx_init(struct bnxt *bp,
 		goto error_deinit;
 	}
 
+	/* TODO: For now we are overriding to APP:1 on this branch*/
+	bp->app_id = 1;
 	rc = bnxt_ulp_cntxt_app_id_set(bp->ulp_ctx, bp->app_id);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Unable to set app_id for ULP init.\n");
@@ -838,11 +845,6 @@ ulp_ctx_init(struct bnxt *bp,
 		goto error_deinit;
 	}
 
-	if (devid == BNXT_ULP_DEVICE_ID_THOR) {
-		ulp_data->ulp_flags &= ~BNXT_ULP_VF_REP_ENABLED;
-		BNXT_TF_DBG(ERR, "Enabled non-VFR mode\n");
-	}
-
 	/*
 	 * Shared session must be created before first regular session but after
 	 * the ulp_ctx is valid.
@@ -902,7 +904,7 @@ ulp_dparms_init(struct bnxt *bp, struct bnxt_ulp_context *ulp_ctx)
 	dparms->ext_flow_db_num_entries = bp->max_num_kflows * 1024;
 	/* GFID =  2 * num_flows */
 	dparms->mark_db_gfid_entries = dparms->ext_flow_db_num_entries * 2;
-	BNXT_TF_DBG(DEBUG, "Set the number of flows = %"PRIu64"\n",
+	BNXT_TF_DBG(DEBUG, "Set the number of flows = %" PRIu64 "\n",
 		    dparms->ext_flow_db_num_entries);
 
 	return 0;
@@ -1393,17 +1395,13 @@ bnxt_ulp_port_init(struct bnxt *bp)
 	uint32_t ulp_flags;
 	int32_t rc = 0;
 
+	if (!bp || !BNXT_TRUFLOW_EN(bp))
+		return rc;
+
 	if (!BNXT_PF(bp) && !BNXT_VF_IS_TRUSTED(bp)) {
 		BNXT_TF_DBG(ERR,
 			    "Skip ulp init for port: %d, not a TVF or PF\n",
-			    bp->eth_dev->data->port_id);
-		return rc;
-	}
-
-	if (!BNXT_TRUFLOW_EN(bp)) {
-		BNXT_TF_DBG(DEBUG,
-			    "Skip ulp init for port: %d, truflow is not enabled\n",
-			    bp->eth_dev->data->port_id);
+			bp->eth_dev->data->port_id);
 		return rc;
 	}
 
@@ -1524,6 +1522,9 @@ bnxt_ulp_port_deinit(struct bnxt *bp)
 	struct rte_pci_device *pci_dev;
 	struct rte_pci_addr *pci_addr;
 
+	if (!BNXT_TRUFLOW_EN(bp))
+		return;
+
 	if (!BNXT_PF(bp) && !BNXT_VF_IS_TRUSTED(bp)) {
 		BNXT_TF_DBG(ERR,
 			    "Skip ULP deinit port:%d, not a TVF or PF\n",
@@ -1531,13 +1532,6 @@ bnxt_ulp_port_deinit(struct bnxt *bp)
 		return;
 	}
 
-	if (!BNXT_TRUFLOW_EN(bp)) {
-		BNXT_TF_DBG(DEBUG,
-			    "Skip ULP deinit for port:%d, truflow is not enabled\n",
-			    bp->eth_dev->data->port_id);
-		return;
-	}
-
 	if (!bp->ulp_ctx) {
 		BNXT_TF_DBG(DEBUG, "ulp ctx already de-allocated\n");
 		return;
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +12 -0
index 19e9dba356..238b1d9657 100644
@@ -13,6 +13,9 @@
 #include "ulp_port_db.h"
 #include "ulp_ha_mgr.h"
 #include <rte_malloc.h>
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#include "ulp_template_debug_proto.h"
+#endif
 
 static int32_t
 bnxt_ulp_flow_validate_args(const struct rte_flow_attr *attr,
@@ -222,6 +225,15 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev,
 	else if (ret == BNXT_TF_RC_FID)
 		goto return_fid;
 
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_PARSER
+	/* Dump the rte flow pattern */
+	ulp_parser_hdr_info_dump(&params);
+	/* Dump the rte flow action */
+	ulp_parser_act_info_dump(&params);
+#endif
+#endif
+
 	ret = ulp_matcher_pattern_match(&params, &params.class_id);
 	if (ret != BNXT_TF_RC_SUCCESS)
 		goto free_fid;
drivers/net/bnxt/tf_ulp/generic_templates/meson.build +10 -7
index b1e7b8cc32..16b27a2e24 100644
@@ -2,12 +2,15 @@
 # Copyright(c) 2018 Intel Corporation
 # Copyright(c) 2020 Broadcom
 
+#Include the folder for headers
 includes += include_directories('.')
+
+#Add the source files
 sources += files(
-        'ulp_template_db_class.c',
-        'ulp_template_db_act.c',
-        'ulp_template_db_tbl.c',
-        'ulp_template_db_wh_plus_act.c',
-        'ulp_template_db_wh_plus_class.c',
-        'ulp_template_db_thor_act.c',
-        'ulp_template_db_thor_class.c')
+	'ulp_template_db_class.c',
+	'ulp_template_db_act.c',
+	'ulp_template_db_tbl.c',
+	'ulp_template_db_wh_plus_act.c',
+	'ulp_template_db_wh_plus_class.c',
+	'ulp_template_db_thor_act.c',
+	'ulp_template_db_thor_class.c')
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c +0 -1
index 83f6152700..e342f340d9 100644
@@ -6104,4 +6104,3 @@ struct bnxt_ulp_mapper_ident_info ulp_thor_class_ident_list[] = {
 	.ident_bit_pos = 29
 	}
 };
-
drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c +1 -1
index 13f71ed83b..22c51976ac 100644
@@ -35,7 +35,7 @@ ulp_fc_mgr_shadow_mem_alloc(struct hw_fc_mem_info *parms, int size)
 	rte_mem_lock_page(parms->mem_va);
 
 	parms->mem_pa = (void *)(uintptr_t)rte_mem_virt2phy(parms->mem_va);
-	if (parms->mem_pa == (void *)(uintptr_t)RTE_BAD_IOVA) {
+	if (parms->mem_pa == (void *)RTE_BAD_IOVA) {
 		BNXT_TF_DBG(ERR, "Allocate failed mem_pa\n");
 		return -ENOMEM;
 	}
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +119 -3

155 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +25 -1
index 67afca8872..0ddfa6f66d 100644
@@ -18,7 +18,7 @@
 
 /*
  * Structure for the flow database resource information
- * The below structure is based on the below partitions
+ * 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
@@ -417,4 +417,28 @@ ulp_flow_db_parent_flow_count_reset(struct bnxt_ulp_context *ulp_ctxt);
 void ulp_flow_db_shared_session_set(struct ulp_flow_db_res_params *res,
 				    enum bnxt_ulp_shared_session shared);
 
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+/*
+ * Dump the flow entry details
+ *
+ * flow_db [in] Ptr to flow db
+ * fid [in] flow id
+ *
+ * returns none
+ */
+void
+ulp_flow_db_debug_fid_dump(struct bnxt_ulp_flow_db *flow_db, uint32_t fid);
+
+/*
+ * Dump the flow database entry details
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * flow_id [in] if zero then all fids are dumped.
+ *
+ * returns none
+ */
+int32_t	ulp_flow_db_debug_dump(struct bnxt_ulp_context *ulp_ctxt,
+			       uint32_t flow_id);
+#endif
+
 #endif /* _ULP_FLOW_DB_H_ */
drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c +5 -0
index 3c1af0b007..c6b2b1675d 100644
@@ -10,6 +10,11 @@
 #include "ulp_mapper.h"
 #include "ulp_flow_db.h"
 
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#include "ulp_template_debug_proto.h"
+#include "ulp_tf_debug.h"
+#endif
+
 /* Retrieve the generic table  initialization parameters for the tbl_idx */
 static struct bnxt_ulp_generic_tbl_params*
 ulp_mapper_gen_tbl_params_get(uint32_t tbl_idx)
drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c +1 -1
index 5f5b5d639e..bc5627ec5b 100644
@@ -185,7 +185,7 @@ ulp_ha_mgr_timer_cb(void *arg __rte_unused)
 	rc = ulp_ha_mgr_state_get(ulp_ctx, &curr_state);
 	if (rc) {
 		/*
-		 * This shouldn't happen, if it does, reset the timer
+		 * This shouldn't happen, if it does, resetart the timer
 		 * and try again next time.
 		 */
 		BNXT_TF_DBG(ERR, "Failed(%d) to get state.\n",
drivers/net/bnxt/tf_ulp/ulp_mapper.c +108 -3

238 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_matcher.c +13 -0
index 67fa61fc7c..e06d8f6287 100644
@@ -6,6 +6,10 @@
 #include "ulp_matcher.h"
 #include "ulp_utils.h"
 
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#include "ulp_template_debug_proto.h"
+#endif
+
 /* Utility function to calculate the class matcher hash */
 static uint32_t
 ulp_matcher_class_hash_calculate(uint64_t hi_sig, uint64_t lo_sig)
@@ -95,6 +99,11 @@ ulp_matcher_pattern_match(struct ulp_rte_parser_params *params,
 
 error:
 	BNXT_TF_DBG(DEBUG, "Did not find any matching template\n");
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+	BNXT_TF_DBG(DEBUG, "class_hid:0x%x, Hdr:%" PRIX64 " Fld:%" PRIX64 "\n",
+		    class_hid, params->hdr_bitmap.bits,
+		    params->fld_bitmap.bits);
+#endif
 	*class_id = 0;
 	return BNXT_TF_RC_ERROR;
 }
@@ -142,6 +151,10 @@ ulp_matcher_action_match(struct ulp_rte_parser_params *params,
 
 error:
 	BNXT_TF_DBG(DEBUG, "Did not find any matching action template\n");
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+	BNXT_TF_DBG(DEBUG, "act_hid:0x%x, Hdr:%" PRIX64 "\n",
+		    act_hid, params->act_bitmap.bits);
+#endif
 	*act_id = 0;
 	return BNXT_TF_RC_ERROR;
 }
drivers/net/bnxt/tf_ulp/ulp_port_db.c +12 -3
index 4045473097..7d9865b3e3 100644
@@ -7,9 +7,13 @@
 #include "bnxt.h"
 #include "bnxt_vnic.h"
 #include "bnxt_tf_common.h"
+#include "bnxt_tf_pmd_shim.h"
 #include "ulp_port_db.h"
 #include "tfp.h"
-#include "bnxt_tf_pmd_shim.h"
+
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#include "ulp_tf_debug.h"
+#endif
 
 static uint32_t
 ulp_port_db_allocate_ifindex(struct bnxt_ulp_port_db *port_db)
@@ -151,12 +155,12 @@ int32_t	ulp_port_db_dev_port_intf_update(struct bnxt_ulp_context *ulp_ctxt,
 
 	intf->type = bnxt_pmd_get_interface_type(port_id);
 	intf->drv_func_id = bnxt_pmd_get_fw_func_id(port_id,
-						    BNXT_ULP_INTF_TYPE_INVALID);
+						BNXT_ULP_INTF_TYPE_INVALID);
 
 	func = &port_db->ulp_func_id_tbl[intf->drv_func_id];
 	if (!func->func_valid) {
 		func->func_svif = bnxt_pmd_get_svif(port_id, true,
-						    BNXT_ULP_INTF_TYPE_INVALID);
+						BNXT_ULP_INTF_TYPE_INVALID);
 		func->func_spif = bnxt_pmd_get_phy_port_id(port_id);
 		func->func_parif =
 			bnxt_pmd_get_parif(port_id, BNXT_ULP_INTF_TYPE_INVALID);
@@ -202,6 +206,11 @@ int32_t	ulp_port_db_dev_port_intf_update(struct bnxt_ulp_context *ulp_ctxt,
 		port_data->port_vport = bnxt_pmd_get_vport(port_id);
 		port_data->port_valid = true;
 	}
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_PORT
+	ulp_port_db_dump(port_db, intf, port_id);
+#endif
+#endif
 	return 0;
 }
 
drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +5 -4
index 5fd52b8f36..79b9957781 100644
@@ -8,6 +8,7 @@
 #include "ulp_template_struct.h"
 #include "bnxt_ulp.h"
 #include "bnxt_tf_common.h"
+#include "bnxt_tf_pmd_shim.h"
 #include "ulp_rte_parser.h"
 #include "ulp_matcher.h"
 #include "ulp_utils.h"
@@ -855,7 +856,7 @@ ulp_rte_vlan_hdr_handler(const struct rte_flow_item *item,
 			       BNXT_ULP_HDR_BIT_II_VLAN);
 		inner_flag = 1;
 	} else {
-		BNXT_TF_DBG(ERR, "Error Parsing:Vlan hdr found without eth\n");
+		BNXT_TF_DBG(ERR, "Error Parsing:Vlan hdr found withtout eth\n");
 		return BNXT_TF_RC_ERROR;
 	}
 	/* Update the field protocol hdr bitmap */
@@ -1135,8 +1136,8 @@ ulp_rte_ipv6_hdr_handler(const struct rte_flow_item *item,
 	ulp_rte_prsr_fld_mask(params, &idx, size, &ver_spec, &ver_mask,
 			      ULP_PRSR_ACT_DEFAULT);
 	/*
-	 * The TC and flow label field are ignored since OVS is setting
-	 * it for match and it is not supported.
+	 * The TC and flow label field are ignored since OVS is
+	 * setting it for match and it is not supported.
 	 * This is a work around and
 	 * shall be addressed in the future.
 	 */
@@ -2138,7 +2139,7 @@ ulp_rte_vf_act_handler(const struct rte_flow_action *action_item,
 		return BNXT_TF_RC_PARSE_ERR;
 	}
 
-	bp = bnxt_get_bp(params->port_id);
+	bp = bnxt_pmd_get_bp(params->port_id);
 	if (bp == NULL) {
 		BNXT_TF_DBG(ERR, "Invalid bp\n");
 		return BNXT_TF_RC_ERROR;
drivers/net/bnxt/tf_ulp/ulp_tun.c +20 -0
index cb8530d791..a1dd5b902c 100644
@@ -3,6 +3,8 @@
  * All rights reserved.
  */
 
+#include <sys/queue.h>
+
 #include <rte_malloc.h>
 
 #include "ulp_tun.h"
@@ -29,6 +31,15 @@ ulp_install_outer_tun_flow(struct ulp_rte_parser_params *params,
 
 	ULP_BITMAP_SET(params->hdr_bitmap.bits, BNXT_ULP_HDR_BIT_F1);
 
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_PARSER
+	/* Dump the rte flow pattern */
+	ulp_parser_hdr_info_dump(params);
+	/* Dump the rte flow action */
+	ulp_parser_act_info_dump(params);
+#endif
+#endif
+
 	ret = ulp_matcher_pattern_match(params, &params->class_id);
 	if (ret != BNXT_TF_RC_SUCCESS)
 		goto err;
@@ -146,6 +157,15 @@ ulp_post_process_cache_inner_tun_flow(struct ulp_rte_parser_params *params,
 	struct ulp_per_port_flow_info *flow_info;
 	int ret;
 
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_PARSER
+	/* Dump the rte flow pattern */
+	ulp_parser_hdr_info_dump(params);
+	/* Dump the rte flow action */
+	ulp_parser_act_info_dump(params);
+#endif
+#endif
+
 	ret = ulp_matcher_pattern_match(params, &params->class_id);
 	if (ret != BNXT_TF_RC_SUCCESS)
 		return BNXT_TF_RC_ERROR;
drivers/net/bnxt/tf_ulp/ulp_utils.c +4 -4
index bafb539c8d..1649e157f2 100644
@@ -62,7 +62,7 @@ ulp_regfile_read(struct ulp_regfile *regfile,
  * data [in] The value is written into this variable.  It is going to be in the
  * same byte order as it was written.
  *
- * size [in] The size in bytes of the value being written into this
+ * size [in] The size in bytes of the value beingritten into this
  * variable.
  *
  * returns 0 on success
@@ -295,7 +295,7 @@ ulp_blob_push(struct ulp_blob *blob,
 				     datalen,
 				     data);
 	if (!rc) {
-		BNXT_TF_DBG(ERR, "Failed to write blob\n");
+		BNXT_TF_DBG(ERR, "Failed ro write blob\n");
 		return 0;
 	}
 	blob->write_idx += datalen;
@@ -355,7 +355,7 @@ ulp_blob_insert(struct ulp_blob *blob, uint32_t offset,
 				     datalen,
 				     data);
 	if (!rc) {
-		BNXT_TF_DBG(ERR, "Failed to write blob\n");
+		BNXT_TF_DBG(ERR, "Failed ro write blob\n");
 		return 0;
 	}
 	/* copy the previously stored data */
@@ -409,7 +409,7 @@ ulp_blob_push_64(struct ulp_blob *blob,
  *
  * data [in] 32-bit value to be added to the blob.
  *
- * datalen [in] The number of bits to be added to the blob.
+ * datalen [in] The number of bits to be added ot the blob.
  *
  * The offset of the data is updated after each push of data.
  * NULL returned on error, pointer pushed value otherwise.
Signature · 1 line
2.17.1
#6 lore raw

PATCH 6/14 net/bnxt: add support for tunnel offloads

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

Added support for tunnel offloads, this includes the support for VXLAN decap action where two flows indicate tunnel offload rule. The first flow indicate the tunnel properties and second flow indicates the inner packet structure. The templates are updated to support this feature.

---
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |    4 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   12 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |   20 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |  212 +-
 .../generic_templates/ulp_template_db_act.c   |    2 +-
 .../generic_templates/ulp_template_db_class.c | 8541 +++++++++++-----
 .../generic_templates/ulp_template_db_enum.h  |  210 +-
 .../generic_templates/ulp_template_db_field.h |  654 +-
 .../generic_templates/ulp_template_db_tbl.c   |  645 +-
 .../ulp_template_db_thor_class.c              |  110 +-
 .../ulp_template_db_wh_plus_act.c             |    2 +-
 .../ulp_template_db_wh_plus_class.c           | 8577 +++++++++++------
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |   46 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h          |    8 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |  562 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |   44 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   52 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |    6 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c |   31 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |  134 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |   10 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   10 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.c             |  541 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.h             |   89 +-
 24 files changed, 13810 insertions(+), 6712 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_tf_common.h +1 -3
index e0ebed3fed..6c4bcd2d90 100644
@@ -37,9 +37,7 @@
 enum bnxt_tf_rc {
 	BNXT_TF_RC_PARSE_ERR	= -2,
 	BNXT_TF_RC_ERROR	= -1,
-	BNXT_TF_RC_SUCCESS	= 0,
-	BNXT_TF_RC_NORMAL	= 1,
-	BNXT_TF_RC_FID		= 2,
+	BNXT_TF_RC_SUCCESS	= 0
 };
 
 /* eth IPv4 Type */
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +10 -2
index 475c7a6cdf..dfafd9ff5b 100644
@@ -860,8 +860,6 @@ ulp_ctx_init(struct bnxt *bp,
 	if (rc)
 		goto error_deinit;
 
-	ulp_tun_tbl_init(ulp_data->tun_tbl);
-
 	bnxt_ulp_cntxt_tfp_set(bp->ulp_ctx, &bp->tfp);
 	return rc;
 
@@ -2064,3 +2062,13 @@ bnxt_ulp_cntxt_entry_release(void)
 {
 	rte_spinlock_unlock(&bnxt_ulp_ctxt_lock);
 }
+
+/* Function to get the app tunnel details from the ulp context. */
+struct bnxt_flow_app_tun_ent *
+bnxt_ulp_cntxt_ptr2_app_tun_list_get(struct bnxt_ulp_context *ulp)
+{
+	if (!ulp || !ulp->cfg_data)
+		return NULL;
+
+	return ulp->cfg_data->app_tun;
+}
drivers/net/bnxt/tf_ulp/bnxt_ulp.h +17 -3
index 082ca501b6..006df9cbc5 100644
@@ -47,6 +47,18 @@ enum bnxt_ulp_flow_mem_type {
 	BNXT_ULP_FLOW_MEM_TYPE_LAST = 3
 };
 
+enum bnxt_rte_flow_item_type {
+	BNXT_RTE_FLOW_ITEM_TYPE_END = (uint32_t)INT_MIN,
+	BNXT_RTE_FLOW_ITEM_TYPE_VXLAN_DECAP,
+	BNXT_RTE_FLOW_ITEM_TYPE_LAST
+};
+
+enum bnxt_rte_flow_action_type {
+	BNXT_RTE_FLOW_ACTION_TYPE_END = (uint32_t)INT_MIN,
+	BNXT_RTE_FLOW_ACTION_TYPE_VXLAN_DECAP,
+	BNXT_RTE_FLOW_ACTION_TYPE_LAST
+};
+
 struct bnxt_ulp_df_rule_info {
 	uint32_t			def_port_flow_id;
 	uint8_t				valid;
@@ -79,6 +91,7 @@ struct bnxt_ulp_data {
 	bool				accum_stats;
 	uint8_t				app_id;
 	uint8_t				num_shared_clients;
+	struct bnxt_flow_app_tun_ent	app_tun[BNXT_ULP_MAX_TUN_CACHE_ENTRIES];
 };
 
 struct bnxt_ulp_context {
@@ -258,9 +271,6 @@ bnxt_ulp_cntxt_acquire_fdb_lock(struct bnxt_ulp_context	*ulp_ctx);
 void
 bnxt_ulp_cntxt_release_fdb_lock(struct bnxt_ulp_context	*ulp_ctx);
 
-int32_t
-ulp_post_process_tun_flow(struct ulp_rte_parser_params *params);
-
 struct bnxt_ulp_glb_resource_info *
 bnxt_ulp_app_glb_resource_info_list_get(uint32_t *num_entries);
 
@@ -301,4 +311,8 @@ bnxt_ulp_cntxt_entry_release(void);
 
 uint8_t
 bnxt_ulp_cntxt_num_shared_clients_get(struct bnxt_ulp_context *ulp_ctx);
+
+struct bnxt_flow_app_tun_ent *
+bnxt_ulp_cntxt_ptr2_app_tun_list_get(struct bnxt_ulp_context *ulp);
+
 #endif /* _BNXT_ULP_H_ */
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +203 -9

262 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_act.c +1 -1
index e18f314856..0da6070d7d 100644
@@ -3,7 +3,7 @@
  * All rights reserved.
  */
 
-/* date: Wed Mar 17 11:31:19 2021 */
+/* date: Mon May 17 15:30:41 2021 */
 
 #include "ulp_template_db_enum.h"
 #include "ulp_template_db_field.h"
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_class.c +6267 -2274

2,657 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_enum.h +189 -21

210 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_field.h +421 -233

654 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c +419 -226

645 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c +55 -55

110 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_act.c +1 -1
index b6d2afd55b..de924fe81a 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_class.c +5591 -2986

8,577 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c +30 -16

46 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h +5 -3
index 448d05c118..9825ed2a27 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_flow_db.c +235 -327

562 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +19 -25

44 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.c +18 -34

52 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.h +3 -3
index 004e89ac2b..d4d6969bb5 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c +31 -0
index 35e9858727..c43774069a 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +80 -54

134 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +9 -1
index 4431f1bbd0..673172c811 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +7 -3
index 0cbac66237..2685e63432 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_tun.c +170 -371

541 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_tun.h +28 -61

89 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

#7 lore raw

PATCH 7/14 net/bnxt: add support for dynamic encap action

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

The encapsulation record processing is enhanced to handle data dynamically. Different combinations of VXLAN encapsulation using no VLAN or single or double VLAN can be supported and also supports both IPv4 and IPv6 versions.

---
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   25 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |    2 +
 .../generic_templates/ulp_template_db_enum.h  |   44 +-
 .../generic_templates/ulp_template_db_tbl.c   |    8 +-
 .../ulp_template_db_thor_act.c                |    4 +-
 .../ulp_template_db_thor_class.c              |   46 +-
 .../ulp_template_db_wh_plus_act.c             | 1700 ++++++++++++-----
 .../ulp_template_db_wh_plus_class.c           |  222 +--
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |    6 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |    2 +-
 drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c          |    2 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |  152 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |    4 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |  337 ++--
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |    2 +
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   10 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |   73 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |   27 +-
 18 files changed, 1717 insertions(+), 949 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +16 -9
index dfafd9ff5b..3b86410fb1 100644
@@ -830,13 +830,12 @@ ulp_ctx_init(struct bnxt *bp,
 		goto error_deinit;
 	}
 
-	/* TODO: For now we are overriding to APP:1 on this branch*/
-	bp->app_id = 1;
 	rc = bnxt_ulp_cntxt_app_id_set(bp->ulp_ctx, bp->app_id);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Unable to set app_id for ULP init.\n");
 		goto error_deinit;
 	}
+	BNXT_TF_DBG(DEBUG, "Ulp initialized with app id %d\n", bp->app_id);
 
 	rc = bnxt_ulp_cntxt_app_caps_init(bp->ulp_ctx, bp->app_id, devid);
 	if (rc) {
@@ -1393,13 +1392,17 @@ bnxt_ulp_port_init(struct bnxt *bp)
 	uint32_t ulp_flags;
 	int32_t rc = 0;
 
-	if (!bp || !BNXT_TRUFLOW_EN(bp))
-		return rc;
-
 	if (!BNXT_PF(bp) && !BNXT_VF_IS_TRUSTED(bp)) {
 		BNXT_TF_DBG(ERR,
 			    "Skip ulp init for port: %d, not a TVF or PF\n",
-			bp->eth_dev->data->port_id);
+			    bp->eth_dev->data->port_id);
+		return rc;
+	}
+
+	if (!BNXT_TRUFLOW_EN(bp)) {
+		BNXT_TF_DBG(ERR,
+			    "Skip ulp init for port: %d, truflow is not enabled\n",
+			    bp->eth_dev->data->port_id);
 		return rc;
 	}
 
@@ -1520,9 +1523,6 @@ bnxt_ulp_port_deinit(struct bnxt *bp)
 	struct rte_pci_device *pci_dev;
 	struct rte_pci_addr *pci_addr;
 
-	if (!BNXT_TRUFLOW_EN(bp))
-		return;
-
 	if (!BNXT_PF(bp) && !BNXT_VF_IS_TRUSTED(bp)) {
 		BNXT_TF_DBG(ERR,
 			    "Skip ULP deinit port:%d, not a TVF or PF\n",
@@ -1530,6 +1530,13 @@ bnxt_ulp_port_deinit(struct bnxt *bp)
 		return;
 	}
 
+	if (!BNXT_TRUFLOW_EN(bp)) {
+		BNXT_TF_DBG(ERR,
+			    "Skip ULP deinit for port:%d, truflow is not enabled\n",
+			    bp->eth_dev->data->port_id);
+		return;
+	}
+
 	if (!bp->ulp_ctx) {
 		BNXT_TF_DBG(DEBUG, "ulp ctx already de-allocated\n");
 		return;
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +2 -0
index 3daf5942e8..413e4c3b26 100644
@@ -96,7 +96,9 @@ bnxt_ulp_init_mapper_params(struct bnxt_ulp_mapper_create_parms *mapper_cparms,
 	mapper_cparms->act_tid = params->act_tmpl;
 	mapper_cparms->func_id = params->func_id;
 	mapper_cparms->hdr_bitmap = &params->hdr_bitmap;
+	mapper_cparms->enc_hdr_bitmap = &params->enc_hdr_bitmap;
 	mapper_cparms->hdr_field = params->hdr_field;
+	mapper_cparms->enc_field = params->enc_field;
 	mapper_cparms->comp_fld = params->comp_fld;
 	mapper_cparms->act = &params->act_bitmap;
 	mapper_cparms->act_prop = &params->act_prop;
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_enum.h +39 -5

80 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c +6 -2
index 58b4dba63c..b5bce6f4c7 100644
@@ -198,7 +198,9 @@ const struct bnxt_ulp_template_device_tbls ulp_template_thor_tbls[] = {
 struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	[BNXT_ULP_DEVICE_ID_WH_PLUS] = {
 	.description             = "Whitney_Plus",
-	.byte_order              = BNXT_ULP_BYTE_ORDER_LE,
+	.key_byte_order          = BNXT_ULP_BYTE_ORDER_LE,
+	.result_byte_order       = BNXT_ULP_BYTE_ORDER_LE,
+	.encap_byte_order        = BNXT_ULP_BYTE_ORDER_BE,
 	.encap_byte_swap         = 1,
 	.int_flow_db_num_entries = 16384,
 	.ext_flow_db_num_entries = 32768,
@@ -218,7 +220,9 @@ struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	},
 	[BNXT_ULP_DEVICE_ID_THOR] = {
 	.description             = "Thor",
-	.byte_order              = BNXT_ULP_BYTE_ORDER_LE,
+	.key_byte_order          = BNXT_ULP_BYTE_ORDER_LE,
+	.result_byte_order       = BNXT_ULP_BYTE_ORDER_LE,
+	.encap_byte_order        = BNXT_ULP_BYTE_ORDER_BE,
 	.encap_byte_swap         = 1,
 	.int_flow_db_num_entries = 16384,
 	.ext_flow_db_num_entries = 32768,
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_act.c +1 -3
index ce5a70b0c5..9faf25aaf0 100644
@@ -3,7 +3,7 @@
  * All rights reserved.
  */
 
-/* date: Thu May 13 18:15:56 2021 */
+/* date: Wed May 26 15:11:34 2021 */
 
 #include "ulp_template_db_enum.h"
 #include "ulp_template_db_field.h"
@@ -41,7 +41,6 @@ struct bnxt_ulp_mapper_tbl_info ulp_thor_act_tbl_list[] = {
 	.tbl_operand = BNXT_ULP_RF_IDX_FLOW_CNTR_PTR_0,
 	.fdb_opcode = BNXT_ULP_FDB_OPC_PUSH_FID,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPC_NOP,
-	.byte_order = BNXT_ULP_BYTE_ORDER_LE,
 	.result_start_idx = 0,
 	.result_bit_size = 64,
 	.result_num_fields = 1
@@ -62,7 +61,6 @@ struct bnxt_ulp_mapper_tbl_info ulp_thor_act_tbl_list[] = {
 	.tbl_operand = BNXT_ULP_RF_IDX_MAIN_ACTION_PTR,
 	.fdb_opcode = BNXT_ULP_FDB_OPC_PUSH_FID,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPC_NOP,
-	.byte_order = BNXT_ULP_BYTE_ORDER_LE,
 	.result_start_idx = 1,
 	.result_bit_size = 128,
 	.result_num_fields = 17
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c +7 -39

250 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_act.c +1196 -504

2,507 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_class.c +58 -164

55 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.c +3 -3
index 039c9c2a6b..1cb52e9bfa 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +1 -1
index 8680ee8f65..6dbec92745 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c +1 -1
index bc5627ec5b..5f5b5d639e 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_mapper.c +123 -29

152 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.h +4 -0
index d4d6969bb5..4d6ba0f73a 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +208 -129

337 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +2 -0
index 673172c811..e14f86278a 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +7 -3
index 2685e63432..904763f27d 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_utils.c +31 -42

73 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_utils.h +12 -15
index e1b0e773f3..68a537fa0a 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

#8 lore raw

PATCH 8/14 net/bnxt: add wild card TCAM byte order for Thor

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

The wild card tcam for Thor platform is different from the profile tcam byte order.

---
 .../generic_templates/ulp_template_db_tbl.c   |  2 ++
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          | 25 +++++++++++++------
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |  1 +
 3 files changed, 21 insertions(+), 7 deletions(-)
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c +2 -0
index b5bce6f4c7..68f1b5fd00 100644
@@ -201,6 +201,7 @@ struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	.key_byte_order          = BNXT_ULP_BYTE_ORDER_LE,
 	.result_byte_order       = BNXT_ULP_BYTE_ORDER_LE,
 	.encap_byte_order        = BNXT_ULP_BYTE_ORDER_BE,
+	.wc_key_byte_order       = BNXT_ULP_BYTE_ORDER_BE,
 	.encap_byte_swap         = 1,
 	.int_flow_db_num_entries = 16384,
 	.ext_flow_db_num_entries = 32768,
@@ -223,6 +224,7 @@ struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	.key_byte_order          = BNXT_ULP_BYTE_ORDER_LE,
 	.result_byte_order       = BNXT_ULP_BYTE_ORDER_LE,
 	.encap_byte_order        = BNXT_ULP_BYTE_ORDER_BE,
+	.wc_key_byte_order       = BNXT_ULP_BYTE_ORDER_BE,
 	.encap_byte_swap         = 1,
 	.int_flow_db_num_entries = 16384,
 	.ext_flow_db_num_entries = 32768,
drivers/net/bnxt/tf_ulp/ulp_mapper.c +18 -7
index 2687a545f3..bcc089b3e1 100644
@@ -1953,6 +1953,15 @@ static void ulp_mapper_wc_tcam_tbl_post_process(struct ulp_blob *blob)
 #endif
 }
 
+static int32_t ulp_mapper_tcam_is_wc_tcam(struct bnxt_ulp_mapper_tbl_info *tbl)
+{
+	if (tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM ||
+	    tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM_HIGH ||
+	    tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM_LOW)
+		return 1;
+	return 0;
+}
+
 static int32_t
 ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 			    struct bnxt_ulp_mapper_tbl_info *tbl)
@@ -1972,6 +1981,7 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	uint32_t hit = 0;
 	uint16_t tmplen = 0;
 	uint16_t idx;
+	enum bnxt_ulp_byte_order key_byte_order;
 
 	/* Set the key and mask to the original key and mask. */
 	key = &okey;
@@ -2003,10 +2013,13 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		return -EINVAL;
 	}
 
-	if (!ulp_blob_init(key, tbl->blob_key_bit_size,
-			   dparms->key_byte_order) ||
-	    !ulp_blob_init(mask, tbl->blob_key_bit_size,
-			   dparms->key_byte_order) ||
+	if (ulp_mapper_tcam_is_wc_tcam(tbl))
+		key_byte_order = dparms->wc_key_byte_order;
+	else
+		key_byte_order = dparms->key_byte_order;
+
+	if (!ulp_blob_init(key, tbl->blob_key_bit_size, key_byte_order) ||
+	    !ulp_blob_init(mask, tbl->blob_key_bit_size, key_byte_order) ||
 	    !ulp_blob_init(&data, tbl->result_bit_size,
 			   dparms->result_byte_order) ||
 	    !ulp_blob_init(&update_data, tbl->result_bit_size,
@@ -2043,9 +2056,7 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	}
 
 	/* For wild card tcam perform the post process to swap the blob */
-	if (tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM ||
-	    tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM_HIGH ||
-	    tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM_LOW) {
+	if (ulp_mapper_tcam_is_wc_tcam(tbl)) {
 		if (dparms->dynamic_pad_en) {
 			/* Sets up the slices for writing to the WC TCAM */
 			rc = ulp_mapper_wc_tcam_tbl_dyn_post_process(dparms,
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +1 -0
index 904763f27d..e2a4b81cec 100644
@@ -212,6 +212,7 @@ struct bnxt_ulp_device_params {
 	enum bnxt_ulp_byte_order	key_byte_order;
 	enum bnxt_ulp_byte_order	result_byte_order;
 	enum bnxt_ulp_byte_order	encap_byte_order;
+	enum bnxt_ulp_byte_order	wc_key_byte_order;
 	uint8_t				encap_byte_swap;
 	uint8_t				num_phy_ports;
 	uint32_t			mark_db_lfid_entries;
Signature · 1 line
2.17.1
#9 lore raw

PATCH 9/14 net/bnxt: add flow templates for Thor

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

1. Add support for egress flows with port and count action for Thor platform.
2. Added templates to support VXLAN encapsulation feature for Thor.
3. Added support for VXLAN decap and VLAN pop actions along with the ingress flow.
4. Added templates to enable VXLAN decap support for f1 and f2 flows.
5. Added templates Thor VF Rep support
6. Added Thor ingress mod table actions for NAT, NAPT, and TTL.
7. Added mirror/sample table support
8. Added supported for IPv6 flows for Thor.

---
 drivers/net/bnxt/tf_core/tf_tcam.c            |     6 +-
 .../generic_templates/ulp_template_db_enum.h  |   123 +-
 .../generic_templates/ulp_template_db_tbl.c   |   182 +-
 .../ulp_template_db_thor_act.c                |  4329 +-
 .../ulp_template_db_thor_class.c              | 44219 ++++++++++++++--
 .../ulp_template_db_wh_plus_class.c           |     4 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |    10 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |    18 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |     1 +
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |     3 +
 10 files changed, 44734 insertions(+), 4161 deletions(-)
drivers/net/bnxt/tf_core/tf_tcam.c +5 -1
index 806af3070a..273f20858b 100644
@@ -323,8 +323,12 @@ tf_tcam_alloc(struct tf *tfp,
 		}
 
 		/* return the start index of each row */
-		if (i == 0)
+		if (parms->priority == 0) {
+			if (i == 0)
+				parms->idx = index;
+		} else {
 			parms->idx = index;
+		}
 	}
 
 	return 0;
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_enum.h +82 -41

200 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c +178 -4

245 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_act.c +4267 -62

2,542 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c +40174 -4045

44,219 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_class.c +2 -2
index 7203dcf1fb..2870a0615a 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_mapper.c +6 -4
index bcc089b3e1..234f7ea2fa 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +16 -2
index 4e9968e5fa..dce95de05c 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +1 -0
index e2a4b81cec..1683cd7ec4 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_utils.c +3 -0
index fc4f435c97..686b80e456 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

#10 lore raw

PATCH 10/14 net/bnxt: tf core SRAM Manager

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

Adjust info message to debug level to prevent excessive logging.

---
 drivers/net/bnxt/tf_core/tf_tbl_sram.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/tf_core/tf_tbl_sram.c +1 -1
index ea10afecb6..d7727f7a11 100644
@@ -130,7 +130,7 @@ static int tf_tbl_sram_get_info(struct tf_tbl_sram_get_info_parms *parms)
 	if (slices)
 		parms->slice_size = tf_tbl_sram_slices_2_size[slices];
 
-	TFP_DRV_LOG(INFO,
+	TFP_DRV_LOG(DEBUG,
 		    "(%s) bank(%s) slice_size(%s)\n",
 		    tf_tbl_type_2_str(parms->tbl_type),
 		    tf_sram_bank_2_str(parms->bank_id),
Signature · 1 line
2.17.1
#11 lore raw

PATCH 11/14 net/bnxt: dynamically allocate space for EM defrag function

In reply to Venkat Duvvuru

From: Randy Schacher <[email protected]>

Alter defrag function to dynamically allocate and delete free_list and adj_list buffers.

---
 drivers/net/bnxt/tf_core/dpool.c | 38 +++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 13 deletions(-)
drivers/net/bnxt/tf_core/dpool.c +25 -13
index 145efa486f..5c03f775a5 100644
@@ -7,9 +7,6 @@
 #include <stdbool.h>
 #include <stdint.h>
 #include <errno.h>
-
-#include <rte_malloc.h>
-
 #include "tfp.h"
 #include "dpool.h"
 
@@ -84,13 +81,13 @@ static int dpool_move(struct dpool *dpool,
 	return 0;
 }
 
-
 int dpool_defrag(struct dpool *dpool,
 		 uint32_t entry_size,
 		 uint8_t defrag)
 {
 	struct dpool_free_list *free_list;
 	struct dpool_adj_list *adj_list;
+	struct tfp_calloc_parms parms;
 	uint32_t count;
 	uint32_t index;
 	uint32_t used;
@@ -103,15 +100,31 @@ int dpool_defrag(struct dpool *dpool,
 	uint32_t max_size = 0;
 	int rc;
 
-	free_list = rte_zmalloc("dpool_free_list",
-				sizeof(struct dpool_free_list), 0);
+	parms.nitems = 1;
+	parms.size = sizeof(struct dpool_free_list);
+	parms.alignment = 0;
+
+	rc = tfp_calloc(&parms);
+
+	if (rc)
+		return rc;
+
+	free_list = (struct dpool_free_list *)parms.mem_va;
 	if (free_list == NULL) {
 		TFP_DRV_LOG(ERR, "dpool free list allocation failed\n");
 		return -ENOMEM;
 	}
 
-	adj_list = rte_zmalloc("dpool_adjacent_list",
-				sizeof(struct dpool_adj_list), 0);
+	parms.nitems = 1;
+	parms.size = sizeof(struct dpool_adj_list);
+	parms.alignment = 0;
+
+	rc = tfp_calloc(&parms);
+
+	if (rc)
+		return rc;
+
+	adj_list = (struct dpool_adj_list *)parms.mem_va;
 	if (adj_list == NULL) {
 		TFP_DRV_LOG(ERR, "dpool adjacent list allocation failed\n");
 		return -ENOMEM;
@@ -239,8 +252,8 @@ int dpool_defrag(struct dpool *dpool,
 					free_list->entry[largest_free_index].index,
 					max_index);
 			if (rc) {
-				rte_free(free_list);
-				rte_free(adj_list);
+				tfp_free(free_list);
+				tfp_free(adj_list);
 				return rc;
 			}
 		} else {
@@ -249,12 +262,11 @@ int dpool_defrag(struct dpool *dpool,
 	}
 
 done:
-	rte_free(free_list);
-	rte_free(adj_list);
+	tfp_free(free_list);
+	tfp_free(adj_list);
 	return largest_free_size;
 }
 
-
 uint32_t dpool_alloc(struct dpool *dpool,
 		     uint32_t size,
 		     uint8_t defrag)
Signature · 1 line
2.17.1
#12 lore raw

PATCH 12/14 net/bnxt: sram manager shared session

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

Fix shared session support issues due to SRAM manager additions. Shared session does not support slices within RM blocks. Calculate resources required without slices and determine base addresses using old methods for the shared session.

---
 drivers/net/bnxt/tf_core/tf_em_internal.c |   5 +-
 drivers/net/bnxt/tf_core/tf_rm.c          | 134 +++++++++++++++++++---
 drivers/net/bnxt/tf_core/tf_tbl_sram.c    |  73 +++++++++---
 3 files changed, 176 insertions(+), 36 deletions(-)
drivers/net/bnxt/tf_core/tf_em_internal.c +4 -1
index 2d57595f17..67ba011eae 100644
@@ -326,8 +326,11 @@ tf_em_int_unbind(struct tf *tfp)
 		return rc;
 
 	if (!tf_session_is_shared_session(tfs)) {
-		for (i = 0; i < TF_DIR_MAX; i++)
+		for (i = 0; i < TF_DIR_MAX; i++) {
+			if (tfs->em_pool[i] == NULL)
+				continue;
 			dpool_free_all(tfs->em_pool[i]);
+		}
 	}
 
 	rc = tf_session_get_db(tfp, TF_MODULE_TYPE_EM, &em_db_ptr);
drivers/net/bnxt/tf_core/tf_rm.c +115 -19

245 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tbl_sram.c +57 -16

99 lines not on this page · raw message

Signature · 1 line
2.17.1
#13 lore raw

PATCH 13/14 net/bnxt: add enhancements to TF ULP

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

1. Added support to specify l4 port masks in the template. Also enabled source mac in the wild card key for ingress flows.

2. Added support to enable offload for ipv6 traffic within the vxlan tunnel connection.

3. The flow counters is reduced from 7168 to 6912 for Whitney. The stats operation is updated to reflect counts for packets at egress from CFA instead of ingress to CFA

4. The miss path for the l2 context table is updated with correct parif and default action handler to handle the miss path for egress flows.

5. This support enables allocation of encapsulation, modification and action records dynamically based on a given flow actions.

6. Reduce the l2context resource requests during open_session. Move the SMAC from the L2Context to the EM/WM

7. Remap the parif in the bd action in order to eliminate incorrect replication of broadcast packets. The layer 4 source port mask was incorrectly updated in the outer layer 4 source port mask instead of inner layer 4. Add the l3 proto to egress rules, switch to using computed fields for l4 ports, add internal smac to f1/f2 flows, add l3 proto to ingress ipv6 flows

---
 drivers/net/bnxt/tf_core/tf_tbl_sram.c        |    7 -
 .../generic_templates/ulp_template_db_class.c | 8102 ++++++++++++-----
 .../generic_templates/ulp_template_db_enum.h  |  675 +-
 .../generic_templates/ulp_template_db_field.h |  195 +-
 .../generic_templates/ulp_template_db_tbl.c   | 2136 ++++-
 .../ulp_template_db_thor_act.c                |  996 +-
 .../ulp_template_db_thor_class.c              | 7495 ++++++++-------
 .../ulp_template_db_wh_plus_class.c           |   14 +-
 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c         |    4 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |  135 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |  175 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   10 +
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |    3 +-
 13 files changed, 13538 insertions(+), 6409 deletions(-)
drivers/net/bnxt/tf_core/tf_tbl_sram.c +0 -7
index 167078a8c6..636811bc2d 100644
@@ -134,11 +134,6 @@ static int tf_tbl_sram_get_info(struct tf_tbl_sram_get_info_parms *parms)
 	if (slices)
 		parms->slice_size = tf_tbl_sram_slices_2_size[slices];
 
-	TFP_DRV_LOG(DEBUG,
-		    "(%s) bank(%s) slice_size(%s)\n",
-		    tf_tbl_type_2_str(parms->tbl_type),
-		    tf_sram_bank_2_str(parms->bank_id),
-		    tf_sram_slice_2_str(parms->slice_size));
 	return rc;
 }
 
@@ -373,7 +368,6 @@ tf_tbl_sram_free(struct tf *tfp __rte_unused,
 		return rc;
 	}
 
-
 #if (DBG_SRAM == 1)
 	{
 		struct tf_sram_mgr_dump_parms dparms;
@@ -411,7 +405,6 @@ tf_tbl_sram_set(struct tf *tfp,
 	void *sram_handle = NULL;
 	uint16_t base = 0, shift = 0;
 
-
 	TF_CHECK_PARMS3(tfp, parms, parms->data);
 
 	/* Retrieve the session information */
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_class.c +5835 -2267

2,975 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_enum.h +418 -257

675 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_field.h +155 -40

195 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c +1632 -504

2,136 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_act.c +871 -125

996 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c +4420 -3075

7,495 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_class.c +7 -7
index 2870a0615a..4b9cb7fd5b 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c +2 -2
index c6b2b1675d..7b6db7a0f8 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_mapper.c +105 -30

135 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +81 -94

175 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +10 -0
index 1683cd7ec4..d3bfb8c12d 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_utils.c +2 -1
index 686b80e456..df3afaa6fd 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

#14 lore raw

PATCH 14/14 net/bnxt: add support for testpmd co-existence

In reply to Venkat Duvvuru

Currently, testpmd support in ULP is enabled only during compilation time. This patch adds support for testpmd during runtime using devarg "testpmd".

---
 drivers/net/bnxt/bnxt.h                 |  3 ++
 drivers/net/bnxt/bnxt_ethdev.c          | 56 +++++++++++++++++++++++++
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c      |  5 +++
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c |  4 +-
 4 files changed, 67 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt.h +3 -0
index 494a1eff37..c9adc66fda 100644
@@ -722,6 +722,9 @@ struct bnxt {
 	((bp)->flags2 & BNXT_FLAGS2_PTP_TIMESYNC_ENABLED)
 #define	BNXT_ACCUM_STATS_EN(bp)			\
 	((bp)->flags2 & BNXT_FLAGS2_ACCUM_STATS_EN)
+#define	BNXT_FLAGS2_TESTPMD_EN			BIT(3)
+#define	BNXT_TESTPMD_EN(bp)			\
+	((bp)->flags2 & BNXT_FLAGS2_TESTPMD_EN)
 
 	uint16_t		chip_num;
 #define CHIP_NUM_58818		0xd818
drivers/net/bnxt/bnxt_ethdev.c +56 -0

83 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/bnxt_ulp.c +5 -0
index 3b86410fb1..2ad662fb17 100644
@@ -844,6 +844,11 @@ ulp_ctx_init(struct bnxt *bp,
 		goto error_deinit;
 	}
 
+	if (BNXT_TESTPMD_EN(bp)) {
+		ulp_data->ulp_flags &= ~BNXT_ULP_VF_REP_ENABLED;
+		BNXT_TF_DBG(ERR, "Enabled Testpmd forward mode\n");
+	}
+
 	/*
 	 * Shared session must be created before first regular session but after
 	 * the ulp_ctx is valid.
drivers/net/bnxt/tf_ulp/ulp_def_rules.c +3 -1
index d8336d164e..827fe30acd 100644
@@ -526,8 +526,10 @@ bnxt_ulp_create_df_rules(struct bnxt *bp)
 	rc = ulp_default_flow_db_cfa_action_get(bp->ulp_ctx,
 						info->def_port_flow_id,
 						&bp->tx_cfa_action);
-	if (rc)
+
+	if (rc || BNXT_TESTPMD_EN(bp))
 		bp->tx_cfa_action = 0;
+
 	info->valid = true;
 	return 0;
 }
Signature · 1 line
2.17.1
#15 lore raw

v2 cover enhancements to host based flow table management

In reply to Venkat Duvvuru

This patch set adds support for new offload features/enhancments for Thor adapters like VF representor support, new flow matches/actions & dynamic SRAM manager support.

v1 ==> v2
=========
1. Fixed compilation issues
2. Abandoned patch 14

Farah Smith (4):
net/bnxt: tf core index table updates
net/bnxt: add Thor SRAM mgr model
net/bnxt: tf core SRAM Manager
net/bnxt: sram manager shared session

Jay Ding (1):
net/bnxt: add flow meter drop counter support

Kishore Padmanabha (6):
net/bnxt: add flow templates support for Thor net/bnxt: add support for tunnel offloads net/bnxt: add support for dynamic encap action net/bnxt: add wild card TCAM byte order for Thor net/bnxt: add flow templates for Thor net/bnxt: add enhancements to TF ULP

Peter Spreadborough (1):
net/bnxt: enable dpool allocator

Randy Schacher (1):
net/bnxt: dynamically allocate space for EM defrag function

 drivers/net/bnxt/tf_core/cfa_resource_types.h |     5 +-
 drivers/net/bnxt/tf_core/dpool.c              |    38 +-
 drivers/net/bnxt/tf_core/ll.c                 |     3 +
 drivers/net/bnxt/tf_core/ll.h                 |    50 +-
 drivers/net/bnxt/tf_core/meson.build          |     2 +
 drivers/net/bnxt/tf_core/tf_core.c            |   169 +-
 drivers/net/bnxt/tf_core/tf_core.h            |   159 +-
 drivers/net/bnxt/tf_core/tf_device.c          |    40 +-
 drivers/net/bnxt/tf_core/tf_device.h          |   137 +-
 drivers/net/bnxt/tf_core/tf_device_p4.c       |    77 +-
 drivers/net/bnxt/tf_core/tf_device_p4.h       |    50 +-
 drivers/net/bnxt/tf_core/tf_device_p58.c      |   112 +-
 drivers/net/bnxt/tf_core/tf_device_p58.h      |    70 +-
 drivers/net/bnxt/tf_core/tf_em.h              |    10 -
 drivers/net/bnxt/tf_core/tf_em_common.c       |     4 +
 .../net/bnxt/tf_core/tf_em_hash_internal.c    |    34 -
 drivers/net/bnxt/tf_core/tf_em_internal.c     |   185 +-
 drivers/net/bnxt/tf_core/tf_msg.c             |     2 +-
 drivers/net/bnxt/tf_core/tf_rm.c              |   180 +-
 drivers/net/bnxt/tf_core/tf_rm.h              |    62 +-
 drivers/net/bnxt/tf_core/tf_session.c         |    56 +
 drivers/net/bnxt/tf_core/tf_session.h         |    58 +-
 drivers/net/bnxt/tf_core/tf_sram_mgr.c        |   971 +
 drivers/net/bnxt/tf_core/tf_sram_mgr.h        |   317 +
 drivers/net/bnxt/tf_core/tf_tbl.c             |   259 +-
 drivers/net/bnxt/tf_core/tf_tbl.h             |    87 +-
 drivers/net/bnxt/tf_core/tf_tbl_sram.c        |   747 +
 drivers/net/bnxt/tf_core/tf_tbl_sram.h        |   154 +
 drivers/net/bnxt/tf_core/tf_tcam.c            |    16 +-
 drivers/net/bnxt/tf_core/tf_tcam.h            |     7 +
 drivers/net/bnxt/tf_core/tf_tcam_shared.c     |    28 +-
 drivers/net/bnxt/tf_core/tf_util.c            |    12 +
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |    10 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |    52 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |    20 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |   226 +-
 .../bnxt/tf_ulp/generic_templates/meson.build |    17 +-
 .../generic_templates/ulp_template_db_act.c   |     2 +-
 .../generic_templates/ulp_template_db_class.c | 12109 +++-
 .../generic_templates/ulp_template_db_enum.h  |   618 +-
 .../generic_templates/ulp_template_db_field.h |   767 +-
 .../generic_templates/ulp_template_db_tbl.c   |  2757 +-
 .../ulp_template_db_thor_act.c                |  5079 +-
 .../ulp_template_db_thor_class.c              | 45573 ++++++++++++++--
 .../ulp_template_db_wh_plus_act.c             |  1700 +-
 .../ulp_template_db_wh_plus_class.c           |  8329 ++-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |    48 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h          |     8 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |   678 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |    68 +-
 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c         |     9 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   448 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |    10 +-
 drivers/net/bnxt/tf_ulp/ulp_matcher.c         |    13 +
 drivers/net/bnxt/tf_ulp/ulp_port_db.c         |    15 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c |    31 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |   663 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |    12 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |    32 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.c             |   521 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.h             |    89 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |    71 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |    27 +-
 meson_options.txt                             |     2 +
 64 files changed, 71149 insertions(+), 12956 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_sram_mgr.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_sram_mgr.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_tbl_sram.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_tbl_sram.h
Signature · 1 line
2.17.1
#16 lore raw

PATCH v2 1/13 net/bnxt: tf core index table updates

From: Farah Smith <[email protected]>

Remove unused shadow table functionality.

---
 drivers/net/bnxt/tf_core/tf_core.c       |  65 --------------
 drivers/net/bnxt/tf_core/tf_core.h       | 103 +----------------------
 drivers/net/bnxt/tf_core/tf_device.h     |  22 -----
 drivers/net/bnxt/tf_core/tf_device_p4.c  |   2 -
 drivers/net/bnxt/tf_core/tf_device_p58.c |   2 -
 drivers/net/bnxt/tf_core/tf_em_common.c  |   4 +
 drivers/net/bnxt/tf_core/tf_tbl.c        |  21 -----
 drivers/net/bnxt/tf_core/tf_tbl.h        |  72 ----------------
 drivers/net/bnxt/tf_ulp/ulp_mapper.c     |   3 +-
 9 files changed, 7 insertions(+), 287 deletions(-)
drivers/net/bnxt/tf_core/tf_core.c +0 -65
index 97e6165e92..5458f76e2d 100644
@@ -1105,71 +1105,6 @@ tf_alloc_tbl_entry(struct tf *tfp,
 	return 0;
 }
 
-int
-tf_search_tbl_entry(struct tf *tfp,
-		    struct tf_search_tbl_entry_parms *parms)
-{
-	int rc;
-	struct tf_session *tfs;
-	struct tf_dev_info *dev;
-	struct tf_tbl_alloc_search_parms sparms;
-
-	TF_CHECK_PARMS2(tfp, parms);
-
-	/* Retrieve the session information */
-	rc = tf_session_get_session(tfp, &tfs);
-	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "%s: Failed to lookup session, rc:%s\n",
-			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
-		return rc;
-	}
-
-	/* Retrieve the device information */
-	rc = tf_session_get_device(tfs, &dev);
-	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "%s: Failed to lookup device, rc:%s\n",
-			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
-		return rc;
-	}
-
-	if (dev->ops->tf_dev_alloc_search_tbl == NULL) {
-		rc = -EOPNOTSUPP;
-		TFP_DRV_LOG(ERR,
-			    "%s: Operation not supported, rc:%s\n",
-			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
-		return rc;
-	}
-
-	memset(&sparms, 0, sizeof(struct tf_tbl_alloc_search_parms));
-	sparms.dir = parms->dir;
-	sparms.type = parms->type;
-	sparms.result = parms->result;
-	sparms.result_sz_in_bytes = parms->result_sz_in_bytes;
-	sparms.alloc = parms->alloc;
-	sparms.tbl_scope_id = parms->tbl_scope_id;
-	rc = dev->ops->tf_dev_alloc_search_tbl(tfp, &sparms);
-	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "%s: TBL allocation failed, rc:%s\n",
-			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
-		return rc;
-	}
-
-	/* Return the outputs from the search */
-	parms->hit = sparms.hit;
-	parms->search_status = sparms.search_status;
-	parms->ref_cnt = sparms.ref_cnt;
-	parms->idx = sparms.idx;
-
-	return 0;
-}
-
 int
 tf_free_tbl_entry(struct tf *tfp,
 		  struct tf_free_tbl_entry_parms *parms)
drivers/net/bnxt/tf_core/tf_core.h +2 -101

122 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device.h +0 -22
index da3f541685..b43cfc6925 100644
@@ -347,28 +347,6 @@ struct tf_dev_ops {
 	int (*tf_dev_free_ext_tbl)(struct tf *tfp,
 				   struct tf_tbl_free_parms *parms);
 
-	/**
-	 * Searches for the specified table type element in a shadow DB.
-	 *
-	 * This API searches for the specified table type element in a
-	 * device specific shadow DB. If the element is found the
-	 * reference count for the element is updated. If the element
-	 * is not found a new element is allocated from the table type
-	 * DB and then inserted into the shadow DB.
-	 *
-	 * [in] tfp
-	 *   Pointer to TF handle
-	 *
-	 * [in] parms
-	 *   Pointer to table allocation and search parameters
-	 *
-	 * Returns
-	 *   - (0) if successful.
-	 *   - (-EINVAL) on failure.
-	 */
-	int (*tf_dev_alloc_search_tbl)(struct tf *tfp,
-				       struct tf_tbl_alloc_search_parms *parms);
-
 	/**
 	 * Sets the specified table type element.
 	 *
drivers/net/bnxt/tf_core/tf_device_p4.c +0 -2
index 971fab7bda..2e7ccec123 100644
@@ -236,7 +236,6 @@ const struct tf_dev_ops tf_dev_ops_p4_init = {
 	.tf_dev_alloc_tbl = NULL,
 	.tf_dev_free_ext_tbl = NULL,
 	.tf_dev_free_tbl = NULL,
-	.tf_dev_alloc_search_tbl = NULL,
 	.tf_dev_set_tbl = NULL,
 	.tf_dev_set_ext_tbl = NULL,
 	.tf_dev_get_tbl = NULL,
@@ -282,7 +281,6 @@ const struct tf_dev_ops tf_dev_ops_p4 = {
 	.tf_dev_alloc_ext_tbl = tf_tbl_ext_alloc,
 	.tf_dev_free_tbl = tf_tbl_free,
 	.tf_dev_free_ext_tbl = tf_tbl_ext_free,
-	.tf_dev_alloc_search_tbl = tf_tbl_alloc_search,
 	.tf_dev_set_tbl = tf_tbl_set,
 	.tf_dev_set_ext_tbl = tf_tbl_ext_common_set,
 	.tf_dev_get_tbl = tf_tbl_get,
drivers/net/bnxt/tf_core/tf_device_p58.c +0 -2
index 6bbc5e21e9..ce4d8c661f 100644
@@ -280,7 +280,6 @@ const struct tf_dev_ops tf_dev_ops_p58_init = {
 	.tf_dev_alloc_tbl = NULL,
 	.tf_dev_free_ext_tbl = NULL,
 	.tf_dev_free_tbl = NULL,
-	.tf_dev_alloc_search_tbl = NULL,
 	.tf_dev_set_tbl = NULL,
 	.tf_dev_set_ext_tbl = NULL,
 	.tf_dev_get_tbl = NULL,
@@ -326,7 +325,6 @@ const struct tf_dev_ops tf_dev_ops_p58 = {
 	.tf_dev_alloc_ext_tbl = tf_tbl_ext_alloc,
 	.tf_dev_free_tbl = tf_tbl_free,
 	.tf_dev_free_ext_tbl = tf_tbl_ext_free,
-	.tf_dev_alloc_search_tbl = tf_tbl_alloc_search,
 	.tf_dev_set_tbl = tf_tbl_set,
 	.tf_dev_set_ext_tbl = tf_tbl_ext_common_set,
 	.tf_dev_get_tbl = tf_tbl_get,
drivers/net/bnxt/tf_core/tf_em_common.c +4 -0
index 812ccb0d29..3bdfc14e05 100644
@@ -23,6 +23,10 @@
 
 #include "bnxt.h"
 
+
+/** Invalid table scope id */
+#define TF_TBL_SCOPE_INVALID 0xffffffff
+
 /* Number of pointers per page_size */
 #define MAX_PAGE_PTRS(page_size)  ((page_size) / sizeof(void *))
 
drivers/net/bnxt/tf_core/tf_tbl.c +0 -21
index ced59130b2..e77399c6bd 100644
@@ -26,11 +26,6 @@
 
 struct tf;
 
-/**
- * Table Shadow DBs
- */
-static void *shadow_tbl_db[TF_DIR_MAX];
-
 /**
  * Shadow init flag, set on bind and cleared on unbind
  */
@@ -327,22 +322,6 @@ tf_tbl_free(struct tf *tfp __rte_unused,
 	return 0;
 }
 
-int
-tf_tbl_alloc_search(struct tf *tfp,
-		    struct tf_tbl_alloc_search_parms *parms)
-{
-	int rc = 0;
-	TF_CHECK_PARMS2(tfp, parms);
-
-	if (!shadow_init || !shadow_tbl_db[parms->dir]) {
-		TFP_DRV_LOG(ERR, "%s: Shadow TBL not initialized.\n",
-			    tf_dir_2_str(parms->dir));
-		return -EINVAL;
-	}
-
-	return rc;
-}
-
 int
 tf_tbl_set(struct tf *tfp,
 	   struct tf_tbl_set_parms *parms)
drivers/net/bnxt/tf_core/tf_tbl.h +0 -72

90 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.c +1 -2
index 871dbad0fe..f3a60cc880 100644
@@ -189,13 +189,12 @@ ulp_mapper_resource_index_tbl_alloc(struct bnxt_ulp_context *ulp_ctx,
 
 	aparms.type = glb_res->resource_type;
 	aparms.dir = glb_res->direction;
-	aparms.search_enable = 0;
 	aparms.tbl_scope_id = tbl_scope_id;
 
 	/* Allocate the index tbl using tf api */
 	rc = tf_alloc_tbl_entry(tfp, &aparms);
 	if (rc) {
-		BNXT_TF_DBG(ERR, "Failed to alloc identifier [%s][%d]\n",
+		BNXT_TF_DBG(ERR, "Failed to alloc index table [%s][%d]\n",
 			    tf_dir_2_str(aparms.dir), aparms.type);
 		return rc;
 	}
Signature · 1 line
2.17.1
#17 lore raw

PATCH v2 2/13 net/bnxt: enable dpool allocator

In reply to Venkat Duvvuru

From: Peter Spreadborough <[email protected]>

Enable dynamic entry allocator for EM SRAM entries. Deprecate static entry allocator code.

---
 drivers/net/bnxt/tf_core/tf_device_p58.c      |   4 -
 drivers/net/bnxt/tf_core/tf_em.h              |  10 -
 .../net/bnxt/tf_core/tf_em_hash_internal.c    |  34 ----
 drivers/net/bnxt/tf_core/tf_em_internal.c     | 180 +-----------------
 4 files changed, 1 insertion(+), 227 deletions(-)
drivers/net/bnxt/tf_core/tf_device_p58.c +0 -4
index ce4d8c661f..808dcb1f77 100644
@@ -348,11 +348,7 @@ const struct tf_dev_ops tf_dev_ops_p58 = {
 	.tf_dev_get_tcam_resc_info = tf_tcam_get_resc_info,
 	.tf_dev_insert_int_em_entry = tf_em_hash_insert_int_entry,
 	.tf_dev_delete_int_em_entry = tf_em_hash_delete_int_entry,
-#if (TF_EM_ALLOC == 1)
 	.tf_dev_move_int_em_entry = tf_em_move_int_entry,
-#else
-	.tf_dev_move_int_em_entry = NULL,
-#endif
 	.tf_dev_insert_ext_em_entry = NULL,
 	.tf_dev_delete_ext_em_entry = NULL,
 	.tf_dev_get_em_resc_info = tf_em_get_resc_info,
drivers/net/bnxt/tf_core/tf_em.h +0 -10
index 568071ad8c..074c128651 100644
@@ -13,16 +13,6 @@
 
 #include "hcapi_cfa_defs.h"
 
-/**
- * TF_EM_ALLOC
- *
- * 0: Use stack allocator with fixed sized entries
- *    (default).
- * 1: Use dpool allocator with variable size
- *    entries.
- */
-#define TF_EM_ALLOC 0
-
 #define TF_EM_MIN_ENTRIES     (1 << 15) /* 32K */
 #define TF_EM_MAX_ENTRIES     (1 << 27) /* 128M */
 
drivers/net/bnxt/tf_core/tf_em_hash_internal.c +0 -34
index 098e8af07e..60273a798c 100644
@@ -22,9 +22,7 @@
 /**
  * EM Pool
  */
-#if (TF_EM_ALLOC == 1)
 #include "dpool.h"
-#endif
 
 /**
  * Insert EM internal entry API
@@ -41,11 +39,7 @@ tf_em_hash_insert_int_entry(struct tf *tfp,
 	uint16_t rptr_index = 0;
 	uint8_t rptr_entry = 0;
 	uint8_t num_of_entries = 0;
-#if (TF_EM_ALLOC == 1)
 	struct dpool *pool;
-#else
-	struct stack *pool;
-#endif
 	uint32_t index;
 	uint32_t key0_hash;
 	uint32_t key1_hash;
@@ -62,7 +56,6 @@ tf_em_hash_insert_int_entry(struct tf *tfp,
 	rc = tf_session_get_device(tfs, &dev);
 	if (rc)
 		return rc;
-#if (TF_EM_ALLOC == 1)
 	pool = (struct dpool *)tfs->em_pool[parms->dir];
 	index = dpool_alloc(pool,
 			    parms->em_record_sz_in_bits / 128,
@@ -74,16 +67,6 @@ tf_em_hash_insert_int_entry(struct tf *tfp,
 			    tf_dir_2_str(parms->dir));
 		return -1;
 	}
-#else
-	pool = (struct stack *)tfs->em_pool[parms->dir];
-	rc = stack_pop(pool, &index);
-	if (rc) {
-		PMD_DRV_LOG(ERR,
-			    "%s, EM entry index allocation failed\n",
-			    tf_dir_2_str(parms->dir));
-		return rc;
-	}
-#endif
 
 	if (dev->ops->tf_dev_cfa_key_hash == NULL)
 		return -EINVAL;
@@ -103,11 +86,7 @@ tf_em_hash_insert_int_entry(struct tf *tfp,
 						  &num_of_entries);
 	if (rc) {
 		/* Free the allocated index before returning */
-#if (TF_EM_ALLOC == 1)
 		dpool_free(pool, index);
-#else
-		stack_push(pool, index);
-#endif
 		return -1;
 	}
 
@@ -128,9 +107,7 @@ tf_em_hash_insert_int_entry(struct tf *tfp,
 				     rptr_index,
 				     rptr_entry,
 				     0);
-#if (TF_EM_ALLOC == 1)
 	dpool_set_entry_data(pool, index, parms->flow_handle);
-#endif
 	return 0;
 }
 
@@ -146,11 +123,7 @@ tf_em_hash_delete_int_entry(struct tf *tfp,
 {
 	int rc = 0;
 	struct tf_session *tfs;
-#if (TF_EM_ALLOC == 1)
 	struct dpool *pool;
-#else
-	struct stack *pool;
-#endif
 	/* Retrieve the session information */
 	rc = tf_session_get_session(tfp, &tfs);
 	if (rc) {
@@ -165,19 +138,13 @@ tf_em_hash_delete_int_entry(struct tf *tfp,
 
 	/* Return resource to pool */
 	if (rc == 0) {
-#if (TF_EM_ALLOC == 1)
 		pool = (struct dpool *)tfs->em_pool[parms->dir];
 		dpool_free(pool, parms->index);
-#else
-		pool = (struct stack *)tfs->em_pool[parms->dir];
-		stack_push(pool, parms->index);
-#endif
 	}
 
 	return rc;
 }
 
-#if (TF_EM_ALLOC == 1)
 /** Move EM internal entry API
  *
  * returns:
@@ -212,4 +179,3 @@ tf_em_move_int_entry(struct tf *tfp,
 
 	return rc;
 }
-#endif
drivers/net/bnxt/tf_core/tf_em_internal.c +1 -179

258 lines not on this page · raw message

Signature · 1 line
2.17.1
#18 lore raw

PATCH v2 3/13 net/bnxt: add flow meter drop counter support

In reply to Venkat Duvvuru

From: Jay Ding <[email protected]>

- Add flow meter drop counter support for Thor.

---
 drivers/net/bnxt/tf_core/cfa_resource_types.h |  5 +-
 drivers/net/bnxt/tf_core/tf_core.h            |  8 +-
 drivers/net/bnxt/tf_core/tf_device_p58.c      |  1 +
 drivers/net/bnxt/tf_core/tf_device_p58.h      | 14 ++++
 drivers/net/bnxt/tf_core/tf_tbl.c             | 74 +++++++++++--------
 drivers/net/bnxt/tf_core/tf_util.c            |  2 +
 6 files changed, 68 insertions(+), 36 deletions(-)
drivers/net/bnxt/tf_core/cfa_resource_types.h +3 -2
index cbab0d0078..36a55d4e17 100644
@@ -104,10 +104,11 @@
 #define CFA_RESOURCE_TYPE_P58_WC_FKB             0x12UL
 /* VEB TCAM */
 #define CFA_RESOURCE_TYPE_P58_VEB_TCAM           0x13UL
+/* Metadata */
+#define CFA_RESOURCE_TYPE_P58_METADATA           0x14UL
 /* Meter drop counter */
 #define CFA_RESOURCE_TYPE_P58_METER_DROP_CNT     0x15UL
-#define CFA_RESOURCE_TYPE_P58_LAST               CFA_RESOURCE_TYPE_P58_METER_DROP_CNT
-
+#define CFA_RESOURCE_TYPE_P58_LAST              CFA_RESOURCE_TYPE_P58_METER_DROP_CNT
 
 /* Multicast Group */
 #define CFA_RESOURCE_TYPE_P45_MCG                 0x0UL
drivers/net/bnxt/tf_core/tf_core.h +6 -2
index 7e0cdf7e0d..af8d13bd7e 100644
@@ -283,9 +283,9 @@ enum tf_tbl_type {
 	TF_TBL_TYPE_ACT_MODIFY_32B,
 	/** TH 64B Modify Record */
 	TF_TBL_TYPE_ACT_MODIFY_64B,
-	/** (Future) Meter Profiles */
+	/** Meter Profiles */
 	TF_TBL_TYPE_METER_PROF,
-	/** (Future) Meter Instance */
+	/** Meter Instance */
 	TF_TBL_TYPE_METER_INST,
 	/** Wh+/SR/Th Mirror Config */
 	TF_TBL_TYPE_MIRROR_CONFIG,
@@ -301,6 +301,8 @@ enum tf_tbl_type {
 	TF_TBL_TYPE_EM_FKB,
 	/** TH WC Flexible Key builder */
 	TF_TBL_TYPE_WC_FKB,
+	/** Meter Drop Counter */
+	TF_TBL_TYPE_METER_DROP_CNT,
 
 	/* External */
 
@@ -2194,6 +2196,8 @@ enum tf_global_config_type {
 	TF_TUNNEL_ENCAP,  /**< Tunnel Encap Config(TECT) */
 	TF_ACTION_BLOCK,  /**< Action Block Config(ABCR) */
 	TF_COUNTER_CFG,   /**< Counter Configuration (CNTRS_CTRL) */
+	TF_METER_CFG,     /**< Meter Config(ACTP4_FMTCR) */
+	TF_METER_INTERVAL_CFG, /**< Meter Interval Config(FMTCR_INTERVAL)  */
 	TF_GLOBAL_CFG_TYPE_MAX
 };
 
drivers/net/bnxt/tf_core/tf_device_p58.c +1 -0
index 808dcb1f77..a492c62bff 100644
@@ -43,6 +43,7 @@ const char *tf_resource_str_p58[CFA_RESOURCE_TYPE_P58_LAST + 1] = {
 	[CFA_RESOURCE_TYPE_P58_EM_FKB]             = "em_fkb  ",
 	[CFA_RESOURCE_TYPE_P58_WC_FKB]             = "wc_fkb  ",
 	[CFA_RESOURCE_TYPE_P58_VEB_TCAM]           = "veb     ",
+	[CFA_RESOURCE_TYPE_P58_METADATA]           = "metadata",
 };
 
 /**
drivers/net/bnxt/tf_core/tf_device_p58.h +14 -0
index 66b0f4e983..8c2e07aa34 100644
@@ -75,10 +75,18 @@ struct tf_rm_element_cfg tf_tbl_p58[TF_TBL_TYPE_MAX] = {
 		TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_METER,
 		0, 0, 0
 	},
+	[TF_TBL_TYPE_METER_DROP_CNT] = {
+		TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_METER_DROP_CNT,
+		0, 0, 0
+	},
 	[TF_TBL_TYPE_MIRROR_CONFIG] = {
 		TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_MIRROR,
 		0, 0, 0
 	},
+	[TF_TBL_TYPE_METADATA] = {
+		TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_METADATA,
+		0, 0, 0
+	},
 	/* Policy - ARs in bank 1 */
 	[TF_TBL_TYPE_FULL_ACT_RECORD] = {
 		.cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_PARENT,
@@ -194,5 +202,11 @@ struct tf_global_cfg_cfg tf_global_cfg_p58[TF_GLOBAL_CFG_TYPE_MAX] = {
 	[TF_COUNTER_CFG] = {
 		TF_GLOBAL_CFG_CFG_HCAPI, TF_COUNTER_CFG
 	},
+	[TF_METER_CFG] = {
+		TF_GLOBAL_CFG_CFG_HCAPI, TF_METER_CFG
+	},
+	[TF_METER_INTERVAL_CFG] = {
+		TF_GLOBAL_CFG_CFG_HCAPI, TF_METER_INTERVAL_CFG
+	},
 };
 #endif /* _TF_DEVICE_P58_H_ */
drivers/net/bnxt/tf_core/tf_tbl.c +42 -32

88 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_util.c +2 -0
index e712816209..d100399d0a 100644
@@ -112,6 +112,8 @@ tf_tbl_type_2_str(enum tf_tbl_type tbl_type)
 		return "WC Flexible Key Builder";
 	case TF_TBL_TYPE_EXT:
 		return "External";
+	case TF_TBL_TYPE_METER_DROP_CNT:
+		return "Meter drop counter";
 	default:
 		return "Invalid tbl type";
 	}
Signature · 1 line
2.17.1
#19 lore raw

PATCH v2 4/13 net/bnxt: add Thor SRAM mgr model

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

Add dynamic SRAM manager allocation support.

---
 drivers/net/bnxt/tf_core/ll.c             |   3 +
 drivers/net/bnxt/tf_core/ll.h             |  50 +-
 drivers/net/bnxt/tf_core/meson.build      |   2 +
 drivers/net/bnxt/tf_core/tf_core.c        | 104 ++-
 drivers/net/bnxt/tf_core/tf_core.h        |  48 +-
 drivers/net/bnxt/tf_core/tf_device.c      |  40 +-
 drivers/net/bnxt/tf_core/tf_device.h      | 133 ++-
 drivers/net/bnxt/tf_core/tf_device_p4.c   |  75 +-
 drivers/net/bnxt/tf_core/tf_device_p4.h   |  50 +-
 drivers/net/bnxt/tf_core/tf_device_p58.c  | 105 ++-
 drivers/net/bnxt/tf_core/tf_device_p58.h  |  60 +-
 drivers/net/bnxt/tf_core/tf_msg.c         |   2 +-
 drivers/net/bnxt/tf_core/tf_rm.c          |  46 +-
 drivers/net/bnxt/tf_core/tf_rm.h          |  62 +-
 drivers/net/bnxt/tf_core/tf_session.c     |  56 ++
 drivers/net/bnxt/tf_core/tf_session.h     |  58 +-
 drivers/net/bnxt/tf_core/tf_sram_mgr.c    | 971 ++++++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_sram_mgr.h    | 317 +++++++
 drivers/net/bnxt/tf_core/tf_tbl.c         | 186 +----
 drivers/net/bnxt/tf_core/tf_tbl.h         |  15 +-
 drivers/net/bnxt/tf_core/tf_tbl_sram.c    | 713 ++++++++++++++++
 drivers/net/bnxt/tf_core/tf_tbl_sram.h    | 154 ++++
 drivers/net/bnxt/tf_core/tf_tcam.c        |  10 +-
 drivers/net/bnxt/tf_core/tf_tcam.h        |   7 +
 drivers/net/bnxt/tf_core/tf_tcam_shared.c |  28 +-
 drivers/net/bnxt/tf_core/tf_util.c        |  10 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c        |  23 +
 meson_options.txt                         |   2 +
 28 files changed, 2978 insertions(+), 352 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_sram_mgr.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_sram_mgr.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_tbl_sram.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_tbl_sram.h
drivers/net/bnxt/tf_core/ll.c +3 -0
index cd168a7970..f2bdff6b9e 100644
@@ -13,6 +13,7 @@ void ll_init(struct ll *ll)
 {
 	ll->head = NULL;
 	ll->tail = NULL;
+	ll->cnt = 0;
 }
 
 /* insert entry in linked list */
@@ -30,6 +31,7 @@ void ll_insert(struct ll *ll,
 		entry->next->prev = entry;
 		ll->head = entry->next->prev;
 	}
+	ll->cnt++;
 }
 
 /* delete entry from linked list */
@@ -49,4 +51,5 @@ void ll_delete(struct ll *ll,
 		entry->prev->next = entry->next;
 		entry->next->prev = entry->prev;
 	}
+	ll->cnt--;
 }
drivers/net/bnxt/tf_core/ll.h +49 -1

72 lines not on this page · raw message

drivers/net/bnxt/tf_core/meson.build +2 -0
index f28e77ec2e..b7333a431b 100644
@@ -16,6 +16,8 @@ sources += files(
         'stack.c',
         'tf_rm.c',
         'tf_tbl.c',
+	'tf_tbl_sram.c',
+	'tf_sram_mgr.c',
         'tf_em_common.c',
         'tf_em_host.c',
         'tf_em_internal.c',
drivers/net/bnxt/tf_core/tf_core.c +65 -39

173 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_core.h +26 -22

95 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device.c +34 -6
index 498e668b16..25a7166bbb 100644
@@ -11,10 +11,14 @@
 #include "tf_rm.h"
 #ifdef TF_TCAM_SHARED
 #include "tf_tcam_shared.h"
+#include "tf_tbl_sram.h"
 #endif /* TF_TCAM_SHARED */
 
 struct tf;
 
+/* Number of slices per row for WC TCAM */
+uint16_t g_wc_num_slices_per_row = TF_WC_TCAM_1_SLICE_PER_ROW;
+
 /* Forward declarations */
 static int tf_dev_unbind_p4(struct tf *tfp);
 static int tf_dev_unbind_p58(struct tf *tfp);
@@ -83,7 +87,8 @@ static int
 tf_dev_bind_p4(struct tf *tfp,
 	       bool shadow_copy,
 	       struct tf_session_resources *resources,
-	       struct tf_dev_info *dev_handle)
+	       struct tf_dev_info *dev_handle,
+	       enum tf_wc_num_slice wc_num_slices)
 {
 	int rc;
 	int frc;
@@ -131,7 +136,6 @@ tf_dev_bind_p4(struct tf *tfp,
 	if (rsv_cnt) {
 		tbl_cfg.num_elements = TF_TBL_TYPE_MAX;
 		tbl_cfg.cfg = tf_tbl_p4;
-		tbl_cfg.shadow_copy = shadow_copy;
 		tbl_cfg.resources = resources;
 		rc = tf_tbl_bind(tfp, &tbl_cfg);
 		if (rc) {
@@ -151,6 +155,7 @@ tf_dev_bind_p4(struct tf *tfp,
 		tcam_cfg.cfg = tf_tcam_p4;
 		tcam_cfg.shadow_copy = shadow_copy;
 		tcam_cfg.resources = resources;
+		tcam_cfg.wc_num_slices = wc_num_slices;
 #ifdef TF_TCAM_SHARED
 		rc = tf_tcam_shared_bind(tfp, &tcam_cfg);
 #else /* !TF_TCAM_SHARED */
@@ -369,7 +374,8 @@ static int
 tf_dev_bind_p58(struct tf *tfp,
 		bool shadow_copy,
 		struct tf_session_resources *resources,
-		struct tf_dev_info *dev_handle)
+		struct tf_dev_info *dev_handle,
+		enum tf_wc_num_slice wc_num_slices)
 {
 	int rc;
 	int frc;
@@ -414,7 +420,6 @@ tf_dev_bind_p58(struct tf *tfp,
 	if (rsv_cnt) {
 		tbl_cfg.num_elements = TF_TBL_TYPE_MAX;
 		tbl_cfg.cfg = tf_tbl_p58;
-		tbl_cfg.shadow_copy = shadow_copy;
 		tbl_cfg.resources = resources;
 		rc = tf_tbl_bind(tfp, &tbl_cfg);
 		if (rc) {
@@ -423,6 +428,13 @@ tf_dev_bind_p58(struct tf *tfp,
 			goto fail;
 		}
 		no_rsv_flag = false;
+
+		rc = tf_tbl_sram_bind(tfp);
+		if (rc) {
+			TFP_DRV_LOG(ERR,
+				    "SRAM table initialization failure\n");
+			goto fail;
+		}
 	}
 
 	rsv_cnt = tf_dev_reservation_check(TF_TCAM_TBL_TYPE_MAX,
@@ -433,6 +445,7 @@ tf_dev_bind_p58(struct tf *tfp,
 		tcam_cfg.cfg = tf_tcam_p58;
 		tcam_cfg.shadow_copy = shadow_copy;
 		tcam_cfg.resources = resources;
+		tcam_cfg.wc_num_slices = wc_num_slices;
 #ifdef TF_TCAM_SHARED
 		rc = tf_tcam_shared_bind(tfp, &tcam_cfg);
 #else /* !TF_TCAM_SHARED */
@@ -565,6 +578,18 @@ tf_dev_unbind_p58(struct tf *tfp)
 		fail = true;
 	}
 
+	/* Unbind the SRAM table prior to table as the table manager
+	 * owns and frees the table DB while the SRAM table manager owns
+	 * and manages it's internal data structures.  SRAM table manager
+	 * relies on the table rm_db to exist.
+	 */
+	rc = tf_tbl_sram_unbind(tfp);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "Device unbind failed, SRAM table\n");
+		fail = true;
+	}
+
 	rc = tf_tbl_unbind(tfp);
 	if (rc) {
 		TFP_DRV_LOG(INFO,
@@ -606,6 +631,7 @@ tf_dev_bind(struct tf *tfp __rte_unused,
 	    enum tf_device_type type,
 	    bool shadow_copy,
 	    struct tf_session_resources *resources,
+	    uint16_t wc_num_slices,
 	    struct tf_dev_info *dev_handle)
 {
 	switch (type) {
@@ -615,13 +641,15 @@ tf_dev_bind(struct tf *tfp __rte_unused,
 		return tf_dev_bind_p4(tfp,
 				      shadow_copy,
 				      resources,
-				      dev_handle);
+				      dev_handle,
+				      wc_num_slices);
 	case TF_DEVICE_TYPE_THOR:
 		dev_handle->type = type;
 		return tf_dev_bind_p58(tfp,
 				       shadow_copy,
 				       resources,
-				       dev_handle);
+				       dev_handle,
+				       wc_num_slices);
 	default:
 		TFP_DRV_LOG(ERR,
 			    "No such device\n");
drivers/net/bnxt/tf_core/tf_device.h +132 -1

187 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p4.c +70 -5

141 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p4.h +25 -25

140 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p58.c +95 -10

183 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p58.h +30 -30

188 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_msg.c +1 -1
index e07d9168be..0fbb2fe837 100644
@@ -2231,7 +2231,7 @@ tf_msg_get_if_tbl_entry(struct tf *tfp,
 	if (rc != 0)
 		return rc;
 
-	tfp_memcpy(params->data, resp.data, req.size);
+	tfp_memcpy(&params->data[0], resp.data, req.size);
 
 	return 0;
 }
drivers/net/bnxt/tf_core/tf_rm.c +43 -3

95 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_rm.h +36 -26

114 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_session.c +56 -0

72 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_session.h +55 -3

88 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_sram_mgr.c new file +971 -0

971 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_sram_mgr.h new file +317 -0

317 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tbl.c +40 -146

14 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tbl.h +1 -14
index 7e1107ffe7..2483718e5d 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_core/tf_tbl_sram.c new file +713 -0

713 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tbl_sram.h new file +154 -0

154 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tcam.c +4 -6
index 45206c5992..806af3070a 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_core/tf_tcam.h +7 -0
index bed17af6ae..b1e7a92b0b 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_core/tf_tcam_shared.c +14 -14
index 83b6fbd5fb..c120c6f577 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_core/tf_util.c +10 -0
index d100399d0a..c1b9be0755 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/bnxt_ulp.c +23 -0
index dbf85e4eda..183bae66c5 100644

Lines of this file are not shown. View the raw message.

meson_options.txt +2 -0
index 0e92734c49..f686e6d92a 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

#20 lore raw

PATCH v2 5/13 net/bnxt: add flow templates support for Thor

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

Template adds non-VFR based support for testpmd with:
matches to include
- DMAC, SIP, DIP, Proto, Sport, Dport
- SIP, DIP, Proto, Sport, Dport
actions:
- count, drop

---
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |   6 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |  36 +++---
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |  12 ++
 .../bnxt/tf_ulp/generic_templates/meson.build |  17 ++-
 .../ulp_template_db_thor_class.c              |   1 -
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |   2 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         | 122 +++++++++++++++++-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |  26 +++-
 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c         |   5 +
 drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c          |   2 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          | 111 +++++++++++++++-
 drivers/net/bnxt/tf_ulp/ulp_matcher.c         |  13 ++
 drivers/net/bnxt/tf_ulp/ulp_port_db.c         |  15 ++-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |   9 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.c             |  20 +++
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |   8 +-
 16 files changed, 356 insertions(+), 49 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_tf_common.h +6 -0
index f59da41e54..e0ebed3fed 100644
@@ -13,6 +13,12 @@
 
 #define BNXT_TF_DBG(lvl, fmt, args...)	PMD_DRV_LOG(lvl, fmt, ## args)
 
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#define BNXT_TF_INF(fmt, args...)	PMD_DRV_LOG(INFO, fmt, ## args)
+#else
+#define BNXT_TF_INF(fmt, args...)
+#endif
+
 #define BNXT_ULP_EM_FLOWS			8192
 #define BNXT_ULP_1M_FLOWS			1000000
 #define BNXT_EEM_RX_GLOBAL_ID_MASK		(BNXT_ULP_1M_FLOWS - 1)
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +15 -21
index 183bae66c5..475c7a6cdf 100644
@@ -698,6 +698,11 @@ ulp_eem_tbl_scope_init(struct bnxt *bp)
 			    rc);
 		return rc;
 	}
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+	BNXT_TF_DBG(DEBUG, "TableScope=0x%0x %d\n",
+		    params.tbl_scope_id,
+		    params.tbl_scope_id);
+#endif
 	rc = bnxt_ulp_cntxt_tbl_scope_id_set(bp->ulp_ctx, params.tbl_scope_id);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Unable to set table scope id\n");
@@ -825,6 +830,8 @@ ulp_ctx_init(struct bnxt *bp,
 		goto error_deinit;
 	}
 
+	/* TODO: For now we are overriding to APP:1 on this branch*/
+	bp->app_id = 1;
 	rc = bnxt_ulp_cntxt_app_id_set(bp->ulp_ctx, bp->app_id);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Unable to set app_id for ULP init.\n");
@@ -838,11 +845,6 @@ ulp_ctx_init(struct bnxt *bp,
 		goto error_deinit;
 	}
 
-	if (devid == BNXT_ULP_DEVICE_ID_THOR) {
-		ulp_data->ulp_flags &= ~BNXT_ULP_VF_REP_ENABLED;
-		BNXT_TF_DBG(ERR, "Enabled non-VFR mode\n");
-	}
-
 	/*
 	 * Shared session must be created before first regular session but after
 	 * the ulp_ctx is valid.
@@ -902,7 +904,7 @@ ulp_dparms_init(struct bnxt *bp, struct bnxt_ulp_context *ulp_ctx)
 	dparms->ext_flow_db_num_entries = bp->max_num_kflows * 1024;
 	/* GFID =  2 * num_flows */
 	dparms->mark_db_gfid_entries = dparms->ext_flow_db_num_entries * 2;
-	BNXT_TF_DBG(DEBUG, "Set the number of flows = %"PRIu64"\n",
+	BNXT_TF_DBG(DEBUG, "Set the number of flows = %" PRIu64 "\n",
 		    dparms->ext_flow_db_num_entries);
 
 	return 0;
@@ -1393,17 +1395,13 @@ bnxt_ulp_port_init(struct bnxt *bp)
 	uint32_t ulp_flags;
 	int32_t rc = 0;
 
+	if (!bp || !BNXT_TRUFLOW_EN(bp))
+		return rc;
+
 	if (!BNXT_PF(bp) && !BNXT_VF_IS_TRUSTED(bp)) {
 		BNXT_TF_DBG(ERR,
 			    "Skip ulp init for port: %d, not a TVF or PF\n",
-			    bp->eth_dev->data->port_id);
-		return rc;
-	}
-
-	if (!BNXT_TRUFLOW_EN(bp)) {
-		BNXT_TF_DBG(DEBUG,
-			    "Skip ulp init for port: %d, truflow is not enabled\n",
-			    bp->eth_dev->data->port_id);
+			bp->eth_dev->data->port_id);
 		return rc;
 	}
 
@@ -1524,6 +1522,9 @@ bnxt_ulp_port_deinit(struct bnxt *bp)
 	struct rte_pci_device *pci_dev;
 	struct rte_pci_addr *pci_addr;
 
+	if (!BNXT_TRUFLOW_EN(bp))
+		return;
+
 	if (!BNXT_PF(bp) && !BNXT_VF_IS_TRUSTED(bp)) {
 		BNXT_TF_DBG(ERR,
 			    "Skip ULP deinit port:%d, not a TVF or PF\n",
@@ -1531,13 +1532,6 @@ bnxt_ulp_port_deinit(struct bnxt *bp)
 		return;
 	}
 
-	if (!BNXT_TRUFLOW_EN(bp)) {
-		BNXT_TF_DBG(DEBUG,
-			    "Skip ULP deinit for port:%d, truflow is not enabled\n",
-			    bp->eth_dev->data->port_id);
-		return;
-	}
-
 	if (!bp->ulp_ctx) {
 		BNXT_TF_DBG(DEBUG, "ulp ctx already de-allocated\n");
 		return;
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +12 -0
index 19e9dba356..238b1d9657 100644
@@ -13,6 +13,9 @@
 #include "ulp_port_db.h"
 #include "ulp_ha_mgr.h"
 #include <rte_malloc.h>
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#include "ulp_template_debug_proto.h"
+#endif
 
 static int32_t
 bnxt_ulp_flow_validate_args(const struct rte_flow_attr *attr,
@@ -222,6 +225,15 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev,
 	else if (ret == BNXT_TF_RC_FID)
 		goto return_fid;
 
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_PARSER
+	/* Dump the rte flow pattern */
+	ulp_parser_hdr_info_dump(&params);
+	/* Dump the rte flow action */
+	ulp_parser_act_info_dump(&params);
+#endif
+#endif
+
 	ret = ulp_matcher_pattern_match(&params, &params.class_id);
 	if (ret != BNXT_TF_RC_SUCCESS)
 		goto free_fid;
drivers/net/bnxt/tf_ulp/generic_templates/meson.build +10 -7
index b1e7b8cc32..16b27a2e24 100644
@@ -2,12 +2,15 @@
 # Copyright(c) 2018 Intel Corporation
 # Copyright(c) 2020 Broadcom
 
+#Include the folder for headers
 includes += include_directories('.')
+
+#Add the source files
 sources += files(
-        'ulp_template_db_class.c',
-        'ulp_template_db_act.c',
-        'ulp_template_db_tbl.c',
-        'ulp_template_db_wh_plus_act.c',
-        'ulp_template_db_wh_plus_class.c',
-        'ulp_template_db_thor_act.c',
-        'ulp_template_db_thor_class.c')
+	'ulp_template_db_class.c',
+	'ulp_template_db_act.c',
+	'ulp_template_db_tbl.c',
+	'ulp_template_db_wh_plus_act.c',
+	'ulp_template_db_wh_plus_class.c',
+	'ulp_template_db_thor_act.c',
+	'ulp_template_db_thor_class.c')
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c +0 -1
index 83f6152700..e342f340d9 100644
@@ -6104,4 +6104,3 @@ struct bnxt_ulp_mapper_ident_info ulp_thor_class_ident_list[] = {
 	.ident_bit_pos = 29
 	}
 };
-
drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c +1 -1
index 13f71ed83b..22c51976ac 100644
@@ -35,7 +35,7 @@ ulp_fc_mgr_shadow_mem_alloc(struct hw_fc_mem_info *parms, int size)
 	rte_mem_lock_page(parms->mem_va);
 
 	parms->mem_pa = (void *)(uintptr_t)rte_mem_virt2phy(parms->mem_va);
-	if (parms->mem_pa == (void *)(uintptr_t)RTE_BAD_IOVA) {
+	if (parms->mem_pa == (void *)RTE_BAD_IOVA) {
 		BNXT_TF_DBG(ERR, "Allocate failed mem_pa\n");
 		return -ENOMEM;
 	}
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +119 -3

155 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +25 -1
index 67afca8872..0ddfa6f66d 100644
@@ -18,7 +18,7 @@
 
 /*
  * Structure for the flow database resource information
- * The below structure is based on the below partitions
+ * 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
@@ -417,4 +417,28 @@ ulp_flow_db_parent_flow_count_reset(struct bnxt_ulp_context *ulp_ctxt);
 void ulp_flow_db_shared_session_set(struct ulp_flow_db_res_params *res,
 				    enum bnxt_ulp_shared_session shared);
 
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+/*
+ * Dump the flow entry details
+ *
+ * flow_db [in] Ptr to flow db
+ * fid [in] flow id
+ *
+ * returns none
+ */
+void
+ulp_flow_db_debug_fid_dump(struct bnxt_ulp_flow_db *flow_db, uint32_t fid);
+
+/*
+ * Dump the flow database entry details
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * flow_id [in] if zero then all fids are dumped.
+ *
+ * returns none
+ */
+int32_t	ulp_flow_db_debug_dump(struct bnxt_ulp_context *ulp_ctxt,
+			       uint32_t flow_id);
+#endif
+
 #endif /* _ULP_FLOW_DB_H_ */
drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c +5 -0
index 3c1af0b007..c6b2b1675d 100644
@@ -10,6 +10,11 @@
 #include "ulp_mapper.h"
 #include "ulp_flow_db.h"
 
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#include "ulp_template_debug_proto.h"
+#include "ulp_tf_debug.h"
+#endif
+
 /* Retrieve the generic table  initialization parameters for the tbl_idx */
 static struct bnxt_ulp_generic_tbl_params*
 ulp_mapper_gen_tbl_params_get(uint32_t tbl_idx)
drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c +1 -1
index 5f5b5d639e..bc5627ec5b 100644
@@ -185,7 +185,7 @@ ulp_ha_mgr_timer_cb(void *arg __rte_unused)
 	rc = ulp_ha_mgr_state_get(ulp_ctx, &curr_state);
 	if (rc) {
 		/*
-		 * This shouldn't happen, if it does, reset the timer
+		 * This shouldn't happen, if it does, resetart the timer
 		 * and try again next time.
 		 */
 		BNXT_TF_DBG(ERR, "Failed(%d) to get state.\n",
drivers/net/bnxt/tf_ulp/ulp_mapper.c +108 -3

238 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_matcher.c +13 -0
index 67fa61fc7c..e06d8f6287 100644
@@ -6,6 +6,10 @@
 #include "ulp_matcher.h"
 #include "ulp_utils.h"
 
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#include "ulp_template_debug_proto.h"
+#endif
+
 /* Utility function to calculate the class matcher hash */
 static uint32_t
 ulp_matcher_class_hash_calculate(uint64_t hi_sig, uint64_t lo_sig)
@@ -95,6 +99,11 @@ ulp_matcher_pattern_match(struct ulp_rte_parser_params *params,
 
 error:
 	BNXT_TF_DBG(DEBUG, "Did not find any matching template\n");
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+	BNXT_TF_DBG(DEBUG, "class_hid:0x%x, Hdr:%" PRIX64 " Fld:%" PRIX64 "\n",
+		    class_hid, params->hdr_bitmap.bits,
+		    params->fld_bitmap.bits);
+#endif
 	*class_id = 0;
 	return BNXT_TF_RC_ERROR;
 }
@@ -142,6 +151,10 @@ ulp_matcher_action_match(struct ulp_rte_parser_params *params,
 
 error:
 	BNXT_TF_DBG(DEBUG, "Did not find any matching action template\n");
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+	BNXT_TF_DBG(DEBUG, "act_hid:0x%x, Hdr:%" PRIX64 "\n",
+		    act_hid, params->act_bitmap.bits);
+#endif
 	*act_id = 0;
 	return BNXT_TF_RC_ERROR;
 }
drivers/net/bnxt/tf_ulp/ulp_port_db.c +12 -3
index 4045473097..7d9865b3e3 100644
@@ -7,9 +7,13 @@
 #include "bnxt.h"
 #include "bnxt_vnic.h"
 #include "bnxt_tf_common.h"
+#include "bnxt_tf_pmd_shim.h"
 #include "ulp_port_db.h"
 #include "tfp.h"
-#include "bnxt_tf_pmd_shim.h"
+
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#include "ulp_tf_debug.h"
+#endif
 
 static uint32_t
 ulp_port_db_allocate_ifindex(struct bnxt_ulp_port_db *port_db)
@@ -151,12 +155,12 @@ int32_t	ulp_port_db_dev_port_intf_update(struct bnxt_ulp_context *ulp_ctxt,
 
 	intf->type = bnxt_pmd_get_interface_type(port_id);
 	intf->drv_func_id = bnxt_pmd_get_fw_func_id(port_id,
-						    BNXT_ULP_INTF_TYPE_INVALID);
+						BNXT_ULP_INTF_TYPE_INVALID);
 
 	func = &port_db->ulp_func_id_tbl[intf->drv_func_id];
 	if (!func->func_valid) {
 		func->func_svif = bnxt_pmd_get_svif(port_id, true,
-						    BNXT_ULP_INTF_TYPE_INVALID);
+						BNXT_ULP_INTF_TYPE_INVALID);
 		func->func_spif = bnxt_pmd_get_phy_port_id(port_id);
 		func->func_parif =
 			bnxt_pmd_get_parif(port_id, BNXT_ULP_INTF_TYPE_INVALID);
@@ -202,6 +206,11 @@ int32_t	ulp_port_db_dev_port_intf_update(struct bnxt_ulp_context *ulp_ctxt,
 		port_data->port_vport = bnxt_pmd_get_vport(port_id);
 		port_data->port_valid = true;
 	}
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_PORT
+	ulp_port_db_dump(port_db, intf, port_id);
+#endif
+#endif
 	return 0;
 }
 
drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +5 -4
index 5fd52b8f36..79b9957781 100644
@@ -8,6 +8,7 @@
 #include "ulp_template_struct.h"
 #include "bnxt_ulp.h"
 #include "bnxt_tf_common.h"
+#include "bnxt_tf_pmd_shim.h"
 #include "ulp_rte_parser.h"
 #include "ulp_matcher.h"
 #include "ulp_utils.h"
@@ -855,7 +856,7 @@ ulp_rte_vlan_hdr_handler(const struct rte_flow_item *item,
 			       BNXT_ULP_HDR_BIT_II_VLAN);
 		inner_flag = 1;
 	} else {
-		BNXT_TF_DBG(ERR, "Error Parsing:Vlan hdr found without eth\n");
+		BNXT_TF_DBG(ERR, "Error Parsing:Vlan hdr found withtout eth\n");
 		return BNXT_TF_RC_ERROR;
 	}
 	/* Update the field protocol hdr bitmap */
@@ -1135,8 +1136,8 @@ ulp_rte_ipv6_hdr_handler(const struct rte_flow_item *item,
 	ulp_rte_prsr_fld_mask(params, &idx, size, &ver_spec, &ver_mask,
 			      ULP_PRSR_ACT_DEFAULT);
 	/*
-	 * The TC and flow label field are ignored since OVS is setting
-	 * it for match and it is not supported.
+	 * The TC and flow label field are ignored since OVS is
+	 * setting it for match and it is not supported.
 	 * This is a work around and
 	 * shall be addressed in the future.
 	 */
@@ -2138,7 +2139,7 @@ ulp_rte_vf_act_handler(const struct rte_flow_action *action_item,
 		return BNXT_TF_RC_PARSE_ERR;
 	}
 
-	bp = bnxt_get_bp(params->port_id);
+	bp = bnxt_pmd_get_bp(params->port_id);
 	if (bp == NULL) {
 		BNXT_TF_DBG(ERR, "Invalid bp\n");
 		return BNXT_TF_RC_ERROR;
drivers/net/bnxt/tf_ulp/ulp_tun.c +20 -0
index cb8530d791..a1dd5b902c 100644
@@ -3,6 +3,8 @@
  * All rights reserved.
  */
 
+#include <sys/queue.h>
+
 #include <rte_malloc.h>
 
 #include "ulp_tun.h"
@@ -29,6 +31,15 @@ ulp_install_outer_tun_flow(struct ulp_rte_parser_params *params,
 
 	ULP_BITMAP_SET(params->hdr_bitmap.bits, BNXT_ULP_HDR_BIT_F1);
 
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_PARSER
+	/* Dump the rte flow pattern */
+	ulp_parser_hdr_info_dump(params);
+	/* Dump the rte flow action */
+	ulp_parser_act_info_dump(params);
+#endif
+#endif
+
 	ret = ulp_matcher_pattern_match(params, &params->class_id);
 	if (ret != BNXT_TF_RC_SUCCESS)
 		goto err;
@@ -146,6 +157,15 @@ ulp_post_process_cache_inner_tun_flow(struct ulp_rte_parser_params *params,
 	struct ulp_per_port_flow_info *flow_info;
 	int ret;
 
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_PARSER
+	/* Dump the rte flow pattern */
+	ulp_parser_hdr_info_dump(params);
+	/* Dump the rte flow action */
+	ulp_parser_act_info_dump(params);
+#endif
+#endif
+
 	ret = ulp_matcher_pattern_match(params, &params->class_id);
 	if (ret != BNXT_TF_RC_SUCCESS)
 		return BNXT_TF_RC_ERROR;
drivers/net/bnxt/tf_ulp/ulp_utils.c +4 -4
index bafb539c8d..1649e157f2 100644
@@ -62,7 +62,7 @@ ulp_regfile_read(struct ulp_regfile *regfile,
  * data [in] The value is written into this variable.  It is going to be in the
  * same byte order as it was written.
  *
- * size [in] The size in bytes of the value being written into this
+ * size [in] The size in bytes of the value beingritten into this
  * variable.
  *
  * returns 0 on success
@@ -295,7 +295,7 @@ ulp_blob_push(struct ulp_blob *blob,
 				     datalen,
 				     data);
 	if (!rc) {
-		BNXT_TF_DBG(ERR, "Failed to write blob\n");
+		BNXT_TF_DBG(ERR, "Failed ro write blob\n");
 		return 0;
 	}
 	blob->write_idx += datalen;
@@ -355,7 +355,7 @@ ulp_blob_insert(struct ulp_blob *blob, uint32_t offset,
 				     datalen,
 				     data);
 	if (!rc) {
-		BNXT_TF_DBG(ERR, "Failed to write blob\n");
+		BNXT_TF_DBG(ERR, "Failed ro write blob\n");
 		return 0;
 	}
 	/* copy the previously stored data */
@@ -409,7 +409,7 @@ ulp_blob_push_64(struct ulp_blob *blob,
  *
  * data [in] 32-bit value to be added to the blob.
  *
- * datalen [in] The number of bits to be added to the blob.
+ * datalen [in] The number of bits to be added ot the blob.
  *
  * The offset of the data is updated after each push of data.
  * NULL returned on error, pointer pushed value otherwise.
Signature · 1 line
2.17.1
#21 lore raw

PATCH v2 6/13 net/bnxt: add support for tunnel offloads

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

Added support for tunnel offloads, this includes the support for VXLAN decap action where two flows indicate tunnel offload rule. The first flow indicate the tunnel properties and second flow indicates the inner packet structure. The templates are updated to support this feature.

---
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |    4 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   12 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |   20 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |  212 +-
 .../generic_templates/ulp_template_db_act.c   |    2 +-
 .../generic_templates/ulp_template_db_class.c | 8541 +++++++++++-----
 .../generic_templates/ulp_template_db_enum.h  |  210 +-
 .../generic_templates/ulp_template_db_field.h |  654 +-
 .../generic_templates/ulp_template_db_tbl.c   |  645 +-
 .../ulp_template_db_thor_class.c              |  110 +-
 .../ulp_template_db_wh_plus_act.c             |    2 +-
 .../ulp_template_db_wh_plus_class.c           | 8577 +++++++++++------
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |   46 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h          |    8 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |  562 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |   44 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   52 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |    6 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c |   31 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |  134 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |   10 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   10 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.c             |  541 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.h             |   89 +-
 24 files changed, 13810 insertions(+), 6712 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_tf_common.h +1 -3
index e0ebed3fed..6c4bcd2d90 100644
@@ -37,9 +37,7 @@
 enum bnxt_tf_rc {
 	BNXT_TF_RC_PARSE_ERR	= -2,
 	BNXT_TF_RC_ERROR	= -1,
-	BNXT_TF_RC_SUCCESS	= 0,
-	BNXT_TF_RC_NORMAL	= 1,
-	BNXT_TF_RC_FID		= 2,
+	BNXT_TF_RC_SUCCESS	= 0
 };
 
 /* eth IPv4 Type */
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +10 -2
index 475c7a6cdf..dfafd9ff5b 100644
@@ -860,8 +860,6 @@ ulp_ctx_init(struct bnxt *bp,
 	if (rc)
 		goto error_deinit;
 
-	ulp_tun_tbl_init(ulp_data->tun_tbl);
-
 	bnxt_ulp_cntxt_tfp_set(bp->ulp_ctx, &bp->tfp);
 	return rc;
 
@@ -2064,3 +2062,13 @@ bnxt_ulp_cntxt_entry_release(void)
 {
 	rte_spinlock_unlock(&bnxt_ulp_ctxt_lock);
 }
+
+/* Function to get the app tunnel details from the ulp context. */
+struct bnxt_flow_app_tun_ent *
+bnxt_ulp_cntxt_ptr2_app_tun_list_get(struct bnxt_ulp_context *ulp)
+{
+	if (!ulp || !ulp->cfg_data)
+		return NULL;
+
+	return ulp->cfg_data->app_tun;
+}
drivers/net/bnxt/tf_ulp/bnxt_ulp.h +17 -3
index 082ca501b6..006df9cbc5 100644
@@ -47,6 +47,18 @@ enum bnxt_ulp_flow_mem_type {
 	BNXT_ULP_FLOW_MEM_TYPE_LAST = 3
 };
 
+enum bnxt_rte_flow_item_type {
+	BNXT_RTE_FLOW_ITEM_TYPE_END = (uint32_t)INT_MIN,
+	BNXT_RTE_FLOW_ITEM_TYPE_VXLAN_DECAP,
+	BNXT_RTE_FLOW_ITEM_TYPE_LAST
+};
+
+enum bnxt_rte_flow_action_type {
+	BNXT_RTE_FLOW_ACTION_TYPE_END = (uint32_t)INT_MIN,
+	BNXT_RTE_FLOW_ACTION_TYPE_VXLAN_DECAP,
+	BNXT_RTE_FLOW_ACTION_TYPE_LAST
+};
+
 struct bnxt_ulp_df_rule_info {
 	uint32_t			def_port_flow_id;
 	uint8_t				valid;
@@ -79,6 +91,7 @@ struct bnxt_ulp_data {
 	bool				accum_stats;
 	uint8_t				app_id;
 	uint8_t				num_shared_clients;
+	struct bnxt_flow_app_tun_ent	app_tun[BNXT_ULP_MAX_TUN_CACHE_ENTRIES];
 };
 
 struct bnxt_ulp_context {
@@ -258,9 +271,6 @@ bnxt_ulp_cntxt_acquire_fdb_lock(struct bnxt_ulp_context	*ulp_ctx);
 void
 bnxt_ulp_cntxt_release_fdb_lock(struct bnxt_ulp_context	*ulp_ctx);
 
-int32_t
-ulp_post_process_tun_flow(struct ulp_rte_parser_params *params);
-
 struct bnxt_ulp_glb_resource_info *
 bnxt_ulp_app_glb_resource_info_list_get(uint32_t *num_entries);
 
@@ -301,4 +311,8 @@ bnxt_ulp_cntxt_entry_release(void);
 
 uint8_t
 bnxt_ulp_cntxt_num_shared_clients_get(struct bnxt_ulp_context *ulp_ctx);
+
+struct bnxt_flow_app_tun_ent *
+bnxt_ulp_cntxt_ptr2_app_tun_list_get(struct bnxt_ulp_context *ulp);
+
 #endif /* _BNXT_ULP_H_ */
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +203 -9

262 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_act.c +1 -1
index e18f314856..0da6070d7d 100644
@@ -3,7 +3,7 @@
  * All rights reserved.
  */
 
-/* date: Wed Mar 17 11:31:19 2021 */
+/* date: Mon May 17 15:30:41 2021 */
 
 #include "ulp_template_db_enum.h"
 #include "ulp_template_db_field.h"
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_class.c +6267 -2274

2,657 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_enum.h +189 -21

210 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_field.h +421 -233

654 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c +419 -226

645 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c +55 -55

110 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_act.c +1 -1
index b6d2afd55b..de924fe81a 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_class.c +5591 -2986

8,577 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c +30 -16

46 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h +5 -3
index 448d05c118..9825ed2a27 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_flow_db.c +235 -327

562 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +19 -25

44 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.c +18 -34

52 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.h +3 -3
index 004e89ac2b..d4d6969bb5 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c +31 -0
index 35e9858727..9b165c12b5 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +80 -54

134 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +9 -1
index 4431f1bbd0..673172c811 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +7 -3
index 0cbac66237..2685e63432 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_tun.c +170 -371

541 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_tun.h +28 -61

89 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

#22 lore raw

PATCH v2 7/13 net/bnxt: add support for dynamic encap action

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

The encapsulation record processing is enhanced to handle data dynamically. Different combinations of VXLAN encapsulation using no VLAN or single or double VLAN can be supported and also supports both IPv4 and IPv6 versions.

---
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   25 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |    2 +
 .../generic_templates/ulp_template_db_enum.h  |   44 +-
 .../generic_templates/ulp_template_db_tbl.c   |    8 +-
 .../ulp_template_db_thor_act.c                |    4 +-
 .../ulp_template_db_thor_class.c              |   46 +-
 .../ulp_template_db_wh_plus_act.c             | 1700 ++++++++++++-----
 .../ulp_template_db_wh_plus_class.c           |  222 +--
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |    6 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |    2 +-
 drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c          |    2 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |  152 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |    4 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |  337 ++--
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |    2 +
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   10 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |   73 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |   27 +-
 18 files changed, 1717 insertions(+), 949 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +16 -9
index dfafd9ff5b..3b86410fb1 100644
@@ -830,13 +830,12 @@ ulp_ctx_init(struct bnxt *bp,
 		goto error_deinit;
 	}
 
-	/* TODO: For now we are overriding to APP:1 on this branch*/
-	bp->app_id = 1;
 	rc = bnxt_ulp_cntxt_app_id_set(bp->ulp_ctx, bp->app_id);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Unable to set app_id for ULP init.\n");
 		goto error_deinit;
 	}
+	BNXT_TF_DBG(DEBUG, "Ulp initialized with app id %d\n", bp->app_id);
 
 	rc = bnxt_ulp_cntxt_app_caps_init(bp->ulp_ctx, bp->app_id, devid);
 	if (rc) {
@@ -1393,13 +1392,17 @@ bnxt_ulp_port_init(struct bnxt *bp)
 	uint32_t ulp_flags;
 	int32_t rc = 0;
 
-	if (!bp || !BNXT_TRUFLOW_EN(bp))
-		return rc;
-
 	if (!BNXT_PF(bp) && !BNXT_VF_IS_TRUSTED(bp)) {
 		BNXT_TF_DBG(ERR,
 			    "Skip ulp init for port: %d, not a TVF or PF\n",
-			bp->eth_dev->data->port_id);
+			    bp->eth_dev->data->port_id);
+		return rc;
+	}
+
+	if (!BNXT_TRUFLOW_EN(bp)) {
+		BNXT_TF_DBG(ERR,
+			    "Skip ulp init for port: %d, truflow is not enabled\n",
+			    bp->eth_dev->data->port_id);
 		return rc;
 	}
 
@@ -1520,9 +1523,6 @@ bnxt_ulp_port_deinit(struct bnxt *bp)
 	struct rte_pci_device *pci_dev;
 	struct rte_pci_addr *pci_addr;
 
-	if (!BNXT_TRUFLOW_EN(bp))
-		return;
-
 	if (!BNXT_PF(bp) && !BNXT_VF_IS_TRUSTED(bp)) {
 		BNXT_TF_DBG(ERR,
 			    "Skip ULP deinit port:%d, not a TVF or PF\n",
@@ -1530,6 +1530,13 @@ bnxt_ulp_port_deinit(struct bnxt *bp)
 		return;
 	}
 
+	if (!BNXT_TRUFLOW_EN(bp)) {
+		BNXT_TF_DBG(ERR,
+			    "Skip ULP deinit for port:%d, truflow is not enabled\n",
+			    bp->eth_dev->data->port_id);
+		return;
+	}
+
 	if (!bp->ulp_ctx) {
 		BNXT_TF_DBG(DEBUG, "ulp ctx already de-allocated\n");
 		return;
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +2 -0
index 3daf5942e8..413e4c3b26 100644
@@ -96,7 +96,9 @@ bnxt_ulp_init_mapper_params(struct bnxt_ulp_mapper_create_parms *mapper_cparms,
 	mapper_cparms->act_tid = params->act_tmpl;
 	mapper_cparms->func_id = params->func_id;
 	mapper_cparms->hdr_bitmap = &params->hdr_bitmap;
+	mapper_cparms->enc_hdr_bitmap = &params->enc_hdr_bitmap;
 	mapper_cparms->hdr_field = params->hdr_field;
+	mapper_cparms->enc_field = params->enc_field;
 	mapper_cparms->comp_fld = params->comp_fld;
 	mapper_cparms->act = &params->act_bitmap;
 	mapper_cparms->act_prop = &params->act_prop;
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_enum.h +39 -5

80 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c +6 -2
index 58b4dba63c..b5bce6f4c7 100644
@@ -198,7 +198,9 @@ const struct bnxt_ulp_template_device_tbls ulp_template_thor_tbls[] = {
 struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	[BNXT_ULP_DEVICE_ID_WH_PLUS] = {
 	.description             = "Whitney_Plus",
-	.byte_order              = BNXT_ULP_BYTE_ORDER_LE,
+	.key_byte_order          = BNXT_ULP_BYTE_ORDER_LE,
+	.result_byte_order       = BNXT_ULP_BYTE_ORDER_LE,
+	.encap_byte_order        = BNXT_ULP_BYTE_ORDER_BE,
 	.encap_byte_swap         = 1,
 	.int_flow_db_num_entries = 16384,
 	.ext_flow_db_num_entries = 32768,
@@ -218,7 +220,9 @@ struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	},
 	[BNXT_ULP_DEVICE_ID_THOR] = {
 	.description             = "Thor",
-	.byte_order              = BNXT_ULP_BYTE_ORDER_LE,
+	.key_byte_order          = BNXT_ULP_BYTE_ORDER_LE,
+	.result_byte_order       = BNXT_ULP_BYTE_ORDER_LE,
+	.encap_byte_order        = BNXT_ULP_BYTE_ORDER_BE,
 	.encap_byte_swap         = 1,
 	.int_flow_db_num_entries = 16384,
 	.ext_flow_db_num_entries = 32768,
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_act.c +1 -3
index ce5a70b0c5..9faf25aaf0 100644
@@ -3,7 +3,7 @@
  * All rights reserved.
  */
 
-/* date: Thu May 13 18:15:56 2021 */
+/* date: Wed May 26 15:11:34 2021 */
 
 #include "ulp_template_db_enum.h"
 #include "ulp_template_db_field.h"
@@ -41,7 +41,6 @@ struct bnxt_ulp_mapper_tbl_info ulp_thor_act_tbl_list[] = {
 	.tbl_operand = BNXT_ULP_RF_IDX_FLOW_CNTR_PTR_0,
 	.fdb_opcode = BNXT_ULP_FDB_OPC_PUSH_FID,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPC_NOP,
-	.byte_order = BNXT_ULP_BYTE_ORDER_LE,
 	.result_start_idx = 0,
 	.result_bit_size = 64,
 	.result_num_fields = 1
@@ -62,7 +61,6 @@ struct bnxt_ulp_mapper_tbl_info ulp_thor_act_tbl_list[] = {
 	.tbl_operand = BNXT_ULP_RF_IDX_MAIN_ACTION_PTR,
 	.fdb_opcode = BNXT_ULP_FDB_OPC_PUSH_FID,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPC_NOP,
-	.byte_order = BNXT_ULP_BYTE_ORDER_LE,
 	.result_start_idx = 1,
 	.result_bit_size = 128,
 	.result_num_fields = 17
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c +7 -39

250 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_act.c +1196 -504

2,507 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_class.c +58 -164

55 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.c +3 -3
index 039c9c2a6b..1cb52e9bfa 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +1 -1
index 8680ee8f65..6dbec92745 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c +1 -1
index bc5627ec5b..5f5b5d639e 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_mapper.c +123 -29

152 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.h +4 -0
index d4d6969bb5..4d6ba0f73a 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +208 -129

337 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +2 -0
index 673172c811..e14f86278a 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +7 -3
index 2685e63432..904763f27d 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_utils.c +31 -42

73 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_utils.h +12 -15
index e1b0e773f3..68a537fa0a 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

#23 lore raw

PATCH v2 8/13 net/bnxt: add wild card TCAM byte order for Thor

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

The wild card tcam for Thor platform is different from the profile tcam byte order.

---
 .../generic_templates/ulp_template_db_tbl.c   |  2 ++
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          | 25 +++++++++++++------
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |  1 +
 3 files changed, 21 insertions(+), 7 deletions(-)
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c +2 -0
index b5bce6f4c7..68f1b5fd00 100644
@@ -201,6 +201,7 @@ struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	.key_byte_order          = BNXT_ULP_BYTE_ORDER_LE,
 	.result_byte_order       = BNXT_ULP_BYTE_ORDER_LE,
 	.encap_byte_order        = BNXT_ULP_BYTE_ORDER_BE,
+	.wc_key_byte_order       = BNXT_ULP_BYTE_ORDER_BE,
 	.encap_byte_swap         = 1,
 	.int_flow_db_num_entries = 16384,
 	.ext_flow_db_num_entries = 32768,
@@ -223,6 +224,7 @@ struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	.key_byte_order          = BNXT_ULP_BYTE_ORDER_LE,
 	.result_byte_order       = BNXT_ULP_BYTE_ORDER_LE,
 	.encap_byte_order        = BNXT_ULP_BYTE_ORDER_BE,
+	.wc_key_byte_order       = BNXT_ULP_BYTE_ORDER_BE,
 	.encap_byte_swap         = 1,
 	.int_flow_db_num_entries = 16384,
 	.ext_flow_db_num_entries = 32768,
drivers/net/bnxt/tf_ulp/ulp_mapper.c +18 -7
index 2687a545f3..bcc089b3e1 100644
@@ -1953,6 +1953,15 @@ static void ulp_mapper_wc_tcam_tbl_post_process(struct ulp_blob *blob)
 #endif
 }
 
+static int32_t ulp_mapper_tcam_is_wc_tcam(struct bnxt_ulp_mapper_tbl_info *tbl)
+{
+	if (tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM ||
+	    tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM_HIGH ||
+	    tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM_LOW)
+		return 1;
+	return 0;
+}
+
 static int32_t
 ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 			    struct bnxt_ulp_mapper_tbl_info *tbl)
@@ -1972,6 +1981,7 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	uint32_t hit = 0;
 	uint16_t tmplen = 0;
 	uint16_t idx;
+	enum bnxt_ulp_byte_order key_byte_order;
 
 	/* Set the key and mask to the original key and mask. */
 	key = &okey;
@@ -2003,10 +2013,13 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		return -EINVAL;
 	}
 
-	if (!ulp_blob_init(key, tbl->blob_key_bit_size,
-			   dparms->key_byte_order) ||
-	    !ulp_blob_init(mask, tbl->blob_key_bit_size,
-			   dparms->key_byte_order) ||
+	if (ulp_mapper_tcam_is_wc_tcam(tbl))
+		key_byte_order = dparms->wc_key_byte_order;
+	else
+		key_byte_order = dparms->key_byte_order;
+
+	if (!ulp_blob_init(key, tbl->blob_key_bit_size, key_byte_order) ||
+	    !ulp_blob_init(mask, tbl->blob_key_bit_size, key_byte_order) ||
 	    !ulp_blob_init(&data, tbl->result_bit_size,
 			   dparms->result_byte_order) ||
 	    !ulp_blob_init(&update_data, tbl->result_bit_size,
@@ -2043,9 +2056,7 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	}
 
 	/* For wild card tcam perform the post process to swap the blob */
-	if (tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM ||
-	    tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM_HIGH ||
-	    tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM_LOW) {
+	if (ulp_mapper_tcam_is_wc_tcam(tbl)) {
 		if (dparms->dynamic_pad_en) {
 			/* Sets up the slices for writing to the WC TCAM */
 			rc = ulp_mapper_wc_tcam_tbl_dyn_post_process(dparms,
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +1 -0
index 904763f27d..e2a4b81cec 100644
@@ -212,6 +212,7 @@ struct bnxt_ulp_device_params {
 	enum bnxt_ulp_byte_order	key_byte_order;
 	enum bnxt_ulp_byte_order	result_byte_order;
 	enum bnxt_ulp_byte_order	encap_byte_order;
+	enum bnxt_ulp_byte_order	wc_key_byte_order;
 	uint8_t				encap_byte_swap;
 	uint8_t				num_phy_ports;
 	uint32_t			mark_db_lfid_entries;
Signature · 1 line
2.17.1
#24 lore raw

PATCH v2 9/13 net/bnxt: add flow templates for Thor

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

1. Add support for egress flows with port and count action for Thor platform.
2. Added templates to support VXLAN encapsulation feature for Thor.
3. Added support for VXLAN decap and VLAN pop actions along with the ingress flow.
4. Added templates to enable VXLAN decap support for f1 and f2 flows.
5. Added templates Thor VF Rep support
6. Added Thor ingress mod table actions for NAT, NAPT, and TTL.
7. Added mirror/sample table support
8. Added supported for IPv6 flows for Thor.

---
 drivers/net/bnxt/tf_core/tf_tcam.c            |     6 +-
 .../generic_templates/ulp_template_db_enum.h  |   123 +-
 .../generic_templates/ulp_template_db_tbl.c   |   182 +-
 .../ulp_template_db_thor_act.c                |  4329 +-
 .../ulp_template_db_thor_class.c              | 44219 ++++++++++++++--
 .../ulp_template_db_wh_plus_class.c           |     4 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |    10 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |    18 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |     1 +
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |     3 +
 10 files changed, 44734 insertions(+), 4161 deletions(-)
drivers/net/bnxt/tf_core/tf_tcam.c +5 -1
index 806af3070a..273f20858b 100644
@@ -323,8 +323,12 @@ tf_tcam_alloc(struct tf *tfp,
 		}
 
 		/* return the start index of each row */
-		if (i == 0)
+		if (parms->priority == 0) {
+			if (i == 0)
+				parms->idx = index;
+		} else {
 			parms->idx = index;
+		}
 	}
 
 	return 0;
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_enum.h +82 -41

200 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c +178 -4

245 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_act.c +4267 -62

2,542 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c +40174 -4045

44,219 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_class.c +2 -2
index 7203dcf1fb..2870a0615a 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_mapper.c +6 -4
index bcc089b3e1..234f7ea2fa 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +16 -2
index 4e9968e5fa..dce95de05c 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +1 -0
index e2a4b81cec..1683cd7ec4 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_utils.c +3 -0
index fc4f435c97..686b80e456 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

#25 lore raw

PATCH v2 10/13 net/bnxt: tf core SRAM Manager

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

Adjust info message to debug level to prevent excessive logging.

---
 drivers/net/bnxt/tf_core/tf_tbl_sram.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/tf_core/tf_tbl_sram.c +1 -1
index ea10afecb6..d7727f7a11 100644
@@ -130,7 +130,7 @@ static int tf_tbl_sram_get_info(struct tf_tbl_sram_get_info_parms *parms)
 	if (slices)
 		parms->slice_size = tf_tbl_sram_slices_2_size[slices];
 
-	TFP_DRV_LOG(INFO,
+	TFP_DRV_LOG(DEBUG,
 		    "(%s) bank(%s) slice_size(%s)\n",
 		    tf_tbl_type_2_str(parms->tbl_type),
 		    tf_sram_bank_2_str(parms->bank_id),
Signature · 1 line
2.17.1
#26 lore raw

PATCH v2 11/13 net/bnxt: dynamically allocate space for EM defrag function

In reply to Venkat Duvvuru

From: Randy Schacher <[email protected]>

Alter defrag function to dynamically allocate and delete free_list and adj_list buffers.

---
 drivers/net/bnxt/tf_core/dpool.c | 38 +++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 13 deletions(-)
drivers/net/bnxt/tf_core/dpool.c +25 -13
index 145efa486f..5c03f775a5 100644
@@ -7,9 +7,6 @@
 #include <stdbool.h>
 #include <stdint.h>
 #include <errno.h>
-
-#include <rte_malloc.h>
-
 #include "tfp.h"
 #include "dpool.h"
 
@@ -84,13 +81,13 @@ static int dpool_move(struct dpool *dpool,
 	return 0;
 }
 
-
 int dpool_defrag(struct dpool *dpool,
 		 uint32_t entry_size,
 		 uint8_t defrag)
 {
 	struct dpool_free_list *free_list;
 	struct dpool_adj_list *adj_list;
+	struct tfp_calloc_parms parms;
 	uint32_t count;
 	uint32_t index;
 	uint32_t used;
@@ -103,15 +100,31 @@ int dpool_defrag(struct dpool *dpool,
 	uint32_t max_size = 0;
 	int rc;
 
-	free_list = rte_zmalloc("dpool_free_list",
-				sizeof(struct dpool_free_list), 0);
+	parms.nitems = 1;
+	parms.size = sizeof(struct dpool_free_list);
+	parms.alignment = 0;
+
+	rc = tfp_calloc(&parms);
+
+	if (rc)
+		return rc;
+
+	free_list = (struct dpool_free_list *)parms.mem_va;
 	if (free_list == NULL) {
 		TFP_DRV_LOG(ERR, "dpool free list allocation failed\n");
 		return -ENOMEM;
 	}
 
-	adj_list = rte_zmalloc("dpool_adjacent_list",
-				sizeof(struct dpool_adj_list), 0);
+	parms.nitems = 1;
+	parms.size = sizeof(struct dpool_adj_list);
+	parms.alignment = 0;
+
+	rc = tfp_calloc(&parms);
+
+	if (rc)
+		return rc;
+
+	adj_list = (struct dpool_adj_list *)parms.mem_va;
 	if (adj_list == NULL) {
 		TFP_DRV_LOG(ERR, "dpool adjacent list allocation failed\n");
 		return -ENOMEM;
@@ -239,8 +252,8 @@ int dpool_defrag(struct dpool *dpool,
 					free_list->entry[largest_free_index].index,
 					max_index);
 			if (rc) {
-				rte_free(free_list);
-				rte_free(adj_list);
+				tfp_free(free_list);
+				tfp_free(adj_list);
 				return rc;
 			}
 		} else {
@@ -249,12 +262,11 @@ int dpool_defrag(struct dpool *dpool,
 	}
 
 done:
-	rte_free(free_list);
-	rte_free(adj_list);
+	tfp_free(free_list);
+	tfp_free(adj_list);
 	return largest_free_size;
 }
 
-
 uint32_t dpool_alloc(struct dpool *dpool,
 		     uint32_t size,
 		     uint8_t defrag)
Signature · 1 line
2.17.1
#27 lore raw

PATCH v2 12/13 net/bnxt: sram manager shared session

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

Fix shared session support issues due to SRAM manager additions. Shared session does not support slices within RM blocks. Calculate resources required without slices and determine base addresses using old methods for the shared session.

---
 drivers/net/bnxt/tf_core/tf_em_internal.c |   5 +-
 drivers/net/bnxt/tf_core/tf_rm.c          | 134 +++++++++++++++++++---
 drivers/net/bnxt/tf_core/tf_tbl_sram.c    |  73 +++++++++---
 3 files changed, 176 insertions(+), 36 deletions(-)
drivers/net/bnxt/tf_core/tf_em_internal.c +4 -1
index 2d57595f17..67ba011eae 100644
@@ -326,8 +326,11 @@ tf_em_int_unbind(struct tf *tfp)
 		return rc;
 
 	if (!tf_session_is_shared_session(tfs)) {
-		for (i = 0; i < TF_DIR_MAX; i++)
+		for (i = 0; i < TF_DIR_MAX; i++) {
+			if (tfs->em_pool[i] == NULL)
+				continue;
 			dpool_free_all(tfs->em_pool[i]);
+		}
 	}
 
 	rc = tf_session_get_db(tfp, TF_MODULE_TYPE_EM, &em_db_ptr);
drivers/net/bnxt/tf_core/tf_rm.c +115 -19

245 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tbl_sram.c +57 -16

99 lines not on this page · raw message

Signature · 1 line
2.17.1
#28 lore raw

PATCH v2 13/13 net/bnxt: add enhancements to TF ULP

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

1. Added support to specify l4 port masks in the template. Also enabled source mac in the wild card key for ingress flows.

2. Added support to enable offload for ipv6 traffic within the vxlan tunnel connection.

3. The flow counters is reduced from 7168 to 6912 for Whitney. The stats operation is updated to reflect counts for packets at egress from CFA instead of ingress to CFA

4. The miss path for the l2 context table is updated with correct parif and default action handler to handle the miss path for egress flows.

5. This support enables allocation of encapsulation, modification and action records dynamically based on a given flow actions.

6. Reduce the l2context resource requests during open_session. Move the SMAC from the L2Context to the EM/WM

7. Remap the parif in the bd action in order to eliminate incorrect replication of broadcast packets. The layer 4 source port mask was incorrectly updated in the outer layer 4 source port mask instead of inner layer 4. Add the l3 proto to egress rules, switch to using computed fields for l4 ports, add internal smac to f1/f2 flows, add l3 proto to ingress ipv6 flows

---
 drivers/net/bnxt/tf_core/tf_tbl_sram.c        |    7 -
 .../generic_templates/ulp_template_db_class.c | 8102 ++++++++++++-----
 .../generic_templates/ulp_template_db_enum.h  |  675 +-
 .../generic_templates/ulp_template_db_field.h |  195 +-
 .../generic_templates/ulp_template_db_tbl.c   | 2136 ++++-
 .../ulp_template_db_thor_act.c                |  996 +-
 .../ulp_template_db_thor_class.c              | 7495 ++++++++-------
 .../ulp_template_db_wh_plus_class.c           |   14 +-
 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c         |    4 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |  135 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |  175 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   10 +
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |    3 +-
 13 files changed, 13538 insertions(+), 6409 deletions(-)
drivers/net/bnxt/tf_core/tf_tbl_sram.c +0 -7
index 167078a8c6..636811bc2d 100644
@@ -134,11 +134,6 @@ static int tf_tbl_sram_get_info(struct tf_tbl_sram_get_info_parms *parms)
 	if (slices)
 		parms->slice_size = tf_tbl_sram_slices_2_size[slices];
 
-	TFP_DRV_LOG(DEBUG,
-		    "(%s) bank(%s) slice_size(%s)\n",
-		    tf_tbl_type_2_str(parms->tbl_type),
-		    tf_sram_bank_2_str(parms->bank_id),
-		    tf_sram_slice_2_str(parms->slice_size));
 	return rc;
 }
 
@@ -373,7 +368,6 @@ tf_tbl_sram_free(struct tf *tfp __rte_unused,
 		return rc;
 	}
 
-
 #if (DBG_SRAM == 1)
 	{
 		struct tf_sram_mgr_dump_parms dparms;
@@ -411,7 +405,6 @@ tf_tbl_sram_set(struct tf *tfp,
 	void *sram_handle = NULL;
 	uint16_t base = 0, shift = 0;
 
-
 	TF_CHECK_PARMS3(tfp, parms, parms->data);
 
 	/* Retrieve the session information */
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_class.c +5835 -2267

2,975 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_enum.h +418 -257

675 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_field.h +155 -40

195 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c +1632 -504

2,136 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_act.c +871 -125

996 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c +4420 -3075

7,495 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_class.c +7 -7
index 2870a0615a..4b9cb7fd5b 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c +2 -2
index c6b2b1675d..7b6db7a0f8 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_mapper.c +105 -30

135 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +81 -94

175 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +10 -0
index 1683cd7ec4..d3bfb8c12d 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_utils.c +2 -1
index 686b80e456..df3afaa6fd 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

#29 lore raw

v3 cover enhancements to host based flow table management

In reply to Venkat Duvvuru

This patch set adds support for new offload features/enhancments for Thor adapters like VF representor support, new flow matches/actions & dynamic SRAM manager support.

v2 ==> v3
=========
* Fixed compilation issue.

Farah Smith (4):
net/bnxt: tf core index table updates
net/bnxt: add Thor SRAM mgr model
net/bnxt: tf core SRAM Manager
net/bnxt: sram manager shared session

Jay Ding (1):
net/bnxt: add flow meter drop counter support

Kishore Padmanabha (6):
net/bnxt: add flow templates support for Thor net/bnxt: add support for tunnel offloads net/bnxt: add support for dynamic encap action net/bnxt: add wild card TCAM byte order for Thor net/bnxt: add flow templates for Thor net/bnxt: add enhancements to TF ULP

Peter Spreadborough (1):
net/bnxt: enable dpool allocator

Randy Schacher (1):
net/bnxt: dynamically allocate space for EM defrag function

 drivers/net/bnxt/tf_core/cfa_resource_types.h |     5 +-
 drivers/net/bnxt/tf_core/dpool.c              |    38 +-
 drivers/net/bnxt/tf_core/ll.c                 |     3 +
 drivers/net/bnxt/tf_core/ll.h                 |    50 +-
 drivers/net/bnxt/tf_core/meson.build          |     2 +
 drivers/net/bnxt/tf_core/tf_core.c            |   169 +-
 drivers/net/bnxt/tf_core/tf_core.h            |   159 +-
 drivers/net/bnxt/tf_core/tf_device.c          |    40 +-
 drivers/net/bnxt/tf_core/tf_device.h          |   137 +-
 drivers/net/bnxt/tf_core/tf_device_p4.c       |    77 +-
 drivers/net/bnxt/tf_core/tf_device_p4.h       |    50 +-
 drivers/net/bnxt/tf_core/tf_device_p58.c      |   112 +-
 drivers/net/bnxt/tf_core/tf_device_p58.h      |    70 +-
 drivers/net/bnxt/tf_core/tf_em.h              |    10 -
 drivers/net/bnxt/tf_core/tf_em_common.c       |     4 +
 .../net/bnxt/tf_core/tf_em_hash_internal.c    |    34 -
 drivers/net/bnxt/tf_core/tf_em_internal.c     |   185 +-
 drivers/net/bnxt/tf_core/tf_msg.c             |     2 +-
 drivers/net/bnxt/tf_core/tf_rm.c              |   180 +-
 drivers/net/bnxt/tf_core/tf_rm.h              |    62 +-
 drivers/net/bnxt/tf_core/tf_session.c         |    56 +
 drivers/net/bnxt/tf_core/tf_session.h         |    58 +-
 drivers/net/bnxt/tf_core/tf_sram_mgr.c        |   971 +
 drivers/net/bnxt/tf_core/tf_sram_mgr.h        |   317 +
 drivers/net/bnxt/tf_core/tf_tbl.c             |   259 +-
 drivers/net/bnxt/tf_core/tf_tbl.h             |    87 +-
 drivers/net/bnxt/tf_core/tf_tbl_sram.c        |   747 +
 drivers/net/bnxt/tf_core/tf_tbl_sram.h        |   154 +
 drivers/net/bnxt/tf_core/tf_tcam.c            |    16 +-
 drivers/net/bnxt/tf_core/tf_tcam.h            |     7 +
 drivers/net/bnxt/tf_core/tf_tcam_shared.c     |    28 +-
 drivers/net/bnxt/tf_core/tf_util.c            |    12 +
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |    10 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |    52 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |    20 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |   226 +-
 .../bnxt/tf_ulp/generic_templates/meson.build |    17 +-
 .../generic_templates/ulp_template_db_act.c   |     2 +-
 .../generic_templates/ulp_template_db_class.c | 12109 +++-
 .../generic_templates/ulp_template_db_enum.h  |   618 +-
 .../generic_templates/ulp_template_db_field.h |   767 +-
 .../generic_templates/ulp_template_db_tbl.c   |  2757 +-
 .../ulp_template_db_thor_act.c                |  5079 +-
 .../ulp_template_db_thor_class.c              | 45573 ++++++++++++++--
 .../ulp_template_db_wh_plus_act.c             |  1700 +-
 .../ulp_template_db_wh_plus_class.c           |  8329 ++-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |    48 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h          |     8 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |   678 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |    68 +-
 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c         |     9 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   448 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |    10 +-
 drivers/net/bnxt/tf_ulp/ulp_matcher.c         |    13 +
 drivers/net/bnxt/tf_ulp/ulp_port_db.c         |    15 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c |    31 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |   663 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |    12 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |    32 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.c             |   521 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.h             |    89 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |    71 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |    27 +-
 meson_options.txt                             |     2 +
 64 files changed, 71149 insertions(+), 12956 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_sram_mgr.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_sram_mgr.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_tbl_sram.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_tbl_sram.h
Signature · 1 line
2.17.1
#30 lore raw

PATCH v3 1/13 net/bnxt: tf core index table updates

From: Farah Smith <[email protected]>

Remove unused shadow table functionality.

---
 drivers/net/bnxt/tf_core/tf_core.c       |  65 --------------
 drivers/net/bnxt/tf_core/tf_core.h       | 103 +----------------------
 drivers/net/bnxt/tf_core/tf_device.h     |  22 -----
 drivers/net/bnxt/tf_core/tf_device_p4.c  |   2 -
 drivers/net/bnxt/tf_core/tf_device_p58.c |   2 -
 drivers/net/bnxt/tf_core/tf_em_common.c  |   4 +
 drivers/net/bnxt/tf_core/tf_tbl.c        |  21 -----
 drivers/net/bnxt/tf_core/tf_tbl.h        |  72 ----------------
 drivers/net/bnxt/tf_ulp/ulp_mapper.c     |   3 +-
 9 files changed, 7 insertions(+), 287 deletions(-)
drivers/net/bnxt/tf_core/tf_core.c +0 -65
index 97e6165e92..5458f76e2d 100644
@@ -1105,71 +1105,6 @@ tf_alloc_tbl_entry(struct tf *tfp,
 	return 0;
 }
 
-int
-tf_search_tbl_entry(struct tf *tfp,
-		    struct tf_search_tbl_entry_parms *parms)
-{
-	int rc;
-	struct tf_session *tfs;
-	struct tf_dev_info *dev;
-	struct tf_tbl_alloc_search_parms sparms;
-
-	TF_CHECK_PARMS2(tfp, parms);
-
-	/* Retrieve the session information */
-	rc = tf_session_get_session(tfp, &tfs);
-	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "%s: Failed to lookup session, rc:%s\n",
-			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
-		return rc;
-	}
-
-	/* Retrieve the device information */
-	rc = tf_session_get_device(tfs, &dev);
-	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "%s: Failed to lookup device, rc:%s\n",
-			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
-		return rc;
-	}
-
-	if (dev->ops->tf_dev_alloc_search_tbl == NULL) {
-		rc = -EOPNOTSUPP;
-		TFP_DRV_LOG(ERR,
-			    "%s: Operation not supported, rc:%s\n",
-			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
-		return rc;
-	}
-
-	memset(&sparms, 0, sizeof(struct tf_tbl_alloc_search_parms));
-	sparms.dir = parms->dir;
-	sparms.type = parms->type;
-	sparms.result = parms->result;
-	sparms.result_sz_in_bytes = parms->result_sz_in_bytes;
-	sparms.alloc = parms->alloc;
-	sparms.tbl_scope_id = parms->tbl_scope_id;
-	rc = dev->ops->tf_dev_alloc_search_tbl(tfp, &sparms);
-	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "%s: TBL allocation failed, rc:%s\n",
-			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
-		return rc;
-	}
-
-	/* Return the outputs from the search */
-	parms->hit = sparms.hit;
-	parms->search_status = sparms.search_status;
-	parms->ref_cnt = sparms.ref_cnt;
-	parms->idx = sparms.idx;
-
-	return 0;
-}
-
 int
 tf_free_tbl_entry(struct tf *tfp,
 		  struct tf_free_tbl_entry_parms *parms)
drivers/net/bnxt/tf_core/tf_core.h +2 -101

122 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device.h +0 -22
index da3f541685..b43cfc6925 100644
@@ -347,28 +347,6 @@ struct tf_dev_ops {
 	int (*tf_dev_free_ext_tbl)(struct tf *tfp,
 				   struct tf_tbl_free_parms *parms);
 
-	/**
-	 * Searches for the specified table type element in a shadow DB.
-	 *
-	 * This API searches for the specified table type element in a
-	 * device specific shadow DB. If the element is found the
-	 * reference count for the element is updated. If the element
-	 * is not found a new element is allocated from the table type
-	 * DB and then inserted into the shadow DB.
-	 *
-	 * [in] tfp
-	 *   Pointer to TF handle
-	 *
-	 * [in] parms
-	 *   Pointer to table allocation and search parameters
-	 *
-	 * Returns
-	 *   - (0) if successful.
-	 *   - (-EINVAL) on failure.
-	 */
-	int (*tf_dev_alloc_search_tbl)(struct tf *tfp,
-				       struct tf_tbl_alloc_search_parms *parms);
-
 	/**
 	 * Sets the specified table type element.
 	 *
drivers/net/bnxt/tf_core/tf_device_p4.c +0 -2
index 971fab7bda..2e7ccec123 100644
@@ -236,7 +236,6 @@ const struct tf_dev_ops tf_dev_ops_p4_init = {
 	.tf_dev_alloc_tbl = NULL,
 	.tf_dev_free_ext_tbl = NULL,
 	.tf_dev_free_tbl = NULL,
-	.tf_dev_alloc_search_tbl = NULL,
 	.tf_dev_set_tbl = NULL,
 	.tf_dev_set_ext_tbl = NULL,
 	.tf_dev_get_tbl = NULL,
@@ -282,7 +281,6 @@ const struct tf_dev_ops tf_dev_ops_p4 = {
 	.tf_dev_alloc_ext_tbl = tf_tbl_ext_alloc,
 	.tf_dev_free_tbl = tf_tbl_free,
 	.tf_dev_free_ext_tbl = tf_tbl_ext_free,
-	.tf_dev_alloc_search_tbl = tf_tbl_alloc_search,
 	.tf_dev_set_tbl = tf_tbl_set,
 	.tf_dev_set_ext_tbl = tf_tbl_ext_common_set,
 	.tf_dev_get_tbl = tf_tbl_get,
drivers/net/bnxt/tf_core/tf_device_p58.c +0 -2
index 6bbc5e21e9..ce4d8c661f 100644
@@ -280,7 +280,6 @@ const struct tf_dev_ops tf_dev_ops_p58_init = {
 	.tf_dev_alloc_tbl = NULL,
 	.tf_dev_free_ext_tbl = NULL,
 	.tf_dev_free_tbl = NULL,
-	.tf_dev_alloc_search_tbl = NULL,
 	.tf_dev_set_tbl = NULL,
 	.tf_dev_set_ext_tbl = NULL,
 	.tf_dev_get_tbl = NULL,
@@ -326,7 +325,6 @@ const struct tf_dev_ops tf_dev_ops_p58 = {
 	.tf_dev_alloc_ext_tbl = tf_tbl_ext_alloc,
 	.tf_dev_free_tbl = tf_tbl_free,
 	.tf_dev_free_ext_tbl = tf_tbl_ext_free,
-	.tf_dev_alloc_search_tbl = tf_tbl_alloc_search,
 	.tf_dev_set_tbl = tf_tbl_set,
 	.tf_dev_set_ext_tbl = tf_tbl_ext_common_set,
 	.tf_dev_get_tbl = tf_tbl_get,
drivers/net/bnxt/tf_core/tf_em_common.c +4 -0
index 812ccb0d29..3bdfc14e05 100644
@@ -23,6 +23,10 @@
 
 #include "bnxt.h"
 
+
+/** Invalid table scope id */
+#define TF_TBL_SCOPE_INVALID 0xffffffff
+
 /* Number of pointers per page_size */
 #define MAX_PAGE_PTRS(page_size)  ((page_size) / sizeof(void *))
 
drivers/net/bnxt/tf_core/tf_tbl.c +0 -21
index ced59130b2..e77399c6bd 100644
@@ -26,11 +26,6 @@
 
 struct tf;
 
-/**
- * Table Shadow DBs
- */
-static void *shadow_tbl_db[TF_DIR_MAX];
-
 /**
  * Shadow init flag, set on bind and cleared on unbind
  */
@@ -327,22 +322,6 @@ tf_tbl_free(struct tf *tfp __rte_unused,
 	return 0;
 }
 
-int
-tf_tbl_alloc_search(struct tf *tfp,
-		    struct tf_tbl_alloc_search_parms *parms)
-{
-	int rc = 0;
-	TF_CHECK_PARMS2(tfp, parms);
-
-	if (!shadow_init || !shadow_tbl_db[parms->dir]) {
-		TFP_DRV_LOG(ERR, "%s: Shadow TBL not initialized.\n",
-			    tf_dir_2_str(parms->dir));
-		return -EINVAL;
-	}
-
-	return rc;
-}
-
 int
 tf_tbl_set(struct tf *tfp,
 	   struct tf_tbl_set_parms *parms)
drivers/net/bnxt/tf_core/tf_tbl.h +0 -72

90 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.c +1 -2
index 871dbad0fe..f3a60cc880 100644
@@ -189,13 +189,12 @@ ulp_mapper_resource_index_tbl_alloc(struct bnxt_ulp_context *ulp_ctx,
 
 	aparms.type = glb_res->resource_type;
 	aparms.dir = glb_res->direction;
-	aparms.search_enable = 0;
 	aparms.tbl_scope_id = tbl_scope_id;
 
 	/* Allocate the index tbl using tf api */
 	rc = tf_alloc_tbl_entry(tfp, &aparms);
 	if (rc) {
-		BNXT_TF_DBG(ERR, "Failed to alloc identifier [%s][%d]\n",
+		BNXT_TF_DBG(ERR, "Failed to alloc index table [%s][%d]\n",
 			    tf_dir_2_str(aparms.dir), aparms.type);
 		return rc;
 	}
Signature · 1 line
2.17.1
#31 lore raw

Re: [dpdk-dev] [PATCH v3 01/13] net/bnxt: tf core index table updates

Quoted 4 lines · Venkat Duvvuru

From: Farah Smith <[email protected]>

Remove unused shadow table functionality.

Can you please update 'tf' (or 'TF') in the patch titles with 'TruFlow', to make it more clear and consistent with the previous commits?

Ajit,

Also can you add 'TruFlow' to the 'devtools/words-case.txt', to have automated checks on it, if you believe it can be useful?

Thanks,
ferruh

Quoted 3 lines

---

#32 lore raw

Re: [dpdk-dev] [PATCH v3 01/13] net/bnxt: tf core index table updates

Quoted 7 lines · Ferruh Yigit
Quoted 4 lines · Venkat Duvvuru

From: Farah Smith <[email protected]>

Remove unused shadow table functionality.

Quoted 8 lines

Can you please update 'tf' (or 'TF') in the patch titles with 'TruFlow', to make it more clear and consistent with the previous commits?

Ajit,

Also can you add 'TruFlow' to the 'devtools/words-case.txt', to have automated checks on it, if you believe it can be useful?

Yes. Let me add that. That way it won't be flagged as a spelling error.

Quoted 8 lines

Thanks,
ferruh

Quoted 3 lines

---

#33 lore raw

PATCH v3 2/13 net/bnxt: enable dpool allocator

In reply to Venkat Duvvuru

From: Peter Spreadborough <[email protected]>

Enable dynamic entry allocator for EM SRAM entries. Deprecate static entry allocator code.

---
 drivers/net/bnxt/tf_core/tf_device_p58.c      |   4 -
 drivers/net/bnxt/tf_core/tf_em.h              |  10 -
 .../net/bnxt/tf_core/tf_em_hash_internal.c    |  34 ----
 drivers/net/bnxt/tf_core/tf_em_internal.c     | 180 +-----------------
 4 files changed, 1 insertion(+), 227 deletions(-)
drivers/net/bnxt/tf_core/tf_device_p58.c +0 -4
index ce4d8c661f..808dcb1f77 100644
@@ -348,11 +348,7 @@ const struct tf_dev_ops tf_dev_ops_p58 = {
 	.tf_dev_get_tcam_resc_info = tf_tcam_get_resc_info,
 	.tf_dev_insert_int_em_entry = tf_em_hash_insert_int_entry,
 	.tf_dev_delete_int_em_entry = tf_em_hash_delete_int_entry,
-#if (TF_EM_ALLOC == 1)
 	.tf_dev_move_int_em_entry = tf_em_move_int_entry,
-#else
-	.tf_dev_move_int_em_entry = NULL,
-#endif
 	.tf_dev_insert_ext_em_entry = NULL,
 	.tf_dev_delete_ext_em_entry = NULL,
 	.tf_dev_get_em_resc_info = tf_em_get_resc_info,
drivers/net/bnxt/tf_core/tf_em.h +0 -10
index 568071ad8c..074c128651 100644
@@ -13,16 +13,6 @@
 
 #include "hcapi_cfa_defs.h"
 
-/**
- * TF_EM_ALLOC
- *
- * 0: Use stack allocator with fixed sized entries
- *    (default).
- * 1: Use dpool allocator with variable size
- *    entries.
- */
-#define TF_EM_ALLOC 0
-
 #define TF_EM_MIN_ENTRIES     (1 << 15) /* 32K */
 #define TF_EM_MAX_ENTRIES     (1 << 27) /* 128M */
 
drivers/net/bnxt/tf_core/tf_em_hash_internal.c +0 -34
index 098e8af07e..60273a798c 100644
@@ -22,9 +22,7 @@
 /**
  * EM Pool
  */
-#if (TF_EM_ALLOC == 1)
 #include "dpool.h"
-#endif
 
 /**
  * Insert EM internal entry API
@@ -41,11 +39,7 @@ tf_em_hash_insert_int_entry(struct tf *tfp,
 	uint16_t rptr_index = 0;
 	uint8_t rptr_entry = 0;
 	uint8_t num_of_entries = 0;
-#if (TF_EM_ALLOC == 1)
 	struct dpool *pool;
-#else
-	struct stack *pool;
-#endif
 	uint32_t index;
 	uint32_t key0_hash;
 	uint32_t key1_hash;
@@ -62,7 +56,6 @@ tf_em_hash_insert_int_entry(struct tf *tfp,
 	rc = tf_session_get_device(tfs, &dev);
 	if (rc)
 		return rc;
-#if (TF_EM_ALLOC == 1)
 	pool = (struct dpool *)tfs->em_pool[parms->dir];
 	index = dpool_alloc(pool,
 			    parms->em_record_sz_in_bits / 128,
@@ -74,16 +67,6 @@ tf_em_hash_insert_int_entry(struct tf *tfp,
 			    tf_dir_2_str(parms->dir));
 		return -1;
 	}
-#else
-	pool = (struct stack *)tfs->em_pool[parms->dir];
-	rc = stack_pop(pool, &index);
-	if (rc) {
-		PMD_DRV_LOG(ERR,
-			    "%s, EM entry index allocation failed\n",
-			    tf_dir_2_str(parms->dir));
-		return rc;
-	}
-#endif
 
 	if (dev->ops->tf_dev_cfa_key_hash == NULL)
 		return -EINVAL;
@@ -103,11 +86,7 @@ tf_em_hash_insert_int_entry(struct tf *tfp,
 						  &num_of_entries);
 	if (rc) {
 		/* Free the allocated index before returning */
-#if (TF_EM_ALLOC == 1)
 		dpool_free(pool, index);
-#else
-		stack_push(pool, index);
-#endif
 		return -1;
 	}
 
@@ -128,9 +107,7 @@ tf_em_hash_insert_int_entry(struct tf *tfp,
 				     rptr_index,
 				     rptr_entry,
 				     0);
-#if (TF_EM_ALLOC == 1)
 	dpool_set_entry_data(pool, index, parms->flow_handle);
-#endif
 	return 0;
 }
 
@@ -146,11 +123,7 @@ tf_em_hash_delete_int_entry(struct tf *tfp,
 {
 	int rc = 0;
 	struct tf_session *tfs;
-#if (TF_EM_ALLOC == 1)
 	struct dpool *pool;
-#else
-	struct stack *pool;
-#endif
 	/* Retrieve the session information */
 	rc = tf_session_get_session(tfp, &tfs);
 	if (rc) {
@@ -165,19 +138,13 @@ tf_em_hash_delete_int_entry(struct tf *tfp,
 
 	/* Return resource to pool */
 	if (rc == 0) {
-#if (TF_EM_ALLOC == 1)
 		pool = (struct dpool *)tfs->em_pool[parms->dir];
 		dpool_free(pool, parms->index);
-#else
-		pool = (struct stack *)tfs->em_pool[parms->dir];
-		stack_push(pool, parms->index);
-#endif
 	}
 
 	return rc;
 }
 
-#if (TF_EM_ALLOC == 1)
 /** Move EM internal entry API
  *
  * returns:
@@ -212,4 +179,3 @@ tf_em_move_int_entry(struct tf *tfp,
 
 	return rc;
 }
-#endif
drivers/net/bnxt/tf_core/tf_em_internal.c +1 -179

258 lines not on this page · raw message

Signature · 1 line
2.17.1
#34 lore raw

PATCH v3 3/13 net/bnxt: add flow meter drop counter support

In reply to Venkat Duvvuru

From: Jay Ding <[email protected]>

- Add flow meter drop counter support for Thor.

---
 drivers/net/bnxt/tf_core/cfa_resource_types.h |  5 +-
 drivers/net/bnxt/tf_core/tf_core.h            |  8 +-
 drivers/net/bnxt/tf_core/tf_device_p58.c      |  1 +
 drivers/net/bnxt/tf_core/tf_device_p58.h      | 14 ++++
 drivers/net/bnxt/tf_core/tf_tbl.c             | 74 +++++++++++--------
 drivers/net/bnxt/tf_core/tf_util.c            |  2 +
 6 files changed, 68 insertions(+), 36 deletions(-)
drivers/net/bnxt/tf_core/cfa_resource_types.h +3 -2
index cbab0d0078..36a55d4e17 100644
@@ -104,10 +104,11 @@
 #define CFA_RESOURCE_TYPE_P58_WC_FKB             0x12UL
 /* VEB TCAM */
 #define CFA_RESOURCE_TYPE_P58_VEB_TCAM           0x13UL
+/* Metadata */
+#define CFA_RESOURCE_TYPE_P58_METADATA           0x14UL
 /* Meter drop counter */
 #define CFA_RESOURCE_TYPE_P58_METER_DROP_CNT     0x15UL
-#define CFA_RESOURCE_TYPE_P58_LAST               CFA_RESOURCE_TYPE_P58_METER_DROP_CNT
-
+#define CFA_RESOURCE_TYPE_P58_LAST              CFA_RESOURCE_TYPE_P58_METER_DROP_CNT
 
 /* Multicast Group */
 #define CFA_RESOURCE_TYPE_P45_MCG                 0x0UL
drivers/net/bnxt/tf_core/tf_core.h +6 -2
index 7e0cdf7e0d..af8d13bd7e 100644
@@ -283,9 +283,9 @@ enum tf_tbl_type {
 	TF_TBL_TYPE_ACT_MODIFY_32B,
 	/** TH 64B Modify Record */
 	TF_TBL_TYPE_ACT_MODIFY_64B,
-	/** (Future) Meter Profiles */
+	/** Meter Profiles */
 	TF_TBL_TYPE_METER_PROF,
-	/** (Future) Meter Instance */
+	/** Meter Instance */
 	TF_TBL_TYPE_METER_INST,
 	/** Wh+/SR/Th Mirror Config */
 	TF_TBL_TYPE_MIRROR_CONFIG,
@@ -301,6 +301,8 @@ enum tf_tbl_type {
 	TF_TBL_TYPE_EM_FKB,
 	/** TH WC Flexible Key builder */
 	TF_TBL_TYPE_WC_FKB,
+	/** Meter Drop Counter */
+	TF_TBL_TYPE_METER_DROP_CNT,
 
 	/* External */
 
@@ -2194,6 +2196,8 @@ enum tf_global_config_type {
 	TF_TUNNEL_ENCAP,  /**< Tunnel Encap Config(TECT) */
 	TF_ACTION_BLOCK,  /**< Action Block Config(ABCR) */
 	TF_COUNTER_CFG,   /**< Counter Configuration (CNTRS_CTRL) */
+	TF_METER_CFG,     /**< Meter Config(ACTP4_FMTCR) */
+	TF_METER_INTERVAL_CFG, /**< Meter Interval Config(FMTCR_INTERVAL)  */
 	TF_GLOBAL_CFG_TYPE_MAX
 };
 
drivers/net/bnxt/tf_core/tf_device_p58.c +1 -0
index 808dcb1f77..a492c62bff 100644
@@ -43,6 +43,7 @@ const char *tf_resource_str_p58[CFA_RESOURCE_TYPE_P58_LAST + 1] = {
 	[CFA_RESOURCE_TYPE_P58_EM_FKB]             = "em_fkb  ",
 	[CFA_RESOURCE_TYPE_P58_WC_FKB]             = "wc_fkb  ",
 	[CFA_RESOURCE_TYPE_P58_VEB_TCAM]           = "veb     ",
+	[CFA_RESOURCE_TYPE_P58_METADATA]           = "metadata",
 };
 
 /**
drivers/net/bnxt/tf_core/tf_device_p58.h +14 -0
index 66b0f4e983..8c2e07aa34 100644
@@ -75,10 +75,18 @@ struct tf_rm_element_cfg tf_tbl_p58[TF_TBL_TYPE_MAX] = {
 		TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_METER,
 		0, 0, 0
 	},
+	[TF_TBL_TYPE_METER_DROP_CNT] = {
+		TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_METER_DROP_CNT,
+		0, 0, 0
+	},
 	[TF_TBL_TYPE_MIRROR_CONFIG] = {
 		TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_MIRROR,
 		0, 0, 0
 	},
+	[TF_TBL_TYPE_METADATA] = {
+		TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_METADATA,
+		0, 0, 0
+	},
 	/* Policy - ARs in bank 1 */
 	[TF_TBL_TYPE_FULL_ACT_RECORD] = {
 		.cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_PARENT,
@@ -194,5 +202,11 @@ struct tf_global_cfg_cfg tf_global_cfg_p58[TF_GLOBAL_CFG_TYPE_MAX] = {
 	[TF_COUNTER_CFG] = {
 		TF_GLOBAL_CFG_CFG_HCAPI, TF_COUNTER_CFG
 	},
+	[TF_METER_CFG] = {
+		TF_GLOBAL_CFG_CFG_HCAPI, TF_METER_CFG
+	},
+	[TF_METER_INTERVAL_CFG] = {
+		TF_GLOBAL_CFG_CFG_HCAPI, TF_METER_INTERVAL_CFG
+	},
 };
 #endif /* _TF_DEVICE_P58_H_ */
drivers/net/bnxt/tf_core/tf_tbl.c +42 -32

88 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_util.c +2 -0
index e712816209..d100399d0a 100644
@@ -112,6 +112,8 @@ tf_tbl_type_2_str(enum tf_tbl_type tbl_type)
 		return "WC Flexible Key Builder";
 	case TF_TBL_TYPE_EXT:
 		return "External";
+	case TF_TBL_TYPE_METER_DROP_CNT:
+		return "Meter drop counter";
 	default:
 		return "Invalid tbl type";
 	}
Signature · 1 line
2.17.1
#35 lore raw

PATCH v3 4/13 net/bnxt: add Thor SRAM mgr model

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

Add dynamic SRAM manager allocation support.

---
 drivers/net/bnxt/tf_core/ll.c             |   3 +
 drivers/net/bnxt/tf_core/ll.h             |  50 +-
 drivers/net/bnxt/tf_core/meson.build      |   2 +
 drivers/net/bnxt/tf_core/tf_core.c        | 104 ++-
 drivers/net/bnxt/tf_core/tf_core.h        |  48 +-
 drivers/net/bnxt/tf_core/tf_device.c      |  40 +-
 drivers/net/bnxt/tf_core/tf_device.h      | 133 ++-
 drivers/net/bnxt/tf_core/tf_device_p4.c   |  75 +-
 drivers/net/bnxt/tf_core/tf_device_p4.h   |  50 +-
 drivers/net/bnxt/tf_core/tf_device_p58.c  | 105 ++-
 drivers/net/bnxt/tf_core/tf_device_p58.h  |  60 +-
 drivers/net/bnxt/tf_core/tf_msg.c         |   2 +-
 drivers/net/bnxt/tf_core/tf_rm.c          |  46 +-
 drivers/net/bnxt/tf_core/tf_rm.h          |  62 +-
 drivers/net/bnxt/tf_core/tf_session.c     |  56 ++
 drivers/net/bnxt/tf_core/tf_session.h     |  58 +-
 drivers/net/bnxt/tf_core/tf_sram_mgr.c    | 971 ++++++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_sram_mgr.h    | 317 +++++++
 drivers/net/bnxt/tf_core/tf_tbl.c         | 186 +----
 drivers/net/bnxt/tf_core/tf_tbl.h         |  15 +-
 drivers/net/bnxt/tf_core/tf_tbl_sram.c    | 713 ++++++++++++++++
 drivers/net/bnxt/tf_core/tf_tbl_sram.h    | 154 ++++
 drivers/net/bnxt/tf_core/tf_tcam.c        |  10 +-
 drivers/net/bnxt/tf_core/tf_tcam.h        |   7 +
 drivers/net/bnxt/tf_core/tf_tcam_shared.c |  28 +-
 drivers/net/bnxt/tf_core/tf_util.c        |  10 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c        |  23 +
 meson_options.txt                         |   2 +
 28 files changed, 2978 insertions(+), 352 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_sram_mgr.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_sram_mgr.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_tbl_sram.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_tbl_sram.h
drivers/net/bnxt/tf_core/ll.c +3 -0
index cd168a7970..f2bdff6b9e 100644
@@ -13,6 +13,7 @@ void ll_init(struct ll *ll)
 {
 	ll->head = NULL;
 	ll->tail = NULL;
+	ll->cnt = 0;
 }
 
 /* insert entry in linked list */
@@ -30,6 +31,7 @@ void ll_insert(struct ll *ll,
 		entry->next->prev = entry;
 		ll->head = entry->next->prev;
 	}
+	ll->cnt++;
 }
 
 /* delete entry from linked list */
@@ -49,4 +51,5 @@ void ll_delete(struct ll *ll,
 		entry->prev->next = entry->next;
 		entry->next->prev = entry->prev;
 	}
+	ll->cnt--;
 }
drivers/net/bnxt/tf_core/ll.h +49 -1

72 lines not on this page · raw message

drivers/net/bnxt/tf_core/meson.build +2 -0
index f28e77ec2e..b7333a431b 100644
@@ -16,6 +16,8 @@ sources += files(
         'stack.c',
         'tf_rm.c',
         'tf_tbl.c',
+	'tf_tbl_sram.c',
+	'tf_sram_mgr.c',
         'tf_em_common.c',
         'tf_em_host.c',
         'tf_em_internal.c',
drivers/net/bnxt/tf_core/tf_core.c +65 -39

173 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_core.h +26 -22

95 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device.c +34 -6
index 498e668b16..25a7166bbb 100644
@@ -11,10 +11,14 @@
 #include "tf_rm.h"
 #ifdef TF_TCAM_SHARED
 #include "tf_tcam_shared.h"
+#include "tf_tbl_sram.h"
 #endif /* TF_TCAM_SHARED */
 
 struct tf;
 
+/* Number of slices per row for WC TCAM */
+uint16_t g_wc_num_slices_per_row = TF_WC_TCAM_1_SLICE_PER_ROW;
+
 /* Forward declarations */
 static int tf_dev_unbind_p4(struct tf *tfp);
 static int tf_dev_unbind_p58(struct tf *tfp);
@@ -83,7 +87,8 @@ static int
 tf_dev_bind_p4(struct tf *tfp,
 	       bool shadow_copy,
 	       struct tf_session_resources *resources,
-	       struct tf_dev_info *dev_handle)
+	       struct tf_dev_info *dev_handle,
+	       enum tf_wc_num_slice wc_num_slices)
 {
 	int rc;
 	int frc;
@@ -131,7 +136,6 @@ tf_dev_bind_p4(struct tf *tfp,
 	if (rsv_cnt) {
 		tbl_cfg.num_elements = TF_TBL_TYPE_MAX;
 		tbl_cfg.cfg = tf_tbl_p4;
-		tbl_cfg.shadow_copy = shadow_copy;
 		tbl_cfg.resources = resources;
 		rc = tf_tbl_bind(tfp, &tbl_cfg);
 		if (rc) {
@@ -151,6 +155,7 @@ tf_dev_bind_p4(struct tf *tfp,
 		tcam_cfg.cfg = tf_tcam_p4;
 		tcam_cfg.shadow_copy = shadow_copy;
 		tcam_cfg.resources = resources;
+		tcam_cfg.wc_num_slices = wc_num_slices;
 #ifdef TF_TCAM_SHARED
 		rc = tf_tcam_shared_bind(tfp, &tcam_cfg);
 #else /* !TF_TCAM_SHARED */
@@ -369,7 +374,8 @@ static int
 tf_dev_bind_p58(struct tf *tfp,
 		bool shadow_copy,
 		struct tf_session_resources *resources,
-		struct tf_dev_info *dev_handle)
+		struct tf_dev_info *dev_handle,
+		enum tf_wc_num_slice wc_num_slices)
 {
 	int rc;
 	int frc;
@@ -414,7 +420,6 @@ tf_dev_bind_p58(struct tf *tfp,
 	if (rsv_cnt) {
 		tbl_cfg.num_elements = TF_TBL_TYPE_MAX;
 		tbl_cfg.cfg = tf_tbl_p58;
-		tbl_cfg.shadow_copy = shadow_copy;
 		tbl_cfg.resources = resources;
 		rc = tf_tbl_bind(tfp, &tbl_cfg);
 		if (rc) {
@@ -423,6 +428,13 @@ tf_dev_bind_p58(struct tf *tfp,
 			goto fail;
 		}
 		no_rsv_flag = false;
+
+		rc = tf_tbl_sram_bind(tfp);
+		if (rc) {
+			TFP_DRV_LOG(ERR,
+				    "SRAM table initialization failure\n");
+			goto fail;
+		}
 	}
 
 	rsv_cnt = tf_dev_reservation_check(TF_TCAM_TBL_TYPE_MAX,
@@ -433,6 +445,7 @@ tf_dev_bind_p58(struct tf *tfp,
 		tcam_cfg.cfg = tf_tcam_p58;
 		tcam_cfg.shadow_copy = shadow_copy;
 		tcam_cfg.resources = resources;
+		tcam_cfg.wc_num_slices = wc_num_slices;
 #ifdef TF_TCAM_SHARED
 		rc = tf_tcam_shared_bind(tfp, &tcam_cfg);
 #else /* !TF_TCAM_SHARED */
@@ -565,6 +578,18 @@ tf_dev_unbind_p58(struct tf *tfp)
 		fail = true;
 	}
 
+	/* Unbind the SRAM table prior to table as the table manager
+	 * owns and frees the table DB while the SRAM table manager owns
+	 * and manages it's internal data structures.  SRAM table manager
+	 * relies on the table rm_db to exist.
+	 */
+	rc = tf_tbl_sram_unbind(tfp);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "Device unbind failed, SRAM table\n");
+		fail = true;
+	}
+
 	rc = tf_tbl_unbind(tfp);
 	if (rc) {
 		TFP_DRV_LOG(INFO,
@@ -606,6 +631,7 @@ tf_dev_bind(struct tf *tfp __rte_unused,
 	    enum tf_device_type type,
 	    bool shadow_copy,
 	    struct tf_session_resources *resources,
+	    uint16_t wc_num_slices,
 	    struct tf_dev_info *dev_handle)
 {
 	switch (type) {
@@ -615,13 +641,15 @@ tf_dev_bind(struct tf *tfp __rte_unused,
 		return tf_dev_bind_p4(tfp,
 				      shadow_copy,
 				      resources,
-				      dev_handle);
+				      dev_handle,
+				      wc_num_slices);
 	case TF_DEVICE_TYPE_THOR:
 		dev_handle->type = type;
 		return tf_dev_bind_p58(tfp,
 				       shadow_copy,
 				       resources,
-				       dev_handle);
+				       dev_handle,
+				       wc_num_slices);
 	default:
 		TFP_DRV_LOG(ERR,
 			    "No such device\n");
drivers/net/bnxt/tf_core/tf_device.h +132 -1

187 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p4.c +70 -5

141 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p4.h +25 -25

140 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p58.c +95 -10

183 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p58.h +30 -30

188 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_msg.c +1 -1
index e07d9168be..0fbb2fe837 100644
@@ -2231,7 +2231,7 @@ tf_msg_get_if_tbl_entry(struct tf *tfp,
 	if (rc != 0)
 		return rc;
 
-	tfp_memcpy(params->data, resp.data, req.size);
+	tfp_memcpy(&params->data[0], resp.data, req.size);
 
 	return 0;
 }
drivers/net/bnxt/tf_core/tf_rm.c +43 -3

95 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_rm.h +36 -26

114 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_session.c +56 -0

72 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_session.h +55 -3

88 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_sram_mgr.c new file +971 -0

971 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_sram_mgr.h new file +317 -0

317 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tbl.c +40 -146

14 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tbl.h +1 -14
index 7e1107ffe7..2483718e5d 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_core/tf_tbl_sram.c new file +713 -0

713 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tbl_sram.h new file +154 -0

154 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tcam.c +4 -6
index 45206c5992..806af3070a 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_core/tf_tcam.h +7 -0
index bed17af6ae..b1e7a92b0b 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_core/tf_tcam_shared.c +14 -14
index 83b6fbd5fb..c120c6f577 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_core/tf_util.c +10 -0
index d100399d0a..c1b9be0755 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/bnxt_ulp.c +23 -0
index dbf85e4eda..183bae66c5 100644

Lines of this file are not shown. View the raw message.

meson_options.txt +2 -0
index 0e92734c49..f686e6d92a 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

#36 lore raw

Re: [dpdk-dev] [PATCH v3 04/13] net/bnxt: add Thor SRAM mgr model

meson_options.txt option('tests', type: 'boolean', value: true, description: · line 50

Quoted 11 lines · Venkat Duvvuru
meson_options.txt +2 -0
index 0e92734c49..f686e6d92a 100644
@@ -46,3 +46,5 @@ option('tests', type: 'boolean', value: true, description:
        'build unit tests')
 option('use_hpet', type: 'boolean', value: false, description:
        'use HPET timer in EAL')
+option('bnxt_tf_wc_slices', type: 'integer', min: 1, max: 4, value: 2,
+	description: 'Number of slices per WC TCAM entry')

Are we sure to add a PMD specific meson option?

I believe if we let to go this way, soon the meson options can be as messy as Makefile config options. @Thomas, @Bruce, what do you think?

#37 lore raw

Re: [dpdk-dev] [PATCH v3 04/13] net/bnxt: add Thor SRAM mgr model

Quoted 16 lines · Ferruh Yigit

meson_options.txt option('tests', type: 'boolean', value: true, description: · line 50

Quoted 11 lines · Venkat Duvvuru
meson_options.txt +2 -0
index 0e92734c49..f686e6d92a 100644
@@ -46,3 +46,5 @@ option('tests', type: 'boolean', value: true, description:
        'build unit tests')
 option('use_hpet', type: 'boolean', value: false, description:
        'use HPET timer in EAL')
+option('bnxt_tf_wc_slices', type: 'integer', min: 1, max: 4, value: 2,
+	description: 'Number of slices per WC TCAM entry')

Are we sure to add a PMD specific meson option?

Quoted 2 lines

I believe if we let to go this way, soon the meson options can be as messy as Makefile config options. @Thomas, @Bruce, what do you think?

Completely agree. Can this be made a runtime option, perhaps passed in as a devarg if necessary?

#38 lore raw

Re: [dpdk-dev] [PATCH v3 04/13] net/bnxt: add Thor SRAM mgr model

16/09/2021 16:01, Bruce Richardson:

Quoted 16 lines · Ferruh Yigit
Quoted 15 lines · Venkat Duvvuru

meson_options.txt option('tests', type: 'boolean', value: true, description: · line 50

Quoted 10 lines
meson_options.txt +2 -0
index 0e92734c49..f686e6d92a 100644
@@ -46,3 +46,5 @@ option('tests', type: 'boolean', value: true, description:
        'build unit tests')
 option('use_hpet', type: 'boolean', value: false, description:
        'use HPET timer in EAL')
+option('bnxt_tf_wc_slices', type: 'integer', min: 1, max: 4, value: 2,
+	description: 'Number of slices per WC TCAM entry')

Are we sure to add a PMD specific meson option?

Quoted 5 lines
Quoted 2 lines

I believe if we let to go this way, soon the meson options can be as messy as Makefile config options. @Thomas, @Bruce, what do you think?

Completely agree. Can this be made a runtime option, perhaps passed in as a devarg if necessary?

+1

#39 lore raw

Re: [dpdk-dev] [PATCH v3 04/13] net/bnxt: add Thor SRAM mgr model

In reply to Ferruh Yigit
Quoted 17 lines · Ferruh Yigit

meson_options.txt option('tests', type: 'boolean', value: true, description:

Quoted 11 lines · Venkat Duvvuru
meson_options.txt +2 -1
index 0e92734c49..f686e6d92a 100644
@@ -46,3 +46,5 @@ option('tests', type: 'boolean', value: true, description:
        'build unit tests')
 option('use_hpet', type: 'boolean', value: false, description:
        'use HPET timer in EAL')
+option('bnxt_tf_wc_slices', type: 'integer', min: 1, max: 4, value: 2,
+     description: 'Number of slices per WC TCAM entry')
--

Are we sure to add a PMD specific meson option?

Quoted 2 lines

I believe if we let to go this way, soon the meson options can be as messy as Makefile config options. @Thomas, @Bruce, what do you think?

Apologies for the confusion.
It is actually taken care of in the code and this meson_options.txt change is not needed.
Will submit a patch to revert it.

Signature · 11 lines
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.
#40 lore raw

Re: [dpdk-dev] [PATCH v3 04/13] net/bnxt: add Thor SRAM mgr model

Quoted 18 lines · Venkat Duvvuru
Quoted 17 lines · Ferruh Yigit

meson_options.txt option('tests', type: 'boolean', value: true, description:

Quoted 11 lines · Venkat Duvvuru
meson_options.txt +2 -1
index 0e92734c49..f686e6d92a 100644
@@ -46,3 +46,5 @@ option('tests', type: 'boolean', value: true, description:
        'build unit tests')
 option('use_hpet', type: 'boolean', value: false, description:
        'use HPET timer in EAL')
+option('bnxt_tf_wc_slices', type: 'integer', min: 1, max: 4, value: 2,
+     description: 'Number of slices per WC TCAM entry')
--

Are we sure to add a PMD specific meson option?

Quoted 8 lines
Quoted 2 lines

I believe if we let to go this way, soon the meson options can be as messy as Makefile config options. @Thomas, @Bruce, what do you think?

Apologies for the confusion.
It is actually taken care of in the code and this meson_options.txt change is not needed.
Will submit a patch to revert it.

Great, thanks.

#41 lore raw

PATCH v3 5/13 net/bnxt: add flow templates support for Thor

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

Template adds non-VFR based support for testpmd with:
matches to include
- DMAC, SIP, DIP, Proto, Sport, Dport
- SIP, DIP, Proto, Sport, Dport
actions:
- count, drop

---
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |   6 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |  36 +++---
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |  12 ++
 .../bnxt/tf_ulp/generic_templates/meson.build |  17 ++-
 .../ulp_template_db_thor_class.c              |   1 -
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |   2 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         | 122 +++++++++++++++++-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |  26 +++-
 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c         |   5 +
 drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c          |   2 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          | 111 +++++++++++++++-
 drivers/net/bnxt/tf_ulp/ulp_matcher.c         |  13 ++
 drivers/net/bnxt/tf_ulp/ulp_port_db.c         |  15 ++-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |   9 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.c             |  20 +++
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |   8 +-
 16 files changed, 356 insertions(+), 49 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_tf_common.h +6 -0
index f59da41e54..e0ebed3fed 100644
@@ -13,6 +13,12 @@
 
 #define BNXT_TF_DBG(lvl, fmt, args...)	PMD_DRV_LOG(lvl, fmt, ## args)
 
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#define BNXT_TF_INF(fmt, args...)	PMD_DRV_LOG(INFO, fmt, ## args)
+#else
+#define BNXT_TF_INF(fmt, args...)
+#endif
+
 #define BNXT_ULP_EM_FLOWS			8192
 #define BNXT_ULP_1M_FLOWS			1000000
 #define BNXT_EEM_RX_GLOBAL_ID_MASK		(BNXT_ULP_1M_FLOWS - 1)
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +15 -21
index 183bae66c5..475c7a6cdf 100644
@@ -698,6 +698,11 @@ ulp_eem_tbl_scope_init(struct bnxt *bp)
 			    rc);
 		return rc;
 	}
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+	BNXT_TF_DBG(DEBUG, "TableScope=0x%0x %d\n",
+		    params.tbl_scope_id,
+		    params.tbl_scope_id);
+#endif
 	rc = bnxt_ulp_cntxt_tbl_scope_id_set(bp->ulp_ctx, params.tbl_scope_id);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Unable to set table scope id\n");
@@ -825,6 +830,8 @@ ulp_ctx_init(struct bnxt *bp,
 		goto error_deinit;
 	}
 
+	/* TODO: For now we are overriding to APP:1 on this branch*/
+	bp->app_id = 1;
 	rc = bnxt_ulp_cntxt_app_id_set(bp->ulp_ctx, bp->app_id);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Unable to set app_id for ULP init.\n");
@@ -838,11 +845,6 @@ ulp_ctx_init(struct bnxt *bp,
 		goto error_deinit;
 	}
 
-	if (devid == BNXT_ULP_DEVICE_ID_THOR) {
-		ulp_data->ulp_flags &= ~BNXT_ULP_VF_REP_ENABLED;
-		BNXT_TF_DBG(ERR, "Enabled non-VFR mode\n");
-	}
-
 	/*
 	 * Shared session must be created before first regular session but after
 	 * the ulp_ctx is valid.
@@ -902,7 +904,7 @@ ulp_dparms_init(struct bnxt *bp, struct bnxt_ulp_context *ulp_ctx)
 	dparms->ext_flow_db_num_entries = bp->max_num_kflows * 1024;
 	/* GFID =  2 * num_flows */
 	dparms->mark_db_gfid_entries = dparms->ext_flow_db_num_entries * 2;
-	BNXT_TF_DBG(DEBUG, "Set the number of flows = %"PRIu64"\n",
+	BNXT_TF_DBG(DEBUG, "Set the number of flows = %" PRIu64 "\n",
 		    dparms->ext_flow_db_num_entries);
 
 	return 0;
@@ -1393,17 +1395,13 @@ bnxt_ulp_port_init(struct bnxt *bp)
 	uint32_t ulp_flags;
 	int32_t rc = 0;
 
+	if (!bp || !BNXT_TRUFLOW_EN(bp))
+		return rc;
+
 	if (!BNXT_PF(bp) && !BNXT_VF_IS_TRUSTED(bp)) {
 		BNXT_TF_DBG(ERR,
 			    "Skip ulp init for port: %d, not a TVF or PF\n",
-			    bp->eth_dev->data->port_id);
-		return rc;
-	}
-
-	if (!BNXT_TRUFLOW_EN(bp)) {
-		BNXT_TF_DBG(DEBUG,
-			    "Skip ulp init for port: %d, truflow is not enabled\n",
-			    bp->eth_dev->data->port_id);
+			bp->eth_dev->data->port_id);
 		return rc;
 	}
 
@@ -1524,6 +1522,9 @@ bnxt_ulp_port_deinit(struct bnxt *bp)
 	struct rte_pci_device *pci_dev;
 	struct rte_pci_addr *pci_addr;
 
+	if (!BNXT_TRUFLOW_EN(bp))
+		return;
+
 	if (!BNXT_PF(bp) && !BNXT_VF_IS_TRUSTED(bp)) {
 		BNXT_TF_DBG(ERR,
 			    "Skip ULP deinit port:%d, not a TVF or PF\n",
@@ -1531,13 +1532,6 @@ bnxt_ulp_port_deinit(struct bnxt *bp)
 		return;
 	}
 
-	if (!BNXT_TRUFLOW_EN(bp)) {
-		BNXT_TF_DBG(DEBUG,
-			    "Skip ULP deinit for port:%d, truflow is not enabled\n",
-			    bp->eth_dev->data->port_id);
-		return;
-	}
-
 	if (!bp->ulp_ctx) {
 		BNXT_TF_DBG(DEBUG, "ulp ctx already de-allocated\n");
 		return;
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +12 -0
index 19e9dba356..238b1d9657 100644
@@ -13,6 +13,9 @@
 #include "ulp_port_db.h"
 #include "ulp_ha_mgr.h"
 #include <rte_malloc.h>
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#include "ulp_template_debug_proto.h"
+#endif
 
 static int32_t
 bnxt_ulp_flow_validate_args(const struct rte_flow_attr *attr,
@@ -222,6 +225,15 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev,
 	else if (ret == BNXT_TF_RC_FID)
 		goto return_fid;
 
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_PARSER
+	/* Dump the rte flow pattern */
+	ulp_parser_hdr_info_dump(&params);
+	/* Dump the rte flow action */
+	ulp_parser_act_info_dump(&params);
+#endif
+#endif
+
 	ret = ulp_matcher_pattern_match(&params, &params.class_id);
 	if (ret != BNXT_TF_RC_SUCCESS)
 		goto free_fid;
drivers/net/bnxt/tf_ulp/generic_templates/meson.build +10 -7
index b1e7b8cc32..16b27a2e24 100644
@@ -2,12 +2,15 @@
 # Copyright(c) 2018 Intel Corporation
 # Copyright(c) 2020 Broadcom
 
+#Include the folder for headers
 includes += include_directories('.')
+
+#Add the source files
 sources += files(
-        'ulp_template_db_class.c',
-        'ulp_template_db_act.c',
-        'ulp_template_db_tbl.c',
-        'ulp_template_db_wh_plus_act.c',
-        'ulp_template_db_wh_plus_class.c',
-        'ulp_template_db_thor_act.c',
-        'ulp_template_db_thor_class.c')
+	'ulp_template_db_class.c',
+	'ulp_template_db_act.c',
+	'ulp_template_db_tbl.c',
+	'ulp_template_db_wh_plus_act.c',
+	'ulp_template_db_wh_plus_class.c',
+	'ulp_template_db_thor_act.c',
+	'ulp_template_db_thor_class.c')
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c +0 -1
index 83f6152700..e342f340d9 100644
@@ -6104,4 +6104,3 @@ struct bnxt_ulp_mapper_ident_info ulp_thor_class_ident_list[] = {
 	.ident_bit_pos = 29
 	}
 };
-
drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c +1 -1
index 13f71ed83b..22c51976ac 100644
@@ -35,7 +35,7 @@ ulp_fc_mgr_shadow_mem_alloc(struct hw_fc_mem_info *parms, int size)
 	rte_mem_lock_page(parms->mem_va);
 
 	parms->mem_pa = (void *)(uintptr_t)rte_mem_virt2phy(parms->mem_va);
-	if (parms->mem_pa == (void *)(uintptr_t)RTE_BAD_IOVA) {
+	if (parms->mem_pa == (void *)RTE_BAD_IOVA) {
 		BNXT_TF_DBG(ERR, "Allocate failed mem_pa\n");
 		return -ENOMEM;
 	}
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +119 -3

155 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +25 -1
index 67afca8872..0ddfa6f66d 100644
@@ -18,7 +18,7 @@
 
 /*
  * Structure for the flow database resource information
- * The below structure is based on the below partitions
+ * 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
@@ -417,4 +417,28 @@ ulp_flow_db_parent_flow_count_reset(struct bnxt_ulp_context *ulp_ctxt);
 void ulp_flow_db_shared_session_set(struct ulp_flow_db_res_params *res,
 				    enum bnxt_ulp_shared_session shared);
 
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+/*
+ * Dump the flow entry details
+ *
+ * flow_db [in] Ptr to flow db
+ * fid [in] flow id
+ *
+ * returns none
+ */
+void
+ulp_flow_db_debug_fid_dump(struct bnxt_ulp_flow_db *flow_db, uint32_t fid);
+
+/*
+ * Dump the flow database entry details
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * flow_id [in] if zero then all fids are dumped.
+ *
+ * returns none
+ */
+int32_t	ulp_flow_db_debug_dump(struct bnxt_ulp_context *ulp_ctxt,
+			       uint32_t flow_id);
+#endif
+
 #endif /* _ULP_FLOW_DB_H_ */
drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c +5 -0
index 3c1af0b007..c6b2b1675d 100644
@@ -10,6 +10,11 @@
 #include "ulp_mapper.h"
 #include "ulp_flow_db.h"
 
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#include "ulp_template_debug_proto.h"
+#include "ulp_tf_debug.h"
+#endif
+
 /* Retrieve the generic table  initialization parameters for the tbl_idx */
 static struct bnxt_ulp_generic_tbl_params*
 ulp_mapper_gen_tbl_params_get(uint32_t tbl_idx)
drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c +1 -1
index 5f5b5d639e..bc5627ec5b 100644
@@ -185,7 +185,7 @@ ulp_ha_mgr_timer_cb(void *arg __rte_unused)
 	rc = ulp_ha_mgr_state_get(ulp_ctx, &curr_state);
 	if (rc) {
 		/*
-		 * This shouldn't happen, if it does, reset the timer
+		 * This shouldn't happen, if it does, resetart the timer
 		 * and try again next time.
 		 */
 		BNXT_TF_DBG(ERR, "Failed(%d) to get state.\n",
drivers/net/bnxt/tf_ulp/ulp_mapper.c +108 -3

238 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_matcher.c +13 -0
index 67fa61fc7c..e06d8f6287 100644
@@ -6,6 +6,10 @@
 #include "ulp_matcher.h"
 #include "ulp_utils.h"
 
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#include "ulp_template_debug_proto.h"
+#endif
+
 /* Utility function to calculate the class matcher hash */
 static uint32_t
 ulp_matcher_class_hash_calculate(uint64_t hi_sig, uint64_t lo_sig)
@@ -95,6 +99,11 @@ ulp_matcher_pattern_match(struct ulp_rte_parser_params *params,
 
 error:
 	BNXT_TF_DBG(DEBUG, "Did not find any matching template\n");
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+	BNXT_TF_DBG(DEBUG, "class_hid:0x%x, Hdr:%" PRIX64 " Fld:%" PRIX64 "\n",
+		    class_hid, params->hdr_bitmap.bits,
+		    params->fld_bitmap.bits);
+#endif
 	*class_id = 0;
 	return BNXT_TF_RC_ERROR;
 }
@@ -142,6 +151,10 @@ ulp_matcher_action_match(struct ulp_rte_parser_params *params,
 
 error:
 	BNXT_TF_DBG(DEBUG, "Did not find any matching action template\n");
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+	BNXT_TF_DBG(DEBUG, "act_hid:0x%x, Hdr:%" PRIX64 "\n",
+		    act_hid, params->act_bitmap.bits);
+#endif
 	*act_id = 0;
 	return BNXT_TF_RC_ERROR;
 }
drivers/net/bnxt/tf_ulp/ulp_port_db.c +12 -3
index 4045473097..7d9865b3e3 100644
@@ -7,9 +7,13 @@
 #include "bnxt.h"
 #include "bnxt_vnic.h"
 #include "bnxt_tf_common.h"
+#include "bnxt_tf_pmd_shim.h"
 #include "ulp_port_db.h"
 #include "tfp.h"
-#include "bnxt_tf_pmd_shim.h"
+
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#include "ulp_tf_debug.h"
+#endif
 
 static uint32_t
 ulp_port_db_allocate_ifindex(struct bnxt_ulp_port_db *port_db)
@@ -151,12 +155,12 @@ int32_t	ulp_port_db_dev_port_intf_update(struct bnxt_ulp_context *ulp_ctxt,
 
 	intf->type = bnxt_pmd_get_interface_type(port_id);
 	intf->drv_func_id = bnxt_pmd_get_fw_func_id(port_id,
-						    BNXT_ULP_INTF_TYPE_INVALID);
+						BNXT_ULP_INTF_TYPE_INVALID);
 
 	func = &port_db->ulp_func_id_tbl[intf->drv_func_id];
 	if (!func->func_valid) {
 		func->func_svif = bnxt_pmd_get_svif(port_id, true,
-						    BNXT_ULP_INTF_TYPE_INVALID);
+						BNXT_ULP_INTF_TYPE_INVALID);
 		func->func_spif = bnxt_pmd_get_phy_port_id(port_id);
 		func->func_parif =
 			bnxt_pmd_get_parif(port_id, BNXT_ULP_INTF_TYPE_INVALID);
@@ -202,6 +206,11 @@ int32_t	ulp_port_db_dev_port_intf_update(struct bnxt_ulp_context *ulp_ctxt,
 		port_data->port_vport = bnxt_pmd_get_vport(port_id);
 		port_data->port_valid = true;
 	}
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_PORT
+	ulp_port_db_dump(port_db, intf, port_id);
+#endif
+#endif
 	return 0;
 }
 
drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +5 -4
index 5fd52b8f36..79b9957781 100644
@@ -8,6 +8,7 @@
 #include "ulp_template_struct.h"
 #include "bnxt_ulp.h"
 #include "bnxt_tf_common.h"
+#include "bnxt_tf_pmd_shim.h"
 #include "ulp_rte_parser.h"
 #include "ulp_matcher.h"
 #include "ulp_utils.h"
@@ -855,7 +856,7 @@ ulp_rte_vlan_hdr_handler(const struct rte_flow_item *item,
 			       BNXT_ULP_HDR_BIT_II_VLAN);
 		inner_flag = 1;
 	} else {
-		BNXT_TF_DBG(ERR, "Error Parsing:Vlan hdr found without eth\n");
+		BNXT_TF_DBG(ERR, "Error Parsing:Vlan hdr found withtout eth\n");
 		return BNXT_TF_RC_ERROR;
 	}
 	/* Update the field protocol hdr bitmap */
@@ -1135,8 +1136,8 @@ ulp_rte_ipv6_hdr_handler(const struct rte_flow_item *item,
 	ulp_rte_prsr_fld_mask(params, &idx, size, &ver_spec, &ver_mask,
 			      ULP_PRSR_ACT_DEFAULT);
 	/*
-	 * The TC and flow label field are ignored since OVS is setting
-	 * it for match and it is not supported.
+	 * The TC and flow label field are ignored since OVS is
+	 * setting it for match and it is not supported.
 	 * This is a work around and
 	 * shall be addressed in the future.
 	 */
@@ -2138,7 +2139,7 @@ ulp_rte_vf_act_handler(const struct rte_flow_action *action_item,
 		return BNXT_TF_RC_PARSE_ERR;
 	}
 
-	bp = bnxt_get_bp(params->port_id);
+	bp = bnxt_pmd_get_bp(params->port_id);
 	if (bp == NULL) {
 		BNXT_TF_DBG(ERR, "Invalid bp\n");
 		return BNXT_TF_RC_ERROR;
drivers/net/bnxt/tf_ulp/ulp_tun.c +20 -0
index cb8530d791..a1dd5b902c 100644
@@ -3,6 +3,8 @@
  * All rights reserved.
  */
 
+#include <sys/queue.h>
+
 #include <rte_malloc.h>
 
 #include "ulp_tun.h"
@@ -29,6 +31,15 @@ ulp_install_outer_tun_flow(struct ulp_rte_parser_params *params,
 
 	ULP_BITMAP_SET(params->hdr_bitmap.bits, BNXT_ULP_HDR_BIT_F1);
 
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_PARSER
+	/* Dump the rte flow pattern */
+	ulp_parser_hdr_info_dump(params);
+	/* Dump the rte flow action */
+	ulp_parser_act_info_dump(params);
+#endif
+#endif
+
 	ret = ulp_matcher_pattern_match(params, &params->class_id);
 	if (ret != BNXT_TF_RC_SUCCESS)
 		goto err;
@@ -146,6 +157,15 @@ ulp_post_process_cache_inner_tun_flow(struct ulp_rte_parser_params *params,
 	struct ulp_per_port_flow_info *flow_info;
 	int ret;
 
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_PARSER
+	/* Dump the rte flow pattern */
+	ulp_parser_hdr_info_dump(params);
+	/* Dump the rte flow action */
+	ulp_parser_act_info_dump(params);
+#endif
+#endif
+
 	ret = ulp_matcher_pattern_match(params, &params->class_id);
 	if (ret != BNXT_TF_RC_SUCCESS)
 		return BNXT_TF_RC_ERROR;
drivers/net/bnxt/tf_ulp/ulp_utils.c +4 -4
index bafb539c8d..1649e157f2 100644
@@ -62,7 +62,7 @@ ulp_regfile_read(struct ulp_regfile *regfile,
  * data [in] The value is written into this variable.  It is going to be in the
  * same byte order as it was written.
  *
- * size [in] The size in bytes of the value being written into this
+ * size [in] The size in bytes of the value beingritten into this
  * variable.
  *
  * returns 0 on success
@@ -295,7 +295,7 @@ ulp_blob_push(struct ulp_blob *blob,
 				     datalen,
 				     data);
 	if (!rc) {
-		BNXT_TF_DBG(ERR, "Failed to write blob\n");
+		BNXT_TF_DBG(ERR, "Failed ro write blob\n");
 		return 0;
 	}
 	blob->write_idx += datalen;
@@ -355,7 +355,7 @@ ulp_blob_insert(struct ulp_blob *blob, uint32_t offset,
 				     datalen,
 				     data);
 	if (!rc) {
-		BNXT_TF_DBG(ERR, "Failed to write blob\n");
+		BNXT_TF_DBG(ERR, "Failed ro write blob\n");
 		return 0;
 	}
 	/* copy the previously stored data */
@@ -409,7 +409,7 @@ ulp_blob_push_64(struct ulp_blob *blob,
  *
  * data [in] 32-bit value to be added to the blob.
  *
- * datalen [in] The number of bits to be added to the blob.
+ * datalen [in] The number of bits to be added ot the blob.
  *
  * The offset of the data is updated after each push of data.
  * NULL returned on error, pointer pushed value otherwise.
Signature · 1 line
2.17.1
#42 lore raw

PATCH v3 6/13 net/bnxt: add support for tunnel offloads

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

Added support for tunnel offloads, this includes the support for VXLAN decap action where two flows indicate tunnel offload rule. The first flow indicate the tunnel properties and second flow indicates the inner packet structure. The templates are updated to support this feature.

---
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |    4 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   12 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |   20 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |  212 +-
 .../generic_templates/ulp_template_db_act.c   |    2 +-
 .../generic_templates/ulp_template_db_class.c | 8541 +++++++++++-----
 .../generic_templates/ulp_template_db_enum.h  |  210 +-
 .../generic_templates/ulp_template_db_field.h |  654 +-
 .../generic_templates/ulp_template_db_tbl.c   |  645 +-
 .../ulp_template_db_thor_class.c              |  110 +-
 .../ulp_template_db_wh_plus_act.c             |    2 +-
 .../ulp_template_db_wh_plus_class.c           | 8577 +++++++++++------
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |   46 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h          |    8 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |  562 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |   44 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   52 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |    6 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c |   31 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |  134 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |   10 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   10 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.c             |  541 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.h             |   89 +-
 24 files changed, 13810 insertions(+), 6712 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_tf_common.h +1 -3
index e0ebed3fed..6c4bcd2d90 100644
@@ -37,9 +37,7 @@
 enum bnxt_tf_rc {
 	BNXT_TF_RC_PARSE_ERR	= -2,
 	BNXT_TF_RC_ERROR	= -1,
-	BNXT_TF_RC_SUCCESS	= 0,
-	BNXT_TF_RC_NORMAL	= 1,
-	BNXT_TF_RC_FID		= 2,
+	BNXT_TF_RC_SUCCESS	= 0
 };
 
 /* eth IPv4 Type */
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +10 -2
index 475c7a6cdf..dfafd9ff5b 100644
@@ -860,8 +860,6 @@ ulp_ctx_init(struct bnxt *bp,
 	if (rc)
 		goto error_deinit;
 
-	ulp_tun_tbl_init(ulp_data->tun_tbl);
-
 	bnxt_ulp_cntxt_tfp_set(bp->ulp_ctx, &bp->tfp);
 	return rc;
 
@@ -2064,3 +2062,13 @@ bnxt_ulp_cntxt_entry_release(void)
 {
 	rte_spinlock_unlock(&bnxt_ulp_ctxt_lock);
 }
+
+/* Function to get the app tunnel details from the ulp context. */
+struct bnxt_flow_app_tun_ent *
+bnxt_ulp_cntxt_ptr2_app_tun_list_get(struct bnxt_ulp_context *ulp)
+{
+	if (!ulp || !ulp->cfg_data)
+		return NULL;
+
+	return ulp->cfg_data->app_tun;
+}
drivers/net/bnxt/tf_ulp/bnxt_ulp.h +17 -3
index 082ca501b6..006df9cbc5 100644
@@ -47,6 +47,18 @@ enum bnxt_ulp_flow_mem_type {
 	BNXT_ULP_FLOW_MEM_TYPE_LAST = 3
 };
 
+enum bnxt_rte_flow_item_type {
+	BNXT_RTE_FLOW_ITEM_TYPE_END = (uint32_t)INT_MIN,
+	BNXT_RTE_FLOW_ITEM_TYPE_VXLAN_DECAP,
+	BNXT_RTE_FLOW_ITEM_TYPE_LAST
+};
+
+enum bnxt_rte_flow_action_type {
+	BNXT_RTE_FLOW_ACTION_TYPE_END = (uint32_t)INT_MIN,
+	BNXT_RTE_FLOW_ACTION_TYPE_VXLAN_DECAP,
+	BNXT_RTE_FLOW_ACTION_TYPE_LAST
+};
+
 struct bnxt_ulp_df_rule_info {
 	uint32_t			def_port_flow_id;
 	uint8_t				valid;
@@ -79,6 +91,7 @@ struct bnxt_ulp_data {
 	bool				accum_stats;
 	uint8_t				app_id;
 	uint8_t				num_shared_clients;
+	struct bnxt_flow_app_tun_ent	app_tun[BNXT_ULP_MAX_TUN_CACHE_ENTRIES];
 };
 
 struct bnxt_ulp_context {
@@ -258,9 +271,6 @@ bnxt_ulp_cntxt_acquire_fdb_lock(struct bnxt_ulp_context	*ulp_ctx);
 void
 bnxt_ulp_cntxt_release_fdb_lock(struct bnxt_ulp_context	*ulp_ctx);
 
-int32_t
-ulp_post_process_tun_flow(struct ulp_rte_parser_params *params);
-
 struct bnxt_ulp_glb_resource_info *
 bnxt_ulp_app_glb_resource_info_list_get(uint32_t *num_entries);
 
@@ -301,4 +311,8 @@ bnxt_ulp_cntxt_entry_release(void);
 
 uint8_t
 bnxt_ulp_cntxt_num_shared_clients_get(struct bnxt_ulp_context *ulp_ctx);
+
+struct bnxt_flow_app_tun_ent *
+bnxt_ulp_cntxt_ptr2_app_tun_list_get(struct bnxt_ulp_context *ulp);
+
 #endif /* _BNXT_ULP_H_ */
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +203 -9

262 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_act.c +1 -1
index e18f314856..0da6070d7d 100644
@@ -3,7 +3,7 @@
  * All rights reserved.
  */
 
-/* date: Wed Mar 17 11:31:19 2021 */
+/* date: Mon May 17 15:30:41 2021 */
 
 #include "ulp_template_db_enum.h"
 #include "ulp_template_db_field.h"
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_class.c +6267 -2274

2,657 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_enum.h +189 -21

210 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_field.h +421 -233

654 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c +419 -226

645 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c +55 -55

110 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_act.c +1 -1
index b6d2afd55b..de924fe81a 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_class.c +5591 -2986

8,577 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c +30 -16

46 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h +5 -3
index 448d05c118..9825ed2a27 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_flow_db.c +235 -327

562 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +19 -25

44 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.c +18 -34

52 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.h +3 -3
index 004e89ac2b..d4d6969bb5 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c +31 -0
index 35e9858727..9b165c12b5 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +80 -54

134 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +9 -1
index 4431f1bbd0..673172c811 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +7 -3
index 0cbac66237..2685e63432 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_tun.c +170 -371

541 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_tun.h +28 -61

89 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

#43 lore raw

PATCH v3 7/13 net/bnxt: add support for dynamic encap action

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

The encapsulation record processing is enhanced to handle data dynamically. Different combinations of VXLAN encapsulation using no VLAN or single or double VLAN can be supported and also supports both IPv4 and IPv6 versions.

---
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   25 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |    2 +
 .../generic_templates/ulp_template_db_enum.h  |   44 +-
 .../generic_templates/ulp_template_db_tbl.c   |    8 +-
 .../ulp_template_db_thor_act.c                |    4 +-
 .../ulp_template_db_thor_class.c              |   46 +-
 .../ulp_template_db_wh_plus_act.c             | 1700 ++++++++++++-----
 .../ulp_template_db_wh_plus_class.c           |  222 +--
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |    6 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |    2 +-
 drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c          |    2 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |  152 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |    4 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |  337 ++--
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |    2 +
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   10 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |   73 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |   27 +-
 18 files changed, 1717 insertions(+), 949 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +16 -9
index dfafd9ff5b..3b86410fb1 100644
@@ -830,13 +830,12 @@ ulp_ctx_init(struct bnxt *bp,
 		goto error_deinit;
 	}
 
-	/* TODO: For now we are overriding to APP:1 on this branch*/
-	bp->app_id = 1;
 	rc = bnxt_ulp_cntxt_app_id_set(bp->ulp_ctx, bp->app_id);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Unable to set app_id for ULP init.\n");
 		goto error_deinit;
 	}
+	BNXT_TF_DBG(DEBUG, "Ulp initialized with app id %d\n", bp->app_id);
 
 	rc = bnxt_ulp_cntxt_app_caps_init(bp->ulp_ctx, bp->app_id, devid);
 	if (rc) {
@@ -1393,13 +1392,17 @@ bnxt_ulp_port_init(struct bnxt *bp)
 	uint32_t ulp_flags;
 	int32_t rc = 0;
 
-	if (!bp || !BNXT_TRUFLOW_EN(bp))
-		return rc;
-
 	if (!BNXT_PF(bp) && !BNXT_VF_IS_TRUSTED(bp)) {
 		BNXT_TF_DBG(ERR,
 			    "Skip ulp init for port: %d, not a TVF or PF\n",
-			bp->eth_dev->data->port_id);
+			    bp->eth_dev->data->port_id);
+		return rc;
+	}
+
+	if (!BNXT_TRUFLOW_EN(bp)) {
+		BNXT_TF_DBG(ERR,
+			    "Skip ulp init for port: %d, truflow is not enabled\n",
+			    bp->eth_dev->data->port_id);
 		return rc;
 	}
 
@@ -1520,9 +1523,6 @@ bnxt_ulp_port_deinit(struct bnxt *bp)
 	struct rte_pci_device *pci_dev;
 	struct rte_pci_addr *pci_addr;
 
-	if (!BNXT_TRUFLOW_EN(bp))
-		return;
-
 	if (!BNXT_PF(bp) && !BNXT_VF_IS_TRUSTED(bp)) {
 		BNXT_TF_DBG(ERR,
 			    "Skip ULP deinit port:%d, not a TVF or PF\n",
@@ -1530,6 +1530,13 @@ bnxt_ulp_port_deinit(struct bnxt *bp)
 		return;
 	}
 
+	if (!BNXT_TRUFLOW_EN(bp)) {
+		BNXT_TF_DBG(ERR,
+			    "Skip ULP deinit for port:%d, truflow is not enabled\n",
+			    bp->eth_dev->data->port_id);
+		return;
+	}
+
 	if (!bp->ulp_ctx) {
 		BNXT_TF_DBG(DEBUG, "ulp ctx already de-allocated\n");
 		return;
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +2 -0
index 3daf5942e8..413e4c3b26 100644
@@ -96,7 +96,9 @@ bnxt_ulp_init_mapper_params(struct bnxt_ulp_mapper_create_parms *mapper_cparms,
 	mapper_cparms->act_tid = params->act_tmpl;
 	mapper_cparms->func_id = params->func_id;
 	mapper_cparms->hdr_bitmap = &params->hdr_bitmap;
+	mapper_cparms->enc_hdr_bitmap = &params->enc_hdr_bitmap;
 	mapper_cparms->hdr_field = params->hdr_field;
+	mapper_cparms->enc_field = params->enc_field;
 	mapper_cparms->comp_fld = params->comp_fld;
 	mapper_cparms->act = &params->act_bitmap;
 	mapper_cparms->act_prop = &params->act_prop;
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_enum.h +39 -5

80 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c +6 -2
index 58b4dba63c..b5bce6f4c7 100644
@@ -198,7 +198,9 @@ const struct bnxt_ulp_template_device_tbls ulp_template_thor_tbls[] = {
 struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	[BNXT_ULP_DEVICE_ID_WH_PLUS] = {
 	.description             = "Whitney_Plus",
-	.byte_order              = BNXT_ULP_BYTE_ORDER_LE,
+	.key_byte_order          = BNXT_ULP_BYTE_ORDER_LE,
+	.result_byte_order       = BNXT_ULP_BYTE_ORDER_LE,
+	.encap_byte_order        = BNXT_ULP_BYTE_ORDER_BE,
 	.encap_byte_swap         = 1,
 	.int_flow_db_num_entries = 16384,
 	.ext_flow_db_num_entries = 32768,
@@ -218,7 +220,9 @@ struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	},
 	[BNXT_ULP_DEVICE_ID_THOR] = {
 	.description             = "Thor",
-	.byte_order              = BNXT_ULP_BYTE_ORDER_LE,
+	.key_byte_order          = BNXT_ULP_BYTE_ORDER_LE,
+	.result_byte_order       = BNXT_ULP_BYTE_ORDER_LE,
+	.encap_byte_order        = BNXT_ULP_BYTE_ORDER_BE,
 	.encap_byte_swap         = 1,
 	.int_flow_db_num_entries = 16384,
 	.ext_flow_db_num_entries = 32768,
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_act.c +1 -3
index ce5a70b0c5..9faf25aaf0 100644
@@ -3,7 +3,7 @@
  * All rights reserved.
  */
 
-/* date: Thu May 13 18:15:56 2021 */
+/* date: Wed May 26 15:11:34 2021 */
 
 #include "ulp_template_db_enum.h"
 #include "ulp_template_db_field.h"
@@ -41,7 +41,6 @@ struct bnxt_ulp_mapper_tbl_info ulp_thor_act_tbl_list[] = {
 	.tbl_operand = BNXT_ULP_RF_IDX_FLOW_CNTR_PTR_0,
 	.fdb_opcode = BNXT_ULP_FDB_OPC_PUSH_FID,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPC_NOP,
-	.byte_order = BNXT_ULP_BYTE_ORDER_LE,
 	.result_start_idx = 0,
 	.result_bit_size = 64,
 	.result_num_fields = 1
@@ -62,7 +61,6 @@ struct bnxt_ulp_mapper_tbl_info ulp_thor_act_tbl_list[] = {
 	.tbl_operand = BNXT_ULP_RF_IDX_MAIN_ACTION_PTR,
 	.fdb_opcode = BNXT_ULP_FDB_OPC_PUSH_FID,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPC_NOP,
-	.byte_order = BNXT_ULP_BYTE_ORDER_LE,
 	.result_start_idx = 1,
 	.result_bit_size = 128,
 	.result_num_fields = 17
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c +7 -39

250 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_act.c +1196 -504

2,507 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_class.c +58 -164

55 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.c +3 -3
index 039c9c2a6b..1cb52e9bfa 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +1 -1
index 8680ee8f65..6dbec92745 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c +1 -1
index bc5627ec5b..5f5b5d639e 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_mapper.c +123 -29

152 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.h +4 -0
index d4d6969bb5..4d6ba0f73a 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +208 -129

337 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +2 -0
index 673172c811..e14f86278a 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +7 -3
index 2685e63432..904763f27d 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_utils.c +31 -42

73 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_utils.h +12 -15
index e1b0e773f3..68a537fa0a 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

#44 lore raw

PATCH v3 8/13 net/bnxt: add wild card TCAM byte order for Thor

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

The wild card tcam for Thor platform is different from the profile tcam byte order.

---
 .../generic_templates/ulp_template_db_tbl.c   |  2 ++
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          | 25 +++++++++++++------
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |  1 +
 3 files changed, 21 insertions(+), 7 deletions(-)
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c +2 -0
index b5bce6f4c7..68f1b5fd00 100644
@@ -201,6 +201,7 @@ struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	.key_byte_order          = BNXT_ULP_BYTE_ORDER_LE,
 	.result_byte_order       = BNXT_ULP_BYTE_ORDER_LE,
 	.encap_byte_order        = BNXT_ULP_BYTE_ORDER_BE,
+	.wc_key_byte_order       = BNXT_ULP_BYTE_ORDER_BE,
 	.encap_byte_swap         = 1,
 	.int_flow_db_num_entries = 16384,
 	.ext_flow_db_num_entries = 32768,
@@ -223,6 +224,7 @@ struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	.key_byte_order          = BNXT_ULP_BYTE_ORDER_LE,
 	.result_byte_order       = BNXT_ULP_BYTE_ORDER_LE,
 	.encap_byte_order        = BNXT_ULP_BYTE_ORDER_BE,
+	.wc_key_byte_order       = BNXT_ULP_BYTE_ORDER_BE,
 	.encap_byte_swap         = 1,
 	.int_flow_db_num_entries = 16384,
 	.ext_flow_db_num_entries = 32768,
drivers/net/bnxt/tf_ulp/ulp_mapper.c +18 -7
index 2687a545f3..bcc089b3e1 100644
@@ -1953,6 +1953,15 @@ static void ulp_mapper_wc_tcam_tbl_post_process(struct ulp_blob *blob)
 #endif
 }
 
+static int32_t ulp_mapper_tcam_is_wc_tcam(struct bnxt_ulp_mapper_tbl_info *tbl)
+{
+	if (tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM ||
+	    tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM_HIGH ||
+	    tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM_LOW)
+		return 1;
+	return 0;
+}
+
 static int32_t
 ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 			    struct bnxt_ulp_mapper_tbl_info *tbl)
@@ -1972,6 +1981,7 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	uint32_t hit = 0;
 	uint16_t tmplen = 0;
 	uint16_t idx;
+	enum bnxt_ulp_byte_order key_byte_order;
 
 	/* Set the key and mask to the original key and mask. */
 	key = &okey;
@@ -2003,10 +2013,13 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		return -EINVAL;
 	}
 
-	if (!ulp_blob_init(key, tbl->blob_key_bit_size,
-			   dparms->key_byte_order) ||
-	    !ulp_blob_init(mask, tbl->blob_key_bit_size,
-			   dparms->key_byte_order) ||
+	if (ulp_mapper_tcam_is_wc_tcam(tbl))
+		key_byte_order = dparms->wc_key_byte_order;
+	else
+		key_byte_order = dparms->key_byte_order;
+
+	if (!ulp_blob_init(key, tbl->blob_key_bit_size, key_byte_order) ||
+	    !ulp_blob_init(mask, tbl->blob_key_bit_size, key_byte_order) ||
 	    !ulp_blob_init(&data, tbl->result_bit_size,
 			   dparms->result_byte_order) ||
 	    !ulp_blob_init(&update_data, tbl->result_bit_size,
@@ -2043,9 +2056,7 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	}
 
 	/* For wild card tcam perform the post process to swap the blob */
-	if (tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM ||
-	    tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM_HIGH ||
-	    tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM_LOW) {
+	if (ulp_mapper_tcam_is_wc_tcam(tbl)) {
 		if (dparms->dynamic_pad_en) {
 			/* Sets up the slices for writing to the WC TCAM */
 			rc = ulp_mapper_wc_tcam_tbl_dyn_post_process(dparms,
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +1 -0
index 904763f27d..e2a4b81cec 100644
@@ -212,6 +212,7 @@ struct bnxt_ulp_device_params {
 	enum bnxt_ulp_byte_order	key_byte_order;
 	enum bnxt_ulp_byte_order	result_byte_order;
 	enum bnxt_ulp_byte_order	encap_byte_order;
+	enum bnxt_ulp_byte_order	wc_key_byte_order;
 	uint8_t				encap_byte_swap;
 	uint8_t				num_phy_ports;
 	uint32_t			mark_db_lfid_entries;
Signature · 1 line
2.17.1
#45 lore raw

PATCH v3 9/13 net/bnxt: add flow templates for Thor

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

1. Add support for egress flows with port and count action for Thor platform.
2. Added templates to support VXLAN encapsulation feature for Thor.
3. Added support for VXLAN decap and VLAN pop actions along with the ingress flow.
4. Added templates to enable VXLAN decap support for f1 and f2 flows.
5. Added templates Thor VF Rep support
6. Added Thor ingress mod table actions for NAT, NAPT, and TTL.
7. Added mirror/sample table support
8. Added supported for IPv6 flows for Thor.

---
 drivers/net/bnxt/tf_core/tf_tcam.c            |     6 +-
 .../generic_templates/ulp_template_db_enum.h  |   123 +-
 .../generic_templates/ulp_template_db_tbl.c   |   182 +-
 .../ulp_template_db_thor_act.c                |  4329 +-
 .../ulp_template_db_thor_class.c              | 44219 ++++++++++++++--
 .../ulp_template_db_wh_plus_class.c           |     4 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |    10 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |    18 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |     1 +
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |     3 +
 10 files changed, 44734 insertions(+), 4161 deletions(-)
drivers/net/bnxt/tf_core/tf_tcam.c +5 -1
index 806af3070a..273f20858b 100644
@@ -323,8 +323,12 @@ tf_tcam_alloc(struct tf *tfp,
 		}
 
 		/* return the start index of each row */
-		if (i == 0)
+		if (parms->priority == 0) {
+			if (i == 0)
+				parms->idx = index;
+		} else {
 			parms->idx = index;
+		}
 	}
 
 	return 0;
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_enum.h +82 -41

200 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c +178 -4

245 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_act.c +4267 -62

2,542 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c +40174 -4045

44,219 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_class.c +2 -2
index 7203dcf1fb..2870a0615a 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_mapper.c +6 -4
index bcc089b3e1..234f7ea2fa 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +16 -2
index 4e9968e5fa..dce95de05c 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +1 -0
index e2a4b81cec..1683cd7ec4 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_utils.c +3 -0
index fc4f435c97..686b80e456 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

#46 lore raw

PATCH v3 10/13 net/bnxt: tf core SRAM Manager

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

Adjust info message to debug level to prevent excessive logging.

---
 drivers/net/bnxt/tf_core/tf_tbl_sram.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/tf_core/tf_tbl_sram.c +1 -1
index ea10afecb6..d7727f7a11 100644
@@ -130,7 +130,7 @@ static int tf_tbl_sram_get_info(struct tf_tbl_sram_get_info_parms *parms)
 	if (slices)
 		parms->slice_size = tf_tbl_sram_slices_2_size[slices];
 
-	TFP_DRV_LOG(INFO,
+	TFP_DRV_LOG(DEBUG,
 		    "(%s) bank(%s) slice_size(%s)\n",
 		    tf_tbl_type_2_str(parms->tbl_type),
 		    tf_sram_bank_2_str(parms->bank_id),
Signature · 1 line
2.17.1
#47 lore raw

PATCH v3 11/13 net/bnxt: dynamically allocate space for EM defrag function

In reply to Venkat Duvvuru

From: Randy Schacher <[email protected]>

Alter defrag function to dynamically allocate and delete free_list and adj_list buffers.

---
 drivers/net/bnxt/tf_core/dpool.c | 38 +++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 13 deletions(-)
drivers/net/bnxt/tf_core/dpool.c +25 -13
index 145efa486f..5c03f775a5 100644
@@ -7,9 +7,6 @@
 #include <stdbool.h>
 #include <stdint.h>
 #include <errno.h>
-
-#include <rte_malloc.h>
-
 #include "tfp.h"
 #include "dpool.h"
 
@@ -84,13 +81,13 @@ static int dpool_move(struct dpool *dpool,
 	return 0;
 }
 
-
 int dpool_defrag(struct dpool *dpool,
 		 uint32_t entry_size,
 		 uint8_t defrag)
 {
 	struct dpool_free_list *free_list;
 	struct dpool_adj_list *adj_list;
+	struct tfp_calloc_parms parms;
 	uint32_t count;
 	uint32_t index;
 	uint32_t used;
@@ -103,15 +100,31 @@ int dpool_defrag(struct dpool *dpool,
 	uint32_t max_size = 0;
 	int rc;
 
-	free_list = rte_zmalloc("dpool_free_list",
-				sizeof(struct dpool_free_list), 0);
+	parms.nitems = 1;
+	parms.size = sizeof(struct dpool_free_list);
+	parms.alignment = 0;
+
+	rc = tfp_calloc(&parms);
+
+	if (rc)
+		return rc;
+
+	free_list = (struct dpool_free_list *)parms.mem_va;
 	if (free_list == NULL) {
 		TFP_DRV_LOG(ERR, "dpool free list allocation failed\n");
 		return -ENOMEM;
 	}
 
-	adj_list = rte_zmalloc("dpool_adjacent_list",
-				sizeof(struct dpool_adj_list), 0);
+	parms.nitems = 1;
+	parms.size = sizeof(struct dpool_adj_list);
+	parms.alignment = 0;
+
+	rc = tfp_calloc(&parms);
+
+	if (rc)
+		return rc;
+
+	adj_list = (struct dpool_adj_list *)parms.mem_va;
 	if (adj_list == NULL) {
 		TFP_DRV_LOG(ERR, "dpool adjacent list allocation failed\n");
 		return -ENOMEM;
@@ -239,8 +252,8 @@ int dpool_defrag(struct dpool *dpool,
 					free_list->entry[largest_free_index].index,
 					max_index);
 			if (rc) {
-				rte_free(free_list);
-				rte_free(adj_list);
+				tfp_free(free_list);
+				tfp_free(adj_list);
 				return rc;
 			}
 		} else {
@@ -249,12 +262,11 @@ int dpool_defrag(struct dpool *dpool,
 	}
 
 done:
-	rte_free(free_list);
-	rte_free(adj_list);
+	tfp_free(free_list);
+	tfp_free(adj_list);
 	return largest_free_size;
 }
 
-
 uint32_t dpool_alloc(struct dpool *dpool,
 		     uint32_t size,
 		     uint8_t defrag)
Signature · 1 line
2.17.1
#48 lore raw

Re: [dpdk-dev] [PATCH v3 11/13] net/bnxt: dynamically allocate space for EM defrag function

Quoted 5 lines · Venkat Duvvuru

From: Randy Schacher <[email protected]>

Alter defrag function to dynamically allocate and delete free_list and adj_list buffers.

Can you explain a little more the reasoning/motivation/impact of the change, why buffers are dynamically allocated, is there any impact the user application will observe after this?

Quoted 2 lines

<...>

#49 lore raw

PATCH v3 12/13 net/bnxt: sram manager shared session

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

Fix shared session support issues due to SRAM manager additions. Shared session does not support slices within RM blocks. Calculate resources required without slices and determine base addresses using old methods for the shared session.

---
 drivers/net/bnxt/tf_core/tf_em_internal.c |   5 +-
 drivers/net/bnxt/tf_core/tf_rm.c          | 134 +++++++++++++++++++---
 drivers/net/bnxt/tf_core/tf_tbl_sram.c    |  73 +++++++++---
 3 files changed, 176 insertions(+), 36 deletions(-)
drivers/net/bnxt/tf_core/tf_em_internal.c +4 -1
index 2d57595f17..67ba011eae 100644
@@ -326,8 +326,11 @@ tf_em_int_unbind(struct tf *tfp)
 		return rc;
 
 	if (!tf_session_is_shared_session(tfs)) {
-		for (i = 0; i < TF_DIR_MAX; i++)
+		for (i = 0; i < TF_DIR_MAX; i++) {
+			if (tfs->em_pool[i] == NULL)
+				continue;
 			dpool_free_all(tfs->em_pool[i]);
+		}
 	}
 
 	rc = tf_session_get_db(tfp, TF_MODULE_TYPE_EM, &em_db_ptr);
drivers/net/bnxt/tf_core/tf_rm.c +115 -19

245 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tbl_sram.c +57 -16

99 lines not on this page · raw message

Signature · 1 line
2.17.1
#50 lore raw

PATCH v3 13/13 net/bnxt: add enhancements to TF ULP

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

1. Added support to specify l4 port masks in the template. Also enabled source mac in the wild card key for ingress flows.

2. Added support to enable offload for ipv6 traffic within the vxlan tunnel connection.

3. The flow counters is reduced from 7168 to 6912 for Whitney. The stats operation is updated to reflect counts for packets at egress from CFA instead of ingress to CFA

4. The miss path for the l2 context table is updated with correct parif and default action handler to handle the miss path for egress flows.

5. This support enables allocation of encapsulation, modification and action records dynamically based on a given flow actions.

6. Reduce the l2context resource requests during open_session. Move the SMAC from the L2Context to the EM/WM

7. Remap the parif in the bd action in order to eliminate incorrect replication of broadcast packets. The layer 4 source port mask was incorrectly updated in the outer layer 4 source port mask instead of inner layer 4. Add the l3 proto to egress rules, switch to using computed fields for l4 ports, add internal smac to f1/f2 flows, add l3 proto to ingress ipv6 flows

---
 drivers/net/bnxt/tf_core/tf_tbl_sram.c        |    7 -
 .../generic_templates/ulp_template_db_class.c | 8102 ++++++++++++-----
 .../generic_templates/ulp_template_db_enum.h  |  675 +-
 .../generic_templates/ulp_template_db_field.h |  195 +-
 .../generic_templates/ulp_template_db_tbl.c   | 2136 ++++-
 .../ulp_template_db_thor_act.c                |  996 +-
 .../ulp_template_db_thor_class.c              | 7495 ++++++++-------
 .../ulp_template_db_wh_plus_class.c           |   14 +-
 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c         |    4 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |  135 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |  175 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   10 +
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |    3 +-
 13 files changed, 13538 insertions(+), 6409 deletions(-)
drivers/net/bnxt/tf_core/tf_tbl_sram.c +0 -7
index 167078a8c6..636811bc2d 100644
@@ -134,11 +134,6 @@ static int tf_tbl_sram_get_info(struct tf_tbl_sram_get_info_parms *parms)
 	if (slices)
 		parms->slice_size = tf_tbl_sram_slices_2_size[slices];
 
-	TFP_DRV_LOG(DEBUG,
-		    "(%s) bank(%s) slice_size(%s)\n",
-		    tf_tbl_type_2_str(parms->tbl_type),
-		    tf_sram_bank_2_str(parms->bank_id),
-		    tf_sram_slice_2_str(parms->slice_size));
 	return rc;
 }
 
@@ -373,7 +368,6 @@ tf_tbl_sram_free(struct tf *tfp __rte_unused,
 		return rc;
 	}
 
-
 #if (DBG_SRAM == 1)
 	{
 		struct tf_sram_mgr_dump_parms dparms;
@@ -411,7 +405,6 @@ tf_tbl_sram_set(struct tf *tfp,
 	void *sram_handle = NULL;
 	uint16_t base = 0, shift = 0;
 
-
 	TF_CHECK_PARMS3(tfp, parms, parms->data);
 
 	/* Retrieve the session information */
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_class.c +5835 -2267

2,975 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_enum.h +418 -257

675 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_field.h +155 -40

195 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c +1632 -504

2,136 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_act.c +871 -125

996 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c +4420 -3075

7,495 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_class.c +7 -7
index 2870a0615a..4b9cb7fd5b 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c +2 -2
index c6b2b1675d..7b6db7a0f8 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_mapper.c +105 -30

135 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +81 -94

175 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +10 -0
index 1683cd7ec4..d3bfb8c12d 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_utils.c +2 -1
index 686b80e456..df3afaa6fd 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

#51 lore raw

Re: [dpdk-dev] [PATCH v3 13/13] net/bnxt: add enhancements to TF ULP

Quoted 33 lines · Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

1. Added support to specify l4 port masks in the template. Also enabled source mac in the wild card key for ingress flows.

2. Added support to enable offload for ipv6 traffic within the vxlan tunnel connection.

3. The flow counters is reduced from 7168 to 6912 for Whitney. The stats operation is updated to reflect counts for packets at egress from CFA instead of ingress to CFA

4. The miss path for the l2 context table is updated with correct parif and default action handler to handle the miss path for egress flows.

5. This support enables allocation of encapsulation, modification and action records dynamically based on a given flow actions.

6. Reduce the l2context resource requests during open_session. Move the SMAC from the L2Context to the EM/WM

7. Remap the parif in the bd action in order to eliminate incorrect replication of broadcast packets. The layer 4 source port mask was incorrectly updated in the outer layer 4 source port mask instead of inner layer 4. Add the l3 proto to egress rules, switch to using computed fields for l4 ports, add internal smac to f1/f2 flows, add l3 proto to ingress ipv6 flows

Quoted 15 lines
---
 drivers/net/bnxt/tf_core/tf_tbl_sram.c        |    7 -
 .../generic_templates/ulp_template_db_class.c | 8102 ++++++++++++-----
 .../generic_templates/ulp_template_db_enum.h  |  675 +-
 .../generic_templates/ulp_template_db_field.h |  195 +-
 .../generic_templates/ulp_template_db_tbl.c   | 2136 ++++-
 .../ulp_template_db_thor_act.c                |  996 +-
 .../ulp_template_db_thor_class.c              | 7495 ++++++++-------
 .../ulp_template_db_wh_plus_class.c           |   14 +-
 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c         |    4 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |  135 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |  175 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   10 +
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |    3 +-
 13 files changed, 13538 insertions(+), 6409 deletions(-)

Hi Ajit,

I can see release notes ('release_21_11.rst') updated in the commit in net-brcm tree [1], but that change doesn't exist in the original patchset.

I think it is crucial to be in sync on this, that content of the patches shouldn't be changed in our sub-trees. cc'ed other subtree maintainers too, to be sure we are all in same page.

Time to time we are doing simple changes/fixes in the repos, to help to the developer, but changes shouldn't go beyond it, and I believe even those changes should be communicated in the mail list for the record.

If the content of the patches needs to be changed, I think that should be done by sending a new version of the set. I am aware it is additional overhead, but still doing otherwise can cause more trouble in long term.

Thanks,
ferruh

[1]
https://git.dpdk.org/next/dpdk-next-net-brcm/commit/?id=840e8bd01b6493940ac6130e1280713ec708d000

#52 lore raw
In reply to Venkat Duvvuru
Quoted 8 lines · Venkat Duvvuru

This patch set adds support for new offload features/enhancments for Thor adapters like VF representor support, new flow matches/actions & dynamic SRAM manager support.

v2 ==> v3
=========
* Fixed compilation issue.

Patchset applied to dpdk-next-net-brcm. Thanks

Quoted 97 lines

Farah Smith (4):
net/bnxt: tf core index table updates
net/bnxt: add Thor SRAM mgr model
net/bnxt: tf core SRAM Manager
net/bnxt: sram manager shared session

Jay Ding (1):
net/bnxt: add flow meter drop counter support

Kishore Padmanabha (6):
net/bnxt: add flow templates support for Thor net/bnxt: add support for tunnel offloads net/bnxt: add support for dynamic encap action net/bnxt: add wild card TCAM byte order for Thor net/bnxt: add flow templates for Thor net/bnxt: add enhancements to TF ULP

Peter Spreadborough (1):
net/bnxt: enable dpool allocator

Randy Schacher (1):
net/bnxt: dynamically allocate space for EM defrag function

 drivers/net/bnxt/tf_core/cfa_resource_types.h |     5 +-
 drivers/net/bnxt/tf_core/dpool.c              |    38 +-
 drivers/net/bnxt/tf_core/ll.c                 |     3 +
 drivers/net/bnxt/tf_core/ll.h                 |    50 +-
 drivers/net/bnxt/tf_core/meson.build          |     2 +
 drivers/net/bnxt/tf_core/tf_core.c            |   169 +-
 drivers/net/bnxt/tf_core/tf_core.h            |   159 +-
 drivers/net/bnxt/tf_core/tf_device.c          |    40 +-
 drivers/net/bnxt/tf_core/tf_device.h          |   137 +-
 drivers/net/bnxt/tf_core/tf_device_p4.c       |    77 +-
 drivers/net/bnxt/tf_core/tf_device_p4.h       |    50 +-
 drivers/net/bnxt/tf_core/tf_device_p58.c      |   112 +-
 drivers/net/bnxt/tf_core/tf_device_p58.h      |    70 +-
 drivers/net/bnxt/tf_core/tf_em.h              |    10 -
 drivers/net/bnxt/tf_core/tf_em_common.c       |     4 +
 .../net/bnxt/tf_core/tf_em_hash_internal.c    |    34 -
 drivers/net/bnxt/tf_core/tf_em_internal.c     |   185 +-
 drivers/net/bnxt/tf_core/tf_msg.c             |     2 +-
 drivers/net/bnxt/tf_core/tf_rm.c              |   180 +-
 drivers/net/bnxt/tf_core/tf_rm.h              |    62 +-
 drivers/net/bnxt/tf_core/tf_session.c         |    56 +
 drivers/net/bnxt/tf_core/tf_session.h         |    58 +-
 drivers/net/bnxt/tf_core/tf_sram_mgr.c        |   971 +
 drivers/net/bnxt/tf_core/tf_sram_mgr.h        |   317 +
 drivers/net/bnxt/tf_core/tf_tbl.c             |   259 +-
 drivers/net/bnxt/tf_core/tf_tbl.h             |    87 +-
 drivers/net/bnxt/tf_core/tf_tbl_sram.c        |   747 +
 drivers/net/bnxt/tf_core/tf_tbl_sram.h        |   154 +
 drivers/net/bnxt/tf_core/tf_tcam.c            |    16 +-
 drivers/net/bnxt/tf_core/tf_tcam.h            |     7 +
 drivers/net/bnxt/tf_core/tf_tcam_shared.c     |    28 +-
 drivers/net/bnxt/tf_core/tf_util.c            |    12 +
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |    10 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |    52 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |    20 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |   226 +-
 .../bnxt/tf_ulp/generic_templates/meson.build |    17 +-
 .../generic_templates/ulp_template_db_act.c   |     2 +-
 .../generic_templates/ulp_template_db_class.c | 12109 +++-
 .../generic_templates/ulp_template_db_enum.h  |   618 +-
 .../generic_templates/ulp_template_db_field.h |   767 +-
 .../generic_templates/ulp_template_db_tbl.c   |  2757 +-
 .../ulp_template_db_thor_act.c                |  5079 +-
 .../ulp_template_db_thor_class.c              | 45573 ++++++++++++++--
 .../ulp_template_db_wh_plus_act.c             |  1700 +-
 .../ulp_template_db_wh_plus_class.c           |  8329 ++-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |    48 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h          |     8 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |   678 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |    68 +-
 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c         |     9 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   448 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |    10 +-
 drivers/net/bnxt/tf_ulp/ulp_matcher.c         |    13 +
 drivers/net/bnxt/tf_ulp/ulp_port_db.c         |    15 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c |    31 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |   663 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |    12 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |    32 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.c             |   521 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.h             |    89 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |    71 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |    27 +-
 meson_options.txt                             |     2 +
 64 files changed, 71149 insertions(+), 12956 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_sram_mgr.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_sram_mgr.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_tbl_sram.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_tbl_sram.h

--
2.17.1

#53 lore raw
In reply to Venkat Duvvuru
Quoted 25 lines · Venkat Duvvuru

This patch set adds support for new offload features/enhancments for Thor adapters like VF representor support, new flow matches/actions & dynamic SRAM manager support.

v2 ==> v3
=========
* Fixed compilation issue.

Farah Smith (4):
net/bnxt: tf core index table updates
net/bnxt: add Thor SRAM mgr model
net/bnxt: tf core SRAM Manager
net/bnxt: sram manager shared session

Jay Ding (1):
net/bnxt: add flow meter drop counter support

Kishore Padmanabha (6):
net/bnxt: add flow templates support for Thor net/bnxt: add support for tunnel offloads net/bnxt: add support for dynamic encap action net/bnxt: add wild card TCAM byte order for Thor net/bnxt: add flow templates for Thor net/bnxt: add enhancements to TF ULP

Quoted 6 lines

Peter Spreadborough (1):
net/bnxt: enable dpool allocator

Randy Schacher (1):
net/bnxt: dynamically allocate space for EM defrag function

Hi Ajit,

There are a few checkpatch errors reported, can you please check them?

Also CI seems failed to apply the patch and not run, indeed patch is merged in the correct tree, but seems on top of wrong commit [1].

Aaron, Lab,

Can you please check if there is an issue with the tree synchronization. (This is previously reported for eventdev too, perhaps there may be a generic problem.)

Can you please trigger the testing of this set after repo updated?

[1]
dpdk-next-net-brcm (175af25734f295874e31b33ccd0879e69fd152a9)

#54 lore raw
Quoted 44 lines · Ferruh Yigit
Quoted 25 lines · Venkat Duvvuru

This patch set adds support for new offload features/enhancments for Thor adapters like VF representor support, new flow matches/actions & dynamic SRAM manager support.

v2 ==> v3
=========
* Fixed compilation issue.

Farah Smith (4):
net/bnxt: tf core index table updates
net/bnxt: add Thor SRAM mgr model
net/bnxt: tf core SRAM Manager
net/bnxt: sram manager shared session

Jay Ding (1):
net/bnxt: add flow meter drop counter support

Kishore Padmanabha (6):
net/bnxt: add flow templates support for Thor net/bnxt: add support for tunnel offloads net/bnxt: add support for dynamic encap action net/bnxt: add wild card TCAM byte order for Thor net/bnxt: add flow templates for Thor net/bnxt: add enhancements to TF ULP

Quoted 6 lines

Peter Spreadborough (1):
net/bnxt: enable dpool allocator

Randy Schacher (1):
net/bnxt: dynamically allocate space for EM defrag function

Hi Ajit,

There are a few checkpatch errors reported, can you please check them?

Also CI seems failed to apply the patch and not run, indeed patch is merged in the correct tree, but seems on top of wrong commit [1].

Aaron, Lab,

Quoted 8 lines

Can you please check if there is an issue with the tree synchronization. (This is previously reported for eventdev too, perhaps there may be a generic problem.)

Can you please trigger the testing of this set after repo updated?

[1]
dpdk-next-net-brcm (175af25734f295874e31b33ccd0879e69fd152a9)

Hi all,

This is related to a current migration that is in process within the lab. I have found the root cause for this issue, and I am working on a solution to fix this tree synchronization issue. Once I have a stable solution, I will rerun the patches that failed to apply.

Thanks,
Brandon

Signature · 5 lines
Brandon Lo
UNH InterOperability Laboratory
21 Madbury Rd, Suite 100, Durham, NH 03824
[email protected]
www.iol.unh.edu
#55 lore raw
In reply to Ferruh Yigit
Quoted 30 lines · Ferruh Yigit
Quoted 28 lines · Venkat Duvvuru

This patch set adds support for new offload features/enhancments for Thor adapters like VF representor support, new flow matches/actions & dynamic SRAM manager support.

v2 ==> v3
=========
* Fixed compilation issue.

Farah Smith (4):
net/bnxt: tf core index table updates
net/bnxt: add Thor SRAM mgr model
net/bnxt: tf core SRAM Manager
net/bnxt: sram manager shared session

Jay Ding (1):
net/bnxt: add flow meter drop counter support

Kishore Padmanabha (6):
net/bnxt: add flow templates support for Thor net/bnxt: add support for tunnel offloads net/bnxt: add support for dynamic encap action net/bnxt: add wild card TCAM byte order for Thor net/bnxt: add flow templates for Thor net/bnxt: add enhancements to TF ULP

Peter Spreadborough (1):
net/bnxt: enable dpool allocator

Quoted 7 lines
Quoted 3 lines

Randy Schacher (1):
net/bnxt: dynamically allocate space for EM defrag function

Hi Ajit,

There are a few checkpatch errors reported, can you please check them?

I had taken care of them, but I forgot to mention it in my merge mail. So the next spin of the patches should have those addressed.

Quoted 3 lines

Also CI seems failed to apply the patch and not run, indeed patch is merged in the correct tree, but seems on top of wrong commit [1].

Looks like Brandon has root caused it.

Thanks
Ajit

Quoted 12 lines

Aaron, Lab,

Can you please check if there is an issue with the tree synchronization. (This is previously reported for eventdev too, perhaps there may be a generic problem.)

Can you please trigger the testing of this set after repo updated?

[1]
dpdk-next-net-brcm (175af25734f295874e31b33ccd0879e69fd152a9)

#56 lore raw

v4 cover enhancements to host based flow table management

In reply to Venkat Duvvuru

This patch set adds support for new offload features/enhancments for Thor adapters like VF representor support, new flow matches/actions & dynamic SRAM manager support.

Farah Smith (4):
net/bnxt: updates to TF core index table
net/bnxt: add SRAM manager model
net/bnxt: change log level to debug
net/bnxt: add SRAM manager shared session

Jay Ding (1):
net/bnxt: add flow meter drop counter support

Kishore Padmanabha (6):
net/bnxt: add flow template support for Thor net/bnxt: add support for tunnel offload API net/bnxt: add support for dynamic encap action net/bnxt: add wild card TCAM byte order for Thor net/bnxt: add flow templates for Thor net/bnxt: add enhancements to TF ULP

Peter Spreadborough (1):
net/bnxt: enable dpool allocator

Randy Schacher (1):
net/bnxt: dynamically allocate space for EM defrag function

 doc/guides/rel_notes/release_21_11.rst        |     6 +
 drivers/net/bnxt/tf_core/cfa_resource_types.h |     5 +-
 drivers/net/bnxt/tf_core/dpool.c              |    38 +-
 drivers/net/bnxt/tf_core/ll.c                 |     3 +
 drivers/net/bnxt/tf_core/ll.h                 |    50 +-
 drivers/net/bnxt/tf_core/meson.build          |     2 +
 drivers/net/bnxt/tf_core/tf_core.c            |   169 +-
 drivers/net/bnxt/tf_core/tf_core.h            |   159 +-
 drivers/net/bnxt/tf_core/tf_device.c          |    40 +-
 drivers/net/bnxt/tf_core/tf_device.h          |   137 +-
 drivers/net/bnxt/tf_core/tf_device_p4.c       |    77 +-
 drivers/net/bnxt/tf_core/tf_device_p4.h       |    50 +-
 drivers/net/bnxt/tf_core/tf_device_p58.c      |   112 +-
 drivers/net/bnxt/tf_core/tf_device_p58.h      |    70 +-
 drivers/net/bnxt/tf_core/tf_em.h              |    10 -
 drivers/net/bnxt/tf_core/tf_em_common.c       |     4 +
 .../net/bnxt/tf_core/tf_em_hash_internal.c    |    34 -
 drivers/net/bnxt/tf_core/tf_em_internal.c     |   185 +-
 drivers/net/bnxt/tf_core/tf_msg.c             |     2 +-
 drivers/net/bnxt/tf_core/tf_rm.c              |   180 +-
 drivers/net/bnxt/tf_core/tf_rm.h              |    62 +-
 drivers/net/bnxt/tf_core/tf_session.c         |    56 +
 drivers/net/bnxt/tf_core/tf_session.h         |    58 +-
 drivers/net/bnxt/tf_core/tf_sram_mgr.c        |   971 +
 drivers/net/bnxt/tf_core/tf_sram_mgr.h        |   317 +
 drivers/net/bnxt/tf_core/tf_tbl.c             |   259 +-
 drivers/net/bnxt/tf_core/tf_tbl.h             |    87 +-
 drivers/net/bnxt/tf_core/tf_tbl_sram.c        |   747 +
 drivers/net/bnxt/tf_core/tf_tbl_sram.h        |   154 +
 drivers/net/bnxt/tf_core/tf_tcam.c            |    16 +-
 drivers/net/bnxt/tf_core/tf_tcam.h            |     7 +
 drivers/net/bnxt/tf_core/tf_tcam_shared.c     |    28 +-
 drivers/net/bnxt/tf_core/tf_util.c            |    12 +
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |    10 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |    52 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |    20 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |   226 +-
 .../bnxt/tf_ulp/generic_templates/meson.build |     3 +
 .../generic_templates/ulp_template_db_act.c   |     2 +-
 .../generic_templates/ulp_template_db_class.c | 12109 +++-
 .../generic_templates/ulp_template_db_enum.h  |   618 +-
 .../generic_templates/ulp_template_db_field.h |   767 +-
 .../generic_templates/ulp_template_db_tbl.c   |  2757 +-
 .../ulp_template_db_thor_act.c                |  5079 +-
 .../ulp_template_db_thor_class.c              | 45573 ++++++++++++++--
 .../ulp_template_db_wh_plus_act.c             |  1700 +-
 .../ulp_template_db_wh_plus_class.c           |  8329 ++-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |    48 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h          |     8 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |   678 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |    68 +-
 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c         |     9 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   448 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |    10 +-
 drivers/net/bnxt/tf_ulp/ulp_matcher.c         |    13 +
 drivers/net/bnxt/tf_ulp/ulp_port_db.c         |    15 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c |    31 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |   663 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |    12 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |    32 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.c             |   521 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.h             |    89 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |    71 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |    27 +-
 64 files changed, 71146 insertions(+), 12949 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_sram_mgr.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_sram_mgr.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_tbl_sram.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_tbl_sram.h
Signature · 1 line
2.17.1
#57 lore raw

PATCH v4 1/13 net/bnxt: updates to TF core index table

From: Farah Smith <[email protected]>

Update the TRUFLOW core index table and
remove unused shadow table functionality.

---
 drivers/net/bnxt/tf_core/tf_core.c       |  65 --------------
 drivers/net/bnxt/tf_core/tf_core.h       | 103 +----------------------
 drivers/net/bnxt/tf_core/tf_device.h     |  22 -----
 drivers/net/bnxt/tf_core/tf_device_p4.c  |   2 -
 drivers/net/bnxt/tf_core/tf_device_p58.c |   2 -
 drivers/net/bnxt/tf_core/tf_em_common.c  |   4 +
 drivers/net/bnxt/tf_core/tf_tbl.c        |  21 -----
 drivers/net/bnxt/tf_core/tf_tbl.h        |  72 ----------------
 drivers/net/bnxt/tf_ulp/ulp_mapper.c     |   3 +-
 9 files changed, 7 insertions(+), 287 deletions(-)
drivers/net/bnxt/tf_core/tf_core.c +0 -65
index 97e6165e92..5458f76e2d 100644
@@ -1105,71 +1105,6 @@ tf_alloc_tbl_entry(struct tf *tfp,
 	return 0;
 }
 
-int
-tf_search_tbl_entry(struct tf *tfp,
-		    struct tf_search_tbl_entry_parms *parms)
-{
-	int rc;
-	struct tf_session *tfs;
-	struct tf_dev_info *dev;
-	struct tf_tbl_alloc_search_parms sparms;
-
-	TF_CHECK_PARMS2(tfp, parms);
-
-	/* Retrieve the session information */
-	rc = tf_session_get_session(tfp, &tfs);
-	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "%s: Failed to lookup session, rc:%s\n",
-			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
-		return rc;
-	}
-
-	/* Retrieve the device information */
-	rc = tf_session_get_device(tfs, &dev);
-	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "%s: Failed to lookup device, rc:%s\n",
-			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
-		return rc;
-	}
-
-	if (dev->ops->tf_dev_alloc_search_tbl == NULL) {
-		rc = -EOPNOTSUPP;
-		TFP_DRV_LOG(ERR,
-			    "%s: Operation not supported, rc:%s\n",
-			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
-		return rc;
-	}
-
-	memset(&sparms, 0, sizeof(struct tf_tbl_alloc_search_parms));
-	sparms.dir = parms->dir;
-	sparms.type = parms->type;
-	sparms.result = parms->result;
-	sparms.result_sz_in_bytes = parms->result_sz_in_bytes;
-	sparms.alloc = parms->alloc;
-	sparms.tbl_scope_id = parms->tbl_scope_id;
-	rc = dev->ops->tf_dev_alloc_search_tbl(tfp, &sparms);
-	if (rc) {
-		TFP_DRV_LOG(ERR,
-			    "%s: TBL allocation failed, rc:%s\n",
-			    tf_dir_2_str(parms->dir),
-			    strerror(-rc));
-		return rc;
-	}
-
-	/* Return the outputs from the search */
-	parms->hit = sparms.hit;
-	parms->search_status = sparms.search_status;
-	parms->ref_cnt = sparms.ref_cnt;
-	parms->idx = sparms.idx;
-
-	return 0;
-}
-
 int
 tf_free_tbl_entry(struct tf *tfp,
 		  struct tf_free_tbl_entry_parms *parms)
drivers/net/bnxt/tf_core/tf_core.h +2 -101

122 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device.h +0 -22
index da3f541685..b43cfc6925 100644
@@ -347,28 +347,6 @@ struct tf_dev_ops {
 	int (*tf_dev_free_ext_tbl)(struct tf *tfp,
 				   struct tf_tbl_free_parms *parms);
 
-	/**
-	 * Searches for the specified table type element in a shadow DB.
-	 *
-	 * This API searches for the specified table type element in a
-	 * device specific shadow DB. If the element is found the
-	 * reference count for the element is updated. If the element
-	 * is not found a new element is allocated from the table type
-	 * DB and then inserted into the shadow DB.
-	 *
-	 * [in] tfp
-	 *   Pointer to TF handle
-	 *
-	 * [in] parms
-	 *   Pointer to table allocation and search parameters
-	 *
-	 * Returns
-	 *   - (0) if successful.
-	 *   - (-EINVAL) on failure.
-	 */
-	int (*tf_dev_alloc_search_tbl)(struct tf *tfp,
-				       struct tf_tbl_alloc_search_parms *parms);
-
 	/**
 	 * Sets the specified table type element.
 	 *
drivers/net/bnxt/tf_core/tf_device_p4.c +0 -2
index 971fab7bda..2e7ccec123 100644
@@ -236,7 +236,6 @@ const struct tf_dev_ops tf_dev_ops_p4_init = {
 	.tf_dev_alloc_tbl = NULL,
 	.tf_dev_free_ext_tbl = NULL,
 	.tf_dev_free_tbl = NULL,
-	.tf_dev_alloc_search_tbl = NULL,
 	.tf_dev_set_tbl = NULL,
 	.tf_dev_set_ext_tbl = NULL,
 	.tf_dev_get_tbl = NULL,
@@ -282,7 +281,6 @@ const struct tf_dev_ops tf_dev_ops_p4 = {
 	.tf_dev_alloc_ext_tbl = tf_tbl_ext_alloc,
 	.tf_dev_free_tbl = tf_tbl_free,
 	.tf_dev_free_ext_tbl = tf_tbl_ext_free,
-	.tf_dev_alloc_search_tbl = tf_tbl_alloc_search,
 	.tf_dev_set_tbl = tf_tbl_set,
 	.tf_dev_set_ext_tbl = tf_tbl_ext_common_set,
 	.tf_dev_get_tbl = tf_tbl_get,
drivers/net/bnxt/tf_core/tf_device_p58.c +0 -2
index 6bbc5e21e9..ce4d8c661f 100644
@@ -280,7 +280,6 @@ const struct tf_dev_ops tf_dev_ops_p58_init = {
 	.tf_dev_alloc_tbl = NULL,
 	.tf_dev_free_ext_tbl = NULL,
 	.tf_dev_free_tbl = NULL,
-	.tf_dev_alloc_search_tbl = NULL,
 	.tf_dev_set_tbl = NULL,
 	.tf_dev_set_ext_tbl = NULL,
 	.tf_dev_get_tbl = NULL,
@@ -326,7 +325,6 @@ const struct tf_dev_ops tf_dev_ops_p58 = {
 	.tf_dev_alloc_ext_tbl = tf_tbl_ext_alloc,
 	.tf_dev_free_tbl = tf_tbl_free,
 	.tf_dev_free_ext_tbl = tf_tbl_ext_free,
-	.tf_dev_alloc_search_tbl = tf_tbl_alloc_search,
 	.tf_dev_set_tbl = tf_tbl_set,
 	.tf_dev_set_ext_tbl = tf_tbl_ext_common_set,
 	.tf_dev_get_tbl = tf_tbl_get,
drivers/net/bnxt/tf_core/tf_em_common.c +4 -0
index 812ccb0d29..3bdfc14e05 100644
@@ -23,6 +23,10 @@
 
 #include "bnxt.h"
 
+
+/** Invalid table scope id */
+#define TF_TBL_SCOPE_INVALID 0xffffffff
+
 /* Number of pointers per page_size */
 #define MAX_PAGE_PTRS(page_size)  ((page_size) / sizeof(void *))
 
drivers/net/bnxt/tf_core/tf_tbl.c +0 -21
index ced59130b2..e77399c6bd 100644
@@ -26,11 +26,6 @@
 
 struct tf;
 
-/**
- * Table Shadow DBs
- */
-static void *shadow_tbl_db[TF_DIR_MAX];
-
 /**
  * Shadow init flag, set on bind and cleared on unbind
  */
@@ -327,22 +322,6 @@ tf_tbl_free(struct tf *tfp __rte_unused,
 	return 0;
 }
 
-int
-tf_tbl_alloc_search(struct tf *tfp,
-		    struct tf_tbl_alloc_search_parms *parms)
-{
-	int rc = 0;
-	TF_CHECK_PARMS2(tfp, parms);
-
-	if (!shadow_init || !shadow_tbl_db[parms->dir]) {
-		TFP_DRV_LOG(ERR, "%s: Shadow TBL not initialized.\n",
-			    tf_dir_2_str(parms->dir));
-		return -EINVAL;
-	}
-
-	return rc;
-}
-
 int
 tf_tbl_set(struct tf *tfp,
 	   struct tf_tbl_set_parms *parms)
drivers/net/bnxt/tf_core/tf_tbl.h +0 -72

90 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.c +1 -2
index 871dbad0fe..f3a60cc880 100644
@@ -189,13 +189,12 @@ ulp_mapper_resource_index_tbl_alloc(struct bnxt_ulp_context *ulp_ctx,
 
 	aparms.type = glb_res->resource_type;
 	aparms.dir = glb_res->direction;
-	aparms.search_enable = 0;
 	aparms.tbl_scope_id = tbl_scope_id;
 
 	/* Allocate the index tbl using tf api */
 	rc = tf_alloc_tbl_entry(tfp, &aparms);
 	if (rc) {
-		BNXT_TF_DBG(ERR, "Failed to alloc identifier [%s][%d]\n",
+		BNXT_TF_DBG(ERR, "Failed to alloc index table [%s][%d]\n",
 			    tf_dir_2_str(aparms.dir), aparms.type);
 		return rc;
 	}
Signature · 1 line
2.17.1
#58 lore raw

PATCH v4 2/13 net/bnxt: enable dpool allocator

In reply to Venkat Duvvuru

From: Peter Spreadborough <[email protected]>

Enable dynamic entry allocator for Exact Match SRAM entries. Deprecate static entry allocator code.

---
 drivers/net/bnxt/tf_core/tf_device_p58.c      |   4 -
 drivers/net/bnxt/tf_core/tf_em.h              |  10 -
 .../net/bnxt/tf_core/tf_em_hash_internal.c    |  34 ----
 drivers/net/bnxt/tf_core/tf_em_internal.c     | 180 +-----------------
 4 files changed, 1 insertion(+), 227 deletions(-)
drivers/net/bnxt/tf_core/tf_device_p58.c +0 -4
index ce4d8c661f..808dcb1f77 100644
@@ -348,11 +348,7 @@ const struct tf_dev_ops tf_dev_ops_p58 = {
 	.tf_dev_get_tcam_resc_info = tf_tcam_get_resc_info,
 	.tf_dev_insert_int_em_entry = tf_em_hash_insert_int_entry,
 	.tf_dev_delete_int_em_entry = tf_em_hash_delete_int_entry,
-#if (TF_EM_ALLOC == 1)
 	.tf_dev_move_int_em_entry = tf_em_move_int_entry,
-#else
-	.tf_dev_move_int_em_entry = NULL,
-#endif
 	.tf_dev_insert_ext_em_entry = NULL,
 	.tf_dev_delete_ext_em_entry = NULL,
 	.tf_dev_get_em_resc_info = tf_em_get_resc_info,
drivers/net/bnxt/tf_core/tf_em.h +0 -10
index 568071ad8c..074c128651 100644
@@ -13,16 +13,6 @@
 
 #include "hcapi_cfa_defs.h"
 
-/**
- * TF_EM_ALLOC
- *
- * 0: Use stack allocator with fixed sized entries
- *    (default).
- * 1: Use dpool allocator with variable size
- *    entries.
- */
-#define TF_EM_ALLOC 0
-
 #define TF_EM_MIN_ENTRIES     (1 << 15) /* 32K */
 #define TF_EM_MAX_ENTRIES     (1 << 27) /* 128M */
 
drivers/net/bnxt/tf_core/tf_em_hash_internal.c +0 -34
index 098e8af07e..60273a798c 100644
@@ -22,9 +22,7 @@
 /**
  * EM Pool
  */
-#if (TF_EM_ALLOC == 1)
 #include "dpool.h"
-#endif
 
 /**
  * Insert EM internal entry API
@@ -41,11 +39,7 @@ tf_em_hash_insert_int_entry(struct tf *tfp,
 	uint16_t rptr_index = 0;
 	uint8_t rptr_entry = 0;
 	uint8_t num_of_entries = 0;
-#if (TF_EM_ALLOC == 1)
 	struct dpool *pool;
-#else
-	struct stack *pool;
-#endif
 	uint32_t index;
 	uint32_t key0_hash;
 	uint32_t key1_hash;
@@ -62,7 +56,6 @@ tf_em_hash_insert_int_entry(struct tf *tfp,
 	rc = tf_session_get_device(tfs, &dev);
 	if (rc)
 		return rc;
-#if (TF_EM_ALLOC == 1)
 	pool = (struct dpool *)tfs->em_pool[parms->dir];
 	index = dpool_alloc(pool,
 			    parms->em_record_sz_in_bits / 128,
@@ -74,16 +67,6 @@ tf_em_hash_insert_int_entry(struct tf *tfp,
 			    tf_dir_2_str(parms->dir));
 		return -1;
 	}
-#else
-	pool = (struct stack *)tfs->em_pool[parms->dir];
-	rc = stack_pop(pool, &index);
-	if (rc) {
-		PMD_DRV_LOG(ERR,
-			    "%s, EM entry index allocation failed\n",
-			    tf_dir_2_str(parms->dir));
-		return rc;
-	}
-#endif
 
 	if (dev->ops->tf_dev_cfa_key_hash == NULL)
 		return -EINVAL;
@@ -103,11 +86,7 @@ tf_em_hash_insert_int_entry(struct tf *tfp,
 						  &num_of_entries);
 	if (rc) {
 		/* Free the allocated index before returning */
-#if (TF_EM_ALLOC == 1)
 		dpool_free(pool, index);
-#else
-		stack_push(pool, index);
-#endif
 		return -1;
 	}
 
@@ -128,9 +107,7 @@ tf_em_hash_insert_int_entry(struct tf *tfp,
 				     rptr_index,
 				     rptr_entry,
 				     0);
-#if (TF_EM_ALLOC == 1)
 	dpool_set_entry_data(pool, index, parms->flow_handle);
-#endif
 	return 0;
 }
 
@@ -146,11 +123,7 @@ tf_em_hash_delete_int_entry(struct tf *tfp,
 {
 	int rc = 0;
 	struct tf_session *tfs;
-#if (TF_EM_ALLOC == 1)
 	struct dpool *pool;
-#else
-	struct stack *pool;
-#endif
 	/* Retrieve the session information */
 	rc = tf_session_get_session(tfp, &tfs);
 	if (rc) {
@@ -165,19 +138,13 @@ tf_em_hash_delete_int_entry(struct tf *tfp,
 
 	/* Return resource to pool */
 	if (rc == 0) {
-#if (TF_EM_ALLOC == 1)
 		pool = (struct dpool *)tfs->em_pool[parms->dir];
 		dpool_free(pool, parms->index);
-#else
-		pool = (struct stack *)tfs->em_pool[parms->dir];
-		stack_push(pool, parms->index);
-#endif
 	}
 
 	return rc;
 }
 
-#if (TF_EM_ALLOC == 1)
 /** Move EM internal entry API
  *
  * returns:
@@ -212,4 +179,3 @@ tf_em_move_int_entry(struct tf *tfp,
 
 	return rc;
 }
-#endif
drivers/net/bnxt/tf_core/tf_em_internal.c +1 -179

258 lines not on this page · raw message

Signature · 1 line
2.17.1
#59 lore raw

PATCH v4 3/13 net/bnxt: add flow meter drop counter support

In reply to Venkat Duvvuru

From: Jay Ding <[email protected]>

This patch adds flow meter drop counter support for Thor.

---
 drivers/net/bnxt/tf_core/cfa_resource_types.h |  5 +-
 drivers/net/bnxt/tf_core/tf_core.h            |  8 +-
 drivers/net/bnxt/tf_core/tf_device_p58.c      |  1 +
 drivers/net/bnxt/tf_core/tf_device_p58.h      | 14 ++++
 drivers/net/bnxt/tf_core/tf_tbl.c             | 74 +++++++++++--------
 drivers/net/bnxt/tf_core/tf_util.c            |  2 +
 6 files changed, 68 insertions(+), 36 deletions(-)
drivers/net/bnxt/tf_core/cfa_resource_types.h +3 -2
index cbab0d0078..36a55d4e17 100644
@@ -104,10 +104,11 @@
 #define CFA_RESOURCE_TYPE_P58_WC_FKB             0x12UL
 /* VEB TCAM */
 #define CFA_RESOURCE_TYPE_P58_VEB_TCAM           0x13UL
+/* Metadata */
+#define CFA_RESOURCE_TYPE_P58_METADATA           0x14UL
 /* Meter drop counter */
 #define CFA_RESOURCE_TYPE_P58_METER_DROP_CNT     0x15UL
-#define CFA_RESOURCE_TYPE_P58_LAST               CFA_RESOURCE_TYPE_P58_METER_DROP_CNT
-
+#define CFA_RESOURCE_TYPE_P58_LAST              CFA_RESOURCE_TYPE_P58_METER_DROP_CNT
 
 /* Multicast Group */
 #define CFA_RESOURCE_TYPE_P45_MCG                 0x0UL
drivers/net/bnxt/tf_core/tf_core.h +6 -2
index 7e0cdf7e0d..af8d13bd7e 100644
@@ -283,9 +283,9 @@ enum tf_tbl_type {
 	TF_TBL_TYPE_ACT_MODIFY_32B,
 	/** TH 64B Modify Record */
 	TF_TBL_TYPE_ACT_MODIFY_64B,
-	/** (Future) Meter Profiles */
+	/** Meter Profiles */
 	TF_TBL_TYPE_METER_PROF,
-	/** (Future) Meter Instance */
+	/** Meter Instance */
 	TF_TBL_TYPE_METER_INST,
 	/** Wh+/SR/Th Mirror Config */
 	TF_TBL_TYPE_MIRROR_CONFIG,
@@ -301,6 +301,8 @@ enum tf_tbl_type {
 	TF_TBL_TYPE_EM_FKB,
 	/** TH WC Flexible Key builder */
 	TF_TBL_TYPE_WC_FKB,
+	/** Meter Drop Counter */
+	TF_TBL_TYPE_METER_DROP_CNT,
 
 	/* External */
 
@@ -2194,6 +2196,8 @@ enum tf_global_config_type {
 	TF_TUNNEL_ENCAP,  /**< Tunnel Encap Config(TECT) */
 	TF_ACTION_BLOCK,  /**< Action Block Config(ABCR) */
 	TF_COUNTER_CFG,   /**< Counter Configuration (CNTRS_CTRL) */
+	TF_METER_CFG,     /**< Meter Config(ACTP4_FMTCR) */
+	TF_METER_INTERVAL_CFG, /**< Meter Interval Config(FMTCR_INTERVAL)  */
 	TF_GLOBAL_CFG_TYPE_MAX
 };
 
drivers/net/bnxt/tf_core/tf_device_p58.c +1 -0
index 808dcb1f77..a492c62bff 100644
@@ -43,6 +43,7 @@ const char *tf_resource_str_p58[CFA_RESOURCE_TYPE_P58_LAST + 1] = {
 	[CFA_RESOURCE_TYPE_P58_EM_FKB]             = "em_fkb  ",
 	[CFA_RESOURCE_TYPE_P58_WC_FKB]             = "wc_fkb  ",
 	[CFA_RESOURCE_TYPE_P58_VEB_TCAM]           = "veb     ",
+	[CFA_RESOURCE_TYPE_P58_METADATA]           = "metadata",
 };
 
 /**
drivers/net/bnxt/tf_core/tf_device_p58.h +14 -0
index 66b0f4e983..8c2e07aa34 100644
@@ -75,10 +75,18 @@ struct tf_rm_element_cfg tf_tbl_p58[TF_TBL_TYPE_MAX] = {
 		TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_METER,
 		0, 0, 0
 	},
+	[TF_TBL_TYPE_METER_DROP_CNT] = {
+		TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_METER_DROP_CNT,
+		0, 0, 0
+	},
 	[TF_TBL_TYPE_MIRROR_CONFIG] = {
 		TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_MIRROR,
 		0, 0, 0
 	},
+	[TF_TBL_TYPE_METADATA] = {
+		TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P58_METADATA,
+		0, 0, 0
+	},
 	/* Policy - ARs in bank 1 */
 	[TF_TBL_TYPE_FULL_ACT_RECORD] = {
 		.cfg_type        = TF_RM_ELEM_CFG_HCAPI_BA_PARENT,
@@ -194,5 +202,11 @@ struct tf_global_cfg_cfg tf_global_cfg_p58[TF_GLOBAL_CFG_TYPE_MAX] = {
 	[TF_COUNTER_CFG] = {
 		TF_GLOBAL_CFG_CFG_HCAPI, TF_COUNTER_CFG
 	},
+	[TF_METER_CFG] = {
+		TF_GLOBAL_CFG_CFG_HCAPI, TF_METER_CFG
+	},
+	[TF_METER_INTERVAL_CFG] = {
+		TF_GLOBAL_CFG_CFG_HCAPI, TF_METER_INTERVAL_CFG
+	},
 };
 #endif /* _TF_DEVICE_P58_H_ */
drivers/net/bnxt/tf_core/tf_tbl.c +42 -32

88 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_util.c +2 -0
index e712816209..d100399d0a 100644
@@ -112,6 +112,8 @@ tf_tbl_type_2_str(enum tf_tbl_type tbl_type)
 		return "WC Flexible Key Builder";
 	case TF_TBL_TYPE_EXT:
 		return "External";
+	case TF_TBL_TYPE_METER_DROP_CNT:
+		return "Meter drop counter";
 	default:
 		return "Invalid tbl type";
 	}
Signature · 1 line
2.17.1
#60 lore raw

PATCH v4 4/13 net/bnxt: add SRAM manager model

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

The SRAM manager supports allocation and free of variable sized records within SRAM memory. These record sizes are 8, 16, 32, or 64B. The SRAM manager algorithm will not fragment memory during run time. Previous implementation only included fixed size 64B records regardless of the size required.

---
 drivers/net/bnxt/tf_core/ll.c             |   3 +
 drivers/net/bnxt/tf_core/ll.h             |  50 +-
 drivers/net/bnxt/tf_core/meson.build      |   2 +
 drivers/net/bnxt/tf_core/tf_core.c        | 104 ++-
 drivers/net/bnxt/tf_core/tf_core.h        |  48 +-
 drivers/net/bnxt/tf_core/tf_device.c      |  40 +-
 drivers/net/bnxt/tf_core/tf_device.h      | 133 ++-
 drivers/net/bnxt/tf_core/tf_device_p4.c   |  75 +-
 drivers/net/bnxt/tf_core/tf_device_p4.h   |  50 +-
 drivers/net/bnxt/tf_core/tf_device_p58.c  | 105 ++-
 drivers/net/bnxt/tf_core/tf_device_p58.h  |  60 +-
 drivers/net/bnxt/tf_core/tf_msg.c         |   2 +-
 drivers/net/bnxt/tf_core/tf_rm.c          |  46 +-
 drivers/net/bnxt/tf_core/tf_rm.h          |  62 +-
 drivers/net/bnxt/tf_core/tf_session.c     |  56 ++
 drivers/net/bnxt/tf_core/tf_session.h     |  58 +-
 drivers/net/bnxt/tf_core/tf_sram_mgr.c    | 971 ++++++++++++++++++++++
 drivers/net/bnxt/tf_core/tf_sram_mgr.h    | 317 +++++++
 drivers/net/bnxt/tf_core/tf_tbl.c         | 186 +----
 drivers/net/bnxt/tf_core/tf_tbl.h         |  15 +-
 drivers/net/bnxt/tf_core/tf_tbl_sram.c    | 713 ++++++++++++++++
 drivers/net/bnxt/tf_core/tf_tbl_sram.h    | 154 ++++
 drivers/net/bnxt/tf_core/tf_tcam.c        |  10 +-
 drivers/net/bnxt/tf_core/tf_tcam.h        |   7 +
 drivers/net/bnxt/tf_core/tf_tcam_shared.c |  28 +-
 drivers/net/bnxt/tf_core/tf_util.c        |  10 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c        |  23 +
 27 files changed, 2976 insertions(+), 352 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_sram_mgr.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_sram_mgr.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_tbl_sram.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_tbl_sram.h
drivers/net/bnxt/tf_core/ll.c +3 -0
index cd168a7970..f2bdff6b9e 100644
@@ -13,6 +13,7 @@ void ll_init(struct ll *ll)
 {
 	ll->head = NULL;
 	ll->tail = NULL;
+	ll->cnt = 0;
 }
 
 /* insert entry in linked list */
@@ -30,6 +31,7 @@ void ll_insert(struct ll *ll,
 		entry->next->prev = entry;
 		ll->head = entry->next->prev;
 	}
+	ll->cnt++;
 }
 
 /* delete entry from linked list */
@@ -49,4 +51,5 @@ void ll_delete(struct ll *ll,
 		entry->prev->next = entry->next;
 		entry->next->prev = entry->prev;
 	}
+	ll->cnt--;
 }
drivers/net/bnxt/tf_core/ll.h +49 -1

72 lines not on this page · raw message

drivers/net/bnxt/tf_core/meson.build +2 -0
index f28e77ec2e..206935d18a 100644
@@ -16,6 +16,8 @@ sources += files(
         'stack.c',
         'tf_rm.c',
         'tf_tbl.c',
+        'tf_tbl_sram.c',
+        'tf_sram_mgr.c',
         'tf_em_common.c',
         'tf_em_host.c',
         'tf_em_internal.c',
drivers/net/bnxt/tf_core/tf_core.c +65 -39

173 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_core.h +26 -22

95 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device.c +34 -6
index 498e668b16..25a7166bbb 100644
@@ -11,10 +11,14 @@
 #include "tf_rm.h"
 #ifdef TF_TCAM_SHARED
 #include "tf_tcam_shared.h"
+#include "tf_tbl_sram.h"
 #endif /* TF_TCAM_SHARED */
 
 struct tf;
 
+/* Number of slices per row for WC TCAM */
+uint16_t g_wc_num_slices_per_row = TF_WC_TCAM_1_SLICE_PER_ROW;
+
 /* Forward declarations */
 static int tf_dev_unbind_p4(struct tf *tfp);
 static int tf_dev_unbind_p58(struct tf *tfp);
@@ -83,7 +87,8 @@ static int
 tf_dev_bind_p4(struct tf *tfp,
 	       bool shadow_copy,
 	       struct tf_session_resources *resources,
-	       struct tf_dev_info *dev_handle)
+	       struct tf_dev_info *dev_handle,
+	       enum tf_wc_num_slice wc_num_slices)
 {
 	int rc;
 	int frc;
@@ -131,7 +136,6 @@ tf_dev_bind_p4(struct tf *tfp,
 	if (rsv_cnt) {
 		tbl_cfg.num_elements = TF_TBL_TYPE_MAX;
 		tbl_cfg.cfg = tf_tbl_p4;
-		tbl_cfg.shadow_copy = shadow_copy;
 		tbl_cfg.resources = resources;
 		rc = tf_tbl_bind(tfp, &tbl_cfg);
 		if (rc) {
@@ -151,6 +155,7 @@ tf_dev_bind_p4(struct tf *tfp,
 		tcam_cfg.cfg = tf_tcam_p4;
 		tcam_cfg.shadow_copy = shadow_copy;
 		tcam_cfg.resources = resources;
+		tcam_cfg.wc_num_slices = wc_num_slices;
 #ifdef TF_TCAM_SHARED
 		rc = tf_tcam_shared_bind(tfp, &tcam_cfg);
 #else /* !TF_TCAM_SHARED */
@@ -369,7 +374,8 @@ static int
 tf_dev_bind_p58(struct tf *tfp,
 		bool shadow_copy,
 		struct tf_session_resources *resources,
-		struct tf_dev_info *dev_handle)
+		struct tf_dev_info *dev_handle,
+		enum tf_wc_num_slice wc_num_slices)
 {
 	int rc;
 	int frc;
@@ -414,7 +420,6 @@ tf_dev_bind_p58(struct tf *tfp,
 	if (rsv_cnt) {
 		tbl_cfg.num_elements = TF_TBL_TYPE_MAX;
 		tbl_cfg.cfg = tf_tbl_p58;
-		tbl_cfg.shadow_copy = shadow_copy;
 		tbl_cfg.resources = resources;
 		rc = tf_tbl_bind(tfp, &tbl_cfg);
 		if (rc) {
@@ -423,6 +428,13 @@ tf_dev_bind_p58(struct tf *tfp,
 			goto fail;
 		}
 		no_rsv_flag = false;
+
+		rc = tf_tbl_sram_bind(tfp);
+		if (rc) {
+			TFP_DRV_LOG(ERR,
+				    "SRAM table initialization failure\n");
+			goto fail;
+		}
 	}
 
 	rsv_cnt = tf_dev_reservation_check(TF_TCAM_TBL_TYPE_MAX,
@@ -433,6 +445,7 @@ tf_dev_bind_p58(struct tf *tfp,
 		tcam_cfg.cfg = tf_tcam_p58;
 		tcam_cfg.shadow_copy = shadow_copy;
 		tcam_cfg.resources = resources;
+		tcam_cfg.wc_num_slices = wc_num_slices;
 #ifdef TF_TCAM_SHARED
 		rc = tf_tcam_shared_bind(tfp, &tcam_cfg);
 #else /* !TF_TCAM_SHARED */
@@ -565,6 +578,18 @@ tf_dev_unbind_p58(struct tf *tfp)
 		fail = true;
 	}
 
+	/* Unbind the SRAM table prior to table as the table manager
+	 * owns and frees the table DB while the SRAM table manager owns
+	 * and manages it's internal data structures.  SRAM table manager
+	 * relies on the table rm_db to exist.
+	 */
+	rc = tf_tbl_sram_unbind(tfp);
+	if (rc) {
+		TFP_DRV_LOG(ERR,
+			    "Device unbind failed, SRAM table\n");
+		fail = true;
+	}
+
 	rc = tf_tbl_unbind(tfp);
 	if (rc) {
 		TFP_DRV_LOG(INFO,
@@ -606,6 +631,7 @@ tf_dev_bind(struct tf *tfp __rte_unused,
 	    enum tf_device_type type,
 	    bool shadow_copy,
 	    struct tf_session_resources *resources,
+	    uint16_t wc_num_slices,
 	    struct tf_dev_info *dev_handle)
 {
 	switch (type) {
@@ -615,13 +641,15 @@ tf_dev_bind(struct tf *tfp __rte_unused,
 		return tf_dev_bind_p4(tfp,
 				      shadow_copy,
 				      resources,
-				      dev_handle);
+				      dev_handle,
+				      wc_num_slices);
 	case TF_DEVICE_TYPE_THOR:
 		dev_handle->type = type;
 		return tf_dev_bind_p58(tfp,
 				       shadow_copy,
 				       resources,
-				       dev_handle);
+				       dev_handle,
+				       wc_num_slices);
 	default:
 		TFP_DRV_LOG(ERR,
 			    "No such device\n");
drivers/net/bnxt/tf_core/tf_device.h +132 -1

187 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p4.c +70 -5

141 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p4.h +25 -25

140 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p58.c +95 -10

183 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_device_p58.h +30 -30

188 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_msg.c +1 -1
index e07d9168be..0fbb2fe837 100644
@@ -2231,7 +2231,7 @@ tf_msg_get_if_tbl_entry(struct tf *tfp,
 	if (rc != 0)
 		return rc;
 
-	tfp_memcpy(params->data, resp.data, req.size);
+	tfp_memcpy(&params->data[0], resp.data, req.size);
 
 	return 0;
 }
drivers/net/bnxt/tf_core/tf_rm.c +43 -3

95 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_rm.h +36 -26

114 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_session.c +56 -0

72 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_session.h +55 -3

88 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_sram_mgr.c new file +971 -0

971 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_sram_mgr.h new file +317 -0

317 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tbl.c +40 -146

14 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tbl.h +1 -14
index 7e1107ffe7..2483718e5d 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_core/tf_tbl_sram.c new file +713 -0

713 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tbl_sram.h new file +154 -0

154 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tcam.c +4 -6
index 45206c5992..806af3070a 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_core/tf_tcam.h +7 -0
index bed17af6ae..b1e7a92b0b 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_core/tf_tcam_shared.c +14 -14
index 83b6fbd5fb..c120c6f577 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_core/tf_util.c +10 -0
index d100399d0a..c1b9be0755 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/bnxt_ulp.c +23 -0
index dbf85e4eda..183bae66c5 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

#61 lore raw

PATCH v4 5/13 net/bnxt: add flow template support for Thor

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

Template adds non-VFR based support for testpmd with:
matches to include
- DMAC, SIP, DIP, Proto, Sport, Dport
- SIP, DIP, Proto, Sport, Dport
actions:
- count, drop

---
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |   6 +
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |  36 +++---
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |  12 ++
 .../bnxt/tf_ulp/generic_templates/meson.build |   3 +
 .../ulp_template_db_thor_class.c              |   1 -
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |   2 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         | 120 +++++++++++++++++-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |  26 +++-
 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c         |   5 +
 drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c          |   2 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          | 111 +++++++++++++++-
 drivers/net/bnxt/tf_ulp/ulp_matcher.c         |  13 ++
 drivers/net/bnxt/tf_ulp/ulp_port_db.c         |  15 ++-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |   9 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.c             |  20 +++
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |   8 +-
 16 files changed, 348 insertions(+), 41 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_tf_common.h +6 -0
index f59da41e54..e0ebed3fed 100644
@@ -13,6 +13,12 @@
 
 #define BNXT_TF_DBG(lvl, fmt, args...)	PMD_DRV_LOG(lvl, fmt, ## args)
 
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#define BNXT_TF_INF(fmt, args...)	PMD_DRV_LOG(INFO, fmt, ## args)
+#else
+#define BNXT_TF_INF(fmt, args...)
+#endif
+
 #define BNXT_ULP_EM_FLOWS			8192
 #define BNXT_ULP_1M_FLOWS			1000000
 #define BNXT_EEM_RX_GLOBAL_ID_MASK		(BNXT_ULP_1M_FLOWS - 1)
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +15 -21
index 183bae66c5..475c7a6cdf 100644
@@ -698,6 +698,11 @@ ulp_eem_tbl_scope_init(struct bnxt *bp)
 			    rc);
 		return rc;
 	}
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+	BNXT_TF_DBG(DEBUG, "TableScope=0x%0x %d\n",
+		    params.tbl_scope_id,
+		    params.tbl_scope_id);
+#endif
 	rc = bnxt_ulp_cntxt_tbl_scope_id_set(bp->ulp_ctx, params.tbl_scope_id);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Unable to set table scope id\n");
@@ -825,6 +830,8 @@ ulp_ctx_init(struct bnxt *bp,
 		goto error_deinit;
 	}
 
+	/* TODO: For now we are overriding to APP:1 on this branch*/
+	bp->app_id = 1;
 	rc = bnxt_ulp_cntxt_app_id_set(bp->ulp_ctx, bp->app_id);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Unable to set app_id for ULP init.\n");
@@ -838,11 +845,6 @@ ulp_ctx_init(struct bnxt *bp,
 		goto error_deinit;
 	}
 
-	if (devid == BNXT_ULP_DEVICE_ID_THOR) {
-		ulp_data->ulp_flags &= ~BNXT_ULP_VF_REP_ENABLED;
-		BNXT_TF_DBG(ERR, "Enabled non-VFR mode\n");
-	}
-
 	/*
 	 * Shared session must be created before first regular session but after
 	 * the ulp_ctx is valid.
@@ -902,7 +904,7 @@ ulp_dparms_init(struct bnxt *bp, struct bnxt_ulp_context *ulp_ctx)
 	dparms->ext_flow_db_num_entries = bp->max_num_kflows * 1024;
 	/* GFID =  2 * num_flows */
 	dparms->mark_db_gfid_entries = dparms->ext_flow_db_num_entries * 2;
-	BNXT_TF_DBG(DEBUG, "Set the number of flows = %"PRIu64"\n",
+	BNXT_TF_DBG(DEBUG, "Set the number of flows = %" PRIu64 "\n",
 		    dparms->ext_flow_db_num_entries);
 
 	return 0;
@@ -1393,17 +1395,13 @@ bnxt_ulp_port_init(struct bnxt *bp)
 	uint32_t ulp_flags;
 	int32_t rc = 0;
 
+	if (!bp || !BNXT_TRUFLOW_EN(bp))
+		return rc;
+
 	if (!BNXT_PF(bp) && !BNXT_VF_IS_TRUSTED(bp)) {
 		BNXT_TF_DBG(ERR,
 			    "Skip ulp init for port: %d, not a TVF or PF\n",
-			    bp->eth_dev->data->port_id);
-		return rc;
-	}
-
-	if (!BNXT_TRUFLOW_EN(bp)) {
-		BNXT_TF_DBG(DEBUG,
-			    "Skip ulp init for port: %d, truflow is not enabled\n",
-			    bp->eth_dev->data->port_id);
+			bp->eth_dev->data->port_id);
 		return rc;
 	}
 
@@ -1524,6 +1522,9 @@ bnxt_ulp_port_deinit(struct bnxt *bp)
 	struct rte_pci_device *pci_dev;
 	struct rte_pci_addr *pci_addr;
 
+	if (!BNXT_TRUFLOW_EN(bp))
+		return;
+
 	if (!BNXT_PF(bp) && !BNXT_VF_IS_TRUSTED(bp)) {
 		BNXT_TF_DBG(ERR,
 			    "Skip ULP deinit port:%d, not a TVF or PF\n",
@@ -1531,13 +1532,6 @@ bnxt_ulp_port_deinit(struct bnxt *bp)
 		return;
 	}
 
-	if (!BNXT_TRUFLOW_EN(bp)) {
-		BNXT_TF_DBG(DEBUG,
-			    "Skip ULP deinit for port:%d, truflow is not enabled\n",
-			    bp->eth_dev->data->port_id);
-		return;
-	}
-
 	if (!bp->ulp_ctx) {
 		BNXT_TF_DBG(DEBUG, "ulp ctx already de-allocated\n");
 		return;
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +12 -0
index 19e9dba356..238b1d9657 100644
@@ -13,6 +13,9 @@
 #include "ulp_port_db.h"
 #include "ulp_ha_mgr.h"
 #include <rte_malloc.h>
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#include "ulp_template_debug_proto.h"
+#endif
 
 static int32_t
 bnxt_ulp_flow_validate_args(const struct rte_flow_attr *attr,
@@ -222,6 +225,15 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev,
 	else if (ret == BNXT_TF_RC_FID)
 		goto return_fid;
 
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_PARSER
+	/* Dump the rte flow pattern */
+	ulp_parser_hdr_info_dump(&params);
+	/* Dump the rte flow action */
+	ulp_parser_act_info_dump(&params);
+#endif
+#endif
+
 	ret = ulp_matcher_pattern_match(&params, &params.class_id);
 	if (ret != BNXT_TF_RC_SUCCESS)
 		goto free_fid;
drivers/net/bnxt/tf_ulp/generic_templates/meson.build +3 -0
index b1e7b8cc32..4ace838a3c 100644
@@ -2,7 +2,10 @@
 # Copyright(c) 2018 Intel Corporation
 # Copyright(c) 2020 Broadcom
 
+#Include the folder for headers
 includes += include_directories('.')
+
+#Add the source files
 sources += files(
         'ulp_template_db_class.c',
         'ulp_template_db_act.c',
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c +0 -1
index 83f6152700..e342f340d9 100644
@@ -6104,4 +6104,3 @@ struct bnxt_ulp_mapper_ident_info ulp_thor_class_ident_list[] = {
 	.ident_bit_pos = 29
 	}
 };
-
drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c +1 -1
index 13f71ed83b..22c51976ac 100644
@@ -35,7 +35,7 @@ ulp_fc_mgr_shadow_mem_alloc(struct hw_fc_mem_info *parms, int size)
 	rte_mem_lock_page(parms->mem_va);
 
 	parms->mem_pa = (void *)(uintptr_t)rte_mem_virt2phy(parms->mem_va);
-	if (parms->mem_pa == (void *)(uintptr_t)RTE_BAD_IOVA) {
+	if (parms->mem_pa == (void *)RTE_BAD_IOVA) {
 		BNXT_TF_DBG(ERR, "Allocate failed mem_pa\n");
 		return -ENOMEM;
 	}
drivers/net/bnxt/tf_ulp/ulp_flow_db.c +118 -2

147 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +25 -1
index 67afca8872..0ddfa6f66d 100644
@@ -18,7 +18,7 @@
 
 /*
  * Structure for the flow database resource information
- * The below structure is based on the below partitions
+ * 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
@@ -417,4 +417,28 @@ ulp_flow_db_parent_flow_count_reset(struct bnxt_ulp_context *ulp_ctxt);
 void ulp_flow_db_shared_session_set(struct ulp_flow_db_res_params *res,
 				    enum bnxt_ulp_shared_session shared);
 
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+/*
+ * Dump the flow entry details
+ *
+ * flow_db [in] Ptr to flow db
+ * fid [in] flow id
+ *
+ * returns none
+ */
+void
+ulp_flow_db_debug_fid_dump(struct bnxt_ulp_flow_db *flow_db, uint32_t fid);
+
+/*
+ * Dump the flow database entry details
+ *
+ * ulp_ctxt [in] Ptr to ulp_context
+ * flow_id [in] if zero then all fids are dumped.
+ *
+ * returns none
+ */
+int32_t	ulp_flow_db_debug_dump(struct bnxt_ulp_context *ulp_ctxt,
+			       uint32_t flow_id);
+#endif
+
 #endif /* _ULP_FLOW_DB_H_ */
drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c +5 -0
index 3c1af0b007..c6b2b1675d 100644
@@ -10,6 +10,11 @@
 #include "ulp_mapper.h"
 #include "ulp_flow_db.h"
 
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#include "ulp_template_debug_proto.h"
+#include "ulp_tf_debug.h"
+#endif
+
 /* Retrieve the generic table  initialization parameters for the tbl_idx */
 static struct bnxt_ulp_generic_tbl_params*
 ulp_mapper_gen_tbl_params_get(uint32_t tbl_idx)
drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c +1 -1
index 5f5b5d639e..bc5627ec5b 100644
@@ -185,7 +185,7 @@ ulp_ha_mgr_timer_cb(void *arg __rte_unused)
 	rc = ulp_ha_mgr_state_get(ulp_ctx, &curr_state);
 	if (rc) {
 		/*
-		 * This shouldn't happen, if it does, reset the timer
+		 * This shouldn't happen, if it does, resetart the timer
 		 * and try again next time.
 		 */
 		BNXT_TF_DBG(ERR, "Failed(%d) to get state.\n",
drivers/net/bnxt/tf_ulp/ulp_mapper.c +108 -3

238 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_matcher.c +13 -0
index 67fa61fc7c..e06d8f6287 100644
@@ -6,6 +6,10 @@
 #include "ulp_matcher.h"
 #include "ulp_utils.h"
 
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#include "ulp_template_debug_proto.h"
+#endif
+
 /* Utility function to calculate the class matcher hash */
 static uint32_t
 ulp_matcher_class_hash_calculate(uint64_t hi_sig, uint64_t lo_sig)
@@ -95,6 +99,11 @@ ulp_matcher_pattern_match(struct ulp_rte_parser_params *params,
 
 error:
 	BNXT_TF_DBG(DEBUG, "Did not find any matching template\n");
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+	BNXT_TF_DBG(DEBUG, "class_hid:0x%x, Hdr:%" PRIX64 " Fld:%" PRIX64 "\n",
+		    class_hid, params->hdr_bitmap.bits,
+		    params->fld_bitmap.bits);
+#endif
 	*class_id = 0;
 	return BNXT_TF_RC_ERROR;
 }
@@ -142,6 +151,10 @@ ulp_matcher_action_match(struct ulp_rte_parser_params *params,
 
 error:
 	BNXT_TF_DBG(DEBUG, "Did not find any matching action template\n");
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+	BNXT_TF_DBG(DEBUG, "act_hid:0x%x, Hdr:%" PRIX64 "\n",
+		    act_hid, params->act_bitmap.bits);
+#endif
 	*act_id = 0;
 	return BNXT_TF_RC_ERROR;
 }
drivers/net/bnxt/tf_ulp/ulp_port_db.c +12 -3
index 4045473097..7d9865b3e3 100644
@@ -7,9 +7,13 @@
 #include "bnxt.h"
 #include "bnxt_vnic.h"
 #include "bnxt_tf_common.h"
+#include "bnxt_tf_pmd_shim.h"
 #include "ulp_port_db.h"
 #include "tfp.h"
-#include "bnxt_tf_pmd_shim.h"
+
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#include "ulp_tf_debug.h"
+#endif
 
 static uint32_t
 ulp_port_db_allocate_ifindex(struct bnxt_ulp_port_db *port_db)
@@ -151,12 +155,12 @@ int32_t	ulp_port_db_dev_port_intf_update(struct bnxt_ulp_context *ulp_ctxt,
 
 	intf->type = bnxt_pmd_get_interface_type(port_id);
 	intf->drv_func_id = bnxt_pmd_get_fw_func_id(port_id,
-						    BNXT_ULP_INTF_TYPE_INVALID);
+						BNXT_ULP_INTF_TYPE_INVALID);
 
 	func = &port_db->ulp_func_id_tbl[intf->drv_func_id];
 	if (!func->func_valid) {
 		func->func_svif = bnxt_pmd_get_svif(port_id, true,
-						    BNXT_ULP_INTF_TYPE_INVALID);
+						BNXT_ULP_INTF_TYPE_INVALID);
 		func->func_spif = bnxt_pmd_get_phy_port_id(port_id);
 		func->func_parif =
 			bnxt_pmd_get_parif(port_id, BNXT_ULP_INTF_TYPE_INVALID);
@@ -202,6 +206,11 @@ int32_t	ulp_port_db_dev_port_intf_update(struct bnxt_ulp_context *ulp_ctxt,
 		port_data->port_vport = bnxt_pmd_get_vport(port_id);
 		port_data->port_valid = true;
 	}
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_PORT
+	ulp_port_db_dump(port_db, intf, port_id);
+#endif
+#endif
 	return 0;
 }
 
drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +5 -4
index 5fd52b8f36..79b9957781 100644
@@ -8,6 +8,7 @@
 #include "ulp_template_struct.h"
 #include "bnxt_ulp.h"
 #include "bnxt_tf_common.h"
+#include "bnxt_tf_pmd_shim.h"
 #include "ulp_rte_parser.h"
 #include "ulp_matcher.h"
 #include "ulp_utils.h"
@@ -855,7 +856,7 @@ ulp_rte_vlan_hdr_handler(const struct rte_flow_item *item,
 			       BNXT_ULP_HDR_BIT_II_VLAN);
 		inner_flag = 1;
 	} else {
-		BNXT_TF_DBG(ERR, "Error Parsing:Vlan hdr found without eth\n");
+		BNXT_TF_DBG(ERR, "Error Parsing:Vlan hdr found withtout eth\n");
 		return BNXT_TF_RC_ERROR;
 	}
 	/* Update the field protocol hdr bitmap */
@@ -1135,8 +1136,8 @@ ulp_rte_ipv6_hdr_handler(const struct rte_flow_item *item,
 	ulp_rte_prsr_fld_mask(params, &idx, size, &ver_spec, &ver_mask,
 			      ULP_PRSR_ACT_DEFAULT);
 	/*
-	 * The TC and flow label field are ignored since OVS is setting
-	 * it for match and it is not supported.
+	 * The TC and flow label field are ignored since OVS is
+	 * setting it for match and it is not supported.
 	 * This is a work around and
 	 * shall be addressed in the future.
 	 */
@@ -2138,7 +2139,7 @@ ulp_rte_vf_act_handler(const struct rte_flow_action *action_item,
 		return BNXT_TF_RC_PARSE_ERR;
 	}
 
-	bp = bnxt_get_bp(params->port_id);
+	bp = bnxt_pmd_get_bp(params->port_id);
 	if (bp == NULL) {
 		BNXT_TF_DBG(ERR, "Invalid bp\n");
 		return BNXT_TF_RC_ERROR;
drivers/net/bnxt/tf_ulp/ulp_tun.c +20 -0
index cb8530d791..a1dd5b902c 100644
@@ -3,6 +3,8 @@
  * All rights reserved.
  */
 
+#include <sys/queue.h>
+
 #include <rte_malloc.h>
 
 #include "ulp_tun.h"
@@ -29,6 +31,15 @@ ulp_install_outer_tun_flow(struct ulp_rte_parser_params *params,
 
 	ULP_BITMAP_SET(params->hdr_bitmap.bits, BNXT_ULP_HDR_BIT_F1);
 
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_PARSER
+	/* Dump the rte flow pattern */
+	ulp_parser_hdr_info_dump(params);
+	/* Dump the rte flow action */
+	ulp_parser_act_info_dump(params);
+#endif
+#endif
+
 	ret = ulp_matcher_pattern_match(params, &params->class_id);
 	if (ret != BNXT_TF_RC_SUCCESS)
 		goto err;
@@ -146,6 +157,15 @@ ulp_post_process_cache_inner_tun_flow(struct ulp_rte_parser_params *params,
 	struct ulp_per_port_flow_info *flow_info;
 	int ret;
 
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
+#ifdef	RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_PARSER
+	/* Dump the rte flow pattern */
+	ulp_parser_hdr_info_dump(params);
+	/* Dump the rte flow action */
+	ulp_parser_act_info_dump(params);
+#endif
+#endif
+
 	ret = ulp_matcher_pattern_match(params, &params->class_id);
 	if (ret != BNXT_TF_RC_SUCCESS)
 		return BNXT_TF_RC_ERROR;
drivers/net/bnxt/tf_ulp/ulp_utils.c +4 -4
index bafb539c8d..1649e157f2 100644
@@ -62,7 +62,7 @@ ulp_regfile_read(struct ulp_regfile *regfile,
  * data [in] The value is written into this variable.  It is going to be in the
  * same byte order as it was written.
  *
- * size [in] The size in bytes of the value being written into this
+ * size [in] The size in bytes of the value beingritten into this
  * variable.
  *
  * returns 0 on success
@@ -295,7 +295,7 @@ ulp_blob_push(struct ulp_blob *blob,
 				     datalen,
 				     data);
 	if (!rc) {
-		BNXT_TF_DBG(ERR, "Failed to write blob\n");
+		BNXT_TF_DBG(ERR, "Failed ro write blob\n");
 		return 0;
 	}
 	blob->write_idx += datalen;
@@ -355,7 +355,7 @@ ulp_blob_insert(struct ulp_blob *blob, uint32_t offset,
 				     datalen,
 				     data);
 	if (!rc) {
-		BNXT_TF_DBG(ERR, "Failed to write blob\n");
+		BNXT_TF_DBG(ERR, "Failed ro write blob\n");
 		return 0;
 	}
 	/* copy the previously stored data */
@@ -409,7 +409,7 @@ ulp_blob_push_64(struct ulp_blob *blob,
  *
  * data [in] 32-bit value to be added to the blob.
  *
- * datalen [in] The number of bits to be added to the blob.
+ * datalen [in] The number of bits to be added ot the blob.
  *
  * The offset of the data is updated after each push of data.
  * NULL returned on error, pointer pushed value otherwise.
Signature · 1 line
2.17.1
#62 lore raw

PATCH v4 6/13 net/bnxt: add support for tunnel offload API

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

Add support for tunnel offload APIs. Specifically the following are supported.
tunnel_decap_set, tunnel_match, tunnel_action_decap_release, tunnel_item_release.

This provides support for VXLAN decap action where two flows can indicate tunnel offload rule. The first flow indicates the tunnel properties and second flow indicates the inner packet structure. The templates are updated to support this feature.

---
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |    4 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   12 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |   20 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |  212 +-
 .../generic_templates/ulp_template_db_act.c   |    2 +-
 .../generic_templates/ulp_template_db_class.c | 8541 +++++++++++-----
 .../generic_templates/ulp_template_db_enum.h  |  210 +-
 .../generic_templates/ulp_template_db_field.h |  654 +-
 .../generic_templates/ulp_template_db_tbl.c   |  645 +-
 .../ulp_template_db_thor_class.c              |  110 +-
 .../ulp_template_db_wh_plus_act.c             |    2 +-
 .../ulp_template_db_wh_plus_class.c           | 8577 +++++++++++------
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |   46 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h          |    8 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |  562 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |   44 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   52 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |    6 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c |   31 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |  134 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |   10 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   10 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.c             |  541 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.h             |   89 +-
 24 files changed, 13810 insertions(+), 6712 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_tf_common.h +1 -3
index e0ebed3fed..6c4bcd2d90 100644
@@ -37,9 +37,7 @@
 enum bnxt_tf_rc {
 	BNXT_TF_RC_PARSE_ERR	= -2,
 	BNXT_TF_RC_ERROR	= -1,
-	BNXT_TF_RC_SUCCESS	= 0,
-	BNXT_TF_RC_NORMAL	= 1,
-	BNXT_TF_RC_FID		= 2,
+	BNXT_TF_RC_SUCCESS	= 0
 };
 
 /* eth IPv4 Type */
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +10 -2
index 475c7a6cdf..dfafd9ff5b 100644
@@ -860,8 +860,6 @@ ulp_ctx_init(struct bnxt *bp,
 	if (rc)
 		goto error_deinit;
 
-	ulp_tun_tbl_init(ulp_data->tun_tbl);
-
 	bnxt_ulp_cntxt_tfp_set(bp->ulp_ctx, &bp->tfp);
 	return rc;
 
@@ -2064,3 +2062,13 @@ bnxt_ulp_cntxt_entry_release(void)
 {
 	rte_spinlock_unlock(&bnxt_ulp_ctxt_lock);
 }
+
+/* Function to get the app tunnel details from the ulp context. */
+struct bnxt_flow_app_tun_ent *
+bnxt_ulp_cntxt_ptr2_app_tun_list_get(struct bnxt_ulp_context *ulp)
+{
+	if (!ulp || !ulp->cfg_data)
+		return NULL;
+
+	return ulp->cfg_data->app_tun;
+}
drivers/net/bnxt/tf_ulp/bnxt_ulp.h +17 -3
index 082ca501b6..006df9cbc5 100644
@@ -47,6 +47,18 @@ enum bnxt_ulp_flow_mem_type {
 	BNXT_ULP_FLOW_MEM_TYPE_LAST = 3
 };
 
+enum bnxt_rte_flow_item_type {
+	BNXT_RTE_FLOW_ITEM_TYPE_END = (uint32_t)INT_MIN,
+	BNXT_RTE_FLOW_ITEM_TYPE_VXLAN_DECAP,
+	BNXT_RTE_FLOW_ITEM_TYPE_LAST
+};
+
+enum bnxt_rte_flow_action_type {
+	BNXT_RTE_FLOW_ACTION_TYPE_END = (uint32_t)INT_MIN,
+	BNXT_RTE_FLOW_ACTION_TYPE_VXLAN_DECAP,
+	BNXT_RTE_FLOW_ACTION_TYPE_LAST
+};
+
 struct bnxt_ulp_df_rule_info {
 	uint32_t			def_port_flow_id;
 	uint8_t				valid;
@@ -79,6 +91,7 @@ struct bnxt_ulp_data {
 	bool				accum_stats;
 	uint8_t				app_id;
 	uint8_t				num_shared_clients;
+	struct bnxt_flow_app_tun_ent	app_tun[BNXT_ULP_MAX_TUN_CACHE_ENTRIES];
 };
 
 struct bnxt_ulp_context {
@@ -258,9 +271,6 @@ bnxt_ulp_cntxt_acquire_fdb_lock(struct bnxt_ulp_context	*ulp_ctx);
 void
 bnxt_ulp_cntxt_release_fdb_lock(struct bnxt_ulp_context	*ulp_ctx);
 
-int32_t
-ulp_post_process_tun_flow(struct ulp_rte_parser_params *params);
-
 struct bnxt_ulp_glb_resource_info *
 bnxt_ulp_app_glb_resource_info_list_get(uint32_t *num_entries);
 
@@ -301,4 +311,8 @@ bnxt_ulp_cntxt_entry_release(void);
 
 uint8_t
 bnxt_ulp_cntxt_num_shared_clients_get(struct bnxt_ulp_context *ulp_ctx);
+
+struct bnxt_flow_app_tun_ent *
+bnxt_ulp_cntxt_ptr2_app_tun_list_get(struct bnxt_ulp_context *ulp);
+
 #endif /* _BNXT_ULP_H_ */
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +203 -9

262 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_act.c +1 -1
index e18f314856..0da6070d7d 100644
@@ -3,7 +3,7 @@
  * All rights reserved.
  */
 
-/* date: Wed Mar 17 11:31:19 2021 */
+/* date: Mon May 17 15:30:41 2021 */
 
 #include "ulp_template_db_enum.h"
 #include "ulp_template_db_field.h"
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_class.c +6267 -2274

2,657 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_enum.h +189 -21

210 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_field.h +421 -233

654 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c +419 -226

645 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c +55 -55

110 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_act.c +1 -1
index b6d2afd55b..de924fe81a 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_class.c +5591 -2986

8,577 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c +30 -16

46 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h +5 -3
index 448d05c118..9825ed2a27 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_flow_db.c +235 -327

562 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +19 -25

44 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.c +18 -34

52 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.h +3 -3
index 004e89ac2b..d4d6969bb5 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c +31 -0
index 35e9858727..9b165c12b5 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +80 -54

134 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +9 -1
index 4431f1bbd0..673172c811 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +7 -3
index 0cbac66237..2685e63432 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_tun.c +170 -371

541 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_tun.h +28 -61

89 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

#63 lore raw

Re: [dpdk-dev] [PATCH v4 06/13] net/bnxt: add support for tunnel offload API

Quoted 13 lines · Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

Add support for tunnel offload APIs. Specifically the following are supported.
tunnel_decap_set, tunnel_match, tunnel_action_decap_release, tunnel_item_release.

This provides support for VXLAN decap action where two flows can indicate tunnel offload rule. The first flow indicates the tunnel properties and second flow indicates the inner packet structure. The templates are updated to support this feature.

Quoted 4 lines

Hi Ajit,

Following warning is reported by Jerin & Thomas:

$ ./devtools/check-doc-vs-code.sh
rte_flow doc out of sync for bnxt
        action shared

This is mainly saying 'RTE_FLOW_ACTION_TYPE_SHARED' flow action is supported but not documented. But from code I am not sure if shared action is used, there is only one range check using this enum in the code, can you please clarify? If it is supported I can update the documentation.

Thanks,
ferruh

#64 lore raw

Re: [dpdk-dev] [PATCH v4 06/13] net/bnxt: add support for tunnel offload API

28/09/2021 14:43, Ferruh Yigit:

Quoted 29 lines · Venkat Duvvuru
Quoted 13 lines

From: Kishore Padmanabha <[email protected]>

Add support for tunnel offload APIs. Specifically the following are supported.
tunnel_decap_set, tunnel_match, tunnel_action_decap_release, tunnel_item_release.

This provides support for VXLAN decap action where two flows can indicate tunnel offload rule. The first flow indicates the tunnel properties and second flow indicates the inner packet structure. The templates are updated to support this feature.

Quoted 4 lines

Hi Ajit,

Following warning is reported by Jerin & Thomas:

$ ./devtools/check-doc-vs-code.sh
rte_flow doc out of sync for bnxt
        action shared
Quoted 4 lines

This is mainly saying 'RTE_FLOW_ACTION_TYPE_SHARED' flow action is supported but not documented. But from code I am not sure if shared action is used, there is only one range check using this enum in the code, can you please clarify? If it is supported I can update the documentation.

Please fix it in the right commit atomically.

#65 lore raw

Re: [dpdk-dev] [PATCH v4 06/13] net/bnxt: add support for tunnel offload API

Quoted 30 lines · Thomas Monjalon

28/09/2021 14:43, Ferruh Yigit:

Quoted 29 lines · Venkat Duvvuru
Quoted 13 lines

From: Kishore Padmanabha <[email protected]>

Add support for tunnel offload APIs. Specifically the following are supported.
tunnel_decap_set, tunnel_match, tunnel_action_decap_release, tunnel_item_release.

This provides support for VXLAN decap action where two flows can indicate tunnel offload rule. The first flow indicates the tunnel properties and second flow indicates the inner packet structure. The templates are updated to support this feature.

Quoted 4 lines

Hi Ajit,

Following warning is reported by Jerin & Thomas:

$ ./devtools/check-doc-vs-code.sh
rte_flow doc out of sync for bnxt
        action shared
Quoted 7 lines
Quoted 4 lines

This is mainly saying 'RTE_FLOW_ACTION_TYPE_SHARED' flow action is supported but not documented. But from code I am not sure if shared action is used, there is only one range check using this enum in the code, can you please clarify? If it is supported I can update the documentation.

Please fix it in the right commit atomically.

Sure I will fix it in the relevant commit, but first I want to be sure what script detected is correct or not.

#66 lore raw

Re: [dpdk-dev] [PATCH v4 06/13] net/bnxt: add support for tunnel offload API

In reply to Ferruh Yigit
Quoted 25 lines · Ferruh Yigit
Quoted 13 lines · Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

Add support for tunnel offload APIs. Specifically the following are supported.
tunnel_decap_set, tunnel_match, tunnel_action_decap_release, tunnel_item_release.

This provides support for VXLAN decap action where two flows can indicate tunnel offload rule. The first flow indicates the tunnel properties and second flow indicates the inner packet structure. The templates are updated to support this feature.

Quoted 4 lines

Hi Ajit,

Following warning is reported by Jerin & Thomas:

Quoted 8 lines
$ ./devtools/check-doc-vs-code.sh
rte_flow doc out of sync for bnxt
        action shared

This is mainly saying 'RTE_FLOW_ACTION_TYPE_SHARED' flow action is supported but not documented. But from code I am not sure if shared action is used, there is only one range check using this enum in the code, can you please clarify?

Correct. RTE_FLOW_ACTION_TYPE_SHARED is being used only for a range check. It is not really a supported action right now as far as the code is concerned. As of now, no document update is necessary. Thanks

Quoted 4 lines

If it is supported I can update the documentation.

Thanks,
ferruh

#67 lore raw

Re: [dpdk-dev] [PATCH v4 06/13] net/bnxt: add support for tunnel offload API

28/09/2021 23:32, Ajit Khaparde:

Quoted 8 lines · Ferruh Yigit
Quoted 7 lines

Following warning is reported by Jerin & Thomas:

$ ./devtools/check-doc-vs-code.sh
rte_flow doc out of sync for bnxt
        action shared
Quoted 7 lines
Quoted 3 lines

This is mainly saying 'RTE_FLOW_ACTION_TYPE_SHARED' flow action is supported but not documented. But from code I am not sure if shared action is used, there is only one range check using this enum in the code, can you please clarify?

Correct. RTE_FLOW_ACTION_TYPE_SHARED is being used only for a range check. It is not really a supported action right now as far as the code is concerned. As of now, no document update is necessary. Thanks

You need to update something to make the check OK. If it is a false positive, it can be handled in the script, but we cannot let the script returning an error.

#68 lore raw

Re: [dpdk-dev] [PATCH v4 06/13] net/bnxt: add support for tunnel offload API

Quoted 13 lines · Thomas Monjalon

28/09/2021 23:32, Ajit Khaparde:

Quoted 12 lines · Ferruh Yigit
Quoted 10 lines

Following warning is reported by Jerin & Thomas:

$ ./devtools/check-doc-vs-code.sh
rte_flow doc out of sync for bnxt
        action shared

This is mainly saying 'RTE_FLOW_ACTION_TYPE_SHARED' flow action is supported but not documented. But from code I am not sure if shared action is used, there is only one range check using this enum in the code, can you please clarify?

Quoted 9 lines
Quoted 3 lines

Correct. RTE_FLOW_ACTION_TYPE_SHARED is being used only for a range check. It is not really a supported action right now as far as the code is concerned. As of now, no document update is necessary. Thanks

You need to update something to make the check OK. If it is a false positive, it can be handled in the script, but we cannot let the script returning an error.

I will add following exception to the script (suggested by Thomas) in the next-net:

devtools/parse-flow-support.sh +2 -1
index 8462abe53603..63c0b20e234f 100755
@@ -25,7 +25,8 @@ exclude() # <pattern>
                                $dir/tf_ulp/ulp_rte_handler_tbl.c |
                                grep -wo "$1[[:alnum:]_]*" | sort -u |
                                tr '\n' '|' | sed 's,.$,\n,')
-                       grep -vE "$filter";;
+                       exceptions='RTE_FLOW_ACTION_TYPE_SHARED'
+                       grep -vE "$filter" | grep -vE $exceptions;;
                *) cat
        esac
 }
#69 lore raw

Re: [dpdk-dev] [PATCH v4 06/13] net/bnxt: add support for tunnel offload API

Quoted 32 lines · Ferruh Yigit
Quoted 13 lines · Thomas Monjalon

28/09/2021 23:32, Ajit Khaparde:

Quoted 12 lines · Ferruh Yigit
Quoted 10 lines

Following warning is reported by Jerin & Thomas:

$ ./devtools/check-doc-vs-code.sh
rte_flow doc out of sync for bnxt
        action shared

This is mainly saying 'RTE_FLOW_ACTION_TYPE_SHARED' flow action is supported but not documented. But from code I am not sure if shared action is used, there is only one range check using this enum in the code, can you please clarify?

Quoted 9 lines
Quoted 3 lines

Correct. RTE_FLOW_ACTION_TYPE_SHARED is being used only for a range check. It is not really a supported action right now as far as the code is concerned. As of now, no document update is necessary. Thanks

You need to update something to make the check OK. If it is a false positive, it can be handled in the script, but we cannot let the script returning an error.

I will add following exception to the script (suggested by Thomas) in the next-net:

devtools/parse-flow-support.sh +0 -0
index 8462abe53603..63c0b20e234f 100755

devtools/parse-flow-support.sh exclude() # <pattern> · line 32

Quoted 9 lines
devtools/parse-flow-support.sh +2 -1
@@ -25,7 +25,8 @@ exclude() # <pattern>
                                $dir/tf_ulp/ulp_rte_handler_tbl.c |
                                grep -wo "$1[[:alnum:]_]*" | sort -u |
                                tr '\n' '|' | sed 's,.$,\n,')
-                       grep -vE "$filter";;
+                       exceptions='RTE_FLOW_ACTION_TYPE_SHARED'
+                       grep -vE "$filter" | grep -vE $exceptions;;
                *) cat
        esac
 }

ACK

Quoted 2 lines
#70 lore raw

PATCH v4 7/13 net/bnxt: add support for dynamic encap action

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

The encapsulation record processing is enhanced to handle data dynamically. Different combinations of VXLAN encapsulation using no VLAN or single or double VLAN can be supported and also supports both IPv4 and IPv6 versions.

---
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |   25 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |    2 +
 .../generic_templates/ulp_template_db_enum.h  |   44 +-
 .../generic_templates/ulp_template_db_tbl.c   |    8 +-
 .../ulp_template_db_thor_act.c                |    4 +-
 .../ulp_template_db_thor_class.c              |   46 +-
 .../ulp_template_db_wh_plus_act.c             | 1700 ++++++++++++-----
 .../ulp_template_db_wh_plus_class.c           |  222 +--
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |    4 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |    2 +-
 drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c          |    2 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |  152 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |    4 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |  337 ++--
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |    2 +
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   10 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |   73 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |   27 +-
 18 files changed, 1716 insertions(+), 948 deletions(-)
drivers/net/bnxt/tf_ulp/bnxt_ulp.c +16 -9
index dfafd9ff5b..3b86410fb1 100644
@@ -830,13 +830,12 @@ ulp_ctx_init(struct bnxt *bp,
 		goto error_deinit;
 	}
 
-	/* TODO: For now we are overriding to APP:1 on this branch*/
-	bp->app_id = 1;
 	rc = bnxt_ulp_cntxt_app_id_set(bp->ulp_ctx, bp->app_id);
 	if (rc) {
 		BNXT_TF_DBG(ERR, "Unable to set app_id for ULP init.\n");
 		goto error_deinit;
 	}
+	BNXT_TF_DBG(DEBUG, "Ulp initialized with app id %d\n", bp->app_id);
 
 	rc = bnxt_ulp_cntxt_app_caps_init(bp->ulp_ctx, bp->app_id, devid);
 	if (rc) {
@@ -1393,13 +1392,17 @@ bnxt_ulp_port_init(struct bnxt *bp)
 	uint32_t ulp_flags;
 	int32_t rc = 0;
 
-	if (!bp || !BNXT_TRUFLOW_EN(bp))
-		return rc;
-
 	if (!BNXT_PF(bp) && !BNXT_VF_IS_TRUSTED(bp)) {
 		BNXT_TF_DBG(ERR,
 			    "Skip ulp init for port: %d, not a TVF or PF\n",
-			bp->eth_dev->data->port_id);
+			    bp->eth_dev->data->port_id);
+		return rc;
+	}
+
+	if (!BNXT_TRUFLOW_EN(bp)) {
+		BNXT_TF_DBG(ERR,
+			    "Skip ulp init for port: %d, truflow is not enabled\n",
+			    bp->eth_dev->data->port_id);
 		return rc;
 	}
 
@@ -1520,9 +1523,6 @@ bnxt_ulp_port_deinit(struct bnxt *bp)
 	struct rte_pci_device *pci_dev;
 	struct rte_pci_addr *pci_addr;
 
-	if (!BNXT_TRUFLOW_EN(bp))
-		return;
-
 	if (!BNXT_PF(bp) && !BNXT_VF_IS_TRUSTED(bp)) {
 		BNXT_TF_DBG(ERR,
 			    "Skip ULP deinit port:%d, not a TVF or PF\n",
@@ -1530,6 +1530,13 @@ bnxt_ulp_port_deinit(struct bnxt *bp)
 		return;
 	}
 
+	if (!BNXT_TRUFLOW_EN(bp)) {
+		BNXT_TF_DBG(ERR,
+			    "Skip ULP deinit for port:%d, truflow is not enabled\n",
+			    bp->eth_dev->data->port_id);
+		return;
+	}
+
 	if (!bp->ulp_ctx) {
 		BNXT_TF_DBG(DEBUG, "ulp ctx already de-allocated\n");
 		return;
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +2 -0
index 3daf5942e8..413e4c3b26 100644
@@ -96,7 +96,9 @@ bnxt_ulp_init_mapper_params(struct bnxt_ulp_mapper_create_parms *mapper_cparms,
 	mapper_cparms->act_tid = params->act_tmpl;
 	mapper_cparms->func_id = params->func_id;
 	mapper_cparms->hdr_bitmap = &params->hdr_bitmap;
+	mapper_cparms->enc_hdr_bitmap = &params->enc_hdr_bitmap;
 	mapper_cparms->hdr_field = params->hdr_field;
+	mapper_cparms->enc_field = params->enc_field;
 	mapper_cparms->comp_fld = params->comp_fld;
 	mapper_cparms->act = &params->act_bitmap;
 	mapper_cparms->act_prop = &params->act_prop;
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_enum.h +39 -5

80 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c +6 -2
index 58b4dba63c..b5bce6f4c7 100644
@@ -198,7 +198,9 @@ const struct bnxt_ulp_template_device_tbls ulp_template_thor_tbls[] = {
 struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	[BNXT_ULP_DEVICE_ID_WH_PLUS] = {
 	.description             = "Whitney_Plus",
-	.byte_order              = BNXT_ULP_BYTE_ORDER_LE,
+	.key_byte_order          = BNXT_ULP_BYTE_ORDER_LE,
+	.result_byte_order       = BNXT_ULP_BYTE_ORDER_LE,
+	.encap_byte_order        = BNXT_ULP_BYTE_ORDER_BE,
 	.encap_byte_swap         = 1,
 	.int_flow_db_num_entries = 16384,
 	.ext_flow_db_num_entries = 32768,
@@ -218,7 +220,9 @@ struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	},
 	[BNXT_ULP_DEVICE_ID_THOR] = {
 	.description             = "Thor",
-	.byte_order              = BNXT_ULP_BYTE_ORDER_LE,
+	.key_byte_order          = BNXT_ULP_BYTE_ORDER_LE,
+	.result_byte_order       = BNXT_ULP_BYTE_ORDER_LE,
+	.encap_byte_order        = BNXT_ULP_BYTE_ORDER_BE,
 	.encap_byte_swap         = 1,
 	.int_flow_db_num_entries = 16384,
 	.ext_flow_db_num_entries = 32768,
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_act.c +1 -3
index ce5a70b0c5..9faf25aaf0 100644
@@ -3,7 +3,7 @@
  * All rights reserved.
  */
 
-/* date: Thu May 13 18:15:56 2021 */
+/* date: Wed May 26 15:11:34 2021 */
 
 #include "ulp_template_db_enum.h"
 #include "ulp_template_db_field.h"
@@ -41,7 +41,6 @@ struct bnxt_ulp_mapper_tbl_info ulp_thor_act_tbl_list[] = {
 	.tbl_operand = BNXT_ULP_RF_IDX_FLOW_CNTR_PTR_0,
 	.fdb_opcode = BNXT_ULP_FDB_OPC_PUSH_FID,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPC_NOP,
-	.byte_order = BNXT_ULP_BYTE_ORDER_LE,
 	.result_start_idx = 0,
 	.result_bit_size = 64,
 	.result_num_fields = 1
@@ -62,7 +61,6 @@ struct bnxt_ulp_mapper_tbl_info ulp_thor_act_tbl_list[] = {
 	.tbl_operand = BNXT_ULP_RF_IDX_MAIN_ACTION_PTR,
 	.fdb_opcode = BNXT_ULP_FDB_OPC_PUSH_FID,
 	.mark_db_opcode = BNXT_ULP_MARK_DB_OPC_NOP,
-	.byte_order = BNXT_ULP_BYTE_ORDER_LE,
 	.result_start_idx = 1,
 	.result_bit_size = 128,
 	.result_num_fields = 17
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c +7 -39

250 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_act.c +1196 -504

2,507 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_class.c +58 -164

55 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_flow_db.c +2 -2
index 9e6bd90aea..1cb52e9bfa 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_flow_db.h +1 -1
index 8680ee8f65..6dbec92745 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c +1 -1
index bc5627ec5b..5f5b5d639e 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_mapper.c +123 -29

152 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_mapper.h +4 -0
index d4d6969bb5..4d6ba0f73a 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +208 -129

337 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +2 -0
index 673172c811..e14f86278a 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +7 -3
index 2685e63432..904763f27d 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_utils.c +31 -42

73 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_utils.h +12 -15
index e1b0e773f3..68a537fa0a 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

#71 lore raw

PATCH v4 8/13 net/bnxt: add wild card TCAM byte order for Thor

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

The wild card TCAM for Thor platform is different from the profile TCAM byte order.

---
 .../generic_templates/ulp_template_db_tbl.c   |  2 ++
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          | 25 +++++++++++++------
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |  1 +
 3 files changed, 21 insertions(+), 7 deletions(-)
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c +2 -0
index b5bce6f4c7..68f1b5fd00 100644
@@ -201,6 +201,7 @@ struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	.key_byte_order          = BNXT_ULP_BYTE_ORDER_LE,
 	.result_byte_order       = BNXT_ULP_BYTE_ORDER_LE,
 	.encap_byte_order        = BNXT_ULP_BYTE_ORDER_BE,
+	.wc_key_byte_order       = BNXT_ULP_BYTE_ORDER_BE,
 	.encap_byte_swap         = 1,
 	.int_flow_db_num_entries = 16384,
 	.ext_flow_db_num_entries = 32768,
@@ -223,6 +224,7 @@ struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	.key_byte_order          = BNXT_ULP_BYTE_ORDER_LE,
 	.result_byte_order       = BNXT_ULP_BYTE_ORDER_LE,
 	.encap_byte_order        = BNXT_ULP_BYTE_ORDER_BE,
+	.wc_key_byte_order       = BNXT_ULP_BYTE_ORDER_BE,
 	.encap_byte_swap         = 1,
 	.int_flow_db_num_entries = 16384,
 	.ext_flow_db_num_entries = 32768,
drivers/net/bnxt/tf_ulp/ulp_mapper.c +18 -7
index 2687a545f3..bcc089b3e1 100644
@@ -1953,6 +1953,15 @@ static void ulp_mapper_wc_tcam_tbl_post_process(struct ulp_blob *blob)
 #endif
 }
 
+static int32_t ulp_mapper_tcam_is_wc_tcam(struct bnxt_ulp_mapper_tbl_info *tbl)
+{
+	if (tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM ||
+	    tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM_HIGH ||
+	    tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM_LOW)
+		return 1;
+	return 0;
+}
+
 static int32_t
 ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 			    struct bnxt_ulp_mapper_tbl_info *tbl)
@@ -1972,6 +1981,7 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	uint32_t hit = 0;
 	uint16_t tmplen = 0;
 	uint16_t idx;
+	enum bnxt_ulp_byte_order key_byte_order;
 
 	/* Set the key and mask to the original key and mask. */
 	key = &okey;
@@ -2003,10 +2013,13 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 		return -EINVAL;
 	}
 
-	if (!ulp_blob_init(key, tbl->blob_key_bit_size,
-			   dparms->key_byte_order) ||
-	    !ulp_blob_init(mask, tbl->blob_key_bit_size,
-			   dparms->key_byte_order) ||
+	if (ulp_mapper_tcam_is_wc_tcam(tbl))
+		key_byte_order = dparms->wc_key_byte_order;
+	else
+		key_byte_order = dparms->key_byte_order;
+
+	if (!ulp_blob_init(key, tbl->blob_key_bit_size, key_byte_order) ||
+	    !ulp_blob_init(mask, tbl->blob_key_bit_size, key_byte_order) ||
 	    !ulp_blob_init(&data, tbl->result_bit_size,
 			   dparms->result_byte_order) ||
 	    !ulp_blob_init(&update_data, tbl->result_bit_size,
@@ -2043,9 +2056,7 @@ ulp_mapper_tcam_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	}
 
 	/* For wild card tcam perform the post process to swap the blob */
-	if (tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM ||
-	    tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM_HIGH ||
-	    tbl->resource_type == TF_TCAM_TBL_TYPE_WC_TCAM_LOW) {
+	if (ulp_mapper_tcam_is_wc_tcam(tbl)) {
 		if (dparms->dynamic_pad_en) {
 			/* Sets up the slices for writing to the WC TCAM */
 			rc = ulp_mapper_wc_tcam_tbl_dyn_post_process(dparms,
drivers/net/bnxt/tf_ulp/ulp_template_struct.h +1 -0
index 904763f27d..e2a4b81cec 100644
@@ -212,6 +212,7 @@ struct bnxt_ulp_device_params {
 	enum bnxt_ulp_byte_order	key_byte_order;
 	enum bnxt_ulp_byte_order	result_byte_order;
 	enum bnxt_ulp_byte_order	encap_byte_order;
+	enum bnxt_ulp_byte_order	wc_key_byte_order;
 	uint8_t				encap_byte_swap;
 	uint8_t				num_phy_ports;
 	uint32_t			mark_db_lfid_entries;
Signature · 1 line
2.17.1
#72 lore raw

PATCH v4 9/13 net/bnxt: add flow templates for Thor

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

1. Add support for egress flows with port and count action for Thor platform.
2. Added templates to support VXLAN encapsulation feature for Thor.
3. Added support for VXLAN decap and VLAN pop actions along with the ingress flow.
4. Added templates to enable VXLAN decap support for f1 and f2 flows.
5. Added templates Thor VF Rep support
6. Added Thor ingress mod table actions for NAT, NAPT, and TTL.
7. Added mirror/sample table support
8. Added supported for IPv6 flows for Thor.

---
 drivers/net/bnxt/tf_core/tf_tcam.c            |     6 +-
 .../generic_templates/ulp_template_db_enum.h  |   123 +-
 .../generic_templates/ulp_template_db_tbl.c   |   182 +-
 .../ulp_template_db_thor_act.c                |  4329 +-
 .../ulp_template_db_thor_class.c              | 44219 ++++++++++++++--
 .../ulp_template_db_wh_plus_class.c           |     4 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |    10 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |    18 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |     1 +
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |     3 +
 10 files changed, 44734 insertions(+), 4161 deletions(-)
drivers/net/bnxt/tf_core/tf_tcam.c +5 -1
index 806af3070a..273f20858b 100644
@@ -323,8 +323,12 @@ tf_tcam_alloc(struct tf *tfp,
 		}
 
 		/* return the start index of each row */
-		if (i == 0)
+		if (parms->priority == 0) {
+			if (i == 0)
+				parms->idx = index;
+		} else {
 			parms->idx = index;
+		}
 	}
 
 	return 0;
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_enum.h +82 -41

200 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c +178 -4

245 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_act.c +4267 -62

2,542 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c +40174 -4045

44,219 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_class.c +2 -2
index 7203dcf1fb..2870a0615a 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_mapper.c +6 -4
index bcc089b3e1..234f7ea2fa 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +16 -2
index 4e9968e5fa..dce95de05c 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +1 -0
index e2a4b81cec..1683cd7ec4 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_utils.c +3 -0
index fc4f435c97..686b80e456 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

#73 lore raw

PATCH v4 10/13 net/bnxt: change log level to debug

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

Adjust info message to debug level to prevent excessive logging.

---
 drivers/net/bnxt/tf_core/tf_tbl_sram.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/tf_core/tf_tbl_sram.c +1 -1
index ea10afecb6..d7727f7a11 100644
@@ -130,7 +130,7 @@ static int tf_tbl_sram_get_info(struct tf_tbl_sram_get_info_parms *parms)
 	if (slices)
 		parms->slice_size = tf_tbl_sram_slices_2_size[slices];
 
-	TFP_DRV_LOG(INFO,
+	TFP_DRV_LOG(DEBUG,
 		    "(%s) bank(%s) slice_size(%s)\n",
 		    tf_tbl_type_2_str(parms->tbl_type),
 		    tf_sram_bank_2_str(parms->bank_id),
Signature · 1 line
2.17.1
#74 lore raw

PATCH v4 11/13 net/bnxt: dynamically allocate space for EM defrag function

In reply to Venkat Duvvuru

From: Randy Schacher <[email protected]>

The dynamic pool allocation defrag function currently uses stack allocation. To improve use of stack space, dynamically allocate and deallocate memory for use to defragment the dynamic pool of EM resources.

---
 drivers/net/bnxt/tf_core/dpool.c | 38 +++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 13 deletions(-)
drivers/net/bnxt/tf_core/dpool.c +25 -13
index 145efa486f..5c03f775a5 100644
@@ -7,9 +7,6 @@
 #include <stdbool.h>
 #include <stdint.h>
 #include <errno.h>
-
-#include <rte_malloc.h>
-
 #include "tfp.h"
 #include "dpool.h"
 
@@ -84,13 +81,13 @@ static int dpool_move(struct dpool *dpool,
 	return 0;
 }
 
-
 int dpool_defrag(struct dpool *dpool,
 		 uint32_t entry_size,
 		 uint8_t defrag)
 {
 	struct dpool_free_list *free_list;
 	struct dpool_adj_list *adj_list;
+	struct tfp_calloc_parms parms;
 	uint32_t count;
 	uint32_t index;
 	uint32_t used;
@@ -103,15 +100,31 @@ int dpool_defrag(struct dpool *dpool,
 	uint32_t max_size = 0;
 	int rc;
 
-	free_list = rte_zmalloc("dpool_free_list",
-				sizeof(struct dpool_free_list), 0);
+	parms.nitems = 1;
+	parms.size = sizeof(struct dpool_free_list);
+	parms.alignment = 0;
+
+	rc = tfp_calloc(&parms);
+
+	if (rc)
+		return rc;
+
+	free_list = (struct dpool_free_list *)parms.mem_va;
 	if (free_list == NULL) {
 		TFP_DRV_LOG(ERR, "dpool free list allocation failed\n");
 		return -ENOMEM;
 	}
 
-	adj_list = rte_zmalloc("dpool_adjacent_list",
-				sizeof(struct dpool_adj_list), 0);
+	parms.nitems = 1;
+	parms.size = sizeof(struct dpool_adj_list);
+	parms.alignment = 0;
+
+	rc = tfp_calloc(&parms);
+
+	if (rc)
+		return rc;
+
+	adj_list = (struct dpool_adj_list *)parms.mem_va;
 	if (adj_list == NULL) {
 		TFP_DRV_LOG(ERR, "dpool adjacent list allocation failed\n");
 		return -ENOMEM;
@@ -239,8 +252,8 @@ int dpool_defrag(struct dpool *dpool,
 					free_list->entry[largest_free_index].index,
 					max_index);
 			if (rc) {
-				rte_free(free_list);
-				rte_free(adj_list);
+				tfp_free(free_list);
+				tfp_free(adj_list);
 				return rc;
 			}
 		} else {
@@ -249,12 +262,11 @@ int dpool_defrag(struct dpool *dpool,
 	}
 
 done:
-	rte_free(free_list);
-	rte_free(adj_list);
+	tfp_free(free_list);
+	tfp_free(adj_list);
 	return largest_free_size;
 }
 
-
 uint32_t dpool_alloc(struct dpool *dpool,
 		     uint32_t size,
 		     uint8_t defrag)
Signature · 1 line
2.17.1
#75 lore raw

PATCH v4 12/13 net/bnxt: add SRAM manager shared session

In reply to Venkat Duvvuru

From: Farah Smith <[email protected]>

Fix shared session support issues due to SRAM manager additions. Shared session does not support slices within RM blocks. Calculate resources required without slices and determine base addresses using old methods for the shared session.

---
 drivers/net/bnxt/tf_core/tf_em_internal.c |   5 +-
 drivers/net/bnxt/tf_core/tf_rm.c          | 134 +++++++++++++++++++---
 drivers/net/bnxt/tf_core/tf_tbl_sram.c    |  73 +++++++++---
 3 files changed, 176 insertions(+), 36 deletions(-)
drivers/net/bnxt/tf_core/tf_em_internal.c +4 -1
index 2d57595f17..67ba011eae 100644
@@ -326,8 +326,11 @@ tf_em_int_unbind(struct tf *tfp)
 		return rc;
 
 	if (!tf_session_is_shared_session(tfs)) {
-		for (i = 0; i < TF_DIR_MAX; i++)
+		for (i = 0; i < TF_DIR_MAX; i++) {
+			if (tfs->em_pool[i] == NULL)
+				continue;
 			dpool_free_all(tfs->em_pool[i]);
+		}
 	}
 
 	rc = tf_session_get_db(tfp, TF_MODULE_TYPE_EM, &em_db_ptr);
drivers/net/bnxt/tf_core/tf_rm.c +115 -19

245 lines not on this page · raw message

drivers/net/bnxt/tf_core/tf_tbl_sram.c +57 -16

99 lines not on this page · raw message

Signature · 1 line
2.17.1
#76 lore raw

PATCH v4 13/13 net/bnxt: add enhancements to TF ULP

In reply to Venkat Duvvuru

From: Kishore Padmanabha <[email protected]>

1. Added support to specify l4 port masks in the template. Also enabled source mac in the wild card key for ingress flows.

2. Added support to enable offload for ipv6 traffic within the vxlan tunnel connection.

3. The flow counters is reduced from 7168 to 6912 for Whitney. The stats operation is updated to reflect counts for packets at egress from CFA instead of ingress to CFA

4. The miss path for the l2 context table is updated with correct parif and default action handler to handle the miss path for egress flows.

5. This support enables allocation of encapsulation, modification and action records dynamically based on a given flow actions.

6. Reduce the l2context resource requests during open_session. Move the SMAC from the L2Context to the EM/WM

7. Remap the parif in the bd action in order to eliminate incorrect replication of broadcast packets. The layer 4 source port mask was incorrectly updated in the outer layer 4 source port mask instead of inner layer 4. Add the l3 proto to egress rules, switch to using computed fields for l4 ports, add internal smac to f1/f2 flows, add l3 proto to ingress ipv6 flows

---
 doc/guides/rel_notes/release_21_11.rst        |    6 +
 drivers/net/bnxt/tf_core/tf_tbl_sram.c        |    7 -
 .../generic_templates/ulp_template_db_class.c | 8102 ++++++++++++-----
 .../generic_templates/ulp_template_db_enum.h  |  675 +-
 .../generic_templates/ulp_template_db_field.h |  195 +-
 .../generic_templates/ulp_template_db_tbl.c   | 2136 ++++-
 .../ulp_template_db_thor_act.c                |  996 +-
 .../ulp_template_db_thor_class.c              | 7495 ++++++++-------
 .../ulp_template_db_wh_plus_class.c           |   14 +-
 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c         |    4 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |  135 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |  175 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |   10 +
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |    3 +-
 14 files changed, 13544 insertions(+), 6409 deletions(-)
doc/guides/rel_notes/release_21_11.rst +6 -0
index 43d367bcad..d82cd8c279 100644
@@ -82,6 +82,12 @@ New Features
 
   * Added PDCP short MAC-I support.
 
+* **Updated Broadcom bnxt PMD.**
+
+  * Added flow offload support for Thor.
+  * Implement support for tunnel offload.
+  * Updated HWRM API to version 1.10.2.44
+
 * **Added multi-process support for testpmd.**
 
   Added command-line options to specify total number of processes and
drivers/net/bnxt/tf_core/tf_tbl_sram.c +0 -7
index 167078a8c6..636811bc2d 100644
@@ -134,11 +134,6 @@ static int tf_tbl_sram_get_info(struct tf_tbl_sram_get_info_parms *parms)
 	if (slices)
 		parms->slice_size = tf_tbl_sram_slices_2_size[slices];
 
-	TFP_DRV_LOG(DEBUG,
-		    "(%s) bank(%s) slice_size(%s)\n",
-		    tf_tbl_type_2_str(parms->tbl_type),
-		    tf_sram_bank_2_str(parms->bank_id),
-		    tf_sram_slice_2_str(parms->slice_size));
 	return rc;
 }
 
@@ -373,7 +368,6 @@ tf_tbl_sram_free(struct tf *tfp __rte_unused,
 		return rc;
 	}
 
-
 #if (DBG_SRAM == 1)
 	{
 		struct tf_sram_mgr_dump_parms dparms;
@@ -411,7 +405,6 @@ tf_tbl_sram_set(struct tf *tfp,
 	void *sram_handle = NULL;
 	uint16_t base = 0, shift = 0;
 
-
 	TF_CHECK_PARMS3(tfp, parms, parms->data);
 
 	/* Retrieve the session information */
drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_class.c +5835 -2267

2,963 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_enum.h +418 -257

675 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_field.h +155 -40

195 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c +1632 -504

2,136 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_act.c +871 -125

996 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c +4420 -3075

7,495 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_class.c +7 -7
index 2870a0615a..4b9cb7fd5b 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c +2 -2
index c6b2b1675d..7b6db7a0f8 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_mapper.c +105 -30

135 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +81 -94

175 lines not on this page · raw message

drivers/net/bnxt/tf_ulp/ulp_template_struct.h +10 -0
index 1683cd7ec4..d3bfb8c12d 100644

Lines of this file are not shown. View the raw message.

drivers/net/bnxt/tf_ulp/ulp_utils.c +2 -1
index 686b80e456..df3afaa6fd 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

Acked-by on the v4 series
#77 lore raw
In reply to Venkat Duvvuru
Quoted 22 lines · Venkat Duvvuru

This patch set adds support for new offload features/enhancments for Thor adapters like VF representor support, new flow matches/actions & dynamic SRAM manager support.

Farah Smith (4):
net/bnxt: updates to TF core index table
net/bnxt: add SRAM manager model
net/bnxt: change log level to debug
net/bnxt: add SRAM manager shared session

Jay Ding (1):
net/bnxt: add flow meter drop counter support

Kishore Padmanabha (6):
net/bnxt: add flow template support for Thor net/bnxt: add support for tunnel offload API net/bnxt: add support for dynamic encap action net/bnxt: add wild card TCAM byte order for Thor net/bnxt: add flow templates for Thor net/bnxt: add enhancements to TF ULP

Quoted 5 lines

Peter Spreadborough (1):
net/bnxt: enable dpool allocator

Randy Schacher (1):
net/bnxt: dynamically allocate space for EM defrag function

For the patchset,

Patchset applied to dpdk-next-net-brcm.
1) Changed instance of TF to TRUFLOW during merge in patch 1/13 and 13/13.

Please apply to dpdk-next-net. Thanks

Quoted 74 lines
 doc/guides/rel_notes/release_21_11.rst        |     6 +
 drivers/net/bnxt/tf_core/cfa_resource_types.h |     5 +-
 drivers/net/bnxt/tf_core/dpool.c              |    38 +-
 drivers/net/bnxt/tf_core/ll.c                 |     3 +
 drivers/net/bnxt/tf_core/ll.h                 |    50 +-
 drivers/net/bnxt/tf_core/meson.build          |     2 +
 drivers/net/bnxt/tf_core/tf_core.c            |   169 +-
 drivers/net/bnxt/tf_core/tf_core.h            |   159 +-
 drivers/net/bnxt/tf_core/tf_device.c          |    40 +-
 drivers/net/bnxt/tf_core/tf_device.h          |   137 +-
 drivers/net/bnxt/tf_core/tf_device_p4.c       |    77 +-
 drivers/net/bnxt/tf_core/tf_device_p4.h       |    50 +-
 drivers/net/bnxt/tf_core/tf_device_p58.c      |   112 +-
 drivers/net/bnxt/tf_core/tf_device_p58.h      |    70 +-
 drivers/net/bnxt/tf_core/tf_em.h              |    10 -
 drivers/net/bnxt/tf_core/tf_em_common.c       |     4 +
 .../net/bnxt/tf_core/tf_em_hash_internal.c    |    34 -
 drivers/net/bnxt/tf_core/tf_em_internal.c     |   185 +-
 drivers/net/bnxt/tf_core/tf_msg.c             |     2 +-
 drivers/net/bnxt/tf_core/tf_rm.c              |   180 +-
 drivers/net/bnxt/tf_core/tf_rm.h              |    62 +-
 drivers/net/bnxt/tf_core/tf_session.c         |    56 +
 drivers/net/bnxt/tf_core/tf_session.h         |    58 +-
 drivers/net/bnxt/tf_core/tf_sram_mgr.c        |   971 +
 drivers/net/bnxt/tf_core/tf_sram_mgr.h        |   317 +
 drivers/net/bnxt/tf_core/tf_tbl.c             |   259 +-
 drivers/net/bnxt/tf_core/tf_tbl.h             |    87 +-
 drivers/net/bnxt/tf_core/tf_tbl_sram.c        |   747 +
 drivers/net/bnxt/tf_core/tf_tbl_sram.h        |   154 +
 drivers/net/bnxt/tf_core/tf_tcam.c            |    16 +-
 drivers/net/bnxt/tf_core/tf_tcam.h            |     7 +
 drivers/net/bnxt/tf_core/tf_tcam_shared.c     |    28 +-
 drivers/net/bnxt/tf_core/tf_util.c            |    12 +
 drivers/net/bnxt/tf_ulp/bnxt_tf_common.h      |    10 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c            |    52 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp.h            |    20 +-
 drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c       |   226 +-
 .../bnxt/tf_ulp/generic_templates/meson.build |     3 +
 .../generic_templates/ulp_template_db_act.c   |     2 +-
 .../generic_templates/ulp_template_db_class.c | 12109 +++-
 .../generic_templates/ulp_template_db_enum.h  |   618 +-
 .../generic_templates/ulp_template_db_field.h |   767 +-
 .../generic_templates/ulp_template_db_tbl.c   |  2757 +-
 .../ulp_template_db_thor_act.c                |  5079 +-
 .../ulp_template_db_thor_class.c              | 45573 ++++++++++++++--
 .../ulp_template_db_wh_plus_act.c             |  1700 +-
 .../ulp_template_db_wh_plus_class.c           |  8329 ++-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c          |    48 +-
 drivers/net/bnxt/tf_ulp/ulp_fc_mgr.h          |     8 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.c         |   678 +-
 drivers/net/bnxt/tf_ulp/ulp_flow_db.h         |    68 +-
 drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c         |     9 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.c          |   448 +-
 drivers/net/bnxt/tf_ulp/ulp_mapper.h          |    10 +-
 drivers/net/bnxt/tf_ulp/ulp_matcher.c         |    13 +
 drivers/net/bnxt/tf_ulp/ulp_port_db.c         |    15 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_handler_tbl.c |    31 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c      |   663 +-
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.h      |    12 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h |    32 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.c             |   521 +-
 drivers/net/bnxt/tf_ulp/ulp_tun.h             |    89 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.c           |    71 +-
 drivers/net/bnxt/tf_ulp/ulp_utils.h           |    27 +-
 64 files changed, 71146 insertions(+), 12949 deletions(-)
 create mode 100644 drivers/net/bnxt/tf_core/tf_sram_mgr.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_sram_mgr.h
 create mode 100644 drivers/net/bnxt/tf_core/tf_tbl_sram.c
 create mode 100644 drivers/net/bnxt/tf_core/tf_tbl_sram.h

--
2.17.1

#78 lore raw
Quoted 30 lines · Ajit Khaparde
Quoted 22 lines · Venkat Duvvuru

This patch set adds support for new offload features/enhancments for Thor adapters like VF representor support, new flow matches/actions & dynamic SRAM manager support.

Farah Smith (4):
net/bnxt: updates to TF core index table
net/bnxt: add SRAM manager model
net/bnxt: change log level to debug
net/bnxt: add SRAM manager shared session

Jay Ding (1):
net/bnxt: add flow meter drop counter support

Kishore Padmanabha (6):
net/bnxt: add flow template support for Thor net/bnxt: add support for tunnel offload API net/bnxt: add support for dynamic encap action net/bnxt: add wild card TCAM byte order for Thor net/bnxt: add flow templates for Thor net/bnxt: add enhancements to TF ULP

Quoted 5 lines

Peter Spreadborough (1):
net/bnxt: enable dpool allocator

Randy Schacher (1):
net/bnxt: dynamically allocate space for EM defrag function

Quoted 8 lines

For the patchset,

Patchset applied to dpdk-next-net-brcm.
1) Changed instance of TF to TRUFLOW during merge in patch 1/13 and 13/13.

Please apply to dpdk-next-net. Thanks

Hi Ajit,

The github actions fails on build for gcc, please check it on my personal github repo:
https://github.com/ferruhy/dpdk/actions/runs/1262767538

I don't have this error in my environment, this can be related to the slightly older compiler in the github (gcc 7.5)

Can you please check the build error? I will keep the set in next-net for now, but won't mark it to pull to main until issue is resolved.
If the fix is trivial, we can update it in the next-net (after issue recorded in mail list), if it is not trivial may require a new version of the set.

btw, in git history 'TruFlow' is used, so I continue to use it, fyi.

Thanks,
ferruh

#79 lore raw
Quoted 41 lines · Ferruh Yigit
Quoted 30 lines · Ajit Khaparde
Quoted 22 lines · Venkat Duvvuru

This patch set adds support for new offload features/enhancments for Thor adapters like VF representor support, new flow matches/actions & dynamic SRAM manager support.

Farah Smith (4):
net/bnxt: updates to TF core index table
net/bnxt: add SRAM manager model
net/bnxt: change log level to debug
net/bnxt: add SRAM manager shared session

Jay Ding (1):
net/bnxt: add flow meter drop counter support

Kishore Padmanabha (6):
net/bnxt: add flow template support for Thor net/bnxt: add support for tunnel offload API net/bnxt: add support for dynamic encap action net/bnxt: add wild card TCAM byte order for Thor net/bnxt: add flow templates for Thor net/bnxt: add enhancements to TF ULP

Quoted 5 lines

Peter Spreadborough (1):
net/bnxt: enable dpool allocator

Randy Schacher (1):
net/bnxt: dynamically allocate space for EM defrag function

Quoted 8 lines

For the patchset,

Patchset applied to dpdk-next-net-brcm.
1) Changed instance of TF to TRUFLOW during merge in patch 1/13 and 13/13.

Please apply to dpdk-next-net. Thanks

Quoted 8 lines

Hi Ajit,

The github actions fails on build for gcc, please check it on my personal github repo:
https://github.com/ferruhy/dpdk/actions/runs/1262767538

I don't have this error in my environment, this can be related to the slightly older compiler in the github (gcc 7.5)

Yes, even I did not see this. Looks genuine and likely because of some different compiler.
I will try to submit a fix. Will you be able to squash it with the relevant commit?

FAILED: drivers/a715181@@tmp_rte_net_bnxt@sta/net_bnxt_tf_core_tf_sram_mgr.c.o ccache gcc -Idrivers/a715181@@tmp_rte_net_bnxt@sta -Idrivers -I../drivers -Idrivers/net/bnxt -I../drivers/net/bnxt -Idrivers/net/bnxt/tf_ulp -I../drivers/net/bnxt/tf_ulp -Idrivers/net/bnxt/tf_ulp/generic_templates -I../drivers/net/bnxt/tf_ulp/generic_templates -Idrivers/net/bnxt/tf_core -I../drivers/net/bnxt/tf_core -Idrivers/net/bnxt/hcapi/cfa -I../drivers/net/bnxt/hcapi/cfa -Ilib/ethdev -I../lib/ethdev -I. -I../ -Iconfig -I../config -Ilib/eal/include -I../lib/eal/include -Ilib/eal/linux/include -I../lib/eal/linux/include -Ilib/eal/x86/include -I../lib/eal/x86/include -Ilib/eal/common -I../lib/eal/common -Ilib/eal -I../lib/eal -Ilib/kvargs -I../lib/kvargs -Ilib/telemetry/../metrics -I../lib/telemetry/../metrics -Ilib/telemetry -I../lib/telemetry -Ilib/net -I../lib/net -Ilib/mbuf -I../lib/mbuf -Ilib/mempool -I../lib/mempool -Ilib/ring -I../lib/ring -Ilib/meter -I../lib/meter -Idrivers/bus/pci -I../drivers/bus/pci -I../drivers/bus/pci/linux -Ilib/pci -I../lib/pci -Idrivers/bus/vdev -I../drivers/bus/vdev -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -O2 -g -include rte_config.h -Wextra -Wcast-qual -Wdeprecated -Wformat -Wformat-nonliteral -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings -Wno-missing-field-initializers -D_GNU_SOURCE -fPIC -march=corei7 -DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API -Wno-format-truncation -DRTE_LIBRTE_BNXT_TF -DSUPPORT_CFA_HW_ALL=1 -DCC_AVX2_SUPPORT -DRTE_LOG_DEFAULT_LOGTYPE=pmd.net.bnxt -MD -MQ 'drivers/a715181@@tmp_rte_net_bnxt@sta/net_bnxt_tf_core_tf_sram_mgr.c.o' -MF 'drivers/a715181@@tmp_rte_net_bnxt@sta/net_bnxt_tf_core_tf_sram_mgr.c.o.d' -o 'drivers/a715181@@tmp_rte_net_bnxt@sta/net_bnxt_tf_core_tf_sram_mgr.c.o' -c ../drivers/net/bnxt/tf_core/tf_sram_mgr.c ../drivers/net/bnxt/tf_core/tf_sram_mgr.c: In function ‘tf_sram_mgr_bind’:
../drivers/net/bnxt/tf_core/tf_sram_mgr.c:418:19: error: ‘slice_list’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

  slice_list->tail = NULL;
                   ^
../drivers/net/bnxt/tf_core/tf_sram_mgr.c:574:29: note: ‘slice_list’
was declared here
  struct tf_sram_slice_list *slice_list;
                             ^~~~~~~~~~

cc1: all warnings being treated as errors

Quoted 8 lines

Can you please check the build error? I will keep the set in next-net for now, but won't mark it to pull to main until issue is resolved.
If the fix is trivial, we can update it in the next-net (after issue recorded in mail list), if it is not trivial may require a new version of the set.

btw, in git history 'TruFlow' is used, so I continue to use it, fyi.

No problem. Thanks

Quoted 4 lines

Thanks,
ferruh

#80 lore raw
Quoted 48 lines · Ajit Khaparde
Quoted 47 lines · Ferruh Yigit
Quoted 30 lines · Ajit Khaparde
Quoted 22 lines · Venkat Duvvuru

This patch set adds support for new offload features/enhancments for Thor adapters like VF representor support, new flow matches/actions & dynamic SRAM manager support.

Farah Smith (4):
net/bnxt: updates to TF core index table
net/bnxt: add SRAM manager model
net/bnxt: change log level to debug
net/bnxt: add SRAM manager shared session

Jay Ding (1):
net/bnxt: add flow meter drop counter support

Kishore Padmanabha (6):
net/bnxt: add flow template support for Thor net/bnxt: add support for tunnel offload API net/bnxt: add support for dynamic encap action net/bnxt: add wild card TCAM byte order for Thor net/bnxt: add flow templates for Thor net/bnxt: add enhancements to TF ULP

Quoted 5 lines

Peter Spreadborough (1):
net/bnxt: enable dpool allocator

Randy Schacher (1):
net/bnxt: dynamically allocate space for EM defrag function

Quoted 8 lines

For the patchset,

Patchset applied to dpdk-next-net-brcm.
1) Changed instance of TF to TRUFLOW during merge in patch 1/13 and 13/13.

Please apply to dpdk-next-net. Thanks

Hi Ajit,

The github actions fails on build for gcc, please check it on my personal github repo:
https://github.com/ferruhy/dpdk/actions/runs/1262767538

Quoted 8 lines
Quoted 2 lines

I don't have this error in my environment, this can be related to the slightly older compiler in the github (gcc 7.5)

Yes, even I did not see this. Looks genuine and likely because of some different compiler.
I will try to submit a fix. Will you be able to squash it with the relevant commit?

If you can send the fix on top of latest next-net, I can squash it in next-net, assuming the fix is simple.

Quoted 60 lines

FAILED: drivers/a715181@@tmp_rte_net_bnxt@sta/net_bnxt_tf_core_tf_sram_mgr.c.o ccache gcc -Idrivers/a715181@@tmp_rte_net_bnxt@sta -Idrivers

(quoted diff) +0 -18
-I../drivers -Idrivers/net/bnxt -I../drivers/net/bnxt
-Idrivers/net/bnxt/tf_ulp -I../drivers/net/bnxt/tf_ulp
-Idrivers/net/bnxt/tf_ulp/generic_templates
-I../drivers/net/bnxt/tf_ulp/generic_templates
-Idrivers/net/bnxt/tf_core -I../drivers/net/bnxt/tf_core
-Idrivers/net/bnxt/hcapi/cfa -I../drivers/net/bnxt/hcapi/cfa
-Ilib/ethdev -I../lib/ethdev -I. -I../ -Iconfig -I../config
-Ilib/eal/include -I../lib/eal/include -Ilib/eal/linux/include
-I../lib/eal/linux/include -Ilib/eal/x86/include
-I../lib/eal/x86/include -Ilib/eal/common -I../lib/eal/common
-Ilib/eal -I../lib/eal -Ilib/kvargs -I../lib/kvargs
-Ilib/telemetry/../metrics -I../lib/telemetry/../metrics
-Ilib/telemetry -I../lib/telemetry -Ilib/net -I../lib/net -Ilib/mbuf
-I../lib/mbuf -Ilib/mempool -I../lib/mempool -Ilib/ring -I../lib/ring
-Ilib/meter -I../lib/meter -Idrivers/bus/pci -I../drivers/bus/pci
-I../drivers/bus/pci/linux -Ilib/pci -I../lib/pci -Idrivers/bus/vdev
-I../drivers/bus/vdev -fdiagnostics-color=always -pipe
-D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -O2 -g -include

rte_config.h -Wextra -Wcast-qual -Wdeprecated -Wformat

(quoted diff) +0 -7
-Wformat-nonliteral -Wformat-security -Wmissing-declarations
-Wmissing-prototypes -Wnested-externs -Wold-style-definition
-Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wundef
-Wwrite-strings -Wno-missing-field-initializers -D_GNU_SOURCE -fPIC
-march=corei7 -DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API
-Wno-format-truncation -DRTE_LIBRTE_BNXT_TF -DSUPPORT_CFA_HW_ALL=1
-DCC_AVX2_SUPPORT -DRTE_LOG_DEFAULT_LOGTYPE=pmd.net.bnxt  -MD -MQ

'drivers/a715181@@tmp_rte_net_bnxt@sta/net_bnxt_tf_core_tf_sram_mgr.c.o'

(quoted diff) +0 -3
-MF 'drivers/a715181@@tmp_rte_net_bnxt@sta/net_bnxt_tf_core_tf_sram_mgr.c.o.d'
-o 'drivers/a715181@@tmp_rte_net_bnxt@sta/net_bnxt_tf_core_tf_sram_mgr.c.o'
-c ../drivers/net/bnxt/tf_core/tf_sram_mgr.c

../drivers/net/bnxt/tf_core/tf_sram_mgr.c: In function ‘tf_sram_mgr_bind’:
../drivers/net/bnxt/tf_core/tf_sram_mgr.c:418:19: error: ‘slice_list’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

  slice_list->tail = NULL;
                   ^
../drivers/net/bnxt/tf_core/tf_sram_mgr.c:574:29: note: ‘slice_list’
was declared here
  struct tf_sram_slice_list *slice_list;
                             ^~~~~~~~~~

cc1: all warnings being treated as errors

Quoted 8 lines

Can you please check the build error? I will keep the set in next-net for now, but won't mark it to pull to main until issue is resolved.
If the fix is trivial, we can update it in the next-net (after issue recorded in mail list), if it is not trivial may require a new version of the set.

btw, in git history 'TruFlow' is used, so I continue to use it, fyi.

No problem. Thanks

Quoted 4 lines

Thanks,
ferruh

#81 lore raw

PATCH 1/1 net/bnxt: remove code to initialize SRAM slice node

From: Kishore Padmanabha <[email protected]>

Remove the code to initialize SRAM slice mode explicitly. The code is redundanat as the memory allocated is initialized to zero by the rte_zmalloc. This fixes the compilation issue for uninitialized pointer when debug optimized configuration is used.

---
 drivers/net/bnxt/tf_core/tf_sram_mgr.c | 47 --------------------------
 1 file changed, 47 deletions(-)
drivers/net/bnxt/tf_core/tf_sram_mgr.c +0 -47
index f633a78b25..a248ef2ce8 100644
@@ -407,19 +407,6 @@ tf_sram_is_slice_allocated_in_block(struct tf_sram_block *block,
 	return rc;
 }
 
-/**
- * Initialize slice list
- */
-static void
-tf_sram_init_slice_list(struct tf_sram_slice_list *slice_list,
-			enum tf_sram_slice_size slice_size)
-{
-	slice_list->head = NULL;
-	slice_list->tail = NULL;
-	slice_list->cnt = 0;
-	slice_list->size = slice_size;
-}
-
 /**
  * Get the block count
  */
@@ -568,11 +555,7 @@ int
 tf_sram_mgr_bind(void **sram_handle)
 {
 	int rc = 0;
-	enum tf_sram_bank_id bank_id;
-	enum tf_sram_slice_size slice_size;
 	struct tf_sram *sram;
-	struct tf_sram_slice_list *slice_list;
-	enum tf_dir dir;
 	struct tfp_calloc_parms cparms;
 
 	TF_CHECK_PARMS1(sram_handle);
@@ -589,37 +572,7 @@ tf_sram_mgr_bind(void **sram_handle)
 		return rc;
 	}
 	sram = (struct tf_sram *)cparms.mem_va;
-
-	/* For each direction
-	 */
-	for (dir = 0; dir < TF_DIR_MAX; dir++) {
-		/* For each bank
-		 */
-		for (bank_id = TF_SRAM_BANK_ID_0;
-		     bank_id < TF_SRAM_BANK_ID_MAX;
-		     bank_id++) {
-			/* Create each sized slice empty list
-			 */
-			for (slice_size = TF_SRAM_SLICE_SIZE_8B;
-			     slice_size < TF_SRAM_SLICE_SIZE_MAX;
-			     slice_size++) {
-				rc = tf_sram_get_slice_list(sram, &slice_list,
-							    slice_size, dir,
-							    bank_id);
-				if (rc) {
-					/* Log error */
-					TFP_DRV_LOG(ERR,
-						  "No SRAM slice list, rc:%s\n",
-						  strerror(-rc));
-					return rc;
-				}
-				tf_sram_init_slice_list(slice_list, slice_size);
-			}
-		}
-	}
-
 	*sram_handle = sram;
-
 	return rc;
 }
 
Signature · 1 line
2.30.1 (Apple Git-130)
#82 lore raw

Re: [dpdk-dev] [PATCH] net/bnxt: remove code to initialize SRAM slice node

Quoted 10 lines · Ajit Khaparde

From: Kishore Padmanabha <[email protected]>

Remove the code to initialize SRAM slice mode explicitly. The code is redundanat as the memory allocated is initialized to zero by the rte_zmalloc. This fixes the compilation issue for uninitialized pointer when debug optimized configuration is used.

Squashed into relevant commit [1] in next-net, thanks.

[1]
net/bnxt: add SRAM manager model