From patchwork Sun May 30 08:58:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venkat Duvvuru X-Patchwork-Id: 93568 X-Patchwork-Delegate: ajit.khaparde@broadcom.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 21C83A0524; Sun, 30 May 2021 11:03:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F3CD941188; Sun, 30 May 2021 11:01:01 +0200 (CEST) Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.11.229]) by mails.dpdk.org (Postfix) with ESMTP id 77C294117F for ; Sun, 30 May 2021 11:00:59 +0200 (CEST) Received: from S60.dhcp.broadcom.net (unknown [10.123.66.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by relay.smtp-ext.broadcom.com (Postfix) with ESMTPS id A46F97DAF; Sun, 30 May 2021 02:00:57 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com A46F97DAF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1622365259; bh=GJbcgc9IdUXP6WZmnvGVv0fECjfJVpfVvhKVV5Hw09s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RG7L/Y6JrORWpurWkSa3UeuyqId5S9gw2TaW1XyMCFKBO3gjMrxUOK5YUH/DBfgDo ShXlrb+osg80x8sCZ2LbGcCk7WS5EwUHp62TjFQcimxokhyiVNW5Rq/kndEKJEsa9q HZ2P5TqiLLw7vE03BuVGMeGOBwo4hKsEznkXCo3Y= From: Venkat Duvvuru To: dev@dpdk.org Cc: Farah Smith , Jay Ding , Randy Schacher , Venkat Duvvuru Date: Sun, 30 May 2021 14:28:50 +0530 Message-Id: <20210530085929.29695-20-venkatkumar.duvvuru@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210530085929.29695-1-venkatkumar.duvvuru@broadcom.com> References: <20210530085929.29695-1-venkatkumar.duvvuru@broadcom.com> Subject: [dpdk-dev] [PATCH 19/58] net/bnxt: cleanup session open/close messages X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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 Add profile_id to set_prof_tcam. Signed-off-by: Farah Smith Signed-off-by: Jay Ding Signed-off-by: Randy Schacher Signed-off-by: Venkat Duvvuru Reviewed-by: Randy Schacher Reviewed-by: Peter Spreadborough --- drivers/net/bnxt/tf_core/tf_device.c | 90 ++++++++++++----------- drivers/net/bnxt/tf_core/tf_em_internal.c | 13 +--- drivers/net/bnxt/tf_core/tf_identifier.c | 15 +--- drivers/net/bnxt/tf_core/tf_if_tbl.c | 18 +---- drivers/net/bnxt/tf_core/tf_session.c | 18 +++-- drivers/net/bnxt/tf_core/tf_tbl.c | 18 ++--- drivers/net/bnxt/tf_core/tf_tcam.c | 12 +-- 7 files changed, 77 insertions(+), 107 deletions(-) diff --git a/drivers/net/bnxt/tf_core/tf_device.c b/drivers/net/bnxt/tf_core/tf_device.c index 55cf55886a..498e668b16 100644 --- a/drivers/net/bnxt/tf_core/tf_device.c +++ b/drivers/net/bnxt/tf_core/tf_device.c @@ -216,20 +216,20 @@ tf_dev_bind_p4(struct tf *tfp, return -ENOMEM; } - if (!tf_session_is_shared_session(tfs)) { - /* - * IF_TBL - */ - if_tbl_cfg.num_elements = TF_IF_TBL_TYPE_MAX; - if_tbl_cfg.cfg = tf_if_tbl_p4; - if_tbl_cfg.shadow_copy = shadow_copy; - rc = tf_if_tbl_bind(tfp, &if_tbl_cfg); - if (rc) { - TFP_DRV_LOG(ERR, - "IF Table initialization failure\n"); - goto fail; - } + /* + * IF_TBL + */ + if_tbl_cfg.num_elements = TF_IF_TBL_TYPE_MAX; + if_tbl_cfg.cfg = tf_if_tbl_p4; + if_tbl_cfg.shadow_copy = shadow_copy; + rc = tf_if_tbl_bind(tfp, &if_tbl_cfg); + if (rc) { + TFP_DRV_LOG(ERR, + "IF Table initialization failure\n"); + goto fail; + } + if (!tf_session_is_shared_session(tfs)) { /* * GLOBAL_CFG */ @@ -271,6 +271,12 @@ tf_dev_unbind_p4(struct tf *tfp) { int rc = 0; bool fail = false; + struct tf_session *tfs; + + /* Retrieve the session information */ + rc = tf_session_get_session_internal(tfp, &tfs); + if (rc) + return rc; /* Unbind all the support modules. As this is only done on * close we only report errors as everything has to be cleaned @@ -318,18 +324,20 @@ tf_dev_unbind_p4(struct tf *tfp) fail = true; } - rc = tf_if_tbl_unbind(tfp); - if (rc) { - TFP_DRV_LOG(INFO, - "Device unbind failed, IF Table Type\n"); - fail = true; - } + if (!tf_session_is_shared_session(tfs)) { + rc = tf_if_tbl_unbind(tfp); + if (rc) { + TFP_DRV_LOG(INFO, + "Device unbind failed, IF Table Type\n"); + fail = true; + } - rc = tf_global_cfg_unbind(tfp); - if (rc) { - TFP_DRV_LOG(INFO, - "Device unbind failed, Global Cfg Type\n"); - fail = true; + rc = tf_global_cfg_unbind(tfp); + if (rc) { + TFP_DRV_LOG(INFO, + "Device unbind failed, Global Cfg Type\n"); + fail = true; + } } if (fail) @@ -472,17 +480,17 @@ tf_dev_bind_p58(struct tf *tfp, /* * IF_TBL */ - if (!tf_session_is_shared_session(tfs)) { - if_tbl_cfg.num_elements = TF_IF_TBL_TYPE_MAX; - if_tbl_cfg.cfg = tf_if_tbl_p58; - if_tbl_cfg.shadow_copy = shadow_copy; - rc = tf_if_tbl_bind(tfp, &if_tbl_cfg); - if (rc) { - TFP_DRV_LOG(ERR, - "IF Table initialization failure\n"); - goto fail; - } + if_tbl_cfg.num_elements = TF_IF_TBL_TYPE_MAX; + if_tbl_cfg.cfg = tf_if_tbl_p58; + if_tbl_cfg.shadow_copy = shadow_copy; + rc = tf_if_tbl_bind(tfp, &if_tbl_cfg); + if (rc) { + TFP_DRV_LOG(ERR, + "IF Table initialization failure\n"); + goto fail; + } + if (!tf_session_is_shared_session(tfs)) { /* * GLOBAL_CFG */ @@ -571,14 +579,14 @@ tf_dev_unbind_p58(struct tf *tfp) fail = true; } - if (!tf_session_is_shared_session(tfs)) { - rc = tf_if_tbl_unbind(tfp); - if (rc) { - TFP_DRV_LOG(ERR, - "Device unbind failed, IF Table Type\n"); - fail = true; - } + rc = tf_if_tbl_unbind(tfp); + if (rc) { + TFP_DRV_LOG(ERR, + "Device unbind failed, IF Table Type\n"); + fail = true; + } + if (!tf_session_is_shared_session(tfs)) { rc = tf_global_cfg_unbind(tfp); if (rc) { TFP_DRV_LOG(ERR, diff --git a/drivers/net/bnxt/tf_core/tf_em_internal.c b/drivers/net/bnxt/tf_core/tf_em_internal.c index 93de513989..28ffbd5876 100644 --- a/drivers/net/bnxt/tf_core/tf_em_internal.c +++ b/drivers/net/bnxt/tf_core/tf_em_internal.c @@ -412,17 +412,13 @@ tf_em_int_bind(struct tf *tfp, db_rc[i] = tf_rm_create_db_no_reservation(tfp, &db_cfg); else db_rc[i] = tf_rm_create_db(tfp, &db_cfg); - if (db_rc[i]) { - TFP_DRV_LOG(ERR, - "%s: EM Int DB creation failed\n", - tf_dir_2_str(i)); - - } } /* No db created */ - if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX]) + if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX]) { + TFP_DRV_LOG(ERR, "EM Int DB creation failed\n"); return db_rc[TF_DIR_RX]; + } if (!tf_session_is_shared_session(tfs)) { @@ -514,9 +510,6 @@ tf_em_int_unbind(struct tf *tfp) rc = tf_session_get_db(tfp, TF_MODULE_TYPE_EM, &em_db_ptr); if (rc) { - TFP_DRV_LOG(INFO, - "Em_db is not initialized, rc:%s\n", - strerror(-rc)); return 0; } em_db = (struct em_rm_db *)em_db_ptr; diff --git a/drivers/net/bnxt/tf_core/tf_identifier.c b/drivers/net/bnxt/tf_core/tf_identifier.c index 3575c3e1a0..9f27a41fcf 100644 --- a/drivers/net/bnxt/tf_core/tf_identifier.c +++ b/drivers/net/bnxt/tf_core/tf_identifier.c @@ -74,11 +74,6 @@ tf_ident_bind(struct tf *tfp, db_rc[i] = tf_rm_create_db_no_reservation(tfp, &db_cfg); else db_rc[i] = tf_rm_create_db(tfp, &db_cfg); - if (db_rc[i]) { - TFP_DRV_LOG(INFO, - "%s: No Identifier DB required\n", - tf_dir_2_str(i)); - } if (parms->shadow_copy) { shadow_cfg.alloc_cnt = @@ -99,8 +94,10 @@ tf_ident_bind(struct tf *tfp, } /* No db created */ - if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX]) + if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX]) { + TFP_DRV_LOG(ERR, "No Identifier DB created\n"); return db_rc[TF_DIR_RX]; + } TFP_DRV_LOG(INFO, "Identifier - initialized\n"); @@ -121,12 +118,8 @@ tf_ident_unbind(struct tf *tfp) TF_CHECK_PARMS1(tfp); rc = tf_session_get_db(tfp, TF_MODULE_TYPE_IDENTIFIER, &ident_db_ptr); - if (rc) { - TFP_DRV_LOG(INFO, - "Ident_db is not initialized, rc:%s\n", - strerror(-rc)); + if (rc) return 0; - } ident_db = (struct ident_rm_db *)ident_db_ptr; for (i = 0; i < TF_DIR_MAX; i++) { diff --git a/drivers/net/bnxt/tf_core/tf_if_tbl.c b/drivers/net/bnxt/tf_core/tf_if_tbl.c index f58fa79b63..762dac0473 100644 --- a/drivers/net/bnxt/tf_core/tf_if_tbl.c +++ b/drivers/net/bnxt/tf_core/tf_if_tbl.c @@ -16,24 +16,16 @@ struct tf; /** * IF Table DBs. + * TODO: Store this data in session db */ static void *if_tbl_db[TF_DIR_MAX]; -/** - * IF Table Shadow DBs - */ -/* static void *shadow_if_tbl_db[TF_DIR_MAX]; */ - /** * Init flag, set on bind and cleared on unbind + * TODO: Store this data in session db */ static uint8_t init; -/** - * Shadow init flag, set on bind and cleared on unbind - */ -/* static uint8_t shadow_init; */ - /** * Convert if_tbl_type to hwrm type. * @@ -70,12 +62,6 @@ tf_if_tbl_bind(struct tf *tfp __rte_unused, { TF_CHECK_PARMS2(tfp, parms); - if (init) { - TFP_DRV_LOG(ERR, - "IF TBL DB already initialized\n"); - return -EINVAL; - } - if_tbl_db[TF_DIR_RX] = parms->cfg; if_tbl_db[TF_DIR_TX] = parms->cfg; diff --git a/drivers/net/bnxt/tf_core/tf_session.c b/drivers/net/bnxt/tf_core/tf_session.c index 93876d8e5d..e6ab518121 100644 --- a/drivers/net/bnxt/tf_core/tf_session.c +++ b/drivers/net/bnxt/tf_core/tf_session.c @@ -425,9 +425,11 @@ tf_session_open_session(struct tf *tfp, } TFP_DRV_LOG(INFO, - "Session created, session_client_id:%d, session_id:%d\n", + "Session created, session_client_id:%d," + "session_id:0x%08x, fw_session_id:%d\n", parms->open_cfg->session_client_id.id, - parms->open_cfg->session_id.id); + parms->open_cfg->session_id.id, + parms->open_cfg->session_id.internal.fw_session_id); } else { scparms.ctrl_chan_name = parms->open_cfg->ctrl_chan_name; scparms.session_client_id = &parms->open_cfg->session_client_id; @@ -438,16 +440,16 @@ tf_session_open_session(struct tf *tfp, rc = tf_session_client_create(tfp, &scparms); if (rc) { TFP_DRV_LOG(ERR, - "Failed to create client on session %d, rc:%s\n", + "Failed to create client on session 0x%x, rc:%s\n", parms->open_cfg->session_id.id, strerror(-rc)); return rc; } TFP_DRV_LOG(INFO, - "Session Client:%d created on session:%d\n", - parms->open_cfg->session_client_id.id, - parms->open_cfg->session_id.id); + "Session Client:%d registered on session:0x%8x\n", + scparms.session_client_id->internal.fw_session_client_id, + tfp->session->session_id.id); } return 0; @@ -541,7 +543,7 @@ tf_session_close_session(struct tf *tfp, client->session_client_id.id); TFP_DRV_LOG(INFO, - "session_id:%d, ref_count:%d\n", + "session_id:0x%08x, ref_count:%d\n", tfs->session_id.id, tfs->ref_count); @@ -587,7 +589,7 @@ tf_session_close_session(struct tf *tfp, tfs->ref_count--; TFP_DRV_LOG(INFO, - "Closed session, session_id:%d, ref_count:%d\n", + "Closed session, session_id:0x%08x, ref_count:%d\n", tfs->session_id.id, tfs->ref_count); diff --git a/drivers/net/bnxt/tf_core/tf_tbl.c b/drivers/net/bnxt/tf_core/tf_tbl.c index 295204ac87..6842291adf 100644 --- a/drivers/net/bnxt/tf_core/tf_tbl.c +++ b/drivers/net/bnxt/tf_core/tf_tbl.c @@ -83,17 +83,15 @@ tf_tbl_bind(struct tf *tfp, db_rc[d] = tf_rm_create_db_no_reservation(tfp, &db_cfg); else db_rc[d] = tf_rm_create_db(tfp, &db_cfg); - if (db_rc[d]) { - TFP_DRV_LOG(ERR, - "%s: No Table DB creation required\n", - tf_dir_2_str(d)); - - } } /* No db created */ - if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX]) + if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX]) { + TFP_DRV_LOG(ERR, + "%s: No Table DB created\n", + tf_dir_2_str(d)); return db_rc[TF_DIR_RX]; + } TFP_DRV_LOG(INFO, "Table Type - initialized\n"); @@ -112,12 +110,8 @@ tf_tbl_unbind(struct tf *tfp) TF_CHECK_PARMS1(tfp); rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TABLE, &tbl_db_ptr); - if (rc) { - TFP_DRV_LOG(INFO, - "Tbl_db is not initialized, rc:%s\n", - strerror(-rc)); + if (rc) return 0; - } tbl_db = (struct tbl_rm_db *)tbl_db_ptr; for (i = 0; i < TF_DIR_MAX; i++) { diff --git a/drivers/net/bnxt/tf_core/tf_tcam.c b/drivers/net/bnxt/tf_core/tf_tcam.c index 5c018f7003..7878f8727a 100644 --- a/drivers/net/bnxt/tf_core/tf_tcam.c +++ b/drivers/net/bnxt/tf_core/tf_tcam.c @@ -113,16 +113,13 @@ tf_tcam_bind(struct tf *tfp, db_rc[d] = tf_rm_create_db_no_reservation(tfp, &db_cfg); else db_rc[d] = tf_rm_create_db(tfp, &db_cfg); - if (db_rc[d]) { - TFP_DRV_LOG(INFO, - "%s: no TCAM DB required\n", - tf_dir_2_str(d)); - } } /* No db created */ - if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX]) + if (db_rc[TF_DIR_RX] && db_rc[TF_DIR_TX]) { + TFP_DRV_LOG(ERR, "No TCAM DB created\n"); return db_rc[TF_DIR_RX]; + } /* check if reserved resource for WC is multiple of num_slices */ for (d = 0; d < TF_DIR_MAX; d++) { @@ -227,9 +224,6 @@ tf_tcam_unbind(struct tf *tfp) rc = tf_session_get_db(tfp, TF_MODULE_TYPE_TCAM, &tcam_db_ptr); if (rc) { - TFP_DRV_LOG(INFO, - "Tcam_db is not initialized, rc:%s\n", - strerror(-rc)); return 0; } tcam_db = (struct tcam_rm_db *)tcam_db_ptr;