From patchwork Mon Nov 28 09:54:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 120200 X-Patchwork-Delegate: jerinj@marvell.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 16A09A00C3; Mon, 28 Nov 2022 10:55:14 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5752842D18; Mon, 28 Nov 2022 10:55:03 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id A373642C76 for ; Mon, 28 Nov 2022 10:55:01 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AS5j8Hx025921 for ; Mon, 28 Nov 2022 01:55:00 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=sfHrjDBdw/aTvblupWLKBHiYDI57RnrNExrFEAtp/A0=; b=AuHi7p3RsUm2QHALg5KO5OuQKIWz0pnm9fxoBtnZiaDoMXM+uO87CKoSUOUYtSONjIUh 2rJ1j5x9205SY39plVC+6cmOMHA+K1bokrKahLqhC5Htbis8oz1U3NKR6Wyp2eBF6FSW f6vUWc4M/TRNrRUm9L9dGj8kpUi1HmC9IUYkCb1BH6TNXslP1Od2sL4dydiabSELxu50 yswv1+NiHXSGduykvZwe9G1QUbmLEvhdkRFgeoy6y4Hc2NTm8doxMKqCn43/KoReQiSh 2QjC9x6DMIqeCRYySH12b+yCpm0L7owBxaV5cUdLvIgvsh2GG42wkFnGgbaBsWx5p6q1 yQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3m4q3srseh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 28 Nov 2022 01:55:00 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 28 Nov 2022 01:54:59 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Mon, 28 Nov 2022 01:54:59 -0800 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 230B05C68E1; Mon, 28 Nov 2022 01:54:56 -0800 (PST) From: Nithin Dabilpuram To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Subject: [PATCH 04/11] common/cnxk: split NIX TM hierarchy enable API Date: Mon, 28 Nov 2022 15:24:35 +0530 Message-ID: <20221128095442.3185112-4-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221128095442.3185112-1-ndabilpuram@marvell.com> References: <20221128095442.3185112-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: gHc0vccDeI-4XQSUg3D9K1SHxxQdSipP X-Proofpoint-GUID: gHc0vccDeI-4XQSUg3D9K1SHxxQdSipP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-28_07,2022-11-25_01,2022-06-22_01 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 From: Satha Rao roc_nix_tm_hierarchy_enable() API will do two things internally, 1) Creation of all TM nodes, allocate HW resources and connect them as requested. 2) Enable transmit by XON SMQ and start SQs In test cases where both steps called independently. In order to support this, patch split the functionality into two APIs. Signed-off-by: Satha Rao --- drivers/common/cnxk/roc_nix.h | 2 + drivers/common/cnxk/roc_nix_tm_ops.c | 116 +++++++++++++++------------ drivers/common/cnxk/version.map | 1 + 3 files changed, 69 insertions(+), 50 deletions(-) diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h index dfc87e8758..47ee078c2e 100644 --- a/drivers/common/cnxk/roc_nix.h +++ b/drivers/common/cnxk/roc_nix.h @@ -672,6 +672,8 @@ int __roc_api roc_nix_tm_hierarchy_disable(struct roc_nix *roc_nix); int __roc_api roc_nix_tm_hierarchy_enable(struct roc_nix *roc_nix, enum roc_nix_tm_tree tree, bool xmit_enable); +int __roc_api roc_nix_tm_hierarchy_xmit_enable(struct roc_nix *roc_nix, enum roc_nix_tm_tree tree); + /* * TM utilities API. diff --git a/drivers/common/cnxk/roc_nix_tm_ops.c b/drivers/common/cnxk/roc_nix_tm_ops.c index 4bf7b1e104..5e8637ebdd 100644 --- a/drivers/common/cnxk/roc_nix_tm_ops.c +++ b/drivers/common/cnxk/roc_nix_tm_ops.c @@ -549,6 +549,67 @@ roc_nix_tm_hierarchy_disable(struct roc_nix *roc_nix) return rc; } +int +roc_nix_tm_hierarchy_xmit_enable(struct roc_nix *roc_nix, enum roc_nix_tm_tree tree) +{ + struct nix *nix = roc_nix_to_nix_priv(roc_nix); + struct nix_tm_node_list *list; + struct nix_tm_node *node; + struct roc_nix_sq *sq; + uint16_t sq_id; + int rc; + + if (tree >= ROC_NIX_TM_TREE_MAX) + return NIX_ERR_PARAM; + + list = nix_tm_node_list(nix, tree); + + /* Update SQ Sched Data while SQ is idle */ + TAILQ_FOREACH(node, list, node) { + if (!nix_tm_is_leaf(nix, node->lvl)) + continue; + + rc = nix_tm_sq_sched_conf(nix, node, false); + if (rc) { + plt_err("SQ %u sched update failed, rc=%d", node->id, + rc); + return rc; + } + } + + /* Finally XON all SMQ's */ + TAILQ_FOREACH(node, list, node) { + if (node->hw_lvl != NIX_TXSCH_LVL_SMQ) + continue; + + rc = nix_tm_smq_xoff(nix, node, false); + if (rc) { + plt_err("Failed to enable smq %u, rc=%d", node->hw_id, + rc); + return rc; + } + } + + /* Enable xmit as all the topology is ready */ + TAILQ_FOREACH(node, list, node) { + if (!nix_tm_is_leaf(nix, node->lvl)) + continue; + + sq_id = node->id; + sq = nix->sqs[sq_id]; + + rc = roc_nix_tm_sq_aura_fc(sq, true); + if (rc) { + plt_err("TM sw xon failed on SQ %u, rc=%d", node->id, + rc); + return rc; + } + node->flags |= NIX_TM_NODE_ENABLED; + } + + return 0; +} + int roc_nix_tm_hierarchy_enable(struct roc_nix *roc_nix, enum roc_nix_tm_tree tree, bool xmit_enable) @@ -556,9 +617,7 @@ roc_nix_tm_hierarchy_enable(struct roc_nix *roc_nix, enum roc_nix_tm_tree tree, struct nix *nix = roc_nix_to_nix_priv(roc_nix); struct nix_tm_node_list *list; struct nix_tm_node *node; - struct roc_nix_sq *sq; uint32_t tree_mask; - uint16_t sq_id; int rc; if (tree >= ROC_NIX_TM_TREE_MAX) @@ -613,55 +672,12 @@ roc_nix_tm_hierarchy_enable(struct roc_nix *roc_nix, enum roc_nix_tm_tree tree, node->flags |= NIX_TM_NODE_ENABLED; } - if (!xmit_enable) - goto skip_sq_update; + if (xmit_enable) + rc = roc_nix_tm_hierarchy_xmit_enable(roc_nix, tree); - /* Update SQ Sched Data while SQ is idle */ - TAILQ_FOREACH(node, list, node) { - if (!nix_tm_is_leaf(nix, node->lvl)) - continue; - - rc = nix_tm_sq_sched_conf(nix, node, false); - if (rc) { - plt_err("SQ %u sched update failed, rc=%d", node->id, - rc); - return rc; - } - } - - /* Finally XON all SMQ's */ - TAILQ_FOREACH(node, list, node) { - if (node->hw_lvl != NIX_TXSCH_LVL_SMQ) - continue; - - rc = nix_tm_smq_xoff(nix, node, false); - if (rc) { - plt_err("Failed to enable smq %u, rc=%d", node->hw_id, - rc); - return rc; - } - } - - /* Enable xmit as all the topology is ready */ - TAILQ_FOREACH(node, list, node) { - if (!nix_tm_is_leaf(nix, node->lvl)) - continue; - - sq_id = node->id; - sq = nix->sqs[sq_id]; - - rc = roc_nix_tm_sq_aura_fc(sq, true); - if (rc) { - plt_err("TM sw xon failed on SQ %u, rc=%d", node->id, - rc); - return rc; - } - node->flags |= NIX_TM_NODE_ENABLED; - } - -skip_sq_update: - nix->tm_flags |= NIX_TM_HIERARCHY_ENA; - return 0; + if (!rc) + nix->tm_flags |= NIX_TM_HIERARCHY_ENA; + return rc; } int diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index 70503c0470..63fe9deb72 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -270,6 +270,7 @@ INTERNAL { roc_nix_tm_tree_type_get; roc_nix_tm_hierarchy_disable; roc_nix_tm_hierarchy_enable; + roc_nix_tm_hierarchy_xmit_enable; roc_nix_tm_init; roc_nix_tm_is_user_hierarchy_enabled; roc_nix_tm_leaf_cnt;