From patchwork Fri Jun 12 13:29:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Somnath Kotur X-Patchwork-Id: 71417 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 1324DA00BE; Fri, 12 Jun 2020 15:45:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 975E51C137; Fri, 12 Jun 2020 15:34:42 +0200 (CEST) Received: from relay.smtp.broadcom.com (unknown [192.19.232.149]) by dpdk.org (Postfix) with ESMTP id 9C9841C0CA for ; Fri, 12 Jun 2020 15:34:38 +0200 (CEST) Received: from dhcp-10-123-153-55.dhcp.broadcom.net (dhcp-10-123-153-55.dhcp.broadcom.net [10.123.153.55]) by relay.smtp.broadcom.com (Postfix) with ESMTP id 733731BD7AB; Fri, 12 Jun 2020 06:34:37 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com 733731BD7AB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1591968878; bh=CMSG/2daTE67lgJthAtWSBp5vFKaJindotP/17GmT04=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DViq+Bt1VVDhKIn7+4uNDd/ou4XINsaH+ko408cPRI4Jjh+9RYO4d1szZcpB176yY vsCsDVPbI/fms3F/c8GQCzb+c0VZGyQucL3bXYFQj5P8l4mM9Sv4Ql7o7cz2usfcYV 5SkI6nOq1RscLF32Q2ZyWKRzBn/93yedo9AEygGg= From: Somnath Kotur To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Fri, 12 Jun 2020 18:59:09 +0530 Message-Id: <20200612132934.16488-26-somnath.kotur@broadcom.com> X-Mailer: git-send-email 2.10.1.613.g2cc2e70 In-Reply-To: <20200612132934.16488-1-somnath.kotur@broadcom.com> References: <20200612132934.16488-1-somnath.kotur@broadcom.com> Subject: [dpdk-dev] [PATCH 25/50] 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: Pete 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: Pete Spreadborough Reviewed-by: Randy Schacher Signed-off-by: Venkat Duvvuru --- 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 8727900..6410843 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 7042f44..c3c712f 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 d0d80da..e31a63b 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 45699a7..bf01df9 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 11899c6..f36c9dc 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 @@ -935,14 +938,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; @@ -960,14 +961,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; @@ -984,16 +983,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) { @@ -1002,8 +998,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; @@ -1095,8 +1090,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; } @@ -1108,13 +1103,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"); @@ -1123,8 +1114,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, @@ -1145,5 +1136,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 ee18a0c..6dd1154 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 ebee4db..a303fde 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 d5bb4ee..b67159a 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,