Test-Label: iol-testing Test-Status: WARNING http://dpdk.org/patch/97688 _apply patch failure_ Submitter: Venkat Duvvuru Date: Wednesday, September 01 2021 14:24:33 Applied on: CommitID:175af25734f295874e31b33ccd0879e69fd152a9 Apply patch set 97688-97698 failed: Checking patch drivers/net/bnxt/tf_core/tf_core.c... Hunk #1 succeeded at 941 (offset -164 lines). Checking patch drivers/net/bnxt/tf_core/tf_core.h... error: while searching for: * @ref tf_get_shared_tbl_increment */ /** * tf_alloc_tbl_entry parameter definition */ struct tf_search_tbl_entry_parms { /** * [in] Receive or transmit direction */ enum tf_dir dir; /** * [in] Type of the allocation */ enum tf_tbl_type type; /** * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT) */ uint32_t tbl_scope_id; /** * [in] Result data to search for */ uint8_t *result; /** * [in] Result data size in bytes */ uint16_t result_sz_in_bytes; /** * [in] Allocate on miss. */ uint8_t alloc; /** * [out] Set if matching entry found */ uint8_t hit; /** * [out] Search result status (hit, miss, reject) */ enum tf_search_status search_status; /** * [out] Current ref count after allocation */ uint16_t ref_cnt; /** * [out] Idx of allocated entry or found entry */ uint32_t idx; }; /** * search Table Entry (experimental) * * This function searches the shadow copy of an index table for a matching * entry. The result data must match for hit to be set. Only TruFlow core * data is accessed. If shadow_copy is not enabled, an error is returned. * * Implementation: * * A hash is performed on the result data and mapped to a shadow copy entry * where the result is populated. If the result matches the entry, hit is set, * ref_cnt is incremented (if alloc), and the search status indicates what * action the caller can take regarding setting the entry. * * search status should be used as follows: * - On MISS, the caller should set the result into the returned index. * * - On REJECT, the caller should reject the flow since there are no resources. * * - On Hit, the matching index is returned to the caller. Additionally, the * ref_cnt is updated. * * Also returns success or failure code. */ int tf_search_tbl_entry(struct tf *tfp, struct tf_search_tbl_entry_parms *parms); /** * tf_alloc_tbl_entry parameter definition */ error: patch failed: drivers/net/bnxt/tf_core/tf_core.h:1622 Hunk #2 succeeded at 1409 (offset -229 lines). Hunk #3 succeeded at 1467 (offset -229 lines). Checking patch drivers/net/bnxt/tf_core/tf_device.h... Hunk #1 succeeded at 296 (offset -51 lines). Checking patch drivers/net/bnxt/tf_core/tf_device_p4.c... Hunk #1 succeeded at 150 (offset -86 lines). Hunk #2 succeeded at 186 (offset -95 lines). Checking patch drivers/net/bnxt/tf_core/tf_device_p58.c... error: drivers/net/bnxt/tf_core/tf_device_p58.c: does not exist in index Checking patch drivers/net/bnxt/tf_core/tf_em_common.c... Checking patch drivers/net/bnxt/tf_core/tf_tbl.c... error: while searching for: struct tf; /** * Table Shadow DBs */ static void *shadow_tbl_db[TF_DIR_MAX]; /** * Shadow init flag, set on bind and cleared on unbind */ error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:26 error: while searching for: 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) error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:327 Checking patch drivers/net/bnxt/tf_core/tf_tbl.h... error: while searching for: * The Table module provides processing of Internal TF table types. */ /** Invalid table scope id */ #define TF_TBL_SCOPE_INVALID 0xffffffff /** * Table configuration parameters error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.h:15 Hunk #2 succeeded at 116 (offset 32 lines). Hunk #3 succeeded at 295 (offset 22 lines). Checking patch drivers/net/bnxt/tf_ulp/ulp_mapper.c... error: while searching for: 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", tf_dir_2_str(aparms.dir), aparms.type); return rc; } error: patch failed: drivers/net/bnxt/tf_ulp/ulp_mapper.c:189 Applied patch drivers/net/bnxt/tf_core/tf_core.c cleanly. Applying patch drivers/net/bnxt/tf_core/tf_core.h with 1 reject... Rejected hunk #1. Hunk #2 applied cleanly. Hunk #3 applied cleanly. Applied patch drivers/net/bnxt/tf_core/tf_device.h cleanly. Applied patch drivers/net/bnxt/tf_core/tf_device_p4.c cleanly. Applied patch drivers/net/bnxt/tf_core/tf_em_common.c cleanly. Applying patch drivers/net/bnxt/tf_core/tf_tbl.c with 2 rejects... Rejected hunk #1. Rejected hunk #2. Applying patch drivers/net/bnxt/tf_core/tf_tbl.h with 1 reject... Rejected hunk #1. Hunk #2 applied cleanly. Hunk #3 applied cleanly. Applying patch drivers/net/bnxt/tf_ulp/ulp_mapper.c with 1 reject... Rejected hunk #1. diff a/drivers/net/bnxt/tf_core/tf_core.h b/drivers/net/bnxt/tf_core/tf_core.h (rejected hunks) @@ -1622,79 +1622,6 @@ int tf_clear_tcam_shared_entries(struct tf *tfp, * @ref tf_get_shared_tbl_increment */ -/** - * tf_alloc_tbl_entry parameter definition - */ -struct tf_search_tbl_entry_parms { - /** - * [in] Receive or transmit direction - */ - enum tf_dir dir; - /** - * [in] Type of the allocation - */ - enum tf_tbl_type type; - /** - * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT) - */ - uint32_t tbl_scope_id; - /** - * [in] Result data to search for - */ - uint8_t *result; - /** - * [in] Result data size in bytes - */ - uint16_t result_sz_in_bytes; - /** - * [in] Allocate on miss. - */ - uint8_t alloc; - /** - * [out] Set if matching entry found - */ - uint8_t hit; - /** - * [out] Search result status (hit, miss, reject) - */ - enum tf_search_status search_status; - /** - * [out] Current ref count after allocation - */ - uint16_t ref_cnt; - /** - * [out] Idx of allocated entry or found entry - */ - uint32_t idx; -}; - -/** - * search Table Entry (experimental) - * - * This function searches the shadow copy of an index table for a matching - * entry. The result data must match for hit to be set. Only TruFlow core - * data is accessed. If shadow_copy is not enabled, an error is returned. - * - * Implementation: - * - * A hash is performed on the result data and mapped to a shadow copy entry - * where the result is populated. If the result matches the entry, hit is set, - * ref_cnt is incremented (if alloc), and the search status indicates what - * action the caller can take regarding setting the entry. - * - * search status should be used as follows: - * - On MISS, the caller should set the result into the returned index. - * - * - On REJECT, the caller should reject the flow since there are no resources. - * - * - On Hit, the matching index is returned to the caller. Additionally, the - * ref_cnt is updated. - * - * Also returns success or failure code. - */ -int tf_search_tbl_entry(struct tf *tfp, - struct tf_search_tbl_entry_parms *parms); - /** * tf_alloc_tbl_entry parameter definition */ diff a/drivers/net/bnxt/tf_core/tf_tbl.c b/drivers/net/bnxt/tf_core/tf_tbl.c (rejected hunks) @@ -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) diff a/drivers/net/bnxt/tf_core/tf_tbl.h b/drivers/net/bnxt/tf_core/tf_tbl.h (rejected hunks) @@ -15,8 +15,6 @@ struct tf; * The Table module provides processing of Internal TF table types. */ -/** Invalid table scope id */ -#define TF_TBL_SCOPE_INVALID 0xffffffff /** * Table configuration parameters diff a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c (rejected hunks) @@ -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; } Checking patch drivers/net/bnxt/tf_core/tf_device_p58.c... error: drivers/net/bnxt/tf_core/tf_device_p58.c: does not exist in index Checking patch drivers/net/bnxt/tf_core/tf_em.h... error: while searching for: #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 */ error: patch failed: drivers/net/bnxt/tf_core/tf_em.h:13 Checking patch drivers/net/bnxt/tf_core/tf_em_hash_internal.c... error: drivers/net/bnxt/tf_core/tf_em_hash_internal.c: does not exist in index Checking patch drivers/net/bnxt/tf_core/tf_em_internal.c... error: while searching for: /** * EM Pool */ #if (TF_EM_ALLOC == 1) #include "dpool.h" #else /** * Create EM Tbl pool of memory indexes. * * [in] dir * direction * [in] num_entries * number of entries to write * [in] start * starting offset * * Return: * 0 - Success, entry allocated - no search support * -ENOMEM -EINVAL -EOPNOTSUPP * - Failure, entry not allocated, out of resources */ static int tf_create_em_pool(struct tf_session *tfs, enum tf_dir dir, uint32_t num_entries, uint32_t start) { struct tfp_calloc_parms parms; uint32_t i, j; int rc = 0; struct stack *pool; /* * Allocate stack pool */ parms.nitems = 1; parms.size = sizeof(struct stack); parms.alignment = 0; rc = tfp_calloc(&parms); if (rc) { TFP_DRV_LOG(ERR, "%s, EM stack allocation failure %s\n", tf_dir_2_str(dir), strerror(-rc)); return rc; } pool = (struct stack *)parms.mem_va; tfs->em_pool[dir] = (void *)pool; /* Assumes that num_entries has been checked before we get here */ parms.nitems = num_entries / TF_SESSION_EM_ENTRY_SIZE; parms.size = sizeof(uint32_t); parms.alignment = 0; rc = tfp_calloc(&parms); if (rc) { TFP_DRV_LOG(ERR, "%s, EM pool allocation failure %s\n", tf_dir_2_str(dir), strerror(-rc)); return rc; } /* Create empty stack */ rc = stack_init(num_entries / TF_SESSION_EM_ENTRY_SIZE, (uint32_t *)parms.mem_va, pool); if (rc) { TFP_DRV_LOG(ERR, "%s, EM pool stack init failure %s\n", tf_dir_2_str(dir), strerror(-rc)); goto cleanup; } /* Fill pool with indexes */ j = start + num_entries - TF_SESSION_EM_ENTRY_SIZE; for (i = 0; i < (num_entries / TF_SESSION_EM_ENTRY_SIZE); i++) { rc = stack_push(pool, j); if (rc) { TFP_DRV_LOG(ERR, "%s, EM pool stack push failure %s\n", tf_dir_2_str(dir), strerror(-rc)); goto cleanup; } j -= TF_SESSION_EM_ENTRY_SIZE; } if (!stack_is_full(pool)) { rc = -EINVAL; TFP_DRV_LOG(ERR, "%s, EM pool stack failure %s\n", tf_dir_2_str(dir), strerror(-rc)); goto cleanup; } return 0; cleanup: tfp_free((void *)parms.mem_va); tfp_free((void *)tfs->em_pool[dir]); tfs->em_pool[dir] = NULL; return rc; } /** * Create EM Tbl pool of memory indexes. * * [in] dir * direction * * Return: */ static void tf_free_em_pool(struct tf_session *tfs, enum tf_dir dir) { struct stack *pool = (struct stack *)tfs->em_pool[dir]; uint32_t *ptr; if (pool != NULL) { ptr = stack_items(pool); if (ptr != NULL) tfp_free(ptr); tfp_free(pool); tfs->em_pool[dir] = NULL; } } #endif /* TF_EM_ALLOC != 1 */ /** * Insert EM internal entry API error: patch failed: drivers/net/bnxt/tf_core/tf_em_internal.c:22 error: while searching for: uint8_t rptr_entry = 0; uint8_t num_of_entries = 0; struct tf_session *tfs; #if (TF_EM_ALLOC == 1) struct dpool *pool; #else struct stack *pool; #endif uint32_t index; /* Retrieve the session information */ error: patch failed: drivers/net/bnxt/tf_core/tf_em_internal.c:178 error: while searching for: return rc; } #if (TF_EM_ALLOC == 1) pool = (struct dpool *)tfs->em_pool[parms->dir]; index = dpool_alloc(pool, TF_SESSION_EM_ENTRY_SIZE, 0); if (index == DP_INVALID_INDEX) { error: patch failed: drivers/net/bnxt/tf_core/tf_em_internal.c:195 error: while searching for: 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 rptr_index = index; error: patch failed: drivers/net/bnxt/tf_core/tf_em_internal.c:204 error: while searching for: &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; } TF_SET_GFID(gfid, error: patch failed: drivers/net/bnxt/tf_core/tf_em_internal.c:224 error: while searching for: { 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) { error: patch failed: drivers/net/bnxt/tf_core/tf_em_internal.c:264 error: while searching for: /* 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) static int tf_em_move_callback(void *user_data, uint64_t entry_data, error: patch failed: drivers/net/bnxt/tf_core/tf_em_internal.c:283 error: while searching for: return rc; } #endif int tf_em_int_bind(struct tf *tfp, error: patch failed: drivers/net/bnxt/tf_core/tf_em_internal.c:342 error: while searching for: tf_dir_2_str(i)); return rc; } #if (TF_EM_ALLOC == 1) /* * Allocate stack pool */ error: patch failed: drivers/net/bnxt/tf_core/tf_em_internal.c:434 error: while searching for: 7, (void *)tfp, tf_em_move_callback); #else rc = tf_create_em_pool(tfs, i, iparms.info->entry.stride, iparms.info->entry.start); #endif /* Logging handled in tf_create_em_pool */ if (rc) return rc; error: patch failed: drivers/net/bnxt/tf_core/tf_em_internal.c:460 error: while searching for: if (!tf_session_is_shared_session(tfs)) { for (i = 0; i < TF_DIR_MAX; i++) #if (TF_EM_ALLOC == 1) dpool_free_all(tfs->em_pool[i]); #else tf_free_em_pool(tfs, i); #endif } rc = tf_session_get_db(tfp, TF_MODULE_TYPE_EM, &em_db_ptr); error: patch failed: drivers/net/bnxt/tf_core/tf_em_internal.c:501 Applying patch drivers/net/bnxt/tf_core/tf_em.h with 1 reject... Rejected hunk #1. Applying patch drivers/net/bnxt/tf_core/tf_em_internal.c with 11 rejects... Rejected hunk #1. Rejected hunk #2. Rejected hunk #3. Rejected hunk #4. Rejected hunk #5. Rejected hunk #6. Rejected hunk #7. Rejected hunk #8. Rejected hunk #9. Rejected hunk #10. Rejected hunk #11. diff a/drivers/net/bnxt/tf_core/tf_em.h b/drivers/net/bnxt/tf_core/tf_em.h (rejected hunks) @@ -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 */ diff a/drivers/net/bnxt/tf_core/tf_em_internal.c b/drivers/net/bnxt/tf_core/tf_em_internal.c (rejected hunks) @@ -22,145 +22,7 @@ /** * EM Pool */ -#if (TF_EM_ALLOC == 1) #include "dpool.h" -#else - -/** - * Create EM Tbl pool of memory indexes. - * - * [in] dir - * direction - * [in] num_entries - * number of entries to write - * [in] start - * starting offset - * - * Return: - * 0 - Success, entry allocated - no search support - * -ENOMEM -EINVAL -EOPNOTSUPP - * - Failure, entry not allocated, out of resources - */ -static int -tf_create_em_pool(struct tf_session *tfs, - enum tf_dir dir, - uint32_t num_entries, - uint32_t start) -{ - struct tfp_calloc_parms parms; - uint32_t i, j; - int rc = 0; - struct stack *pool; - - /* - * Allocate stack pool - */ - parms.nitems = 1; - parms.size = sizeof(struct stack); - parms.alignment = 0; - - rc = tfp_calloc(&parms); - - if (rc) { - TFP_DRV_LOG(ERR, - "%s, EM stack allocation failure %s\n", - tf_dir_2_str(dir), - strerror(-rc)); - return rc; - } - - pool = (struct stack *)parms.mem_va; - tfs->em_pool[dir] = (void *)pool; - - /* Assumes that num_entries has been checked before we get here */ - parms.nitems = num_entries / TF_SESSION_EM_ENTRY_SIZE; - parms.size = sizeof(uint32_t); - parms.alignment = 0; - - rc = tfp_calloc(&parms); - - if (rc) { - TFP_DRV_LOG(ERR, - "%s, EM pool allocation failure %s\n", - tf_dir_2_str(dir), - strerror(-rc)); - return rc; - } - - /* Create empty stack - */ - rc = stack_init(num_entries / TF_SESSION_EM_ENTRY_SIZE, - (uint32_t *)parms.mem_va, - pool); - - if (rc) { - TFP_DRV_LOG(ERR, - "%s, EM pool stack init failure %s\n", - tf_dir_2_str(dir), - strerror(-rc)); - goto cleanup; - } - - /* Fill pool with indexes - */ - j = start + num_entries - TF_SESSION_EM_ENTRY_SIZE; - - for (i = 0; i < (num_entries / TF_SESSION_EM_ENTRY_SIZE); i++) { - rc = stack_push(pool, j); - if (rc) { - TFP_DRV_LOG(ERR, - "%s, EM pool stack push failure %s\n", - tf_dir_2_str(dir), - strerror(-rc)); - goto cleanup; - } - - j -= TF_SESSION_EM_ENTRY_SIZE; - } - - if (!stack_is_full(pool)) { - rc = -EINVAL; - TFP_DRV_LOG(ERR, - "%s, EM pool stack failure %s\n", - tf_dir_2_str(dir), - strerror(-rc)); - goto cleanup; - } - - return 0; -cleanup: - tfp_free((void *)parms.mem_va); - tfp_free((void *)tfs->em_pool[dir]); - tfs->em_pool[dir] = NULL; - return rc; -} - -/** - * Create EM Tbl pool of memory indexes. - * - * [in] dir - * direction - * - * Return: - */ -static void -tf_free_em_pool(struct tf_session *tfs, - enum tf_dir dir) -{ - struct stack *pool = (struct stack *)tfs->em_pool[dir]; - uint32_t *ptr; - - if (pool != NULL) { - ptr = stack_items(pool); - - if (ptr != NULL) - tfp_free(ptr); - - tfp_free(pool); - tfs->em_pool[dir] = NULL; - } -} -#endif /* TF_EM_ALLOC != 1 */ /** * Insert EM internal entry API @@ -178,11 +40,7 @@ tf_em_insert_int_entry(struct tf *tfp, uint8_t rptr_entry = 0; uint8_t num_of_entries = 0; struct tf_session *tfs; -#if (TF_EM_ALLOC == 1) struct dpool *pool; -#else - struct stack *pool; -#endif uint32_t index; /* Retrieve the session information */ @@ -195,7 +53,6 @@ tf_em_insert_int_entry(struct tf *tfp, return rc; } -#if (TF_EM_ALLOC == 1) pool = (struct dpool *)tfs->em_pool[parms->dir]; index = dpool_alloc(pool, TF_SESSION_EM_ENTRY_SIZE, 0); if (index == DP_INVALID_INDEX) { @@ -204,16 +61,6 @@ tf_em_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 rptr_index = index; @@ -224,11 +71,7 @@ tf_em_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; } TF_SET_GFID(gfid, @@ -264,11 +107,7 @@ tf_em_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) { @@ -283,19 +122,13 @@ tf_em_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) static int tf_em_move_callback(void *user_data, uint64_t entry_data, @@ -342,7 +175,6 @@ tf_em_move_callback(void *user_data, return rc; } -#endif int tf_em_int_bind(struct tf *tfp, @@ -434,7 +266,7 @@ tf_em_int_bind(struct tf *tfp, tf_dir_2_str(i)); return rc; } -#if (TF_EM_ALLOC == 1) + /* * Allocate stack pool */ @@ -460,12 +292,6 @@ tf_em_int_bind(struct tf *tfp, 7, (void *)tfp, tf_em_move_callback); -#else - rc = tf_create_em_pool(tfs, - i, - iparms.info->entry.stride, - iparms.info->entry.start); -#endif /* Logging handled in tf_create_em_pool */ if (rc) return rc; @@ -501,11 +327,7 @@ tf_em_int_unbind(struct tf *tfp) if (!tf_session_is_shared_session(tfs)) { for (i = 0; i < TF_DIR_MAX; i++) -#if (TF_EM_ALLOC == 1) dpool_free_all(tfs->em_pool[i]); -#else - tf_free_em_pool(tfs, i); -#endif } rc = tf_session_get_db(tfp, TF_MODULE_TYPE_EM, &em_db_ptr); Checking patch drivers/net/bnxt/tf_core/cfa_resource_types.h... error: while searching for: #define CFA_RESOURCE_TYPE_P58_WC_FKB 0x12UL /* VEB TCAM */ #define CFA_RESOURCE_TYPE_P58_VEB_TCAM 0x13UL /* 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 /* Multicast Group */ #define CFA_RESOURCE_TYPE_P45_MCG 0x0UL error: patch failed: drivers/net/bnxt/tf_core/cfa_resource_types.h:104 Checking patch drivers/net/bnxt/tf_core/tf_core.h... error: drivers/net/bnxt/tf_core/tf_core.h: does not match index Checking patch drivers/net/bnxt/tf_core/tf_device_p58.c... error: drivers/net/bnxt/tf_core/tf_device_p58.c: does not exist in index Checking patch drivers/net/bnxt/tf_core/tf_device_p58.h... error: drivers/net/bnxt/tf_core/tf_device_p58.h: does not exist in index Checking patch drivers/net/bnxt/tf_core/tf_tbl.c... error: while searching for: } } /* Verify that the entry has been previously allocated */ aparms.rm_db = tbl_db->tbl_db[parms->dir]; aparms.subtype = parms->type; TF_TBL_PTR_TO_RM(&aparms.index, parms->idx, base, shift); aparms.allocated = &allocated; rc = tf_rm_is_allocated(&aparms); if (rc) return rc; if (allocated != TF_RM_ALLOCATED_ENTRY_IN_USE) { TFP_DRV_LOG(ERR, "%s, Invalid or not allocated index, type:%d, idx:%d\n", tf_dir_2_str(parms->dir), parms->type, parms->idx); return -EINVAL; } /* Set the entry */ error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:374 error: while searching for: } } /* Verify that the entry has been previously allocated */ aparms.rm_db = tbl_db->tbl_db[parms->dir]; aparms.subtype = parms->type; TF_TBL_PTR_TO_RM(&aparms.index, parms->idx, base, shift); aparms.allocated = &allocated; rc = tf_rm_is_allocated(&aparms); if (rc) return rc; if (allocated != TF_RM_ALLOCATED_ENTRY_IN_USE) { TFP_DRV_LOG(ERR, "%s, Invalid or not allocated index, type:%d, idx:%d\n", tf_dir_2_str(parms->dir), parms->type, parms->idx); return -EINVAL; } /* Set the entry */ error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:477 Checking patch drivers/net/bnxt/tf_core/tf_util.c... Hunk #1 succeeded at 124 (offset 12 lines). Applying patch drivers/net/bnxt/tf_core/cfa_resource_types.h with 1 reject... Rejected hunk #1. Applying patch drivers/net/bnxt/tf_core/tf_tbl.c with 2 rejects... Rejected hunk #1. Rejected hunk #2. Applied patch drivers/net/bnxt/tf_core/tf_util.c cleanly. diff a/drivers/net/bnxt/tf_core/cfa_resource_types.h b/drivers/net/bnxt/tf_core/cfa_resource_types.h (rejected hunks) @@ -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 diff a/drivers/net/bnxt/tf_core/tf_tbl.c b/drivers/net/bnxt/tf_core/tf_tbl.c (rejected hunks) @@ -374,23 +374,28 @@ tf_tbl_set(struct tf *tfp, } } - /* Verify that the entry has been previously allocated */ - aparms.rm_db = tbl_db->tbl_db[parms->dir]; - aparms.subtype = parms->type; - TF_TBL_PTR_TO_RM(&aparms.index, parms->idx, base, shift); - - aparms.allocated = &allocated; - rc = tf_rm_is_allocated(&aparms); - if (rc) - return rc; + /* Do not check meter drop counter because it is not allocated + * resources + */ + if (parms->type != TF_TBL_TYPE_METER_DROP_CNT) { + /* Verify that the entry has been previously allocated */ + aparms.rm_db = tbl_db->tbl_db[parms->dir]; + aparms.subtype = parms->type; + TF_TBL_PTR_TO_RM(&aparms.index, parms->idx, base, shift); + + aparms.allocated = &allocated; + rc = tf_rm_is_allocated(&aparms); + if (rc) + return rc; - if (allocated != TF_RM_ALLOCATED_ENTRY_IN_USE) { - TFP_DRV_LOG(ERR, - "%s, Invalid or not allocated index, type:%d, idx:%d\n", - tf_dir_2_str(parms->dir), - parms->type, - parms->idx); - return -EINVAL; + if (allocated != TF_RM_ALLOCATED_ENTRY_IN_USE) { + TFP_DRV_LOG(ERR, + "%s, Invalid or not allocated index, type:%d, idx:%d\n", + tf_dir_2_str(parms->dir), + parms->type, + parms->idx); + return -EINVAL; + } } /* Set the entry */ @@ -477,23 +482,28 @@ tf_tbl_get(struct tf *tfp, } } - /* Verify that the entry has been previously allocated */ - aparms.rm_db = tbl_db->tbl_db[parms->dir]; - aparms.subtype = parms->type; - TF_TBL_PTR_TO_RM(&aparms.index, parms->idx, base, shift); - - aparms.allocated = &allocated; - rc = tf_rm_is_allocated(&aparms); - if (rc) - return rc; + /* Do not check meter drop counter because it is not allocated + * resources. + */ + if (parms->type != TF_TBL_TYPE_METER_DROP_CNT) { + /* Verify that the entry has been previously allocated */ + aparms.rm_db = tbl_db->tbl_db[parms->dir]; + aparms.subtype = parms->type; + TF_TBL_PTR_TO_RM(&aparms.index, parms->idx, base, shift); + + aparms.allocated = &allocated; + rc = tf_rm_is_allocated(&aparms); + if (rc) + return rc; - if (allocated != TF_RM_ALLOCATED_ENTRY_IN_USE) { - TFP_DRV_LOG(ERR, - "%s, Invalid or not allocated index, type:%d, idx:%d\n", - tf_dir_2_str(parms->dir), - parms->type, - parms->idx); - return -EINVAL; + if (allocated != TF_RM_ALLOCATED_ENTRY_IN_USE) { + TFP_DRV_LOG(ERR, + "%s, Invalid or not allocated index, type:%d, idx:%d\n", + tf_dir_2_str(parms->dir), + parms->type, + parms->idx); + return -EINVAL; + } } /* Set the entry */ Checking patch drivers/net/bnxt/tf_core/ll.c... Checking patch drivers/net/bnxt/tf_core/ll.h... Checking patch drivers/net/bnxt/tf_core/meson.build... error: drivers/net/bnxt/tf_core/meson.build: does not exist in index Checking patch drivers/net/bnxt/tf_core/tf_core.c... error: drivers/net/bnxt/tf_core/tf_core.c: does not match index Checking patch drivers/net/bnxt/tf_core/tf_core.h... error: drivers/net/bnxt/tf_core/tf_core.h: does not match index Checking patch drivers/net/bnxt/tf_core/tf_device.c... error: while searching for: #include "tf_rm.h" #ifdef TF_TCAM_SHARED #include "tf_tcam_shared.h" #endif /* TF_TCAM_SHARED */ struct tf; /* Forward declarations */ static int tf_dev_unbind_p4(struct tf *tfp); static int tf_dev_unbind_p58(struct tf *tfp); error: patch failed: drivers/net/bnxt/tf_core/tf_device.c:11 Hunk #2 succeeded at 36 (offset -51 lines). error: while searching for: 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) { error: patch failed: drivers/net/bnxt/tf_core/tf_device.c:131 error: while searching for: tcam_cfg.cfg = tf_tcam_p4; tcam_cfg.shadow_copy = shadow_copy; tcam_cfg.resources = resources; #ifdef TF_TCAM_SHARED rc = tf_tcam_shared_bind(tfp, &tcam_cfg); #else /* !TF_TCAM_SHARED */ error: patch failed: drivers/net/bnxt/tf_core/tf_device.c:151 error: while searching for: tf_dev_bind_p58(struct tf *tfp, bool shadow_copy, struct tf_session_resources *resources, struct tf_dev_info *dev_handle) { int rc; int frc; error: patch failed: drivers/net/bnxt/tf_core/tf_device.c:369 error: while searching for: 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) { error: patch failed: drivers/net/bnxt/tf_core/tf_device.c:414 error: while searching for: goto fail; } no_rsv_flag = false; } rsv_cnt = tf_dev_reservation_check(TF_TCAM_TBL_TYPE_MAX, error: patch failed: drivers/net/bnxt/tf_core/tf_device.c:423 error: while searching for: tcam_cfg.cfg = tf_tcam_p58; tcam_cfg.shadow_copy = shadow_copy; tcam_cfg.resources = resources; #ifdef TF_TCAM_SHARED rc = tf_tcam_shared_bind(tfp, &tcam_cfg); #else /* !TF_TCAM_SHARED */ error: patch failed: drivers/net/bnxt/tf_core/tf_device.c:433 error: while searching for: fail = true; } rc = tf_tbl_unbind(tfp); if (rc) { TFP_DRV_LOG(INFO, error: patch failed: drivers/net/bnxt/tf_core/tf_device.c:565 Hunk #10 succeeded at 240 (offset -391 lines). error: while searching for: return tf_dev_bind_p4(tfp, shadow_copy, resources, dev_handle); case TF_DEVICE_TYPE_THOR: dev_handle->type = type; return tf_dev_bind_p58(tfp, shadow_copy, resources, dev_handle); default: TFP_DRV_LOG(ERR, "No such device\n"); error: patch failed: drivers/net/bnxt/tf_core/tf_device.c:615 Checking patch drivers/net/bnxt/tf_core/tf_device.h... error: drivers/net/bnxt/tf_core/tf_device.h: does not match index Checking patch drivers/net/bnxt/tf_core/tf_device_p4.c... error: drivers/net/bnxt/tf_core/tf_device_p4.c: does not match index Checking patch drivers/net/bnxt/tf_core/tf_device_p4.h... error: while searching for: struct tf_rm_element_cfg tf_ident_p4[TF_IDENT_TYPE_MAX] = { [TF_IDENT_TYPE_L2_CTXT_HIGH] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_L2_CTXT_REMAP_HIGH, 0, 0, 0 }, [TF_IDENT_TYPE_L2_CTXT_LOW] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_L2_CTXT_REMAP_LOW, 0, 0, 0 }, [TF_IDENT_TYPE_PROF_FUNC] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_PROF_FUNC, 0, 0, 0 }, [TF_IDENT_TYPE_WC_PROF] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_WC_TCAM_PROF_ID, 0, 0, 0 }, [TF_IDENT_TYPE_EM_PROF] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_EM_PROF_ID, 0, 0, 0 }, }; struct tf_rm_element_cfg tf_tcam_p4[TF_TCAM_TBL_TYPE_MAX] = { [TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_HIGH] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_L2_CTXT_TCAM_HIGH, 0, 0, 0 }, [TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_L2_CTXT_TCAM_LOW, 0, 0, 0 }, [TF_TCAM_TBL_TYPE_PROF_TCAM] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_PROF_TCAM, 0, 0, 0 }, [TF_TCAM_TBL_TYPE_WC_TCAM] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_WC_TCAM, 0, 0, 0 }, [TF_TCAM_TBL_TYPE_SP_TCAM] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_SP_TCAM, 0, 0, 0 }, }; struct tf_rm_element_cfg tf_tbl_p4[TF_TBL_TYPE_MAX] = { [TF_TBL_TYPE_FULL_ACT_RECORD] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_FULL_ACTION, 0, 0, 0 }, [TF_TBL_TYPE_MCAST_GROUPS] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_MCG, 0, 0, 0 }, [TF_TBL_TYPE_ACT_ENCAP_8B] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_ENCAP_8B, 0, 0, 0 }, [TF_TBL_TYPE_ACT_ENCAP_16B] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_ENCAP_16B, 0, 0, 0 }, [TF_TBL_TYPE_ACT_ENCAP_64B] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_ENCAP_64B, 0, 0, 0 }, [TF_TBL_TYPE_ACT_SP_SMAC] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_SP_MAC, 0, 0, 0 }, [TF_TBL_TYPE_ACT_SP_SMAC_IPV4] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_SP_MAC_IPV4, 0, 0, 0 }, [TF_TBL_TYPE_ACT_SP_SMAC_IPV6] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_SP_MAC_IPV6, 0, 0, 0 }, [TF_TBL_TYPE_ACT_STATS_64] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_COUNTER_64B, 0, 0, 0 }, [TF_TBL_TYPE_ACT_MODIFY_IPV4] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_NAT_IPV4, 0, 0, 0 }, [TF_TBL_TYPE_METER_PROF] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_METER_PROF, 0, 0, 0 }, [TF_TBL_TYPE_METER_INST] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_METER, 0, 0, 0 }, [TF_TBL_TYPE_MIRROR_CONFIG] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_MIRROR, 0, 0, 0 }, }; error: patch failed: drivers/net/bnxt/tf_core/tf_device_p4.h:15 error: while searching for: struct tf_rm_element_cfg tf_em_ext_p4[TF_EM_TBL_TYPE_MAX] = { [TF_EM_TBL_TYPE_TBL_SCOPE] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_TBL_SCOPE, 0, 0, 0 }, }; struct tf_rm_element_cfg tf_em_int_p4[TF_EM_TBL_TYPE_MAX] = { [TF_EM_TBL_TYPE_EM_RECORD] = { TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_EM_REC, 0, 0, 0 }, }; error: patch failed: drivers/net/bnxt/tf_core/tf_device_p4.h:117 Checking patch drivers/net/bnxt/tf_core/tf_device_p58.c... error: drivers/net/bnxt/tf_core/tf_device_p58.c: does not exist in index Checking patch drivers/net/bnxt/tf_core/tf_device_p58.h... error: drivers/net/bnxt/tf_core/tf_device_p58.h: does not exist in index Checking patch drivers/net/bnxt/tf_core/tf_msg.c... error: while searching for: if (rc != 0) return rc; tfp_memcpy(params->data, resp.data, req.size); return 0; } error: patch failed: drivers/net/bnxt/tf_core/tf_msg.c:2231 Checking patch drivers/net/bnxt/tf_core/tf_rm.c... Hunk #1 succeeded at 36 (offset 2 lines). error: while searching for: * - - Failure if negative */ static int tf_rm_update_parent_reservations(struct tf_rm_element_cfg *cfg, uint16_t *alloc_cnt, uint16_t num_elements, uint16_t *req_cnt) { int parent, child; /* Search through all the elements */ for (parent = 0; parent < num_elements; parent++) { error: patch failed: drivers/net/bnxt/tf_core/tf_rm.c:356 error: while searching for: if (alloc_cnt[parent] % cfg[parent].slices) combined_cnt++; /* Search again through all the elements */ for (child = 0; child < num_elements; child++) { /* If this is one of my children */ if (cfg[child].cfg_type == TF_RM_ELEM_CFG_HCAPI_BA_CHILD && cfg[child].parent_subtype == parent) { uint16_t cnt = 0; RTE_ASSERT(cfg[child].slices); /* Increment the parents combined count * with each child's count adjusted for * number of slices per RM allocated item. error: patch failed: drivers/net/bnxt/tf_core/tf_rm.c:377 error: while searching for: /* Update the req_cnt based upon the element configuration */ tf_rm_update_parent_reservations(parms->cfg, parms->alloc_cnt, parms->num_elements, req_cnt); error: patch failed: drivers/net/bnxt/tf_core/tf_rm.c:479 error: while searching for: db[i].cfg_type = cfg->cfg_type; db[i].hcapi_type = cfg->hcapi_type; /* Save the parent subtype for later use to find the pool */ error: patch failed: drivers/net/bnxt/tf_core/tf_rm.c:594 Hunk #6 succeeded at 910 (offset -381 lines). Checking patch drivers/net/bnxt/tf_core/tf_rm.h... Hunk #2 succeeded at 95 (offset -9 lines). error: while searching for: uint16_t hcapi_type; /** * if cfg_type == TF_RM_ELEM_CFG_HCAPI_BA_CHILD * * Parent Truflow module subtype associated with this resource type. */ uint16_t parent_subtype; /** * if cfg_type == TF_RM_ELEM_CFG_HCAPI_BA_CHILD * * Resource slices. How many slices will fit in the * resource pool chunk size. */ uint8_t slices; /** * Pool element divider count * If 0 or 1, there is 1:1 correspondence between the RM * BA pool resource element and the HCAPI RM firmware * resource. If > 1, the RM BA pool element has a 1:n * correspondence to the HCAPI RM firmware resource. */ uint8_t divider; }; /** error: patch failed: drivers/net/bnxt/tf_core/tf_rm.h:125 Hunk #4 succeeded at 113 (offset -24 lines). Hunk #5 succeeded at 280 (offset -28 lines). Hunk #6 succeeded at 360 (offset -30 lines). Hunk #7 succeeded at 505 (offset -64 lines). Checking patch drivers/net/bnxt/tf_core/tf_session.c... error: while searching for: parms->open_cfg->device_type, session->shadow_copy, &parms->open_cfg->resources, &session->dev); /* Logging handled by dev_bind */ error: patch failed: drivers/net/bnxt/tf_core/tf_session.c:202 Hunk #2 succeeded at 640 (offset -66 lines). error: while searching for: tfs->tcam_shared_db_handle = tcam_shared_db_handle; return rc; } #endif /* TF_TCAM_SHARED */ error: patch failed: drivers/net/bnxt/tf_core/tf_session.c:1012 Checking patch drivers/net/bnxt/tf_core/tf_session.h... error: while searching for: */ void *tcam_shared_db_handle; #endif /* TF_TCAM_SHARED */ }; /** error: patch failed: drivers/net/bnxt/tf_core/tf_session.h:166 error: while searching for: * * @ref tf_session_set_tcam_shared_db * #endif */ /** error: patch failed: drivers/net/bnxt/tf_core/tf_session.h:278 Hunk #3 succeeded at 365 (offset -78 lines). Hunk #4 succeeded at 378 (offset -78 lines). error: while searching for: tf_session_get_tcam_shared_db(struct tf *tfp, void **tcam_shared_db_handle); #endif /* _TF_SESSION_H_ */ error: patch failed: drivers/net/bnxt/tf_core/tf_session.h:614 Checking patch drivers/net/bnxt/tf_core/tf_sram_mgr.c... Checking patch drivers/net/bnxt/tf_core/tf_sram_mgr.h... Checking patch drivers/net/bnxt/tf_core/tf_tbl.c... error: while searching for: #include "tf_session.h" #include "tf_device.h" #define TF_TBL_RM_TO_PTR(new_idx, idx, base, shift) { \ *(new_idx) = (((idx) + (base)) << (shift)); \ } #define TF_TBL_PTR_TO_RM(new_idx, idx, base, shift) { \ *(new_idx) = (((idx) >> (shift)) - (base)); \ } struct tf; /** * Shadow init flag, set on bind and cleared on unbind */ static uint8_t shadow_init; int tf_tbl_bind(struct tf *tfp, error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:16 error: while searching for: tbl_db->tbl_db[i] = NULL; } shadow_init = 0; return 0; } error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:121 error: while searching for: struct tf_rm_allocate_parms aparms = { 0 }; struct tf_session *tfs; struct tf_dev_info *dev; uint16_t base = 0, shift = 0; struct tbl_rm_db *tbl_db; void *tbl_db_ptr = NULL; error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:135 error: while searching for: rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TABLE, &tbl_db_ptr); if (rc) { TFP_DRV_LOG(ERR, "Failed to get em_ext_db from session, rc:%s\n", strerror(-rc)); return rc; } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; /* Only get table info if required for the device */ if (dev->ops->tf_dev_get_tbl_info) { rc = dev->ops->tf_dev_get_tbl_info(tfp, tbl_db->tbl_db[parms->dir], parms->type, &base, &shift); if (rc) { TFP_DRV_LOG(ERR, "%s: Failed to get table info:%d\n", tf_dir_2_str(parms->dir), parms->type); return rc; } } /* Allocate requested element */ aparms.rm_db = tbl_db->tbl_db[parms->dir]; aparms.subtype = parms->type; error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:154 error: while searching for: rc = tf_rm_allocate(&aparms); if (rc) { TFP_DRV_LOG(ERR, "%s: Failed allocate, type:%d\n", tf_dir_2_str(parms->dir), parms->type); return rc; } TF_TBL_RM_TO_PTR(&idx, idx, base, shift); *parms->idx = idx; return 0; error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:183 error: while searching for: int allocated = 0; struct tf_session *tfs; struct tf_dev_info *dev; uint16_t base = 0, shift = 0; struct tbl_rm_db *tbl_db; void *tbl_db_ptr = NULL; error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:205 error: while searching for: } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; /* Only get table info if required for the device */ if (dev->ops->tf_dev_get_tbl_info) { rc = dev->ops->tf_dev_get_tbl_info(tfp, tbl_db->tbl_db[parms->dir], parms->type, &base, &shift); if (rc) { TFP_DRV_LOG(ERR, "%s: Failed to get table info:%d\n", tf_dir_2_str(parms->dir), parms->type); return rc; } } /* Check if element is in use */ aparms.rm_db = tbl_db->tbl_db[parms->dir]; aparms.subtype = parms->type; TF_TBL_PTR_TO_RM(&aparms.index, parms->idx, base, shift); aparms.allocated = &allocated; rc = tf_rm_is_allocated(&aparms); if (rc) error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:230 Hunk #8 succeeded at 253 (offset 42 lines). error: while searching for: rc = tf_rm_get_hcapi_type(&hparms); if (rc) { TFP_DRV_LOG(ERR, "%s, Failed type lookup, type:%d, rc:%s\n", tf_dir_2_str(parms->dir), parms->type, strerror(-rc)); return rc; } error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:279 error: while searching for: parms->idx); if (rc) { TFP_DRV_LOG(ERR, "%s, Set failed, type:%d, rc:%s\n", tf_dir_2_str(parms->dir), parms->type, strerror(-rc)); return rc; } error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:295 error: while searching for: /* Free requested element */ fparms.rm_db = tbl_db->tbl_db[parms->dir]; fparms.subtype = parms->type; TF_TBL_PTR_TO_RM(&fparms.index, parms->idx, base, shift); rc = tf_rm_free(&fparms); if (rc) { TFP_DRV_LOG(ERR, "%s: Free failed, type:%d, index:%d\n", tf_dir_2_str(parms->dir), parms->type, parms->idx); return rc; } error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:306 error: while searching for: struct tf_rm_get_hcapi_parms hparms = { 0 }; struct tf_session *tfs; struct tf_dev_info *dev; uint16_t base = 0, shift = 0; struct tbl_rm_db *tbl_db; void *tbl_db_ptr = NULL; error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:333 error: while searching for: } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; /* Only get table info if required for the device */ if (dev->ops->tf_dev_get_tbl_info) { rc = dev->ops->tf_dev_get_tbl_info(tfp, tbl_db->tbl_db[parms->dir], parms->type, &base, &shift); if (rc) { TFP_DRV_LOG(ERR, "%s: Failed to get table info:%d\n", tf_dir_2_str(parms->dir), parms->type); return rc; } } /* Do not check meter drop counter because it is not allocated * resources error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:358 error: while searching for: /* Verify that the entry has been previously allocated */ aparms.rm_db = tbl_db->tbl_db[parms->dir]; aparms.subtype = parms->type; TF_TBL_PTR_TO_RM(&aparms.index, parms->idx, base, shift); aparms.allocated = &allocated; rc = tf_rm_is_allocated(&aparms); if (rc) return rc; if (allocated != TF_RM_ALLOCATED_ENTRY_IN_USE) { TFP_DRV_LOG(ERR, "%s, Invalid or not allocated index, type:%d, idx:%d\n", tf_dir_2_str(parms->dir), parms->type, parms->idx); return -EINVAL; } } error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:381 Hunk #15 succeeded at 472 (offset 134 lines). Hunk #16 succeeded at 487 (offset 134 lines). error: while searching for: struct tf_rm_get_hcapi_parms hparms = { 0 }; struct tf_session *tfs; struct tf_dev_info *dev; uint16_t base = 0, shift = 0; struct tbl_rm_db *tbl_db; void *tbl_db_ptr = NULL; error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:441 error: while searching for: } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; /* Only get table info if required for the device */ if (dev->ops->tf_dev_get_tbl_info) { rc = dev->ops->tf_dev_get_tbl_info(tfp, tbl_db->tbl_db[parms->dir], parms->type, &base, &shift); if (rc) { TFP_DRV_LOG(ERR, "%s: Failed to get table info:%d\n", tf_dir_2_str(parms->dir), parms->type); return rc; } } /* Do not check meter drop counter because it is not allocated * resources. */ error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:466 error: while searching for: /* Verify that the entry has been previously allocated */ aparms.rm_db = tbl_db->tbl_db[parms->dir]; aparms.subtype = parms->type; TF_TBL_PTR_TO_RM(&aparms.index, parms->idx, base, shift); aparms.allocated = &allocated; rc = tf_rm_is_allocated(&aparms); if (rc) error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:489 error: while searching for: if (allocated != TF_RM_ALLOCATED_ENTRY_IN_USE) { TFP_DRV_LOG(ERR, "%s, Invalid or not allocated index, type:%d, idx:%d\n", tf_dir_2_str(parms->dir), parms->type, parms->idx); return -EINVAL; } error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:498 Hunk #21 succeeded at 541 (offset 113 lines). Hunk #22 succeeded at 557 (offset 113 lines). error: while searching for: struct tf_rm_check_indexes_in_range_parms cparms = { 0 }; struct tf_session *tfs; struct tf_dev_info *dev; uint16_t base = 0, shift = 0; struct tbl_rm_db *tbl_db; void *tbl_db_ptr = NULL; error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:549 error: while searching for: } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; /* Only get table info if required for the device */ if (dev->ops->tf_dev_get_tbl_info) { rc = dev->ops->tf_dev_get_tbl_info(tfp, tbl_db->tbl_db[parms->dir], parms->type, &base, &shift); if (rc) { TFP_DRV_LOG(ERR, "%s: Failed to get table info:%d\n", tf_dir_2_str(parms->dir), parms->type); return rc; } } /* Verify that the entries are in the range of reserved resources. */ cparms.rm_db = tbl_db->tbl_db[parms->dir]; cparms.subtype = parms->type; TF_TBL_PTR_TO_RM(&cparms.starting_index, parms->starting_idx, base, shift); cparms.num_entries = parms->num_entries; rc = tf_rm_check_indexes_in_range(&cparms); if (rc) { TFP_DRV_LOG(ERR, "%s, Invalid or %d index starting from %d" " not in range, type:%d", tf_dir_2_str(parms->dir), parms->starting_idx, parms->num_entries, parms->type); return rc; } error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:574 Hunk #25 succeeded at 610 (offset 98 lines). Hunk #26 succeeded at 627 (offset 98 lines). error: while searching for: struct tf_rm_get_alloc_info_parms ainfo; void *tbl_db_ptr = NULL; struct tbl_rm_db *tbl_db; uint16_t base = 0, shift = 0; struct tf_dev_info *dev; struct tf_session *tfs; TF_CHECK_PARMS2(tfp, tbl); error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:653 error: while searching for: tbl_db = (struct tbl_rm_db *)tbl_db_ptr; /* check if reserved resource for WC is multiple of num_slices */ for (d = 0; d < TF_DIR_MAX; d++) { ainfo.rm_db = tbl_db->tbl_db[d]; dinfo = tbl[d].info; error: patch failed: drivers/net/bnxt/tf_core/tf_tbl.c:677 Checking patch drivers/net/bnxt/tf_core/tf_tbl.h... error: drivers/net/bnxt/tf_core/tf_tbl.h: does not match index Checking patch drivers/net/bnxt/tf_core/tf_tbl_sram.c... Checking patch drivers/net/bnxt/tf_core/tf_tbl_sram.h... Checking patch drivers/net/bnxt/tf_core/tf_tcam.c... error: while searching for: struct tf_shadow_tcam_free_db_parms fshadow; struct tf_shadow_tcam_cfg_parms shadow_cfg; struct tf_shadow_tcam_create_db_parms shadow_cdb; uint16_t num_slices = 1; struct tf_session *tfs; struct tf_dev_info *dev; struct tcam_rm_db *tcam_db; error: patch failed: drivers/net/bnxt/tf_core/tf_tcam.c:43 error: while searching for: if (rc) return rc; if (dev->ops->tf_dev_get_tcam_slice_info == NULL) { rc = -EOPNOTSUPP; TFP_DRV_LOG(ERR, "Operation not supported, rc:%s\n", error: patch failed: drivers/net/bnxt/tf_core/tf_tcam.c:61 error: while searching for: return rc; } rc = dev->ops->tf_dev_get_tcam_slice_info(tfp, TF_TCAM_TBL_TYPE_WC_TCAM, 0, &num_slices); if (rc) return rc; error: patch failed: drivers/net/bnxt/tf_core/tf_tcam.c:69 Checking patch drivers/net/bnxt/tf_core/tf_tcam.h... Checking patch drivers/net/bnxt/tf_core/tf_tcam_shared.c... error: drivers/net/bnxt/tf_core/tf_tcam_shared.c: does not exist in index Checking patch drivers/net/bnxt/tf_core/tf_util.c... error: drivers/net/bnxt/tf_core/tf_util.c: does not match index Checking patch drivers/net/bnxt/tf_ulp/bnxt_ulp.c... error: while searching for: size_t copy_nbytes; uint32_t ulp_dev_id = BNXT_ULP_DEVICE_ID_LAST; int32_t rc = 0; /* only perform this if shared session is enabled. */ if (!bnxt_ulp_cntxt_shared_session_enabled(bp->ulp_ctx)) error: patch failed: drivers/net/bnxt/tf_ulp/bnxt_ulp.c:384 error: while searching for: if (rc) return rc; rc = bnxt_ulp_cntxt_dev_id_get(bp->ulp_ctx, &ulp_dev_id); if (rc) { BNXT_TF_DBG(ERR, "Unable to get device id from ulp.\n"); error: patch failed: drivers/net/bnxt/tf_ulp/bnxt_ulp.c:422 error: while searching for: parms.shadow_copy = true; parms.bp = bp; /* * Open the session here, but the collect the resources during the error: patch failed: drivers/net/bnxt/tf_ulp/bnxt_ulp.c:445 error: while searching for: struct tf_open_session_parms params; struct tf_session_resources *resources; uint32_t ulp_dev_id = BNXT_ULP_DEVICE_ID_LAST; memset(¶ms, 0, sizeof(params)); error: patch failed: drivers/net/bnxt/tf_ulp/bnxt_ulp.c:516 Hunk #5 succeeded at 261 (offset -280 lines). error: while searching for: return rc; params.bp = bp; rc = tf_open_session(&bp->tfp, ¶ms); if (rc) { BNXT_TF_DBG(ERR, "Failed to open TF session - %s, rc = %d\n", error: patch failed: drivers/net/bnxt/tf_ulp/bnxt_ulp.c:556 Checking patch meson_options.txt... Hunk #1 succeeded at 44 (offset -2 lines). Applied patch drivers/net/bnxt/tf_core/ll.c cleanly. Applied patch drivers/net/bnxt/tf_core/ll.h cleanly. Applying patch drivers/net/bnxt/tf_core/tf_device.c with 9 rejects... Rejected hunk #1. Hunk #2 applied cleanly. Rejected hunk #3. Rejected hunk #4. Rejected hunk #5. Rejected hunk #6. Rejected hunk #7. Rejected hunk #8. Rejected hunk #9. Hunk #10 applied cleanly. Rejected hunk #11. Applying patch drivers/net/bnxt/tf_core/tf_device_p4.h with 2 rejects... Rejected hunk #1. Rejected hunk #2. Applying patch drivers/net/bnxt/tf_core/tf_msg.c with 1 reject... Rejected hunk #1. Applying patch drivers/net/bnxt/tf_core/tf_rm.c with 4 rejects... Hunk #1 applied cleanly. Rejected hunk #2. Rejected hunk #3. Rejected hunk #4. Rejected hunk #5. Hunk #6 applied cleanly. Applying patch drivers/net/bnxt/tf_core/tf_rm.h with 1 reject... Hunk #1 applied cleanly. Hunk #2 applied cleanly. Rejected hunk #3. Hunk #4 applied cleanly. Hunk #5 applied cleanly. Hunk #6 applied cleanly. Hunk #7 applied cleanly. Applying patch drivers/net/bnxt/tf_core/tf_session.c with 2 rejects... Rejected hunk #1. Hunk #2 applied cleanly. Rejected hunk #3. Applying patch drivers/net/bnxt/tf_core/tf_session.h with 3 rejects... Rejected hunk #1. Rejected hunk #2. Hunk #3 applied cleanly. Hunk #4 applied cleanly. Rejected hunk #5. Applied patch drivers/net/bnxt/tf_core/tf_sram_mgr.c cleanly. Applied patch drivers/net/bnxt/tf_core/tf_sram_mgr.h cleanly. Applying patch drivers/net/bnxt/tf_core/tf_tbl.c with 21 rejects... Rejected hunk #1. Rejected hunk #2. Rejected hunk #3. Rejected hunk #4. Rejected hunk #5. Rejected hunk #6. Rejected hunk #7. Hunk #8 applied cleanly. Rejected hunk #9. Rejected hunk #10. Rejected hunk #11. Rejected hunk #12. Rejected hunk #13. Rejected hunk #14. Hunk #15 applied cleanly. Hunk #16 applied cleanly. Rejected hunk #17. Rejected hunk #18. Rejected hunk #19. Rejected hunk #20. Hunk #21 applied cleanly. Hunk #22 applied cleanly. Rejected hunk #23. Rejected hunk #24. Hunk #25 applied cleanly. Hunk #26 applied cleanly. Rejected hunk #27. Rejected hunk #28. Applied patch drivers/net/bnxt/tf_core/tf_tbl_sram.c cleanly. Applied patch drivers/net/bnxt/tf_core/tf_tbl_sram.h cleanly. Applying patch drivers/net/bnxt/tf_core/tf_tcam.c with 3 rejects... Rejected hunk #1. Rejected hunk #2. Rejected hunk #3. Applied patch drivers/net/bnxt/tf_core/tf_tcam.h cleanly. Applying patch drivers/net/bnxt/tf_ulp/bnxt_ulp.c with 5 rejects... Rejected hunk #1. Rejected hunk #2. Rejected hunk #3. Rejected hunk #4. Hunk #5 applied cleanly. Rejected hunk #6. Applied patch meson_options.txt cleanly. diff a/drivers/net/bnxt/tf_core/tf_device.c b/drivers/net/bnxt/tf_core/tf_device.c (rejected hunks) @@ -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); @@ -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, @@ -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"); diff a/drivers/net/bnxt/tf_core/tf_device_p4.h b/drivers/net/bnxt/tf_core/tf_device_p4.h (rejected hunks) @@ -15,101 +15,101 @@ struct tf_rm_element_cfg tf_ident_p4[TF_IDENT_TYPE_MAX] = { [TF_IDENT_TYPE_L2_CTXT_HIGH] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_L2_CTXT_REMAP_HIGH, - 0, 0, 0 + 0, 0 }, [TF_IDENT_TYPE_L2_CTXT_LOW] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_L2_CTXT_REMAP_LOW, - 0, 0, 0 + 0, 0 }, [TF_IDENT_TYPE_PROF_FUNC] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_PROF_FUNC, - 0, 0, 0 + 0, 0 }, [TF_IDENT_TYPE_WC_PROF] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_WC_TCAM_PROF_ID, - 0, 0, 0 + 0, 0 }, [TF_IDENT_TYPE_EM_PROF] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_EM_PROF_ID, - 0, 0, 0 + 0, 0 }, }; struct tf_rm_element_cfg tf_tcam_p4[TF_TCAM_TBL_TYPE_MAX] = { [TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_HIGH] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_L2_CTXT_TCAM_HIGH, - 0, 0, 0 + 0, 0 }, [TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_L2_CTXT_TCAM_LOW, - 0, 0, 0 + 0, 0 }, [TF_TCAM_TBL_TYPE_PROF_TCAM] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_PROF_TCAM, - 0, 0, 0 + 0, 0 }, [TF_TCAM_TBL_TYPE_WC_TCAM] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_WC_TCAM, - 0, 0, 0 + 0, 0 }, [TF_TCAM_TBL_TYPE_SP_TCAM] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_SP_TCAM, - 0, 0, 0 + 0, 0 }, }; struct tf_rm_element_cfg tf_tbl_p4[TF_TBL_TYPE_MAX] = { [TF_TBL_TYPE_FULL_ACT_RECORD] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_FULL_ACTION, - 0, 0, 0 + 0, 0 }, [TF_TBL_TYPE_MCAST_GROUPS] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_MCG, - 0, 0, 0 + 0, 0 }, [TF_TBL_TYPE_ACT_ENCAP_8B] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_ENCAP_8B, - 0, 0, 0 + 0, 0 }, [TF_TBL_TYPE_ACT_ENCAP_16B] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_ENCAP_16B, - 0, 0, 0 + 0, 0 }, [TF_TBL_TYPE_ACT_ENCAP_64B] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_ENCAP_64B, - 0, 0, 0 + 0, 0 }, [TF_TBL_TYPE_ACT_SP_SMAC] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_SP_MAC, - 0, 0, 0 + 0, 0 }, [TF_TBL_TYPE_ACT_SP_SMAC_IPV4] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_SP_MAC_IPV4, - 0, 0, 0 + 0, 0 }, [TF_TBL_TYPE_ACT_SP_SMAC_IPV6] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_SP_MAC_IPV6, - 0, 0, 0 + 0, 0 }, [TF_TBL_TYPE_ACT_STATS_64] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_COUNTER_64B, - 0, 0, 0 + 0, 0 }, [TF_TBL_TYPE_ACT_MODIFY_IPV4] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_NAT_IPV4, - 0, 0, 0 + 0, 0 }, [TF_TBL_TYPE_METER_PROF] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_METER_PROF, - 0, 0, 0 + 0, 0 }, [TF_TBL_TYPE_METER_INST] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_METER, - 0, 0, 0 + 0, 0 }, [TF_TBL_TYPE_MIRROR_CONFIG] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_MIRROR, - 0, 0, 0 + 0, 0 }, }; @@ -117,14 +117,14 @@ struct tf_rm_element_cfg tf_tbl_p4[TF_TBL_TYPE_MAX] = { struct tf_rm_element_cfg tf_em_ext_p4[TF_EM_TBL_TYPE_MAX] = { [TF_EM_TBL_TYPE_TBL_SCOPE] = { TF_RM_ELEM_CFG_HCAPI_BA, CFA_RESOURCE_TYPE_P4_TBL_SCOPE, - 0, 0, 0 + 0, 0 }, }; struct tf_rm_element_cfg tf_em_int_p4[TF_EM_TBL_TYPE_MAX] = { [TF_EM_TBL_TYPE_EM_RECORD] = { TF_RM_ELEM_CFG_HCAPI, CFA_RESOURCE_TYPE_P4_EM_REC, - 0, 0, 0 + 0, 0 }, }; diff a/drivers/net/bnxt/tf_core/tf_msg.c b/drivers/net/bnxt/tf_core/tf_msg.c (rejected hunks) @@ -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(¶ms->data[0], resp.data, req.size); return 0; } diff a/drivers/net/bnxt/tf_core/tf_rm.c b/drivers/net/bnxt/tf_core/tf_rm.c (rejected hunks) @@ -356,12 +362,15 @@ tf_rm_check_residuals(struct tf_rm_new_db *rm_db, * - - Failure if negative */ static int -tf_rm_update_parent_reservations(struct tf_rm_element_cfg *cfg, +tf_rm_update_parent_reservations(struct tf *tfp, + struct tf_dev_info *dev, + struct tf_rm_element_cfg *cfg, uint16_t *alloc_cnt, uint16_t num_elements, uint16_t *req_cnt) { int parent, child; + const char *type_str; /* Search through all the elements */ for (parent = 0; parent < num_elements; parent++) { @@ -377,15 +386,25 @@ tf_rm_update_parent_reservations(struct tf_rm_element_cfg *cfg, if (alloc_cnt[parent] % cfg[parent].slices) combined_cnt++; + if (alloc_cnt[parent]) { + dev->ops->tf_dev_get_resource_str(tfp, + cfg[parent].hcapi_type, + &type_str); + } + /* Search again through all the elements */ for (child = 0; child < num_elements; child++) { /* If this is one of my children */ if (cfg[child].cfg_type == TF_RM_ELEM_CFG_HCAPI_BA_CHILD && - cfg[child].parent_subtype == parent) { + cfg[child].parent_subtype == parent && + alloc_cnt[child]) { uint16_t cnt = 0; RTE_ASSERT(cfg[child].slices); + dev->ops->tf_dev_get_resource_str(tfp, + cfg[child].hcapi_type, + &type_str); /* Increment the parents combined count * with each child's count adjusted for * number of slices per RM allocated item. @@ -479,7 +498,7 @@ tf_rm_create_db(struct tf *tfp, /* Update the req_cnt based upon the element configuration */ - tf_rm_update_parent_reservations(parms->cfg, + tf_rm_update_parent_reservations(tfp, dev, parms->cfg, parms->alloc_cnt, parms->num_elements, req_cnt); @@ -594,6 +613,7 @@ tf_rm_create_db(struct tf *tfp, db[i].cfg_type = cfg->cfg_type; db[i].hcapi_type = cfg->hcapi_type; + db[i].slices = cfg->slices; /* Save the parent subtype for later use to find the pool */ diff a/drivers/net/bnxt/tf_core/tf_rm.h b/drivers/net/bnxt/tf_core/tf_rm.h (rejected hunks) @@ -125,28 +111,19 @@ struct tf_rm_element_cfg { uint16_t hcapi_type; /** - * if cfg_type == TF_RM_ELEM_CFG_HCAPI_BA_CHILD + * if cfg_type == TF_RM_ELEM_CFG_HCAPI_BA_CHILD/PARENT * * Parent Truflow module subtype associated with this resource type. */ uint16_t parent_subtype; /** - * if cfg_type == TF_RM_ELEM_CFG_HCAPI_BA_CHILD + * if cfg_type == TF_RM_ELEM_CFG_HCAPI_BA_CHILD/PARENT * * Resource slices. How many slices will fit in the * resource pool chunk size. */ uint8_t slices; - - /** - * Pool element divider count - * If 0 or 1, there is 1:1 correspondence between the RM - * BA pool resource element and the HCAPI RM firmware - * resource. If > 1, the RM BA pool element has a 1:n - * correspondence to the HCAPI RM firmware resource. - */ - uint8_t divider; }; /** diff a/drivers/net/bnxt/tf_core/tf_session.c b/drivers/net/bnxt/tf_core/tf_session.c (rejected hunks) @@ -202,6 +202,7 @@ tf_session_create(struct tf *tfp, parms->open_cfg->device_type, session->shadow_copy, &parms->open_cfg->resources, + parms->open_cfg->wc_num_slices, &session->dev); /* Logging handled by dev_bind */ @@ -1012,4 +1029,43 @@ tf_session_set_tcam_shared_db(struct tf *tfp, tfs->tcam_shared_db_handle = tcam_shared_db_handle; return rc; } + +int +tf_session_get_sram_db(struct tf *tfp, + void **sram_handle) +{ + struct tf_session *tfs = NULL; + int rc = 0; + + *sram_handle = NULL; + + if (tfp == NULL) + return (-EINVAL); + + rc = tf_session_get_session_internal(tfp, &tfs); + if (rc) + return rc; + + *sram_handle = tfs->sram_handle; + return rc; +} + +int +tf_session_set_sram_db(struct tf *tfp, + void *sram_handle) +{ + struct tf_session *tfs = NULL; + int rc = 0; + + if (tfp == NULL) + return (-EINVAL); + + rc = tf_session_get_session_internal(tfp, &tfs); + if (rc) + return rc; + + tfs->sram_handle = sram_handle; + return rc; +} + #endif /* TF_TCAM_SHARED */ diff a/drivers/net/bnxt/tf_core/tf_session.h b/drivers/net/bnxt/tf_core/tf_session.h (rejected hunks) @@ -166,6 +166,10 @@ struct tf_session { */ void *tcam_shared_db_handle; #endif /* TF_TCAM_SHARED */ + /** + * SRAM db reference for the session + */ + void *sram_handle; }; /** @@ -278,6 +282,10 @@ struct tf_session_close_session_parms { * * @ref tf_session_set_tcam_shared_db * #endif + * + * @ref tf_session_get_sram_db + * + * @ref tf_session_set_sram_db */ /** @@ -614,4 +642,28 @@ int tf_session_get_tcam_shared_db(struct tf *tfp, void **tcam_shared_db_handle); +/** + * Set the pointer to the SRAM database + * + * [in] session, pointer to the session + * + * Returns: + * - the pointer to the parent bnxt struct + */ +int +tf_session_set_sram_db(struct tf *tfp, + void *sram_handle); + +/** + * Get the pointer to the SRAM database + * + * [in] session, pointer to the session + * + * Returns: + * - the pointer to the parent bnxt struct + */ +int +tf_session_get_sram_db(struct tf *tfp, + void **sram_handle); + #endif /* _TF_SESSION_H_ */ diff a/drivers/net/bnxt/tf_core/tf_tbl.c b/drivers/net/bnxt/tf_core/tf_tbl.c (rejected hunks) @@ -16,20 +16,11 @@ #include "tf_session.h" #include "tf_device.h" -#define TF_TBL_RM_TO_PTR(new_idx, idx, base, shift) { \ - *(new_idx) = (((idx) + (base)) << (shift)); \ -} - -#define TF_TBL_PTR_TO_RM(new_idx, idx, base, shift) { \ - *(new_idx) = (((idx) >> (shift)) - (base)); \ -} - struct tf; -/** - * Shadow init flag, set on bind and cleared on unbind - */ -static uint8_t shadow_init; +#define TF_TBL_RM_TO_PTR(new_idx, idx, base, shift) { \ + *(new_idx) = (((idx) + (base)) << (shift)); \ +} int tf_tbl_bind(struct tf *tfp, @@ -121,8 +112,6 @@ tf_tbl_unbind(struct tf *tfp) tbl_db->tbl_db[i] = NULL; } - shadow_init = 0; - return 0; } @@ -135,7 +124,6 @@ tf_tbl_alloc(struct tf *tfp __rte_unused, struct tf_rm_allocate_parms aparms = { 0 }; struct tf_session *tfs; struct tf_dev_info *dev; - uint16_t base = 0, shift = 0; struct tbl_rm_db *tbl_db; void *tbl_db_ptr = NULL; @@ -154,28 +142,12 @@ tf_tbl_alloc(struct tf *tfp __rte_unused, rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TABLE, &tbl_db_ptr); if (rc) { TFP_DRV_LOG(ERR, - "Failed to get em_ext_db from session, rc:%s\n", + "Failed to get tbl_db from session, rc:%s\n", strerror(-rc)); return rc; } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; - /* Only get table info if required for the device */ - if (dev->ops->tf_dev_get_tbl_info) { - rc = dev->ops->tf_dev_get_tbl_info(tfp, - tbl_db->tbl_db[parms->dir], - parms->type, - &base, - &shift); - if (rc) { - TFP_DRV_LOG(ERR, - "%s: Failed to get table info:%d\n", - tf_dir_2_str(parms->dir), - parms->type); - return rc; - } - } - /* Allocate requested element */ aparms.rm_db = tbl_db->tbl_db[parms->dir]; aparms.subtype = parms->type; @@ -183,13 +155,12 @@ tf_tbl_alloc(struct tf *tfp __rte_unused, rc = tf_rm_allocate(&aparms); if (rc) { TFP_DRV_LOG(ERR, - "%s: Failed allocate, type:%d\n", + "%s: Failed allocate, type:%s\n", tf_dir_2_str(parms->dir), - parms->type); + tf_tbl_type_2_str(parms->type)); return rc; } - TF_TBL_RM_TO_PTR(&idx, idx, base, shift); *parms->idx = idx; return 0; @@ -205,7 +176,6 @@ tf_tbl_free(struct tf *tfp __rte_unused, int allocated = 0; struct tf_session *tfs; struct tf_dev_info *dev; - uint16_t base = 0, shift = 0; struct tbl_rm_db *tbl_db; void *tbl_db_ptr = NULL; @@ -230,28 +200,10 @@ tf_tbl_free(struct tf *tfp __rte_unused, } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; - /* Only get table info if required for the device */ - if (dev->ops->tf_dev_get_tbl_info) { - rc = dev->ops->tf_dev_get_tbl_info(tfp, - tbl_db->tbl_db[parms->dir], - parms->type, - &base, - &shift); - if (rc) { - TFP_DRV_LOG(ERR, - "%s: Failed to get table info:%d\n", - tf_dir_2_str(parms->dir), - parms->type); - return rc; - } - } - /* Check if element is in use */ aparms.rm_db = tbl_db->tbl_db[parms->dir]; aparms.subtype = parms->type; - - TF_TBL_PTR_TO_RM(&aparms.index, parms->idx, base, shift); - + aparms.index = parms->idx; aparms.allocated = &allocated; rc = tf_rm_is_allocated(&aparms); if (rc) @@ -279,9 +231,9 @@ tf_tbl_free(struct tf *tfp __rte_unused, rc = tf_rm_get_hcapi_type(&hparms); if (rc) { TFP_DRV_LOG(ERR, - "%s, Failed type lookup, type:%d, rc:%s\n", + "%s, Failed type lookup, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), - parms->type, + tf_tbl_type_2_str(parms->type), strerror(-rc)); return rc; } @@ -295,9 +247,9 @@ tf_tbl_free(struct tf *tfp __rte_unused, parms->idx); if (rc) { TFP_DRV_LOG(ERR, - "%s, Set failed, type:%d, rc:%s\n", + "%s, Set failed, type:%s, rc:%s\n", tf_dir_2_str(parms->dir), - parms->type, + tf_tbl_type_2_str(parms->type), strerror(-rc)); return rc; } @@ -306,15 +258,13 @@ tf_tbl_free(struct tf *tfp __rte_unused, /* Free requested element */ fparms.rm_db = tbl_db->tbl_db[parms->dir]; fparms.subtype = parms->type; - - TF_TBL_PTR_TO_RM(&fparms.index, parms->idx, base, shift); - + fparms.index = parms->idx; rc = tf_rm_free(&fparms); if (rc) { TFP_DRV_LOG(ERR, - "%s: Free failed, type:%d, index:%d\n", + "%s: Free failed, type:%s, index:%d\n", tf_dir_2_str(parms->dir), - parms->type, + tf_tbl_type_2_str(parms->type), parms->idx); return rc; } @@ -333,7 +283,6 @@ tf_tbl_set(struct tf *tfp, struct tf_rm_get_hcapi_parms hparms = { 0 }; struct tf_session *tfs; struct tf_dev_info *dev; - uint16_t base = 0, shift = 0; struct tbl_rm_db *tbl_db; void *tbl_db_ptr = NULL; @@ -358,21 +307,6 @@ tf_tbl_set(struct tf *tfp, } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; - /* Only get table info if required for the device */ - if (dev->ops->tf_dev_get_tbl_info) { - rc = dev->ops->tf_dev_get_tbl_info(tfp, - tbl_db->tbl_db[parms->dir], - parms->type, - &base, - &shift); - if (rc) { - TFP_DRV_LOG(ERR, - "%s: Failed to get table info:%d\n", - tf_dir_2_str(parms->dir), - parms->type); - return rc; - } - } /* Do not check meter drop counter because it is not allocated * resources @@ -381,19 +315,18 @@ tf_tbl_set(struct tf *tfp, /* Verify that the entry has been previously allocated */ aparms.rm_db = tbl_db->tbl_db[parms->dir]; aparms.subtype = parms->type; - TF_TBL_PTR_TO_RM(&aparms.index, parms->idx, base, shift); - aparms.allocated = &allocated; + aparms.index = parms->idx; rc = tf_rm_is_allocated(&aparms); if (rc) return rc; if (allocated != TF_RM_ALLOCATED_ENTRY_IN_USE) { TFP_DRV_LOG(ERR, - "%s, Invalid or not allocated index, type:%d, idx:%d\n", - tf_dir_2_str(parms->dir), - parms->type, - parms->idx); + "%s, Invalid or not allocated, type:%s, idx:%d\n", + tf_dir_2_str(parms->dir), + tf_tbl_type_2_str(parms->type), + parms->idx); return -EINVAL; } } @@ -441,7 +374,6 @@ tf_tbl_get(struct tf *tfp, struct tf_rm_get_hcapi_parms hparms = { 0 }; struct tf_session *tfs; struct tf_dev_info *dev; - uint16_t base = 0, shift = 0; struct tbl_rm_db *tbl_db; void *tbl_db_ptr = NULL; @@ -466,22 +398,6 @@ tf_tbl_get(struct tf *tfp, } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; - /* Only get table info if required for the device */ - if (dev->ops->tf_dev_get_tbl_info) { - rc = dev->ops->tf_dev_get_tbl_info(tfp, - tbl_db->tbl_db[parms->dir], - parms->type, - &base, - &shift); - if (rc) { - TFP_DRV_LOG(ERR, - "%s: Failed to get table info:%d\n", - tf_dir_2_str(parms->dir), - parms->type); - return rc; - } - } - /* Do not check meter drop counter because it is not allocated * resources. */ @@ -489,8 +405,7 @@ tf_tbl_get(struct tf *tfp, /* Verify that the entry has been previously allocated */ aparms.rm_db = tbl_db->tbl_db[parms->dir]; aparms.subtype = parms->type; - TF_TBL_PTR_TO_RM(&aparms.index, parms->idx, base, shift); - + aparms.index = parms->idx; aparms.allocated = &allocated; rc = tf_rm_is_allocated(&aparms); if (rc) @@ -498,9 +413,9 @@ tf_tbl_get(struct tf *tfp, if (allocated != TF_RM_ALLOCATED_ENTRY_IN_USE) { TFP_DRV_LOG(ERR, - "%s, Invalid or not allocated index, type:%d, idx:%d\n", + "%s, Invalid or not allocated index, type:%s, idx:%d\n", tf_dir_2_str(parms->dir), - parms->type, + tf_tbl_type_2_str(parms->type), parms->idx); return -EINVAL; } @@ -549,7 +464,6 @@ tf_tbl_bulk_get(struct tf *tfp, struct tf_rm_check_indexes_in_range_parms cparms = { 0 }; struct tf_session *tfs; struct tf_dev_info *dev; - uint16_t base = 0, shift = 0; struct tbl_rm_db *tbl_db; void *tbl_db_ptr = NULL; @@ -574,40 +488,21 @@ tf_tbl_bulk_get(struct tf *tfp, } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; - /* Only get table info if required for the device */ - if (dev->ops->tf_dev_get_tbl_info) { - rc = dev->ops->tf_dev_get_tbl_info(tfp, - tbl_db->tbl_db[parms->dir], - parms->type, - &base, - &shift); - if (rc) { - TFP_DRV_LOG(ERR, - "%s: Failed to get table info:%d\n", - tf_dir_2_str(parms->dir), - parms->type); - return rc; - } - } - /* Verify that the entries are in the range of reserved resources. */ cparms.rm_db = tbl_db->tbl_db[parms->dir]; cparms.subtype = parms->type; - - TF_TBL_PTR_TO_RM(&cparms.starting_index, parms->starting_idx, - base, shift); - cparms.num_entries = parms->num_entries; + cparms.starting_index = parms->starting_idx; rc = tf_rm_check_indexes_in_range(&cparms); if (rc) { TFP_DRV_LOG(ERR, "%s, Invalid or %d index starting from %d" - " not in range, type:%d", + " not in range, type:%s", tf_dir_2_str(parms->dir), parms->starting_idx, parms->num_entries, - parms->type); + tf_tbl_type_2_str(parms->type)); return rc; } @@ -653,9 +548,9 @@ tf_tbl_get_resc_info(struct tf *tfp, struct tf_rm_get_alloc_info_parms ainfo; void *tbl_db_ptr = NULL; struct tbl_rm_db *tbl_db; - uint16_t base = 0, shift = 0; struct tf_dev_info *dev; struct tf_session *tfs; + uint16_t base = 0, shift = 0; TF_CHECK_PARMS2(tfp, tbl); @@ -677,7 +572,6 @@ tf_tbl_get_resc_info(struct tf *tfp, tbl_db = (struct tbl_rm_db *)tbl_db_ptr; - /* check if reserved resource for WC is multiple of num_slices */ for (d = 0; d < TF_DIR_MAX; d++) { ainfo.rm_db = tbl_db->tbl_db[d]; dinfo = tbl[d].info; diff a/drivers/net/bnxt/tf_core/tf_tcam.c b/drivers/net/bnxt/tf_core/tf_tcam.c (rejected hunks) @@ -43,7 +43,7 @@ tf_tcam_bind(struct tf *tfp, struct tf_shadow_tcam_free_db_parms fshadow; struct tf_shadow_tcam_cfg_parms shadow_cfg; struct tf_shadow_tcam_create_db_parms shadow_cdb; - uint16_t num_slices = 1; + uint16_t num_slices = parms->wc_num_slices; struct tf_session *tfs; struct tf_dev_info *dev; struct tcam_rm_db *tcam_db; @@ -61,7 +61,7 @@ tf_tcam_bind(struct tf *tfp, if (rc) return rc; - if (dev->ops->tf_dev_get_tcam_slice_info == NULL) { + if (dev->ops->tf_dev_set_tcam_slice_info == NULL) { rc = -EOPNOTSUPP; TFP_DRV_LOG(ERR, "Operation not supported, rc:%s\n", @@ -69,10 +69,8 @@ tf_tcam_bind(struct tf *tfp, return rc; } - rc = dev->ops->tf_dev_get_tcam_slice_info(tfp, - TF_TCAM_TBL_TYPE_WC_TCAM, - 0, - &num_slices); + rc = dev->ops->tf_dev_set_tcam_slice_info(tfp, + num_slices); if (rc) return rc; diff a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c (rejected hunks) @@ -384,6 +384,7 @@ ulp_ctx_shared_session_open(struct bnxt *bp, size_t copy_nbytes; uint32_t ulp_dev_id = BNXT_ULP_DEVICE_ID_LAST; int32_t rc = 0; + uint8_t app_id; /* only perform this if shared session is enabled. */ if (!bnxt_ulp_cntxt_shared_session_enabled(bp->ulp_ctx)) @@ -422,6 +423,12 @@ ulp_ctx_shared_session_open(struct bnxt *bp, if (rc) return rc; + rc = bnxt_ulp_cntxt_app_id_get(bp->ulp_ctx, &app_id); + if (rc) { + BNXT_TF_DBG(ERR, "Unable to get the app id from ulp.\n"); + return -EINVAL; + } + rc = bnxt_ulp_cntxt_dev_id_get(bp->ulp_ctx, &ulp_dev_id); if (rc) { BNXT_TF_DBG(ERR, "Unable to get device id from ulp.\n"); @@ -445,6 +452,10 @@ ulp_ctx_shared_session_open(struct bnxt *bp, parms.shadow_copy = true; parms.bp = bp; + if (app_id == 0 || app_id == 3) + parms.wc_num_slices = TF_WC_TCAM_2_SLICE_PER_ROW; + else + parms.wc_num_slices = TF_WC_TCAM_1_SLICE_PER_ROW; /* * Open the session here, but the collect the resources during the @@ -516,6 +527,7 @@ ulp_ctx_session_open(struct bnxt *bp, struct tf_open_session_parms params; struct tf_session_resources *resources; uint32_t ulp_dev_id = BNXT_ULP_DEVICE_ID_LAST; + uint8_t app_id; memset(¶ms, 0, sizeof(params)); @@ -556,6 +574,11 @@ ulp_ctx_session_open(struct bnxt *bp, return rc; params.bp = bp; + if (app_id == 0 || app_id == 3) + params.wc_num_slices = TF_WC_TCAM_2_SLICE_PER_ROW; + else + params.wc_num_slices = TF_WC_TCAM_1_SLICE_PER_ROW; + rc = tf_open_session(&bp->tfp, ¶ms); if (rc) { BNXT_TF_DBG(ERR, "Failed to open TF session - %s, rc = %d\n", Checking patch drivers/net/bnxt/tf_ulp/bnxt_tf_common.h... Checking patch drivers/net/bnxt/tf_ulp/bnxt_ulp.c... error: drivers/net/bnxt/tf_ulp/bnxt_ulp.c: does not match index Checking patch drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c... error: while searching for: #include "ulp_port_db.h" #include "ulp_ha_mgr.h" #include static int32_t bnxt_ulp_flow_validate_args(const struct rte_flow_attr *attr, error: patch failed: drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c:13 Hunk #2 succeeded at 183 (offset -42 lines). Checking patch drivers/net/bnxt/tf_ulp/generic_templates/meson.build... error: drivers/net/bnxt/tf_ulp/generic_templates/meson.build: does not exist in index Checking patch drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c... error: drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c: does not exist in index Checking patch drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c... Checking patch drivers/net/bnxt/tf_ulp/ulp_flow_db.c... error: while searching for: func = (((res_info->nxt_resource_idx & ULP_FLOW_DB_RES_FUNC_MASK) >> ULP_FLOW_DB_RES_FUNC_BITS) << ULP_FLOW_DB_RES_FUNC_UPPER); /* The resource func is split into upper and lower */ if (func & ULP_FLOW_DB_RES_FUNC_NEED_LOWER) return (func | res_info->resource_func_lower); return func; error: patch failed: drivers/net/bnxt/tf_ulp/ulp_flow_db.c:116 Hunk #2 succeeded at 642 (offset -12 lines). error: while searching for: if (params->critical_resource && fid_resource->resource_em_handle) { BNXT_TF_DBG(DEBUG, "Ignore multiple critical resources\n"); /* Ignore the multiple critical resources */ params->critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO; } error: patch failed: drivers/net/bnxt/tf_ulp/ulp_flow_db.c:714 error: while searching for: * flow_type [in] Specify it is regular or default flow * fid [in] The index to the flow entry * params [in/out] The contents to be copied into params. * Only the critical_resource needs to be set by the caller. * * Returns 0 on success and negative on failure. */ error: patch failed: drivers/net/bnxt/tf_ulp/ulp_flow_db.c:766 Hunk #5 succeeded at 918 (offset -22 lines). error: while searching for: if (res && (shared & BNXT_ULP_SHARED_SESSION_YES)) res->fdb_flags |= ULP_FDB_FLAG_SHARED_SESSION; } error: patch failed: drivers/net/bnxt/tf_ulp/ulp_flow_db.c:1921 Checking patch drivers/net/bnxt/tf_ulp/ulp_flow_db.h... error: while searching for: /* * Structure for the flow database resource information * The below structure is based on the below partitions * 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 error: patch failed: drivers/net/bnxt/tf_ulp/ulp_flow_db.h:18 error: while searching for: void ulp_flow_db_shared_session_set(struct ulp_flow_db_res_params *res, enum bnxt_ulp_shared_session shared); #endif /* _ULP_FLOW_DB_H_ */ error: patch failed: drivers/net/bnxt/tf_ulp/ulp_flow_db.h:417 Checking patch drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c... error: drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c: does not exist in index Checking patch drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c... error: drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c: does not exist in index Checking patch drivers/net/bnxt/tf_ulp/ulp_mapper.c... error: while searching for: #include "ulp_ha_mgr.h" #include "bnxt_tf_pmd_shim.h" static uint8_t mapper_fld_zeros[16] = { 0 }; static uint8_t mapper_fld_ones[16] = { error: patch failed: drivers/net/bnxt/tf_ulp/ulp_mapper.c:22 Hunk #2 succeeded at 120 (offset -41 lines). Hunk #3 succeeded at 185 (offset -43 lines). error: while searching for: tf_ident_2_str(iparms.ident_type)); return rc; } id = (uint64_t)tfp_cpu_to_be_64(iparms.id); if (ulp_regfile_write(parms->regfile, idx, id)) { error: patch failed: drivers/net/bnxt/tf_ulp/ulp_mapper.c:784 error: while searching for: } else { *val = iparms.id; } return 0; error: error: patch failed: drivers/net/bnxt/tf_ulp/ulp_mapper.c:813 error: while searching for: sparms.search_id); return rc; } /* Write it to the regfile */ id = (uint64_t)tfp_cpu_to_be_64(sparms.search_id); error: patch failed: drivers/net/bnxt/tf_ulp/ulp_mapper.c:877 Hunk #7 succeeded at 773 (offset -162 lines). error: while searching for: return -EINVAL; } idx = tfp_be_to_cpu_16(idx); if (idx >= BNXT_ULP_CF_IDX_LAST || bytelen > sizeof(uint64_t)) { BNXT_TF_DBG(ERR, "comp field [%d] read oob %d\n", idx, bytelen); return -EINVAL; error: patch failed: drivers/net/bnxt/tf_ulp/ulp_mapper.c:996 error: while searching for: break; } return rc; error: BNXT_TF_DBG(ERR, "Error in %s:%s process %u:%u\n", name, fld->description, (val) ? write_idx : 0, val_len); error: patch failed: drivers/net/bnxt/tf_ulp/ulp_mapper.c:1448 error: while searching for: } /* if encap bit swap is enabled perform the bit swap */ if (parms->device_params->encap_byte_swap && encap_flds) ulp_blob_perform_encap_swap(data); return rc; } error: patch failed: drivers/net/bnxt/tf_ulp/ulp_mapper.c:1500 error: while searching for: tf_dir_2_str(sparms.dir), sparms.idx); return -EIO; } /* Mark action */ rc = ulp_mapper_mark_act_ptr_process(parms, tbl); error: patch failed: drivers/net/bnxt/tf_ulp/ulp_mapper.c:1725 Hunk #12 succeeded at 1513 (offset -275 lines). error: while searching for: { ulp_blob_perform_64B_word_swap(blob); ulp_blob_perform_64B_byte_swap(blob); } static int32_t error: patch failed: drivers/net/bnxt/tf_ulp/ulp_mapper.c:1838 error: while searching for: BNXT_TF_DBG(ERR, "Failed to build the result blob\n"); return rc; } if (dparms->dynamic_pad_en) { uint32_t abits = dparms->em_blk_align_bits; error: patch failed: drivers/net/bnxt/tf_ulp/ulp_mapper.c:2134 error: while searching for: ulp_blob_pad_align(&data, abits); ulp_blob_perform_byte_reverse(&data, ULP_BITS_2_BYTE(abits)); } /* do the transpose for the internal EM keys */ error: patch failed: drivers/net/bnxt/tf_ulp/ulp_mapper.c:2148 error: while searching for: } tmplen = ulp_blob_data_len_get(&key); ulp_blob_perform_byte_reverse(&key, ULP_BITS_2_BYTE(tmplen)); } rc = bnxt_ulp_cntxt_tbl_scope_id_get(parms->ulp_ctx, error: patch failed: drivers/net/bnxt/tf_ulp/ulp_mapper.c:2160 Hunk #17 succeeded at 1891 (offset -380 lines). error: while searching for: sparms.idx, rc); goto error; } /* Calculate action record size */ if (tbl->resource_type == TF_TBL_TYPE_EXT) { error: patch failed: drivers/net/bnxt/tf_ulp/ulp_mapper.c:2479 error: while searching for: iftbl_params.idx, rc); return rc; } /* * TBD: Need to look at the need to store idx in flow db for restore error: patch failed: drivers/net/bnxt/tf_ulp/ulp_mapper.c:2635 error: while searching for: /* The_key is a byte array convert it to a search index */ cache_key = ulp_blob_data_get(&key, &tmplen); /* get the generic table */ gen_tbl_list = &parms->mapper_data->gen_tbl_list[tbl_idx]; error: patch failed: drivers/net/bnxt/tf_ulp/ulp_mapper.c:2697 error: while searching for: for (tbl_idx = 0; tbl_idx < num_tbls && cond_goto;) { tbl = &tbls[tbl_idx]; cond_goto = tbl->execute_info.cond_true_goto; /* Process the conditional func code opcodes */ if (ulp_mapper_func_info_process(parms, tbl)) { BNXT_TF_DBG(ERR, "Failed to process cond update\n"); error: patch failed: drivers/net/bnxt/tf_ulp/ulp_mapper.c:3495 Checking patch drivers/net/bnxt/tf_ulp/ulp_matcher.c... Hunk #2 succeeded at 85 (offset -14 lines). Hunk #3 succeeded at 127 (offset -24 lines). Checking patch drivers/net/bnxt/tf_ulp/ulp_port_db.c... error: while searching for: #include "bnxt.h" #include "bnxt_vnic.h" #include "bnxt_tf_common.h" #include "ulp_port_db.h" #include "tfp.h" #include "bnxt_tf_pmd_shim.h" static uint32_t ulp_port_db_allocate_ifindex(struct bnxt_ulp_port_db *port_db) error: patch failed: drivers/net/bnxt/tf_ulp/ulp_port_db.c:7 error: while searching for: 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); 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); 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); error: patch failed: drivers/net/bnxt/tf_ulp/ulp_port_db.c:151 error: while searching for: port_data->port_vport = bnxt_pmd_get_vport(port_id); port_data->port_valid = true; } return 0; } error: patch failed: drivers/net/bnxt/tf_ulp/ulp_port_db.c:202 Checking patch drivers/net/bnxt/tf_ulp/ulp_rte_parser.c... Hunk #1 succeeded at 9 (offset 1 line). error: while searching for: BNXT_ULP_HDR_BIT_II_VLAN); inner_flag = 1; } else { BNXT_TF_DBG(ERR, "Error Parsing:Vlan hdr found without eth\n"); return BNXT_TF_RC_ERROR; } /* Update the field protocol hdr bitmap */ error: patch failed: drivers/net/bnxt/tf_ulp/ulp_rte_parser.c:855 error: while searching for: 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. * This is a work around and * shall be addressed in the future. */ error: patch failed: drivers/net/bnxt/tf_ulp/ulp_rte_parser.c:1135 error: while searching for: return BNXT_TF_RC_PARSE_ERR; } bp = bnxt_get_bp(params->port_id); if (bp == NULL) { BNXT_TF_DBG(ERR, "Invalid bp\n"); return BNXT_TF_RC_ERROR; error: patch failed: drivers/net/bnxt/tf_ulp/ulp_rte_parser.c:2138 Checking patch drivers/net/bnxt/tf_ulp/ulp_tun.c... Hunk #3 succeeded at 158 (offset 1 line). Checking patch drivers/net/bnxt/tf_ulp/ulp_utils.c... error: while searching for: * 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 * variable. * * returns 0 on success error: patch failed: drivers/net/bnxt/tf_ulp/ulp_utils.c:62 error: while searching for: datalen, data); if (!rc) { BNXT_TF_DBG(ERR, "Failed to write blob\n"); return 0; } blob->write_idx += datalen; error: patch failed: drivers/net/bnxt/tf_ulp/ulp_utils.c:295 error: while searching for: datalen, data); if (!rc) { BNXT_TF_DBG(ERR, "Failed to write blob\n"); return 0; } /* copy the previously stored data */ error: patch failed: drivers/net/bnxt/tf_ulp/ulp_utils.c:355 error: while searching for: * * data [in] 32-bit value to be added to the blob. * * datalen [in] The number of bits to be added to the blob. * * The offset of the data is updated after each push of data. * NULL returned on error, pointer pushed value otherwise. error: patch failed: drivers/net/bnxt/tf_ulp/ulp_utils.c:409 Applied patch drivers/net/bnxt/tf_ulp/bnxt_tf_common.h cleanly. Applying patch drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c with 1 reject... Rejected hunk #1. Hunk #2 applied cleanly. Applied patch drivers/net/bnxt/tf_ulp/ulp_fc_mgr.c cleanly. Applying patch drivers/net/bnxt/tf_ulp/ulp_flow_db.c with 4 rejects... Rejected hunk #1. Hunk #2 applied cleanly. Rejected hunk #3. Rejected hunk #4. Hunk #5 applied cleanly. Rejected hunk #6. Applying patch drivers/net/bnxt/tf_ulp/ulp_flow_db.h with 2 rejects... Rejected hunk #1. Rejected hunk #2. Applying patch drivers/net/bnxt/tf_ulp/ulp_mapper.c with 16 rejects... Rejected hunk #1. Hunk #2 applied cleanly. Hunk #3 applied cleanly. Rejected hunk #4. Rejected hunk #5. Rejected hunk #6. Hunk #7 applied cleanly. Rejected hunk #8. Rejected hunk #9. Rejected hunk #10. Rejected hunk #11. Hunk #12 applied cleanly. Rejected hunk #13. Rejected hunk #14. Rejected hunk #15. Rejected hunk #16. Hunk #17 applied cleanly. Rejected hunk #18. Rejected hunk #19. Rejected hunk #20. Rejected hunk #21. Applied patch drivers/net/bnxt/tf_ulp/ulp_matcher.c cleanly. Applying patch drivers/net/bnxt/tf_ulp/ulp_port_db.c with 3 rejects... Rejected hunk #1. Rejected hunk #2. Rejected hunk #3. Applying patch drivers/net/bnxt/tf_ulp/ulp_rte_parser.c with 3 rejects... Hunk #1 applied cleanly. Rejected hunk #2. Rejected hunk #3. Rejected hunk #4. Applied patch drivers/net/bnxt/tf_ulp/ulp_tun.c cleanly. Applying patch drivers/net/bnxt/tf_ulp/ulp_utils.c with 4 rejects... Rejected hunk #1. Rejected hunk #2. Rejected hunk #3. Rejected hunk #4. diff a/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c (rejected hunks) @@ -13,6 +13,9 @@ #include "ulp_port_db.h" #include "ulp_ha_mgr.h" #include +#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, diff a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c (rejected hunks) @@ -116,7 +116,7 @@ ulp_flow_db_resource_func_get(struct ulp_fdb_resource_info *res_info) func = (((res_info->nxt_resource_idx & ULP_FLOW_DB_RES_FUNC_MASK) >> ULP_FLOW_DB_RES_FUNC_BITS) << ULP_FLOW_DB_RES_FUNC_UPPER); - /* The resource func is split into upper and lower */ + /* The reource func is split into upper and lower */ if (func & ULP_FLOW_DB_RES_FUNC_NEED_LOWER) return (func | res_info->resource_func_lower); return func; @@ -714,7 +717,7 @@ ulp_flow_db_resource_add(struct bnxt_ulp_context *ulp_ctxt, if (params->critical_resource && fid_resource->resource_em_handle) { BNXT_TF_DBG(DEBUG, "Ignore multiple critical resources\n"); - /* Ignore the multiple critical resources */ + /* Ignore the multiple criticial resources */ params->critical_resource = BNXT_ULP_CRITICAL_RESOURCE_NO; } @@ -766,7 +769,7 @@ ulp_flow_db_resource_add(struct bnxt_ulp_context *ulp_ctxt, * flow_type [in] Specify it is regular or default flow * fid [in] The index to the flow entry * params [in/out] The contents to be copied into params. - * Only the critical_resource needs to be set by the caller. + * Onlythe critical_resource needs to be set by the caller. * * Returns 0 on success and negative on failure. */ @@ -1921,3 +1927,113 @@ void ulp_flow_db_shared_session_set(struct ulp_flow_db_res_params *res, if (res && (shared & BNXT_ULP_SHARED_SESSION_YES)) res->fdb_flags |= ULP_FDB_FLAG_SHARED_SESSION; } + +#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG +/* + * Dump the entry details + * + * ulp_ctxt [in] Ptr to ulp_context + * + * returns none + */ +static void ulp_flow_db_res_dump(struct ulp_fdb_resource_info *r, + uint32_t *nxt_res) +{ + uint8_t res_func = ulp_flow_db_resource_func_get(r); + + BNXT_TF_DBG(DEBUG, "Resource func = %x, nxt_resource_idx = %x\n", + res_func, (ULP_FLOW_DB_RES_NXT_MASK & r->nxt_resource_idx)); + if (res_func == BNXT_ULP_RESOURCE_FUNC_EM_TABLE) + BNXT_TF_DBG(DEBUG, "EM Handle = 0x%016" PRIX64 "\n", + r->resource_em_handle); + else + BNXT_TF_DBG(DEBUG, "Handle = 0x%08x\n", r->resource_hndl); + + *nxt_res = 0; + ULP_FLOW_DB_RES_NXT_SET(*nxt_res, + r->nxt_resource_idx); +} + +/* + * 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) +{ + struct ulp_fdb_resource_info *r; + struct bnxt_ulp_flow_tbl *flow_tbl; + uint32_t nxt_res = 0; + uint32_t def_flag = 0, reg_flag = 0; + + flow_tbl = &flow_db->flow_tbl; + if (ulp_flow_db_active_flows_bit_is_set(flow_db, + BNXT_ULP_FDB_TYPE_REGULAR, fid)) + reg_flag = 1; + if (ulp_flow_db_active_flows_bit_is_set(flow_db, + BNXT_ULP_FDB_TYPE_DEFAULT, fid)) + def_flag = 1; + + if (reg_flag && def_flag) + BNXT_TF_DBG(DEBUG, "RID = %u\n", fid); + else if (reg_flag) + BNXT_TF_DBG(DEBUG, "Regular fid = %u and func id = %u\n", + fid, flow_db->func_id_tbl[fid]); + else if (def_flag) + BNXT_TF_DBG(DEBUG, "Default fid = %u\n", fid); + else + return; + /* iterate the resource */ + nxt_res = fid; + do { + r = &flow_tbl->flow_resources[nxt_res]; + ulp_flow_db_res_dump(r, &nxt_res); + } while (nxt_res); +} + +/* + * 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) +{ + struct bnxt_ulp_flow_db *flow_db; + struct bnxt_ulp_flow_tbl *flow_tbl; + uint32_t fid; + + if (!ulp_ctxt || !ulp_ctxt->cfg_data) { + BNXT_TF_DBG(ERR, "Invalid Arguments\n"); + return -EINVAL; + } + flow_db = bnxt_ulp_cntxt_ptr2_flow_db_get(ulp_ctxt); + if (!flow_db) { + BNXT_TF_DBG(ERR, "Invalid Arguments\n"); + return -EINVAL; + } + + flow_tbl = &flow_db->flow_tbl; + if (flow_id) { + ulp_flow_db_debug_fid_dump(flow_db, flow_id); + return 0; + } + + BNXT_TF_DBG(DEBUG, "Dump flows = %u:%u\n", + flow_tbl->num_flows, + flow_tbl->num_resources); + BNXT_TF_DBG(DEBUG, "Head_index = %u, Tail_index = %u\n", + flow_tbl->head_index, flow_tbl->tail_index); + for (fid = 1; fid < flow_tbl->num_flows; fid++) + ulp_flow_db_debug_fid_dump(flow_db, fid); + BNXT_TF_DBG(DEBUG, "Done.\n"); + return 0; +} +#endif diff a/drivers/net/bnxt/tf_ulp/ulp_flow_db.h b/drivers/net/bnxt/tf_ulp/ulp_flow_db.h (rejected hunks) @@ -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_ */ diff a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c (rejected hunks) @@ -22,6 +22,11 @@ #include "ulp_ha_mgr.h" #include "bnxt_tf_pmd_shim.h" +#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG +#include "ulp_template_debug_proto.h" +#include "ulp_tf_debug.h" +#endif + static uint8_t mapper_fld_zeros[16] = { 0 }; static uint8_t mapper_fld_ones[16] = { @@ -784,6 +803,9 @@ ulp_mapper_ident_process(struct bnxt_ulp_mapper_parms *parms, tf_ident_2_str(iparms.ident_type)); return rc; } + BNXT_TF_INF("Alloc ident %s:%s.success.\n", + tf_dir_2_str(iparms.dir), + tf_ident_2_str(iparms.ident_type)); id = (uint64_t)tfp_cpu_to_be_64(iparms.id); if (ulp_regfile_write(parms->regfile, idx, id)) { @@ -813,6 +835,11 @@ ulp_mapper_ident_process(struct bnxt_ulp_mapper_parms *parms, } else { *val = iparms.id; } +#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG +#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER + ulp_mapper_ident_field_dump("Ident", ident, tbl, iparms.id); +#endif +#endif return 0; error: @@ -877,6 +904,10 @@ ulp_mapper_ident_extract(struct bnxt_ulp_mapper_parms *parms, sparms.search_id); return rc; } + BNXT_TF_INF("Search ident %s:%s:%x.success.\n", + tf_dir_2_str(sparms.dir), + tf_tbl_type_2_str(sparms.ident_type), + sparms.search_id); /* Write it to the regfile */ id = (uint64_t)tfp_cpu_to_be_64(sparms.search_id); @@ -996,7 +1032,7 @@ ulp_mapper_field_src_process(struct bnxt_ulp_mapper_parms *parms, return -EINVAL; } idx = tfp_be_to_cpu_16(idx); - if (idx >= BNXT_ULP_CF_IDX_LAST || bytelen > sizeof(uint64_t)) { + if (idx >= BNXT_ULP_CF_IDX_LAST || bytelen > sizeof(uint32_t)) { BNXT_TF_DBG(ERR, "comp field [%d] read oob %d\n", idx, bytelen); return -EINVAL; @@ -1448,7 +1484,16 @@ ulp_mapper_field_opc_process(struct bnxt_ulp_mapper_parms *parms, break; } - return rc; + if (!rc) { +#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG +#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER + if (fld->field_src1 != BNXT_ULP_FIELD_SRC_ZERO) + ulp_mapper_field_dump(name, fld, blob, write_idx, val, + val_len); +#endif +#endif + return rc; + } error: BNXT_TF_DBG(ERR, "Error in %s:%s process %u:%u\n", name, fld->description, (val) ? write_idx : 0, val_len); @@ -1500,8 +1545,15 @@ ulp_mapper_tbl_result_build(struct bnxt_ulp_mapper_parms *parms, } /* if encap bit swap is enabled perform the bit swap */ - if (parms->device_params->encap_byte_swap && encap_flds) + if (parms->device_params->encap_byte_swap && encap_flds) { ulp_blob_perform_encap_swap(data); +#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG +#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER + BNXT_TF_DBG(INFO, "Dump after encap swap\n"); + ulp_mapper_blob_dump(data); +#endif +#endif + } return rc; } @@ -1725,6 +1777,9 @@ ulp_mapper_tcam_tbl_entry_write(struct bnxt_ulp_mapper_parms *parms, tf_dir_2_str(sparms.dir), sparms.idx); return -EIO; } + BNXT_TF_INF("tcam[%s][%s][%x] write success.\n", + tf_tcam_tbl_2_str(sparms.tcam_tbl_type), + tf_dir_2_str(sparms.dir), sparms.idx); /* Mark action */ rc = ulp_mapper_mark_act_ptr_process(parms, tbl); @@ -1838,6 +1898,12 @@ static void ulp_mapper_wc_tcam_tbl_post_process(struct ulp_blob *blob) { ulp_blob_perform_64B_word_swap(blob); ulp_blob_perform_64B_byte_swap(blob); +#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG +#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER + BNXT_TF_DBG(INFO, "Dump after wc tcam post process\n"); + ulp_mapper_blob_dump(blob); +#endif +#endif } static int32_t @@ -2134,6 +2200,11 @@ ulp_mapper_em_tbl_process(struct bnxt_ulp_mapper_parms *parms, BNXT_TF_DBG(ERR, "Failed to build the result blob\n"); return rc; } +#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG +#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER + ulp_mapper_result_dump("EM Result", tbl, &data); +#endif +#endif if (dparms->dynamic_pad_en) { uint32_t abits = dparms->em_blk_align_bits; @@ -2148,6 +2219,11 @@ ulp_mapper_em_tbl_process(struct bnxt_ulp_mapper_parms *parms, ulp_blob_pad_align(&data, abits); ulp_blob_perform_byte_reverse(&data, ULP_BITS_2_BYTE(abits)); +#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG +#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER + ulp_mapper_result_dump("EM Merged Result", tbl, &data); +#endif +#endif } /* do the transpose for the internal EM keys */ @@ -2160,6 +2236,11 @@ ulp_mapper_em_tbl_process(struct bnxt_ulp_mapper_parms *parms, } tmplen = ulp_blob_data_len_get(&key); ulp_blob_perform_byte_reverse(&key, ULP_BITS_2_BYTE(tmplen)); +#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG +#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER + ulp_mapper_result_dump("EM Key Transpose", tbl, &key); +#endif +#endif } rc = bnxt_ulp_cntxt_tbl_scope_id_get(parms->ulp_ctx, @@ -2479,6 +2566,9 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms, sparms.idx, rc); goto error; } + BNXT_TF_INF("Index table[%s][%s][%x] write successful.\n", + tf_tbl_type_2_str(sparms.type), + tf_dir_2_str(sparms.dir), sparms.idx); /* Calculate action record size */ if (tbl->resource_type == TF_TBL_TYPE_EXT) { @@ -2635,6 +2725,10 @@ ulp_mapper_if_tbl_process(struct bnxt_ulp_mapper_parms *parms, iftbl_params.idx, rc); return rc; } + BNXT_TF_INF("Set table[%s][%s][%x] success.\n", + tf_if_tbl_2_str(iftbl_params.type), + tf_dir_2_str(iftbl_params.dir), + iftbl_params.idx); /* * TBD: Need to look at the need to store idx in flow db for restore @@ -2697,6 +2791,12 @@ ulp_mapper_gen_tbl_process(struct bnxt_ulp_mapper_parms *parms, /* The_key is a byte array convert it to a search index */ cache_key = ulp_blob_data_get(&key, &tmplen); +#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG +#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER + BNXT_TF_DBG(DEBUG, "The gen_tbl[%u] key\n", tbl_idx); + ulp_mapper_blob_dump(&key); +#endif +#endif /* get the generic table */ gen_tbl_list = &parms->mapper_data->gen_tbl_list[tbl_idx]; @@ -3495,6 +3595,11 @@ ulp_mapper_tbls_process(struct bnxt_ulp_mapper_parms *parms, uint32_t tid) for (tbl_idx = 0; tbl_idx < num_tbls && cond_goto;) { tbl = &tbls[tbl_idx]; cond_goto = tbl->execute_info.cond_true_goto; +#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG +#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER + ulp_mapper_table_dump(tbl, tbl_idx); +#endif +#endif /* Process the conditional func code opcodes */ if (ulp_mapper_func_info_process(parms, tbl)) { BNXT_TF_DBG(ERR, "Failed to process cond update\n"); diff a/drivers/net/bnxt/tf_ulp/ulp_port_db.c b/drivers/net/bnxt/tf_ulp/ulp_port_db.c (rejected hunks) @@ -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; } diff a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c (rejected hunks) @@ -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; diff a/drivers/net/bnxt/tf_ulp/ulp_utils.c b/drivers/net/bnxt/tf_ulp/ulp_utils.c (rejected hunks) @@ -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. Checking patch drivers/net/bnxt/tf_ulp/bnxt_ulp.c... error: drivers/net/bnxt/tf_ulp/bnxt_ulp.c: does not match index Checking patch drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c... error: drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c: does not match index Checking patch drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_enum.h... error: drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_enum.h: does not exist in index Checking patch drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c... error: drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c: does not exist in index Checking patch drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_act.c... error: drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_act.c: does not exist in index Checking patch drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c... error: drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c: does not exist in index Checking patch drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_act.c... error: drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_act.c: does not exist in index Checking patch drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_class.c... error: drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_class.c: does not exist in index Checking patch drivers/net/bnxt/tf_ulp/ulp_flow_db.c... error: drivers/net/bnxt/tf_ulp/ulp_flow_db.c: does not match index Checking patch drivers/net/bnxt/tf_ulp/ulp_flow_db.h... Hunk #1 succeeded at 15 (offset -3 lines). Checking patch drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c... error: drivers/net/bnxt/tf_ulp/ulp_ha_mgr.c: does not exist in index Checking patch drivers/net/bnxt/tf_ulp/ulp_mapper.c... error: drivers/net/bnxt/tf_ulp/ulp_mapper.c: does not match index Checking patch drivers/net/bnxt/tf_ulp/ulp_mapper.h... error: while searching for: struct ulp_rte_act_prop *act_prop; struct ulp_rte_act_bitmap *act_bitmap; struct ulp_rte_hdr_bitmap *hdr_bitmap; struct ulp_rte_hdr_field *hdr_field; struct ulp_rte_field_bitmap *fld_bitmap; uint64_t *comp_fld; struct ulp_regfile *regfile; error: patch failed: drivers/net/bnxt/tf_ulp/ulp_mapper.h:44 error: while searching for: struct bnxt_ulp_mapper_create_parms { uint32_t app_priority; struct ulp_rte_hdr_bitmap *hdr_bitmap; struct ulp_rte_hdr_field *hdr_field; uint64_t *comp_fld; struct ulp_rte_act_bitmap *act; struct ulp_rte_act_prop *act_prop; error: patch failed: drivers/net/bnxt/tf_ulp/ulp_mapper.h:67 Checking patch drivers/net/bnxt/tf_ulp/ulp_rte_parser.c... error: drivers/net/bnxt/tf_ulp/ulp_rte_parser.c: does not match index Checking patch drivers/net/bnxt/tf_ulp/ulp_rte_parser.h... error: while searching for: #define BNXT_ULP_GET_IPV6_FLOWLABEL(vtcf) \ ((vtcf) & BNXT_ULP_PARSER_IPV6_FLOW_LABEL) #define BNXT_ULP_PARSER_IPV6_VER_MASK 0xf0000000 #define BNXT_ULP_PARSER_IPV6_TC 0x0ff00000 #define BNXT_ULP_PARSER_IPV6_FLOW_LABEL 0x000fffff enum bnxt_ulp_prsr_action { ULP_PRSR_ACT_DEFAULT = 0, error: patch failed: drivers/net/bnxt/tf_ulp/ulp_rte_parser.h:33 Checking patch drivers/net/bnxt/tf_ulp/ulp_template_struct.h... error: while searching for: #define BNXT_ULP_PROTO_HDR_GRE_NUM 6 #define BNXT_ULP_PROTO_HDR_ICMP_NUM 5 #define BNXT_ULP_PROTO_HDR_MAX 128 #define BNXT_ULP_PROTO_HDR_FIELD_SVIF_IDX 1 /* Direction attributes */ error: patch failed: drivers/net/bnxt/tf_ulp/ulp_template_struct.h:30 error: while searching for: /* Structure to be used for passing all the parser functions */ struct ulp_rte_parser_params { STAILQ_ENTRY(ulp_rte_parser_params) next; struct ulp_rte_hdr_bitmap hdr_bitmap; struct ulp_rte_hdr_bitmap hdr_fp_bit; struct ulp_rte_field_bitmap fld_bitmap; struct ulp_rte_field_bitmap fld_s_bitmap; struct ulp_rte_hdr_field hdr_field[BNXT_ULP_PROTO_HDR_MAX]; uint64_t comp_fld[BNXT_ULP_CF_IDX_LAST]; uint32_t field_idx; struct ulp_rte_act_bitmap act_bitmap; error: patch failed: drivers/net/bnxt/tf_ulp/ulp_template_struct.h:64 Hunk #3 succeeded at 160 (offset -49 lines). error: while searching for: uint8_t direction; enum bnxt_ulp_pri_opc pri_opcode; uint32_t pri_operand; enum bnxt_ulp_byte_order byte_order; /* conflict resolution opcode */ enum bnxt_ulp_accept_opc accept_opcode; error: patch failed: drivers/net/bnxt/tf_ulp/ulp_template_struct.h:254 Hunk #5 succeeded at 205 (offset -65 lines). Checking patch drivers/net/bnxt/tf_ulp/ulp_utils.c... error: while searching for: * 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 beingritten into this * variable. * * returns 0 on success error: patch failed: drivers/net/bnxt/tf_ulp/ulp_utils.c:62 Hunk #2 succeeded at 266 (offset -29 lines). Hunk #3 succeeded at 326 (offset -29 lines). Hunk #4 succeeded at 380 (offset -29 lines). error: while searching for: return 0; } /* * Read data from the operand * error: patch failed: drivers/net/bnxt/tf_ulp/ulp_utils.c:987 Hunk #6 succeeded at 753 (offset -286 lines). Checking patch drivers/net/bnxt/tf_ulp/ulp_utils.h... error: while searching for: ulp_blob_append(struct ulp_blob *dst, struct ulp_blob *src, uint16_t src_offset, uint16_t src_len); /* * Read data from the operand * error: patch failed: drivers/net/bnxt/tf_ulp/ulp_utils.h:475 Hunk #2 succeeded at 361 (offset -142 lines). Applied patch drivers/net/bnxt/tf_ulp/ulp_flow_db.h cleanly. Applying patch drivers/net/bnxt/tf_ulp/ulp_mapper.h with 2 rejects... Rejected hunk #1. Rejected hunk #2. Applying patch drivers/net/bnxt/tf_ulp/ulp_rte_parser.h with 1 reject... Rejected hunk #1. Applying patch drivers/net/bnxt/tf_ulp/ulp_template_struct.h with 3 rejects... Rejected hunk #1. Rejected hunk #2. Hunk #3 applied cleanly. Rejected hunk #4. Hunk #5 applied cleanly. Applying patch drivers/net/bnxt/tf_ulp/ulp_utils.c with 2 rejects... Rejected hunk #1. Hunk #2 applied cleanly. Hunk #3 applied cleanly. Hunk #4 applied cleanly. Rejected hunk #5. Hunk #6 applied cleanly. Applying patch drivers/net/bnxt/tf_ulp/ulp_utils.h with 1 reject... Rejected hunk #1. Hunk #2 applied cleanly. diff a/drivers/net/bnxt/tf_ulp/ulp_mapper.h b/drivers/net/bnxt/tf_ulp/ulp_mapper.h (rejected hunks) @@ -44,7 +44,9 @@ struct bnxt_ulp_mapper_parms { struct ulp_rte_act_prop *act_prop; struct ulp_rte_act_bitmap *act_bitmap; struct ulp_rte_hdr_bitmap *hdr_bitmap; + struct ulp_rte_hdr_bitmap *enc_hdr_bitmap; struct ulp_rte_hdr_field *hdr_field; + struct ulp_rte_hdr_field *enc_field; struct ulp_rte_field_bitmap *fld_bitmap; uint64_t *comp_fld; struct ulp_regfile *regfile; @@ -67,7 +69,9 @@ struct bnxt_ulp_mapper_parms { struct bnxt_ulp_mapper_create_parms { uint32_t app_priority; struct ulp_rte_hdr_bitmap *hdr_bitmap; + struct ulp_rte_hdr_bitmap *enc_hdr_bitmap; struct ulp_rte_hdr_field *hdr_field; + struct ulp_rte_hdr_field *enc_field; uint64_t *comp_fld; struct ulp_rte_act_bitmap *act; struct ulp_rte_act_prop *act_prop; diff a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h (rejected hunks) @@ -33,8 +33,10 @@ #define BNXT_ULP_GET_IPV6_FLOWLABEL(vtcf) \ ((vtcf) & BNXT_ULP_PARSER_IPV6_FLOW_LABEL) #define BNXT_ULP_PARSER_IPV6_VER_MASK 0xf0000000 +#define BNXT_ULP_IPV6_DFLT_VER 0x60000000 #define BNXT_ULP_PARSER_IPV6_TC 0x0ff00000 #define BNXT_ULP_PARSER_IPV6_FLOW_LABEL 0x000fffff +#define BNXT_ULP_DEFAULT_TTL 64 enum bnxt_ulp_prsr_action { ULP_PRSR_ACT_DEFAULT = 0, diff a/drivers/net/bnxt/tf_ulp/ulp_template_struct.h b/drivers/net/bnxt/tf_ulp/ulp_template_struct.h (rejected hunks) @@ -30,6 +30,7 @@ #define BNXT_ULP_PROTO_HDR_GRE_NUM 6 #define BNXT_ULP_PROTO_HDR_ICMP_NUM 5 #define BNXT_ULP_PROTO_HDR_MAX 128 +#define BNXT_ULP_PROTO_HDR_ENCAP_MAX 64 #define BNXT_ULP_PROTO_HDR_FIELD_SVIF_IDX 1 /* Direction attributes */ @@ -64,12 +65,13 @@ struct ulp_rte_act_prop { /* Structure to be used for passing all the parser functions */ struct ulp_rte_parser_params { - STAILQ_ENTRY(ulp_rte_parser_params) next; struct ulp_rte_hdr_bitmap hdr_bitmap; + struct ulp_rte_hdr_bitmap enc_hdr_bitmap; struct ulp_rte_hdr_bitmap hdr_fp_bit; struct ulp_rte_field_bitmap fld_bitmap; struct ulp_rte_field_bitmap fld_s_bitmap; struct ulp_rte_hdr_field hdr_field[BNXT_ULP_PROTO_HDR_MAX]; + struct ulp_rte_hdr_field enc_field[BNXT_ULP_PROTO_HDR_ENCAP_MAX]; uint64_t comp_fld[BNXT_ULP_CF_IDX_LAST]; uint32_t field_idx; struct ulp_rte_act_bitmap act_bitmap; @@ -254,7 +258,6 @@ struct bnxt_ulp_mapper_tbl_info { uint8_t direction; enum bnxt_ulp_pri_opc pri_opcode; uint32_t pri_operand; - enum bnxt_ulp_byte_order byte_order; /* conflict resolution opcode */ enum bnxt_ulp_accept_opc accept_opcode; diff a/drivers/net/bnxt/tf_ulp/ulp_utils.c b/drivers/net/bnxt/tf_ulp/ulp_utils.c (rejected hunks) @@ -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 beingritten into this + * size [in] The size in bytes of the value being written into this * variable. * * returns 0 on success @@ -987,6 +987,33 @@ ulp_blob_append(struct ulp_blob *dst, struct ulp_blob *src, return 0; } +/* + * Perform the blob buffer copy. + * This api makes the src blob merged to the dst blob. + * + * dst [in] The destination blob, the blob to be merged. + * src [in] The src blob. + * + * returns 0 on success. + */ +int32_t +ulp_blob_buffer_copy(struct ulp_blob *dst, struct ulp_blob *src) +{ + if ((dst->write_idx + src->write_idx) > dst->bitlen) { + BNXT_TF_DBG(ERR, "source buffer too large\n"); + return -EINVAL; + } + if (ULP_BITS_IS_BYTE_NOT_ALIGNED(dst->write_idx) || + ULP_BITS_IS_BYTE_NOT_ALIGNED(src->write_idx)) { + BNXT_TF_DBG(ERR, "source buffer is not aligned\n"); + return -EINVAL; + } + memcpy(&dst->data[ULP_BITS_2_BYTE_NR(dst->write_idx)], + src->data, ULP_BITS_2_BYTE_NR(src->write_idx)); + dst->write_idx += src->write_idx; + return 0; +} + /* * Read data from the operand * diff a/drivers/net/bnxt/tf_ulp/ulp_utils.h b/drivers/net/bnxt/tf_ulp/ulp_utils.h (rejected hunks) @@ -475,6 +475,18 @@ int32_t ulp_blob_append(struct ulp_blob *dst, struct ulp_blob *src, uint16_t src_offset, uint16_t src_len); +/* + * Perform the blob buffer copy. + * This api makes the src blob merged to the dst blob. + * + * dst [in] The destination blob, the blob to be merged. + * src [in] The src blob. + * + * returns 0 on success. + */ +int32_t +ulp_blob_buffer_copy(struct ulp_blob *dst, struct ulp_blob *src); + /* * Read data from the operand * Checking patch drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c... error: drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c: does not exist in index Checking patch drivers/net/bnxt/tf_ulp/ulp_mapper.c... error: drivers/net/bnxt/tf_ulp/ulp_mapper.c: does not match index Checking patch drivers/net/bnxt/tf_ulp/ulp_template_struct.h... error: drivers/net/bnxt/tf_ulp/ulp_template_struct.h: does not match index Checking patch drivers/net/bnxt/tf_core/tf_tbl_sram.c... error: drivers/net/bnxt/tf_core/tf_tbl_sram.c: does not exist in index Checking patch drivers/net/bnxt/tf_core/dpool.c... error: drivers/net/bnxt/tf_core/dpool.c: does not exist in index Checking patch drivers/net/bnxt/tf_core/tf_em_internal.c... error: while searching for: return rc; if (!tf_session_is_shared_session(tfs)) { for (i = 0; i < TF_DIR_MAX; i++) dpool_free_all(tfs->em_pool[i]); } rc = tf_session_get_db(tfp, TF_MODULE_TYPE_EM, &em_db_ptr); error: patch failed: drivers/net/bnxt/tf_core/tf_em_internal.c:326 Checking patch drivers/net/bnxt/tf_core/tf_rm.c... error: drivers/net/bnxt/tf_core/tf_rm.c: does not match index Checking patch drivers/net/bnxt/tf_core/tf_tbl_sram.c... error: drivers/net/bnxt/tf_core/tf_tbl_sram.c: does not exist in index Applying patch drivers/net/bnxt/tf_core/tf_em_internal.c with 1 reject... Rejected hunk #1. diff a/drivers/net/bnxt/tf_core/tf_em_internal.c b/drivers/net/bnxt/tf_core/tf_em_internal.c (rejected hunks) @@ -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); Checking patch drivers/net/bnxt/bnxt.h... error: while searching for: ((bp)->flags2 & BNXT_FLAGS2_PTP_TIMESYNC_ENABLED) #define BNXT_ACCUM_STATS_EN(bp) \ ((bp)->flags2 & BNXT_FLAGS2_ACCUM_STATS_EN) uint16_t chip_num; #define CHIP_NUM_58818 0xd818 error: patch failed: drivers/net/bnxt/bnxt.h:722 Checking patch drivers/net/bnxt/bnxt_ethdev.c... error: while searching for: #define BNXT_DEVARG_REP_FC_R2F "rep-fc-r2f" #define BNXT_DEVARG_REP_FC_F2R "rep-fc-f2r" #define BNXT_DEVARG_APP_ID "app-id" static const char *const bnxt_dev_args[] = { BNXT_DEVARG_REPRESENTOR, error: patch failed: drivers/net/bnxt/bnxt_ethdev.c:98 error: while searching for: BNXT_DEVARG_REP_FC_R2F, BNXT_DEVARG_REP_FC_F2R, BNXT_DEVARG_APP_ID, NULL }; /* * accum-stats == false to disable flow counter accumulation * accum-stats == true to enable flow counter accumulation error: patch failed: drivers/net/bnxt/bnxt_ethdev.c:111 Hunk #3 succeeded at 5515 (offset -347 lines). error: while searching for: if (ret) goto err; err: /* * Handler for "app-id" devarg. error: patch failed: drivers/net/bnxt/bnxt_ethdev.c:5890 Checking patch drivers/net/bnxt/tf_ulp/bnxt_ulp.c... error: drivers/net/bnxt/tf_ulp/bnxt_ulp.c: does not match index Checking patch drivers/net/bnxt/tf_ulp/ulp_def_rules.c... error: while searching for: rc = ulp_default_flow_db_cfa_action_get(bp->ulp_ctx, info->def_port_flow_id, &bp->tx_cfa_action); if (rc) bp->tx_cfa_action = 0; info->valid = true; return 0; } error: patch failed: drivers/net/bnxt/tf_ulp/ulp_def_rules.c:526 Applying patch drivers/net/bnxt/bnxt.h with 1 reject... Rejected hunk #1. Applying patch drivers/net/bnxt/bnxt_ethdev.c with 3 rejects... Rejected hunk #1. Rejected hunk #2. Hunk #3 applied cleanly. Rejected hunk #4. Applying patch drivers/net/bnxt/tf_ulp/ulp_def_rules.c with 1 reject... Rejected hunk #1. diff a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h (rejected hunks) @@ -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 diff a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c (rejected hunks) @@ -98,6 +98,7 @@ static const struct rte_pci_id bnxt_pci_id_map[] = { #define BNXT_DEVARG_REP_FC_R2F "rep-fc-r2f" #define BNXT_DEVARG_REP_FC_F2R "rep-fc-f2r" #define BNXT_DEVARG_APP_ID "app-id" +#define BNXT_DEVARG_TESTPMD "testpmd" static const char *const bnxt_dev_args[] = { BNXT_DEVARG_REPRESENTOR, @@ -111,9 +112,17 @@ static const char *const bnxt_dev_args[] = { BNXT_DEVARG_REP_FC_R2F, BNXT_DEVARG_REP_FC_F2R, BNXT_DEVARG_APP_ID, + BNXT_DEVARG_TESTPMD, NULL }; +/* + * testpmd == false to disable + * testpmd == true to enable + */ +#define BNXT_DEVARG_TESTPMD_INVALID(truflow) ((testpmd) > 1) + + /* * accum-stats == false to disable flow counter accumulation * accum-stats == true to enable flow counter accumulation @@ -5890,6 +5937,15 @@ bnxt_parse_dev_args(struct bnxt *bp, struct rte_devargs *devargs) if (ret) goto err; + /* + * Handler for "testpmd" devarg. + * Invoked as for ex: "-a 0000:00:0d.0,testpmd=1" + */ + ret = rte_kvargs_process(kvlist, BNXT_DEVARG_TESTPMD, + bnxt_parse_devarg_testpmd, bp); + if (ret) + goto err; + err: /* * Handler for "app-id" devarg. diff a/drivers/net/bnxt/tf_ulp/ulp_def_rules.c b/drivers/net/bnxt/tf_ulp/ulp_def_rules.c (rejected hunks) @@ -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; } https://lab.dpdk.org/results/dashboard/patchsets/18487/ UNH-IOL DPDK Community Lab