From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0C059A0C45; Sat, 18 Sep 2021 16:32:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 873BE410F4; Sat, 18 Sep 2021 16:32:23 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 3D00B410E0 for ; Sat, 18 Sep 2021 16:32:20 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18IEBL4u016135; Sat, 18 Sep 2021 07:32:17 -0700 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-type; s=pfpt0220; bh=gw4bdnuY3gukOr9nMMJ7li/3EmSu9TABffuFC/6n8rQ=; b=AkM29xO2z0lzbW8izHHKziWpge1gKJOGg+SwPLKj3UtsXLBYywBD+Q88sCaX7/ccoSlf Fwq3RsdaCFi7gJIK46P0LhL8Os+kdfoDU5bYfqDNEP6PFN7t8oyoKvSASCIVcDpdtSVa jaYhE6oqemKrg5rqmuRiEqYKjMG5EV6ukCtuSP2/1fRLdMHa2mOsNBwVakNcVKgiPpnf wTZcwuamH/9ppowxISV9ylG5tAjn7eqcUzxYPr/MT/WWvAN3HFIG2klmT4QpObS1Q3ph hPHWmNYmKE+DOp+58giIhlp/F82YOwIrP7c/3dZSLzu9ckC9Lv+JzK/9XcaW0LPWdrTy Qw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com with ESMTP id 3b5fmm08ys-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sat, 18 Sep 2021 07:32:17 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sat, 18 Sep 2021 07:32:15 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Sat, 18 Sep 2021 07:32:15 -0700 Received: from cavium.marvell.com (unknown [10.28.34.244]) by maili.marvell.com (Postfix) with ESMTP id 0B3CE3F705D; Sat, 18 Sep 2021 07:32:13 -0700 (PDT) From: To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Ray Kinsella CC: Date: Sat, 18 Sep 2021 10:31:52 -0400 Message-ID: <1631975519-30924-3-git-send-email-skoteshwar@marvell.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1631975519-30924-1-git-send-email-skoteshwar@marvell.com> References: <1630516236-10526-1-git-send-email-skoteshwar@marvell.com> <1631975519-30924-1-git-send-email-skoteshwar@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-ORIG-GUID: 6cGjVIC-Hyb8OUKi-13FPVKnYrh5jdmx X-Proofpoint-GUID: 6cGjVIC-Hyb8OUKi-13FPVKnYrh5jdmx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-09-18_05,2021-09-17_02,2020-04-07_01 Subject: [dpdk-dev] [PATCH v2 2/8] common/cnxk: flush smq 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: Satha Rao Added new API to flush all SMQs related nix interface Signed-off-by: Satha Rao --- drivers/common/cnxk/hw/nix.h | 6 +++++ drivers/common/cnxk/roc_nix.h | 1 + drivers/common/cnxk/roc_nix_tm_ops.c | 50 ++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/version.map | 1 + 4 files changed, 58 insertions(+) diff --git a/drivers/common/cnxk/hw/nix.h b/drivers/common/cnxk/hw/nix.h index a0ffd25..bc908c2 100644 --- a/drivers/common/cnxk/hw/nix.h +++ b/drivers/common/cnxk/hw/nix.h @@ -2189,4 +2189,10 @@ struct nix_lso_format { #define NIX_LSO_FORMAT_IDX_TSOV4 0 #define NIX_LSO_FORMAT_IDX_TSOV6 1 +/* [CN10K, .) */ +#define NIX_SENDSTATALG_MASK 0x7 +#define NIX_SENDSTATALG_SEL_MASK 0x8 +#define NIX_SENDSTAT_IOFFSET_MASK 0xFFF +#define NIX_SENDSTAT_OOFFSET_MASK 0xFFF + #endif /* __NIX_HW_H__ */ diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h index b0e6fab..ac7bd7e 100644 --- a/drivers/common/cnxk/roc_nix.h +++ b/drivers/common/cnxk/roc_nix.h @@ -468,6 +468,7 @@ int __roc_api roc_nix_tm_rsrc_count(struct roc_nix *roc_nix, int __roc_api roc_nix_tm_node_name_get(struct roc_nix *roc_nix, uint32_t node_id, char *buf, size_t buflen); +int __roc_api roc_nix_smq_flush(struct roc_nix *roc_nix); /* MAC */ int __roc_api roc_nix_mac_rxtx_start_stop(struct roc_nix *roc_nix, bool start); diff --git a/drivers/common/cnxk/roc_nix_tm_ops.c b/drivers/common/cnxk/roc_nix_tm_ops.c index ed244d4..d9741f5 100644 --- a/drivers/common/cnxk/roc_nix_tm_ops.c +++ b/drivers/common/cnxk/roc_nix_tm_ops.c @@ -311,6 +311,56 @@ } int +roc_nix_smq_flush(struct roc_nix *roc_nix) +{ + struct nix *nix = roc_nix_to_nix_priv(roc_nix); + struct nix_tm_node_list *list; + enum roc_nix_tm_tree tree; + struct nix_tm_node *node; + int rc = 0; + + if (!(nix->tm_flags & NIX_TM_HIERARCHY_ENA)) + return 0; + + tree = nix->tm_tree; + list = nix_tm_node_list(nix, tree); + + /* XOFF & Flush all SMQ's. HRM mandates + * all SQ's empty before SMQ flush is issued. + */ + TAILQ_FOREACH(node, list, node) { + if (node->hw_lvl != NIX_TXSCH_LVL_SMQ) + continue; + if (!(node->flags & NIX_TM_NODE_HWRES)) + continue; + + rc = nix_tm_smq_xoff(nix, node, true); + if (rc) { + plt_err("Failed to enable smq %u, rc=%d", node->hw_id, + rc); + goto exit; + } + } + + /* XON all SMQ's */ + TAILQ_FOREACH(node, list, node) { + if (node->hw_lvl != NIX_TXSCH_LVL_SMQ) + continue; + if (!(node->flags & NIX_TM_NODE_HWRES)) + continue; + + rc = nix_tm_smq_xoff(nix, node, false); + if (rc) { + plt_err("Failed to enable smq %u, rc=%d", node->hw_id, + rc); + goto exit; + } + } +exit: + return rc; +} + +int roc_nix_tm_hierarchy_disable(struct roc_nix *roc_nix) { struct nix *nix = roc_nix_to_nix_priv(roc_nix); diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index 5df2e56..388f938 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -170,6 +170,7 @@ INTERNAL { roc_nix_xstats_names_get; roc_nix_switch_hdr_set; roc_nix_eeprom_info_get; + roc_nix_smq_flush; roc_nix_tm_dump; roc_nix_tm_fini; roc_nix_tm_free_resources; -- 1.8.3.1