From patchwork Sat Apr 25 14:01:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 69307 X-Patchwork-Delegate: ajit.khaparde@broadcom.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A36D8A00C2; Sat, 25 Apr 2020 16:01:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 750701C1B3; Sat, 25 Apr 2020 16:01:50 +0200 (CEST) Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 6946D1C1C4 for ; Sat, 25 Apr 2020 16:01:49 +0200 (CEST) Received: from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net [10.75.242.48]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 1996530C01B; Sat, 25 Apr 2020 06:49:57 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 1996530C01B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1587822597; bh=ILCjTlW5GbFj+w7vf4jzChwJyofkbaS03xRRgoqLiE4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dC1FX86h1QtxCp9oL45Ii/OoE7oixWjaOQ12X8fyBao0aXrxg/98fO6uTHhf2Anzk 1PTPx/rKz5yoKy4IJlckjZoDI+QhMddNahySSzMaeyV2q0r8X5GJEmsHEmyYNs4kue jndvQ7EF+xqq2w9SH0AkgxVaZuYTdzEaViS6Nsfg= Received: from localhost.localdomain (unknown [10.230.185.215]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id 104F614008B; Sat, 25 Apr 2020 07:01:47 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: Mike Baucom , Kishore Padmanabha Date: Sat, 25 Apr 2020 07:01:38 -0700 Message-Id: <20200425140141.27947-2-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.21.1 (Apple Git-122.3) In-Reply-To: <20200425140141.27947-1-ajit.khaparde@broadcom.com> References: <1587786446-35230-1-git-send-email-venkatkumar.duvvuru@broadcom.com> <20200425140141.27947-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 1/4] net/bnxt: reserve a flowdb resource function as invalid X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Mike Baucom The resource function did not have a method of invalidating or indicating that a resource is uninitialized. Added an invalid enum so that processing works correctly for partially added flows. Signed-off-by: Mike Baucom Reviewed-by: Kishore Padmanabha Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/tf_ulp/ulp_template_db.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db.h b/drivers/net/bnxt/tf_ulp/ulp_template_db.h index a5606bdc4..e6065d2fb 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_db.h +++ b/drivers/net/bnxt/tf_ulp/ulp_template_db.h @@ -204,13 +204,14 @@ enum bnxt_ulp_regfile_index { }; enum bnxt_ulp_resource_func { - BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE = 0, - BNXT_ULP_RESOURCE_FUNC_EM_TABLE = 1, - BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE = 2, - BNXT_ULP_RESOURCE_FUNC_CACHE_TABLE = 3, - BNXT_ULP_RESOURCE_FUNC_IDENTIFIER = 4, - BNXT_ULP_RESOURCE_FUNC_HW_FID = 5, - BNXT_ULP_RESOURCE_FUNC_LAST = 6 + BNXT_ULP_RESOURCE_FUNC_INVALID = 0, + BNXT_ULP_RESOURCE_FUNC_TCAM_TABLE = 1, + BNXT_ULP_RESOURCE_FUNC_EM_TABLE = 2, + BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE = 3, + BNXT_ULP_RESOURCE_FUNC_CACHE_TABLE = 4, + BNXT_ULP_RESOURCE_FUNC_IDENTIFIER = 5, + BNXT_ULP_RESOURCE_FUNC_HW_FID = 6, + BNXT_ULP_RESOURCE_FUNC_LAST = 7 }; enum bnxt_ulp_result_opc { From patchwork Sat Apr 25 14:01:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 69311 X-Patchwork-Delegate: ajit.khaparde@broadcom.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2BE6DA00C2; Sat, 25 Apr 2020 16:02:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0B4AA1C219; Sat, 25 Apr 2020 16:01:57 +0200 (CEST) Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 5AC5B1BF8C for ; Sat, 25 Apr 2020 16:01:49 +0200 (CEST) Received: from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net [10.75.242.48]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 54A0330C021; Sat, 25 Apr 2020 06:49:57 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 54A0330C021 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1587822597; bh=NKNPSnSeE1q++4VYtrKOIP64kE6A8vFwHj4YLveZOtI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J5Vf4LxxsD2U3rstjeKdxnhFy10EB1ibsJL37quW2Eft6l++C1+XVdx45DnZD6FXs U2ILTfZ4dy6c3+5Egsq+xh13MuamNCnUVSnvOlXv8TofGUjq3S4fg8WqkCZ7i7i6I6 6IC07NO5ON8NkGjSwU19pYMJoM4i5cPQIBjBaUbs= Received: from localhost.localdomain (unknown [10.230.185.215]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id 4643814008C; Sat, 25 Apr 2020 07:01:47 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: Farah Smith , Mike Baucom , Peter Spreadborough , Kishore Padmanabha Date: Sat, 25 Apr 2020 07:01:39 -0700 Message-Id: <20200425140141.27947-3-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.21.1 (Apple Git-122.3) In-Reply-To: <20200425140141.27947-1-ajit.khaparde@broadcom.com> References: <1587786446-35230-1-git-send-email-venkatkumar.duvvuru@broadcom.com> <20200425140141.27947-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 2/4] net/bnxt: update action record external pool X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Farah Smith - Added support variable sized action records - Additional error checking on table scope params - Single external pool supported per direction - Changed to return action record pointer - Allows action pool to fully utilize the number of flows Signed-off-by: Farah Smith Signed-off-by: Mike Baucom Reviewed-by: Peter Spreadborough Reviewed-by: Kishore Padmanabha --- drivers/net/bnxt/tf_core/tf_core.c | 3 - drivers/net/bnxt/tf_core/tf_core.h | 15 +-- drivers/net/bnxt/tf_core/tf_rm.c | 3 - drivers/net/bnxt/tf_core/tf_session.h | 6 -- drivers/net/bnxt/tf_core/tf_tbl.c | 136 ++++++++++---------------- drivers/net/bnxt/tf_core/tf_tbl.h | 4 +- 6 files changed, 62 insertions(+), 105 deletions(-) diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c index fc7d6381f..cf9f36adb 100644 --- a/drivers/net/bnxt/tf_core/tf_core.c +++ b/drivers/net/bnxt/tf_core/tf_core.c @@ -175,9 +175,6 @@ tf_open_session(struct tf *tfp, /* Setup hash seeds */ tf_seeds_init(session); - /* Initialize external pool data structures */ - tf_init_tbl_pool(session); - session->ref_count++; /* Return session ID */ diff --git a/drivers/net/bnxt/tf_core/tf_core.h b/drivers/net/bnxt/tf_core/tf_core.h index 6a1f3a106..4b60973ee 100644 --- a/drivers/net/bnxt/tf_core/tf_core.h +++ b/drivers/net/bnxt/tf_core/tf_core.h @@ -83,7 +83,7 @@ enum tf_mem { /** EEM record AR helper * - * Helpers to handle the Action Record Pointer in the EEM Record Entry. + * Helper to handle the Action Record Pointer in the EEM Record Entry. * * Convert absolute offset to action record pointer in EEM record entry * Convert action record pointer in EEM record entry to absolute offset @@ -91,8 +91,6 @@ enum tf_mem { #define TF_ACT_REC_OFFSET_2_PTR(offset) ((offset) >> 4) #define TF_ACT_REC_PTR_2_OFFSET(offset) ((offset) << 4) -#define TF_ACT_REC_INDEX_2_OFFSET(idx) ((idx) << 9) - /* * Helper Macros */ @@ -943,8 +941,6 @@ enum tf_tbl_type { * scope. Internal types are not. */ TF_TBL_TYPE_EXT, - /** Future - external pool of size0 entries */ - TF_TBL_TYPE_EXT_0, TF_TBL_TYPE_MAX }; @@ -959,6 +955,10 @@ struct tf_alloc_tbl_entry_parms { * [in] Type of the allocation */ enum tf_tbl_type type; + /** + * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT) + */ + uint32_t tbl_scope_id; /** * [in] Enable search for matching entry. If the table type is * internal the shadow copy will be searched before @@ -1028,6 +1028,10 @@ struct tf_free_tbl_entry_parms { * [in] Type of the allocation type */ enum tf_tbl_type type; + /** + * [in] Table scope identifier (ignored unless TF_TBL_TYPE_EXT) + */ + uint32_t tbl_scope_id; /** * [in] Index to free */ @@ -1070,7 +1074,6 @@ int tf_free_tbl_entry(struct tf *tfp, struct tf_set_tbl_entry_parms { /** * [in] Table scope identifier - * */ uint32_t tbl_scope_id; /** diff --git a/drivers/net/bnxt/tf_core/tf_rm.c b/drivers/net/bnxt/tf_core/tf_rm.c index a5e96f29b..38b1e71cd 100644 --- a/drivers/net/bnxt/tf_core/tf_rm.c +++ b/drivers/net/bnxt/tf_core/tf_rm.c @@ -3104,7 +3104,6 @@ tf_rm_lookup_tbl_type_pool(struct tf_session *tfs, break; /* No bitalloc pools for these types */ case TF_TBL_TYPE_EXT: - case TF_TBL_TYPE_EXT_0: default: break; } @@ -3211,7 +3210,6 @@ tf_rm_convert_tbl_type(enum tf_tbl_type type, case TF_TBL_TYPE_ACT_MODIFY_IPV6_SRC: case TF_TBL_TYPE_VNIC_SVIF: case TF_TBL_TYPE_EXT: /* No pools for this type */ - case TF_TBL_TYPE_EXT_0: /* No pools for this type */ default: *hcapi_type = -1; rc = -EOPNOTSUPP; @@ -3277,7 +3275,6 @@ tf_rm_convert_index(struct tf_session *tfs, /* Not yet supported */ case TF_TBL_TYPE_VNIC_SVIF: case TF_TBL_TYPE_EXT: /* No pools for this type */ - case TF_TBL_TYPE_EXT_0: /* No pools for this type */ default: return -EOPNOTSUPP; } diff --git a/drivers/net/bnxt/tf_core/tf_session.h b/drivers/net/bnxt/tf_core/tf_session.h index fed34f146..50ef2d530 100644 --- a/drivers/net/bnxt/tf_core/tf_session.h +++ b/drivers/net/bnxt/tf_core/tf_session.h @@ -289,12 +289,6 @@ struct tf_session { /** Table scope array */ struct tf_tbl_scope_cb tbl_scopes[TF_NUM_TBL_SCOPE]; - - /** Each external pool is associated with a single table scope - * For each external pool store the associated table scope in - * this data structure - */ - uint32_t ext_pool_2_scope[TF_DIR_MAX][TF_EXT_POOL_CNT_MAX]; }; #endif /* _TF_SESSION_H_ */ diff --git a/drivers/net/bnxt/tf_core/tf_tbl.c b/drivers/net/bnxt/tf_core/tf_tbl.c index 17df27435..236affe25 100644 --- a/drivers/net/bnxt/tf_core/tf_tbl.c +++ b/drivers/net/bnxt/tf_core/tf_tbl.c @@ -701,6 +701,21 @@ tf_em_validate_num_entries(struct tf_tbl_scope_cb *tbl_scope_cb, } } + if (parms->rx_num_flows_in_k != 0 && + (parms->rx_max_key_sz_in_bits / 8 == 0)) { + PMD_DRV_LOG(ERR, + "EEM: Rx key size required: %u\n", + (parms->rx_max_key_sz_in_bits)); + return -EINVAL; + } + + if (parms->tx_num_flows_in_k != 0 && + (parms->tx_max_key_sz_in_bits / 8 == 0)) { + PMD_DRV_LOG(ERR, + "EEM: Tx key size required: %u\n", + (parms->tx_max_key_sz_in_bits)); + return -EINVAL; + } /* Rx */ tbl_scope_cb->em_ctx_info[TF_DIR_RX].em_tables[KEY0_TABLE].num_entries = parms->rx_num_flows_in_k * TF_KILOBYTE; @@ -715,7 +730,7 @@ tf_em_validate_num_entries(struct tf_tbl_scope_cb *tbl_scope_cb, tbl_scope_cb->em_ctx_info[TF_DIR_RX].em_tables[RECORD_TABLE].num_entries = parms->rx_num_flows_in_k * TF_KILOBYTE; tbl_scope_cb->em_ctx_info[TF_DIR_RX].em_tables[RECORD_TABLE].entry_size = - parms->tx_max_action_entry_sz_in_bits / 8; + parms->rx_max_action_entry_sz_in_bits / 8; tbl_scope_cb->em_ctx_info[TF_DIR_RX].em_tables[EFC_TABLE].num_entries = 0; @@ -954,14 +969,10 @@ tf_free_tbl_entry_shadow(struct tf_session *tfs, /** * Create External Tbl pool of memory indexes. * - * [in] session - * Pointer to session * [in] dir * direction * [in] tbl_scope_cb * pointer to the table scope - * [in] tbl_scope_id - * id of the table scope * [in] num_entries * number of entries to write * [in] entry_sz_bytes @@ -973,18 +984,16 @@ tf_free_tbl_entry_shadow(struct tf_session *tfs, * - Failure, entry not allocated, out of resources */ static int -tf_create_tbl_pool_external(struct tf_session *session, - enum tf_dir dir, +tf_create_tbl_pool_external(enum tf_dir dir, struct tf_tbl_scope_cb *tbl_scope_cb, - uint32_t table_scope_id, uint32_t num_entries, uint32_t entry_sz_bytes) - { struct tfp_calloc_parms parms; - uint32_t i, j; + uint32_t i; + int32_t j; int rc = 0; - struct stack *pool = &tbl_scope_cb->ext_pool[dir][TF_EXT_POOL_0]; + struct stack *pool = &tbl_scope_cb->ext_act_pool[dir]; parms.nitems = num_entries; parms.size = sizeof(uint32_t); @@ -1009,18 +1018,23 @@ tf_create_tbl_pool_external(struct tf_session *session, /* Save the malloced memory address so that it can * be freed when the table scope is freed. */ - tbl_scope_cb->ext_pool_mem[dir][TF_EXT_POOL_0] = - (uint32_t *)parms.mem_va; + tbl_scope_cb->ext_act_pool_mem[dir] = (uint32_t *)parms.mem_va; - /* Fill pool with indexes + /* Fill pool with indexes in reverse */ - j = num_entries * entry_sz_bytes - 1; + j = (num_entries - 1) * entry_sz_bytes; for (i = 0; i < num_entries; i++) { rc = stack_push(pool, j); if (rc != 0) { - PMD_DRV_LOG(ERR, "%d TBL: stack failure %s\n", - dir, strerror(-rc)); + PMD_DRV_LOG(ERR, "%s TBL: stack failure %s\n", + tf_dir_2_str(dir), strerror(-rc)); + goto cleanup; + } + + if (j < 0) { + PMD_DRV_LOG(ERR, "%d TBL: invalid offset (%d)\n", + dir, j); goto cleanup; } j -= entry_sz_bytes; @@ -1032,10 +1046,6 @@ tf_create_tbl_pool_external(struct tf_session *session, dir, strerror(-rc)); goto cleanup; } - /* Set the table scope associated with the pool - */ - session->ext_pool_2_scope[dir][TF_EXT_POOL_0] = table_scope_id; - return 0; cleanup: tfp_free((void *)parms.mem_va); @@ -1045,8 +1055,6 @@ tf_create_tbl_pool_external(struct tf_session *session, /** * Destroy External Tbl pool of memory indexes. * - * [in] session - * Pointer to session * [in] dir * direction * [in] tbl_scope_cb @@ -1054,18 +1062,13 @@ tf_create_tbl_pool_external(struct tf_session *session, * */ static void -tf_destroy_tbl_pool_external(struct tf_session *session, - enum tf_dir dir, - struct tf_tbl_scope_cb *tbl_scope_cb) +tf_destroy_tbl_pool_external(enum tf_dir dir, + struct tf_tbl_scope_cb *tbl_scope_cb) { - uint32_t *ext_pool_mem = - tbl_scope_cb->ext_pool_mem[dir][TF_EXT_POOL_0]; + uint32_t *ext_act_pool_mem = + tbl_scope_cb->ext_act_pool_mem[dir]; - tfp_free(ext_pool_mem); - - /* Set the table scope associated with the pool - */ - session->ext_pool_2_scope[dir][TF_EXT_POOL_0] = TF_TBL_SCOPE_INVALID; + tfp_free(ext_act_pool_mem); } /** @@ -1088,7 +1091,6 @@ tf_alloc_tbl_entry_pool_external(struct tf *tfp, int rc; uint32_t index; struct tf_session *tfs; - uint32_t tbl_scope_id; struct tf_tbl_scope_cb *tbl_scope_cb; struct stack *pool; @@ -1107,26 +1109,17 @@ tf_alloc_tbl_entry_pool_external(struct tf *tfp, tfs = (struct tf_session *)(tfp->session->core_data); - if (parms->type != TF_TBL_TYPE_EXT) { - PMD_DRV_LOG(ERR, - "dir:%d, Type not supported, type:%d\n", - parms->dir, - parms->type); - return -EOPNOTSUPP; - } - /* Get the pool info from the table scope */ - tbl_scope_id = tfs->ext_pool_2_scope[parms->dir][TF_EXT_POOL_0]; - tbl_scope_cb = tbl_scope_cb_find(tfs, tbl_scope_id); + tbl_scope_cb = tbl_scope_cb_find(tfs, parms->tbl_scope_id); if (tbl_scope_cb == NULL) { PMD_DRV_LOG(ERR, - "dir:%d, table scope not allocated\n", - parms->dir); + "%s, table scope not allocated\n", + tf_dir_2_str(parms->dir)); return -EINVAL; } - pool = &tbl_scope_cb->ext_pool[parms->dir][TF_EXT_POOL_0]; + pool = &tbl_scope_cb->ext_act_pool[parms->dir]; /* Allocate an element */ @@ -1246,12 +1239,11 @@ tf_alloc_tbl_entry_pool_internal(struct tf *tfp, */ static int tf_free_tbl_entry_pool_external(struct tf *tfp, - struct tf_free_tbl_entry_parms *parms) + struct tf_free_tbl_entry_parms *parms) { int rc = 0; struct tf_session *tfs; uint32_t index; - uint32_t tbl_scope_id; struct tf_tbl_scope_cb *tbl_scope_cb; struct stack *pool; @@ -1270,26 +1262,17 @@ tf_free_tbl_entry_pool_external(struct tf *tfp, tfs = (struct tf_session *)(tfp->session->core_data); - if (parms->type != TF_TBL_TYPE_EXT) { - PMD_DRV_LOG(ERR, - "dir:%d, Type not supported, type:%d\n", - parms->dir, - parms->type); - return -EOPNOTSUPP; - } - /* Get the pool info from the table scope */ - tbl_scope_id = tfs->ext_pool_2_scope[parms->dir][TF_EXT_POOL_0]; - tbl_scope_cb = tbl_scope_cb_find(tfs, tbl_scope_id); + tbl_scope_cb = tbl_scope_cb_find(tfs, parms->tbl_scope_id); if (tbl_scope_cb == NULL) { PMD_DRV_LOG(ERR, - "dir:%d, table scope error\n", + "dir:%d, Session info invalid\n", parms->dir); return -EINVAL; } - pool = &tbl_scope_cb->ext_pool[parms->dir][TF_EXT_POOL_0]; + pool = &tbl_scope_cb->ext_act_pool[parms->dir]; index = parms->idx; @@ -1390,18 +1373,6 @@ tf_free_tbl_entry_pool_internal(struct tf *tfp, return rc; } -/* API defined in tf_tbl.h */ -void -tf_init_tbl_pool(struct tf_session *session) -{ - enum tf_dir dir; - - for (dir = 0; dir < TF_DIR_MAX; dir++) { - session->ext_pool_2_scope[dir][TF_EXT_POOL_0] = - TF_TBL_SCOPE_INVALID; - } -} - /* API defined in tf_em.h */ struct tf_tbl_scope_cb * tbl_scope_cb_find(struct tf_session *session, @@ -1447,8 +1418,7 @@ tf_free_eem_tbl_scope_cb(struct tf *tfp, for (dir = 0; dir < TF_DIR_MAX; dir++) { /* Free associated external pools */ - tf_destroy_tbl_pool_external(session, - dir, + tf_destroy_tbl_pool_external(dir, tbl_scope_cb); tf_msg_em_op(tfp, dir, @@ -1551,12 +1521,10 @@ tf_alloc_eem_tbl_scope(struct tf *tfp, * Initially, this is a single fixed size pool for all external * actions related to a single table scope. */ - rc = tf_create_tbl_pool_external(session, - dir, - tbl_scope_cb, - index, - TF_EXT_POOL_ENTRY_CNT, - TF_EXT_POOL_ENTRY_SZ_BYTES); + rc = tf_create_tbl_pool_external(dir, + tbl_scope_cb, + em_tables[RECORD_TABLE].num_entries, + em_tables[RECORD_TABLE].entry_size); if (rc) { PMD_DRV_LOG(ERR, "%d TBL: Unable to allocate idx pools %s\n", @@ -1600,13 +1568,12 @@ tf_set_tbl_entry(struct tf *tfp, if (parms->type == TF_TBL_TYPE_EXT) { void *base_addr; - uint32_t offset = TF_ACT_REC_INDEX_2_OFFSET(parms->idx); + uint32_t offset = parms->idx; uint32_t tbl_scope_id; session = (struct tf_session *)(tfp->session->core_data); - tbl_scope_id = - session->ext_pool_2_scope[parms->dir][TF_EXT_POOL_0]; + tbl_scope_id = parms->tbl_scope_id; if (tbl_scope_id == TF_TBL_SCOPE_INVALID) { PMD_DRV_LOG(ERR, @@ -1618,7 +1585,6 @@ tf_set_tbl_entry(struct tf *tfp, /* Get the table scope control block associated with the * external pool */ - tbl_scope_cb = tbl_scope_cb_find(session, tbl_scope_id); if (tbl_scope_cb == NULL) diff --git a/drivers/net/bnxt/tf_core/tf_tbl.h b/drivers/net/bnxt/tf_core/tf_tbl.h index 5d3ea71f4..bdc6288ee 100644 --- a/drivers/net/bnxt/tf_core/tf_tbl.h +++ b/drivers/net/bnxt/tf_core/tf_tbl.h @@ -72,8 +72,8 @@ struct tf_tbl_scope_cb { int index; struct tf_em_ctx_mem_info em_ctx_info[TF_DIR_MAX]; struct tf_em_caps em_caps[TF_DIR_MAX]; - struct stack ext_pool[TF_DIR_MAX][TF_EXT_POOL_CNT_MAX]; - uint32_t *ext_pool_mem[TF_DIR_MAX][TF_EXT_POOL_CNT_MAX]; + struct stack ext_act_pool[TF_DIR_MAX]; + uint32_t *ext_act_pool_mem[TF_DIR_MAX]; }; /** Hardware Page sizes supported for EEM: 4K, 8K, 64K, 256K, 1M, 2M, 4M, 1G. From patchwork Sat Apr 25 14:01:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 69309 X-Patchwork-Delegate: ajit.khaparde@broadcom.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 80A9DA00C2; Sat, 25 Apr 2020 16:02:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F2ABA1C1E5; Sat, 25 Apr 2020 16:01:53 +0200 (CEST) Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 66C571C1BF for ; Sat, 25 Apr 2020 16:01:49 +0200 (CEST) Received: from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net [10.75.242.48]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 90C3B30C026; Sat, 25 Apr 2020 06:49:57 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 90C3B30C026 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1587822597; bh=vpSHJ1IAKtfXmM/Mtxc2fTe6WtBJoNGMsU0ZC4+jG3g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DtanBzeKEHB/4eBmyKRMCg7l2XFNp5szTOf9c72C25jXVzEMXUf5zi7udiOPT2oG8 CRKa+BRVlVPzMPaFn79mUZSDaxN5DMfkv1M5vcmVpdefYEMTSQFDiL5H9RbUzMPIp+ 5vok4Ntm4QO7UN731kvX98lB+/rZfXAOP7HESrBY= Received: from localhost.localdomain (unknown [10.230.185.215]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id 7FF39140069; Sat, 25 Apr 2020 07:01:47 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: Mike Baucom , Kishore Padmanabha , Venkat Duvvuru Date: Sat, 25 Apr 2020 07:01:40 -0700 Message-Id: <20200425140141.27947-4-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.21.1 (Apple Git-122.3) In-Reply-To: <20200425140141.27947-1-ajit.khaparde@broadcom.com> References: <1587786446-35230-1-git-send-email-venkatkumar.duvvuru@broadcom.com> <20200425140141.27947-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 3/4] net/bnxt: ulp changes to handle action/index tables X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Mike Baucom The ulp required changes to properly call the index table management routines and use the index for external memory indices. The ulp no longer has to account for stride as the tf_core returns the actual offset, not a 0 based index. Signed-off-by: Mike Baucom Reviewed-by: Kishore Padmanabha Reviewed-by: Venkat Duvvuru Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/tf_ulp/ulp_mapper.c | 30 ++++++++++++++++++---------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c index dc7b7ca5e..9ea6fdba0 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c +++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c @@ -401,7 +401,7 @@ ulp_mapper_tcam_entry_free(struct bnxt_ulp_context *ulp __rte_unused, } static inline int32_t -ulp_mapper_index_entry_free(struct bnxt_ulp_context *ulp __rte_unused, +ulp_mapper_index_entry_free(struct bnxt_ulp_context *ulp, struct tf *tfp, struct ulp_flow_db_res_params *res) { @@ -411,6 +411,12 @@ ulp_mapper_index_entry_free(struct bnxt_ulp_context *ulp __rte_unused, .idx = (uint32_t)res->resource_hndl }; + /* + * Just set the table scope, it will be ignored if not necessary + * by the tf_free_tbl_entry + */ + bnxt_ulp_cntxt_tbl_scope_id_get(ulp, &fparms.tbl_scope_id); + return tf_free_tbl_entry(tfp, &fparms); } @@ -805,6 +811,9 @@ ulp_mapper_action_alloc_and_set(struct bnxt_ulp_mapper_parms *parms, int32_t rc = 0; int32_t trc; uint64_t idx; + uint32_t tbl_scope_id; + + bnxt_ulp_cntxt_tbl_scope_id_get(parms->ulp_ctx, &tbl_scope_id); /* Set the allocation parameters for the table*/ alloc_parms.dir = atbls->direction; @@ -812,6 +821,7 @@ ulp_mapper_action_alloc_and_set(struct bnxt_ulp_mapper_parms *parms, alloc_parms.search_enable = atbls->srch_b4_alloc; alloc_parms.result = ulp_blob_data_get(blob, &alloc_parms.result_sz_in_bytes); + alloc_parms.tbl_scope_id = tbl_scope_id; if (!alloc_parms.result) { BNXT_TF_DBG(ERR, "blob is not populated\n"); return -EINVAL; @@ -826,14 +836,10 @@ ulp_mapper_action_alloc_and_set(struct bnxt_ulp_mapper_parms *parms, } /* Need to calculate the idx for the result record */ - /* - * TBD: Need to get the stride from tflib instead of having to - * understand the construction of the pointer - */ uint64_t tmpidx = alloc_parms.idx; if (atbls->table_type == TF_TBL_TYPE_EXT) - tmpidx = (alloc_parms.idx * TF_ACTION_RECORD_SZ) >> 4; + tmpidx = TF_ACT_REC_OFFSET_2_PTR(alloc_parms.idx); else tmpidx = alloc_parms.idx; @@ -863,10 +869,7 @@ ulp_mapper_action_alloc_and_set(struct bnxt_ulp_mapper_parms *parms, set_parm.data_sz_in_bytes = length / 8; if (set_parm.type == TF_TBL_TYPE_EXT) - bnxt_ulp_cntxt_tbl_scope_id_get(parms->ulp_ctx, - &set_parm.tbl_scope_id); - else - set_parm.tbl_scope_id = 0; + set_parm.tbl_scope_id = tbl_scope_id; /* set the table entry */ rc = tf_set_tbl_entry(parms->tfp, &set_parm); @@ -1396,9 +1399,11 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms, struct tf_alloc_tbl_entry_parms aparms = { 0 }; struct tf_set_tbl_entry_parms sparms = { 0 }; struct tf_free_tbl_entry_parms free_parms = { 0 }; - + uint32_t tbl_scope_id; struct tf *tfp = bnxt_ulp_cntxt_tfp_get(parms->ulp_ctx); + bnxt_ulp_cntxt_tbl_scope_id_get(parms->ulp_ctx, &tbl_scope_id); + if (!ulp_blob_init(&data, tbl->result_bit_size, parms->order)) { BNXT_TF_DBG(ERR, "Failed initial index table blob\n"); return -EINVAL; @@ -1427,6 +1432,7 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms, aparms.search_enable = tbl->srch_b4_alloc; aparms.result = ulp_blob_data_get(&data, &tmplen); aparms.result_sz_in_bytes = ULP_SZ_BITS2BYTES(tbl->result_bit_size); + aparms.tbl_scope_id = tbl_scope_id; /* All failures after the alloc succeeds require a free */ rc = tf_alloc_tbl_entry(tfp, &aparms); @@ -1454,6 +1460,7 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms, sparms.data_sz_in_bytes = ULP_SZ_BITS2BYTES(tbl->result_bit_size); sparms.idx = aparms.idx; + sparms.tbl_scope_id = tbl_scope_id; rc = tf_set_tbl_entry(tfp, &sparms); if (rc) { @@ -1494,6 +1501,7 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms, free_parms.dir = tbl->direction; free_parms.type = tbl->table_type; free_parms.idx = aparms.idx; + free_parms.tbl_scope_id = tbl_scope_id; trc = tf_free_tbl_entry(tfp, &free_parms); if (trc) From patchwork Sat Apr 25 14:01:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 69310 X-Patchwork-Delegate: ajit.khaparde@broadcom.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A4BE8A00C2; Sat, 25 Apr 2020 16:02:15 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A13A41C1F7; Sat, 25 Apr 2020 16:01:55 +0200 (CEST) Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 63ACC1C1B3 for ; Sat, 25 Apr 2020 16:01:49 +0200 (CEST) Received: from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net [10.75.242.48]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 848D330C025; Sat, 25 Apr 2020 06:49:57 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 848D330C025 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1587822597; bh=RQwzet1N9ah8NS6o/b8//pG+4V3odqTyVONd6xwwWNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uzw+FFFHDyijK9pZfX5Rp5bEgOs0yf3nHRfqiis83xpz36uobl5dXtV7DOiDQadXo 5gvDNXGi+sjQAK5B4nWPmrwdeHFlY8ZMTmdus2rnW64NfRSdkmsAjv30EBxQCp4bH4 NVdfyp8EtJFQ/guUTdgYZr9YNxY1u9t6Xx7XmAGs= Received: from localhost.localdomain (unknown [10.230.185.215]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id BD52514008B; Sat, 25 Apr 2020 07:01:47 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: Shahaji Bhosle , Randy Schacher , Venkat Duvvuru , Mike Baucom Date: Sat, 25 Apr 2020 07:01:41 -0700 Message-Id: <20200425140141.27947-5-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.21.1 (Apple Git-122.3) In-Reply-To: <20200425140141.27947-1-ajit.khaparde@broadcom.com> References: <1587786446-35230-1-git-send-email-venkatkumar.duvvuru@broadcom.com> <20200425140141.27947-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 4/4] net/bnxt: add truflow flush-timer to alloc table scope API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Shahaji Bhosle Updated the params list to include flush timer, this will allow users to set the HW flush timer value in 10th of second. Setting 0 will disable the pending cache flush feature. Signed-off-by: Shahaji Bhosle Signed-off-by: Randy Schacher Signed-off-by: Venkat Duvvuru Reviewed-by: Mike Baucom Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/tf_core/tf_core.h | 6 ++++++ drivers/net/bnxt/tf_core/tf_msg.c | 3 +++ drivers/net/bnxt/tf_core/tf_msg.h | 1 + drivers/net/bnxt/tf_core/tf_tbl.c | 1 + drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 6 ++++++ 5 files changed, 17 insertions(+) diff --git a/drivers/net/bnxt/tf_core/tf_core.h b/drivers/net/bnxt/tf_core/tf_core.h index 4b60973ee..1eedd80e7 100644 --- a/drivers/net/bnxt/tf_core/tf_core.h +++ b/drivers/net/bnxt/tf_core/tf_core.h @@ -560,6 +560,12 @@ struct tf_alloc_tbl_scope_parms { * [in] Brd4 only receive table access interface id */ uint32_t tx_tbl_if_id; + /** + * [in] Flush pending HW cached flows every 1/10th of value + * set in seconds, both idle and active flows are flushed + * from the HW cache. If set to 0, this feature will be disabled. + */ + uint8_t hw_flow_cache_flush_timer; /** * [out] table scope identifier */ diff --git a/drivers/net/bnxt/tf_core/tf_msg.c b/drivers/net/bnxt/tf_core/tf_msg.c index bdf8f155f..beecafdeb 100644 --- a/drivers/net/bnxt/tf_core/tf_msg.c +++ b/drivers/net/bnxt/tf_core/tf_msg.c @@ -978,6 +978,7 @@ int tf_msg_em_cfg(struct tf *tfp, uint16_t key1_ctx_id, uint16_t record_ctx_id, uint16_t efc_ctx_id, + uint8_t flush_interval, int dir) { int rc; @@ -993,6 +994,8 @@ int tf_msg_em_cfg(struct tf *tfp, req.flags = tfp_cpu_to_le_32(flags); req.num_entries = tfp_cpu_to_le_32(num_entries); + req.flush_interval = flush_interval; + req.key0_ctx_id = tfp_cpu_to_le_16(key0_ctx_id); req.key1_ctx_id = tfp_cpu_to_le_16(key1_ctx_id); req.record_ctx_id = tfp_cpu_to_le_16(record_ctx_id); diff --git a/drivers/net/bnxt/tf_core/tf_msg.h b/drivers/net/bnxt/tf_core/tf_msg.h index b8d8c1ede..030d1881e 100644 --- a/drivers/net/bnxt/tf_core/tf_msg.h +++ b/drivers/net/bnxt/tf_core/tf_msg.h @@ -152,6 +152,7 @@ int tf_msg_em_cfg(struct tf *tfp, uint16_t key1_ctx_id, uint16_t record_ctx_id, uint16_t efc_ctx_id, + uint8_t flush_interval, int dir); /** diff --git a/drivers/net/bnxt/tf_core/tf_tbl.c b/drivers/net/bnxt/tf_core/tf_tbl.c index 236affe25..93f387e86 100644 --- a/drivers/net/bnxt/tf_core/tf_tbl.c +++ b/drivers/net/bnxt/tf_core/tf_tbl.c @@ -1500,6 +1500,7 @@ tf_alloc_eem_tbl_scope(struct tf *tfp, em_tables[KEY1_TABLE].ctx_id, em_tables[RECORD_TABLE].ctx_id, em_tables[EFC_TABLE].ctx_id, + parms->hw_flow_cache_flush_timer, dir); if (rc) { PMD_DRV_LOG(ERR, diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c index f8047f0d6..a9cc92d34 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c @@ -121,6 +121,12 @@ bnxt_init_tbl_scope_parms(struct bnxt *bp, else dparms = bnxt_ulp_device_params_get(dev_id); + /* + * Set the flush timer for EEM entries. The value is in 100ms intervals, + * so 100 is 10s. + */ + params->hw_flow_cache_flush_timer = 100; + if (!dparms) { params->rx_max_key_sz_in_bits = BNXT_ULP_DFLT_RX_MAX_KEY; params->rx_max_action_entry_sz_in_bits =