From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 35F19A04DB; Sat, 17 Oct 2020 08:29:21 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 95ACBE2EE; Sat, 17 Oct 2020 08:28:22 +0200 (CEST) Received: from relay.smtp-ext.broadcom.com (unknown [192.19.221.30]) by dpdk.org (Postfix) with ESMTP id 5C052E26B for ; Sat, 17 Oct 2020 08:28:13 +0200 (CEST) Received: from S60.dhcp.broadcom.net (unknown [10.123.66.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by relay.smtp-ext.broadcom.com (Postfix) with ESMTPS id 284892433F; Fri, 16 Oct 2020 23:28:12 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 284892433F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1602916092; bh=VNB8tm+Cp/uaXsWnn0NLNpEucnGQzx3lQDlpiTY6KtE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SNnnoXRsmO3IsE+rZcXvfrHOfWlKnta4OXNJBpSfkzInL5tFy8xSCu3sIOESx9dax GD7mEigCm1KuyYbGT2UKxo1J1sQtKMWjLN8ghDBeHAXT1fHJpAlSTJIbYh28VxX4FV 1gOs4L/vS5DXjMI43vjK05zJeaTfyjdS77LNuujo= From: Venkat Duvvuru To: dev@dpdk.org Cc: Jay Ding Date: Sat, 17 Oct 2020 11:57:58 +0530 Message-Id: <1602916089-18576-4-git-send-email-venkatkumar.duvvuru@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1602916089-18576-1-git-send-email-venkatkumar.duvvuru@broadcom.com> References: <1602916089-18576-1-git-send-email-venkatkumar.duvvuru@broadcom.com> Subject: [dpdk-dev] [PATCH 03/14] net/bnxt: changes to support 2 table scopes 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: Jay Ding This reverts commit 1312374a4e3c1851ae5e0d52cb8788c5b5e76fe0. Signed-off-by: Jay Ding Reviewed-by: Randy Schacher --- drivers/net/bnxt/tf_core/tf_em_common.c | 85 +-------------------------------- drivers/net/bnxt/tf_core/tf_em_common.h | 27 +---------- drivers/net/bnxt/tf_core/tf_em_host.c | 23 +++++++-- 3 files changed, 21 insertions(+), 114 deletions(-) diff --git a/drivers/net/bnxt/tf_core/tf_em_common.c b/drivers/net/bnxt/tf_core/tf_em_common.c index 0d8b908..0f4b121 100644 --- a/drivers/net/bnxt/tf_core/tf_em_common.c +++ b/drivers/net/bnxt/tf_core/tf_em_common.c @@ -44,28 +44,6 @@ static enum tf_mem_type mem_type; /** Table scope array */ struct tf_tbl_scope_cb tbl_scopes[TF_NUM_TBL_SCOPE]; -/** Table scope reversal table - * - * Table scope are allocated from 15 to 0 within HCAPI RM. Because of the - * association between PFs and legacy table scopes, reverse table scope ids. - * 15 indicates 0, 14 indicates 1, etc... The application will only see the 0 - * based number. The firmware will only use the 0 based number. Only HCAPI RM - * and Truflow RM believe the number is 15. When HCAPI RM support allocation - * from low to high is supported, this adjust function can be removed. - */ -const uint32_t tbl_scope_reverse[TF_NUM_TBL_SCOPE] = { - 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; - -static uint32_t -tf_tbl_scope_adjust(uint32_t tbl_scope_id) -{ - if (tbl_scope_id < TF_NUM_TBL_SCOPE) - return tbl_scope_reverse[tbl_scope_id]; - else - return TF_TBL_SCOPE_INVALID; -}; - - /* API defined in tf_em.h */ struct tf_tbl_scope_cb * tbl_scope_cb_find(uint32_t tbl_scope_id) @@ -73,17 +51,11 @@ tbl_scope_cb_find(uint32_t tbl_scope_id) int i; struct tf_rm_is_allocated_parms parms = { 0 }; int allocated; - uint32_t rm_tbl_scope_id; - - rm_tbl_scope_id = tf_tbl_scope_adjust(tbl_scope_id); - - if (rm_tbl_scope_id == TF_TBL_SCOPE_INVALID) - return NULL; /* Check that id is valid */ parms.rm_db = eem_db[TF_DIR_RX]; parms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE; - parms.index = rm_tbl_scope_id; + parms.index = tbl_scope_id; parms.allocated = &allocated; i = tf_rm_is_allocated(&parms); @@ -99,61 +71,6 @@ tbl_scope_cb_find(uint32_t tbl_scope_id) return NULL; } -int tf_tbl_scope_alloc(uint32_t *tbl_scope_id) -{ - int rc; - struct tf_rm_allocate_parms parms = { 0 }; - uint32_t rm_tbl_scope_id; - uint32_t usr_tbl_scope_id = TF_TBL_SCOPE_INVALID; - - /* Get Table Scope control block from the session pool */ - parms.rm_db = eem_db[TF_DIR_RX]; - parms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE; - parms.index = &rm_tbl_scope_id; - - rc = tf_rm_allocate(&parms); - if (rc) { - TFP_DRV_LOG(ERR, - "Failed to allocate table scope rc:%s\n", - strerror(-rc)); - return rc; - } - - usr_tbl_scope_id = tf_tbl_scope_adjust(rm_tbl_scope_id); - - if (usr_tbl_scope_id == TF_TBL_SCOPE_INVALID) { - TFP_DRV_LOG(ERR, - "Invalid table scope allocated id:%d\n", - (int)rm_tbl_scope_id); - return -EINVAL; - } - *tbl_scope_id = usr_tbl_scope_id; - return 0; -}; - -int tf_tbl_scope_free(uint32_t tbl_scope_id) -{ - struct tf_rm_free_parms parms = { 0 }; - uint32_t rm_tbl_scope_id; - uint32_t rc; - - rm_tbl_scope_id = tf_tbl_scope_adjust(tbl_scope_id); - - if (rm_tbl_scope_id == TF_TBL_SCOPE_INVALID) { - TFP_DRV_LOG(ERR, - "Invalid table scope allocated id:%d\n", - (int)tbl_scope_id); - return -EINVAL; - } - - parms.rm_db = eem_db[TF_DIR_RX]; - parms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE; - parms.index = rm_tbl_scope_id; - - rc = tf_rm_free(&parms); - return rc; -}; - int tf_create_tbl_pool_external(enum tf_dir dir, struct tf_tbl_scope_cb *tbl_scope_cb, diff --git a/drivers/net/bnxt/tf_core/tf_em_common.h b/drivers/net/bnxt/tf_core/tf_em_common.h index f71a487..fa313c4 100644 --- a/drivers/net/bnxt/tf_core/tf_em_common.h +++ b/drivers/net/bnxt/tf_core/tf_em_common.h @@ -9,6 +9,7 @@ #include "tf_core.h" #include "tf_session.h" + /** * Function to search for table scope control block structure * with specified table scope ID. @@ -23,32 +24,6 @@ struct tf_tbl_scope_cb *tbl_scope_cb_find(uint32_t tbl_scope_id); /** - * Table Scope Allocate - * - * Allocate a table scope - * - * [in/out] pointer to tbl_scope_id - * - * Returns: - * 0 - success - * -EINVAL - error - */ -int tf_tbl_scope_alloc(uint32_t *tbl_scope_id); - -/** - * Table Scope Free - * - * Free a table scope - * - * [in] tbl_scope_id to free - * - * Returns: - * 0 - success - * -EINVAL - error - */ -int tf_tbl_scope_free(uint32_t tbl_scope_id); - -/** * Create and initialize a stack to use for action entries * * [in] dir diff --git a/drivers/net/bnxt/tf_core/tf_em_host.c b/drivers/net/bnxt/tf_core/tf_em_host.c index cfcb12f..b5db94f 100644 --- a/drivers/net/bnxt/tf_core/tf_em_host.c +++ b/drivers/net/bnxt/tf_core/tf_em_host.c @@ -374,8 +374,14 @@ tf_em_ext_alloc(struct tf *tfp, struct tf_alloc_tbl_scope_parms *parms) struct tf_tbl_scope_cb *tbl_scope_cb; struct hcapi_cfa_em_table *em_tables; struct tf_free_tbl_scope_parms free_parms; - - rc = tf_tbl_scope_alloc(&parms->tbl_scope_id); + struct tf_rm_allocate_parms aparms = { 0 }; + struct tf_rm_free_parms fparms = { 0 }; + + /* Get Table Scope control block from the session pool */ + aparms.rm_db = eem_db[TF_DIR_RX]; + aparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE; + aparms.index = (uint32_t *)&parms->tbl_scope_id; + rc = tf_rm_allocate(&aparms); if (rc) { TFP_DRV_LOG(ERR, "Failed to allocate table scope\n"); @@ -472,7 +478,11 @@ tf_em_ext_alloc(struct tf *tfp, struct tf_alloc_tbl_scope_parms *parms) return -EINVAL; cleanup: - tf_tbl_scope_free(parms->tbl_scope_id); + /* Free Table control block */ + fparms.rm_db = eem_db[TF_DIR_RX]; + fparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE; + fparms.index = parms->tbl_scope_id; + tf_rm_free(&fparms); return -EINVAL; } @@ -483,6 +493,7 @@ tf_em_ext_free(struct tf *tfp, int rc = 0; enum tf_dir dir; struct tf_tbl_scope_cb *tbl_scope_cb; + struct tf_rm_free_parms aparms = { 0 }; tbl_scope_cb = tbl_scope_cb_find(parms->tbl_scope_id); @@ -491,7 +502,11 @@ tf_em_ext_free(struct tf *tfp, return -EINVAL; } - rc = tf_tbl_scope_free(parms->tbl_scope_id); + /* Free Table control block */ + aparms.rm_db = eem_db[TF_DIR_RX]; + aparms.db_index = TF_EM_TBL_TYPE_TBL_SCOPE; + aparms.index = parms->tbl_scope_id; + rc = tf_rm_free(&aparms); if (rc) { TFP_DRV_LOG(ERR, "Failed to free table scope\n"); -- 2.7.4