From patchwork Wed Jul 1 06:51:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 72548 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 D6116A0350; Wed, 1 Jul 2020 08:58:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BF3981D37E; Wed, 1 Jul 2020 08:52: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 82C2D1C0D2 for ; Wed, 1 Jul 2020 08:52:26 +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 8502930C333; Tue, 30 Jun 2020 23:52:25 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 8502930C333 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1593586345; bh=QGOl8riC0o1ukboDNb9epnJEyv+pbfShx9by8TW1VOg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KOBBO9rVcsptPTtF1JJUKUJSNOjwUurv1r8rDf7Gz5L21814QK2Tfd7AX03FPF6sD 5Qg9PCLY54kPM/+Wg2w9fnB8J6AtWcWI9tCWbhb+oRjp8kGou59aTjhvRryk7h48oa 9IK/XTfqgCRrggfcY2WuUP/uoK3Pyue5ezoBbAcY= Received: from localhost.localdomain (unknown [10.230.185.215]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id F3ED914008B; Tue, 30 Jun 2020 23:52:24 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: Peter Spreadborough , Randy Schacher , Venkat Duvvuru Date: Tue, 30 Jun 2020 23:51:46 -0700 Message-Id: <20200701065212.41391-26-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.21.1 (Apple Git-122.3) In-Reply-To: <20200701065212.41391-1-ajit.khaparde@broadcom.com> References: <20200612132934.16488-1-somnath.kotur@broadcom.com> <20200701065212.41391-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 25/51] net/bnxt: remove table scope from session 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: Peter Spreadborough - Remove table scope data from session. Added to EEM. - Complete move to RM of table scope base and range. - Fix some err messaging strings. - Fix the tcam logging message. Signed-off-by: Peter Spreadborough Reviewed-by: Randy Schacher Signed-off-by: Venkat Duvvuru Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/tf_core/tf_core.c | 2 +- drivers/net/bnxt/tf_core/tf_em.h | 1 - drivers/net/bnxt/tf_core/tf_em_common.c | 16 +++++++---- drivers/net/bnxt/tf_core/tf_em_common.h | 5 +--- drivers/net/bnxt/tf_core/tf_em_host.c | 38 ++++++++++--------------- drivers/net/bnxt/tf_core/tf_em_system.c | 12 +++----- drivers/net/bnxt/tf_core/tf_session.h | 3 -- drivers/net/bnxt/tf_core/tf_tcam.c | 6 ++-- 8 files changed, 35 insertions(+), 48 deletions(-) diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c index 8727900c4..6410843f6 100644 --- a/drivers/net/bnxt/tf_core/tf_core.c +++ b/drivers/net/bnxt/tf_core/tf_core.c @@ -573,7 +573,7 @@ tf_free_tcam_entry(struct tf *tfp, rc = dev->ops->tf_dev_free_tcam(tfp, &fparms); if (rc) { TFP_DRV_LOG(ERR, - "%s: TCAM allocation failed, rc:%s\n", + "%s: TCAM free failed, rc:%s\n", tf_dir_2_str(parms->dir), strerror(-rc)); return rc; diff --git a/drivers/net/bnxt/tf_core/tf_em.h b/drivers/net/bnxt/tf_core/tf_em.h index 7042f44e9..c3c712fb9 100644 --- a/drivers/net/bnxt/tf_core/tf_em.h +++ b/drivers/net/bnxt/tf_core/tf_em.h @@ -9,7 +9,6 @@ #include "tf_core.h" #include "tf_session.h" -#define TF_HACK_TBL_SCOPE_BASE 68 #define SUPPORT_CFA_HW_P4 1 #define SUPPORT_CFA_HW_P58 0 #define SUPPORT_CFA_HW_P59 0 diff --git a/drivers/net/bnxt/tf_core/tf_em_common.c b/drivers/net/bnxt/tf_core/tf_em_common.c index d0d80daeb..e31a63b46 100644 --- a/drivers/net/bnxt/tf_core/tf_em_common.c +++ b/drivers/net/bnxt/tf_core/tf_em_common.c @@ -29,6 +29,8 @@ */ void *eem_db[TF_DIR_MAX]; +#define TF_EEM_DB_TBL_SCOPE 1 + /** * Init flag, set on bind and cleared on unbind */ @@ -39,10 +41,12 @@ static uint8_t init; */ static enum tf_mem_type mem_type; +/** Table scope array */ +struct tf_tbl_scope_cb tbl_scopes[TF_NUM_TBL_SCOPE]; + /* API defined in tf_em.h */ struct tf_tbl_scope_cb * -tbl_scope_cb_find(struct tf_session *session, - uint32_t tbl_scope_id) +tbl_scope_cb_find(uint32_t tbl_scope_id) { int i; struct tf_rm_is_allocated_parms parms; @@ -50,8 +54,8 @@ tbl_scope_cb_find(struct tf_session *session, /* Check that id is valid */ parms.rm_db = eem_db[TF_DIR_RX]; - parms.db_index = 1/**** TYPE TABLE-SCOPE??? ****/; - parms.index = tbl_scope_id + TF_HACK_TBL_SCOPE_BASE; + parms.db_index = TF_EEM_DB_TBL_SCOPE; + parms.index = tbl_scope_id; parms.allocated = &allocated; i = tf_rm_is_allocated(&parms); @@ -60,8 +64,8 @@ tbl_scope_cb_find(struct tf_session *session, return NULL; for (i = 0; i < TF_NUM_TBL_SCOPE; i++) { - if (session->tbl_scopes[i].tbl_scope_id == tbl_scope_id) - return &session->tbl_scopes[i]; + if (tbl_scopes[i].tbl_scope_id == tbl_scope_id) + return &tbl_scopes[i]; } return NULL; diff --git a/drivers/net/bnxt/tf_core/tf_em_common.h b/drivers/net/bnxt/tf_core/tf_em_common.h index 45699a7c3..bf01df9b8 100644 --- a/drivers/net/bnxt/tf_core/tf_em_common.h +++ b/drivers/net/bnxt/tf_core/tf_em_common.h @@ -14,8 +14,6 @@ * Function to search for table scope control block structure * with specified table scope ID. * - * [in] session - * Session to use for the search of the table scope control block * [in] tbl_scope_id * Table scope ID to search for * @@ -23,8 +21,7 @@ * Pointer to the found table scope control block struct or NULL if * table scope control block struct not found */ -struct tf_tbl_scope_cb *tbl_scope_cb_find(struct tf_session *session, - uint32_t tbl_scope_id); +struct tf_tbl_scope_cb *tbl_scope_cb_find(uint32_t tbl_scope_id); /** * Create and initialize a stack to use for action entries diff --git a/drivers/net/bnxt/tf_core/tf_em_host.c b/drivers/net/bnxt/tf_core/tf_em_host.c index 8be39afdd..543edb54a 100644 --- a/drivers/net/bnxt/tf_core/tf_em_host.c +++ b/drivers/net/bnxt/tf_core/tf_em_host.c @@ -48,6 +48,9 @@ * EM DBs. */ extern void *eem_db[TF_DIR_MAX]; +#define TF_EEM_DB_TBL_SCOPE 1 + +extern struct tf_tbl_scope_cb tbl_scopes[TF_NUM_TBL_SCOPE]; /** * Function to free a page table @@ -934,14 +937,12 @@ tf_delete_eem_entry(struct tf_tbl_scope_cb *tbl_scope_cb, * -EINVAL - Error */ int -tf_em_insert_ext_entry(struct tf *tfp, +tf_em_insert_ext_entry(struct tf *tfp __rte_unused, struct tf_insert_em_entry_parms *parms) { struct tf_tbl_scope_cb *tbl_scope_cb; - tbl_scope_cb = - tbl_scope_cb_find((struct tf_session *)(tfp->session->core_data), - parms->tbl_scope_id); + tbl_scope_cb = tbl_scope_cb_find(parms->tbl_scope_id); if (tbl_scope_cb == NULL) { TFP_DRV_LOG(ERR, "Invalid tbl_scope_cb\n"); return -EINVAL; @@ -957,14 +958,12 @@ tf_em_insert_ext_entry(struct tf *tfp, * -EINVAL - Error */ int -tf_em_delete_ext_entry(struct tf *tfp, +tf_em_delete_ext_entry(struct tf *tfp __rte_unused, struct tf_delete_em_entry_parms *parms) { struct tf_tbl_scope_cb *tbl_scope_cb; - tbl_scope_cb = - tbl_scope_cb_find((struct tf_session *)(tfp->session->core_data), - parms->tbl_scope_id); + tbl_scope_cb = tbl_scope_cb_find(parms->tbl_scope_id); if (tbl_scope_cb == NULL) { TFP_DRV_LOG(ERR, "Invalid tbl_scope_cb\n"); return -EINVAL; @@ -981,16 +980,13 @@ tf_em_ext_host_alloc(struct tf *tfp, enum tf_dir dir; struct tf_tbl_scope_cb *tbl_scope_cb; struct hcapi_cfa_em_table *em_tables; - struct tf_session *session; struct tf_free_tbl_scope_parms free_parms; struct tf_rm_allocate_parms aparms = { 0 }; struct tf_rm_free_parms fparms = { 0 }; - session = (struct tf_session *)tfp->session->core_data; - /* Get Table Scope control block from the session pool */ aparms.rm_db = eem_db[TF_DIR_RX]; - aparms.db_index = 1/**** TYPE TABLE-SCOPE??? ****/; + aparms.db_index = TF_EEM_DB_TBL_SCOPE; aparms.index = (uint32_t *)&parms->tbl_scope_id; rc = tf_rm_allocate(&aparms); if (rc) { @@ -999,8 +995,7 @@ tf_em_ext_host_alloc(struct tf *tfp, return rc; } - parms->tbl_scope_id -= TF_HACK_TBL_SCOPE_BASE; - tbl_scope_cb = &session->tbl_scopes[parms->tbl_scope_id]; + tbl_scope_cb = &tbl_scopes[parms->tbl_scope_id]; tbl_scope_cb->index = parms->tbl_scope_id; tbl_scope_cb->tbl_scope_id = parms->tbl_scope_id; @@ -1092,8 +1087,8 @@ tf_em_ext_host_alloc(struct tf *tfp, cleanup: /* Free Table control block */ fparms.rm_db = eem_db[TF_DIR_RX]; - fparms.db_index = 1/**** TYPE TABLE-SCOPE??? ****/; - fparms.index = parms->tbl_scope_id + TF_HACK_TBL_SCOPE_BASE; + fparms.db_index = TF_EEM_DB_TBL_SCOPE; + fparms.index = parms->tbl_scope_id; tf_rm_free(&fparms); return -EINVAL; } @@ -1105,13 +1100,9 @@ tf_em_ext_host_free(struct tf *tfp, int rc = 0; enum tf_dir dir; struct tf_tbl_scope_cb *tbl_scope_cb; - struct tf_session *session; struct tf_rm_free_parms aparms = { 0 }; - session = (struct tf_session *)(tfp->session->core_data); - - tbl_scope_cb = tbl_scope_cb_find(session, - parms->tbl_scope_id); + tbl_scope_cb = tbl_scope_cb_find(parms->tbl_scope_id); if (tbl_scope_cb == NULL) { TFP_DRV_LOG(ERR, "Table scope error\n"); @@ -1120,8 +1111,8 @@ tf_em_ext_host_free(struct tf *tfp, /* Free Table control block */ aparms.rm_db = eem_db[TF_DIR_RX]; - aparms.db_index = 1/**** TYPE TABLE-SCOPE??? ****/; - aparms.index = parms->tbl_scope_id + TF_HACK_TBL_SCOPE_BASE; + aparms.db_index = TF_EEM_DB_TBL_SCOPE; + aparms.index = parms->tbl_scope_id; rc = tf_rm_free(&aparms); if (rc) { TFP_DRV_LOG(ERR, @@ -1142,5 +1133,6 @@ tf_em_ext_host_free(struct tf *tfp, tf_em_ctx_unreg(tfp, tbl_scope_cb, dir); } + tbl_scopes[parms->tbl_scope_id].tbl_scope_id = -1; return rc; } diff --git a/drivers/net/bnxt/tf_core/tf_em_system.c b/drivers/net/bnxt/tf_core/tf_em_system.c index ee18a0c70..6dd115470 100644 --- a/drivers/net/bnxt/tf_core/tf_em_system.c +++ b/drivers/net/bnxt/tf_core/tf_em_system.c @@ -63,14 +63,12 @@ tf_delete_eem_entry(struct tf_tbl_scope_cb *tbl_scope_cb __rte_unused, * -EINVAL - Error */ int -tf_em_insert_ext_sys_entry(struct tf *tfp, +tf_em_insert_ext_sys_entry(struct tf *tfp __rte_unused, struct tf_insert_em_entry_parms *parms) { struct tf_tbl_scope_cb *tbl_scope_cb; - tbl_scope_cb = tbl_scope_cb_find - ((struct tf_session *)(tfp->session->core_data), - parms->tbl_scope_id); + tbl_scope_cb = tbl_scope_cb_find(parms->tbl_scope_id); if (tbl_scope_cb == NULL) { TFP_DRV_LOG(ERR, "Invalid tbl_scope_cb\n"); return -EINVAL; @@ -87,14 +85,12 @@ tf_em_insert_ext_sys_entry(struct tf *tfp, * -EINVAL - Error */ int -tf_em_delete_ext_sys_entry(struct tf *tfp, +tf_em_delete_ext_sys_entry(struct tf *tfp __rte_unused, struct tf_delete_em_entry_parms *parms) { struct tf_tbl_scope_cb *tbl_scope_cb; - tbl_scope_cb = tbl_scope_cb_find - ((struct tf_session *)(tfp->session->core_data), - parms->tbl_scope_id); + tbl_scope_cb = tbl_scope_cb_find(parms->tbl_scope_id); if (tbl_scope_cb == NULL) { TFP_DRV_LOG(ERR, "Invalid tbl_scope_cb\n"); return -EINVAL; diff --git a/drivers/net/bnxt/tf_core/tf_session.h b/drivers/net/bnxt/tf_core/tf_session.h index ebee4db8c..a303fde51 100644 --- a/drivers/net/bnxt/tf_core/tf_session.h +++ b/drivers/net/bnxt/tf_core/tf_session.h @@ -100,9 +100,6 @@ struct tf_session { /** Device handle */ struct tf_dev_info dev; - - /** Table scope array */ - struct tf_tbl_scope_cb tbl_scopes[TF_NUM_TBL_SCOPE]; }; /** diff --git a/drivers/net/bnxt/tf_core/tf_tcam.c b/drivers/net/bnxt/tf_core/tf_tcam.c index d5bb4eec1..b67159a54 100644 --- a/drivers/net/bnxt/tf_core/tf_tcam.c +++ b/drivers/net/bnxt/tf_core/tf_tcam.c @@ -287,7 +287,8 @@ tf_tcam_free(struct tf *tfp, rc = tf_msg_tcam_entry_free(tfp, parms); if (rc) { /* Log error */ - TFP_DRV_LOG(ERR, "%s: %s: Entry %d free failed with err %s", + TFP_DRV_LOG(ERR, + "%s: %s: Entry %d free failed, rc:%s\n", tf_dir_2_str(parms->dir), tf_tcam_tbl_2_str(parms->type), parms->idx, @@ -382,7 +383,8 @@ tf_tcam_set(struct tf *tfp __rte_unused, rc = tf_msg_tcam_entry_set(tfp, parms); if (rc) { /* Log error */ - TFP_DRV_LOG(ERR, "%s: %s: Entry %d free failed with err %s", + TFP_DRV_LOG(ERR, + "%s: %s: Entry %d set failed, rc:%s", tf_dir_2_str(parms->dir), tf_tcam_tbl_2_str(parms->type), parms->idx,