From patchwork Sun Jun 13 00:06:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 94114 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 5E015A0C41; Sun, 13 Jun 2021 02:10:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1EF5A411B7; Sun, 13 Jun 2021 02:07:30 +0200 (CEST) Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by mails.dpdk.org (Postfix) with ESMTP id EAB9E410FF for ; Sun, 13 Jun 2021 02:07:24 +0200 (CEST) Received: by mail-pl1-f178.google.com with SMTP id u18so4061274plc.0 for ; Sat, 12 Jun 2021 17:07:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version; bh=Cq9O0uBpnsqYYFz/lkRN9xslA2MSs+zWQwARbdLTVT8=; b=VOGFe/049e7DRAoa6wRywnqWiLKFi+3TUouuloGxkHqjgi/P6VpRQMMSWqAV4aWU4N Y03PoaZZzqwyC0uKiphyh/EygaTXQRpf8yVNsVqaVvcIlWEZ/ZnYJ/qYAjhuIh71jw7l Mmm2s71EFVJ4N5EsO4CHgC9wd+7OWe2mHHJdw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version; bh=Cq9O0uBpnsqYYFz/lkRN9xslA2MSs+zWQwARbdLTVT8=; b=EGB8k+dkkZ2DqTItJ+Kj+KR8B8InSSDLA+lhtGaulr9Op33q81vI7GHx+kMXosex39 MqdzSYjsGZ7b95iRC7G068x5jcrEQd6vsE1xglRJtJZA6jqGDAyf/SrHL3nMMIIyX2yg blj6ItGI/3QSk64wwMv2n7fw7QepiQFICTf3YI+FNwO8cWYTtryt/0Fq1H6dYxavDj1A +wKdbrweCDIFvRJjmky8/h8aY8f/FKwAS5Rg+UAuTsrFlJsvHT3iK7m1N/4HT7xh9AnZ ChLVWsghUwy5pUXkW15dSdo4Bp7u4fQqyMsfRW733TsU4VwoPtFmpITJBUw7DkvYz2cx ia+Q== X-Gm-Message-State: AOAM530iamhJWMvPbW3hMpsyQY8hI45+NBPhkG5o81RNnmq1lsDjc/+0 Kpe4Scgfg/jnhdQ+s3be/HPctSFm46RvYz00fVNmNc99KjVW+uEt9hi8+ZtIaoMvHgM2lzlYB2o ToM8aSXjWC5cddniPq/PbeNDtvxPz1utRCPGFXfVWOxCmwPHkAIj1lV313zKY4WE= X-Google-Smtp-Source: ABdhPJz9EMhT9H+2jJaDyN8goaZREKtY13lFLsDuIzfXgvvrDbPfmzHjINqFLfi1mLjBaAACPtN/vg== X-Received: by 2002:a17:902:b609:b029:118:8a66:6963 with SMTP id b9-20020a170902b609b02901188a666963mr8643718pls.65.1623542843530; Sat, 12 Jun 2021 17:07:23 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id gg22sm12774609pjb.17.2021.06.12.17.07.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Jun 2021 17:07:23 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: Farah Smith , Jay Ding , Venkat Duvvuru , Randy Schacher , Peter Spreadborough Date: Sat, 12 Jun 2021 17:06:13 -0700 Message-Id: <20210613000652.28191-20-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.21.1 (Apple Git-122.3) In-Reply-To: <20210613000652.28191-1-ajit.khaparde@broadcom.com> References: <20210530085929.29695-1-venkatkumar.duvvuru@broadcom.com> <20210613000652.28191-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [dpdk-dev] [PATCH v2 19/58] net/bnxt: cleanup logs in session handling paths 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 Cleanup some of the log messages in the session open and close paths. Signed-off-by: Farah Smith Signed-off-by: Jay Ding Signed-off-by: Venkat Duvvuru Reviewed-by: Randy Schacher Reviewed-by: Peter Spreadborough Reviewed-by: Ajit Khaparde --- 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;