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 023BEA0C45; Wed, 22 Sep 2021 08:12:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 73D984119D; Wed, 22 Sep 2021 08:12:24 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id C4BCA4119C for ; Wed, 22 Sep 2021 08:12:18 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18LLFxaq023412; Tue, 21 Sep 2021 23:12:15 -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=qQYgStywZ7DqgK1WNia9EMkJ6ePNJmN+6LqAXVN6a2A=; b=jW8v320NYbdfWfIj4jRe/CR6XQ+5o/aN3TbvLlyjTlMFdOd47qifoOr265SvjY8TASGn 6tx9b/XexzajmKL+GCW2OZ21h6mePrywCxgCFavPY38qqnv4TH3/zLpXwUH38ocrPMal gGLDA4CkJ1GfyVZQ5iQLMiBzrNZ/Cv3+9eJabxe+A4YcUfghok39vb2bSkZAindRrUSn b/0URLg7Wkqfda8rHgmequNkN/+bHaY07tRpKstV1zcqBm0z2gbO3A/MjQTcaeWRmjRX msRjE/pY5nAyRO2sxSDcHcuUDJvHE+DlztLnx1+21I5mjbS+ZVMpFPwYVr/n4ZWiD7xY vw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com with ESMTP id 3b7q5d9ep5-19 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 21 Sep 2021 23:12:15 -0700 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.18; Tue, 21 Sep 2021 23:12:03 -0700 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; Tue, 21 Sep 2021 23:12:03 -0700 Received: from cavium.marvell.com (cavium.marvell.com [10.28.34.244]) by maili.marvell.com (Postfix) with ESMTP id AA43E3F7079; Tue, 21 Sep 2021 23:12:01 -0700 (PDT) From: To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Ray Kinsella CC: Date: Wed, 22 Sep 2021 02:11:42 -0400 Message-ID: <1632291108-28780-3-git-send-email-skoteshwar@marvell.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1632291108-28780-1-git-send-email-skoteshwar@marvell.com> References: <1630516236-10526-1-git-send-email-skoteshwar@marvell.com> <1632291108-28780-1-git-send-email-skoteshwar@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-GUID: eVFu2Gf9nYQ6KPDCFvJPAZFisE6KFDC9 X-Proofpoint-ORIG-GUID: eVFu2Gf9nYQ6KPDCFvJPAZFisE6KFDC9 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-22_02,2021-09-20_01,2020-04-07_01 Subject: [dpdk-dev] [PATCH v3 2/8] common/cnxk: support SMQ flush 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 Each NIX interface had one or more SMQs connected to SQs to send packets. When flush enabled on SMQ, hardware will push all packets from SMQ to physical link. This API will enable flush on all SMQs of an interface. Signed-off-by: Satha Rao Acked-by: Nithin Dabilpuram --- 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 a0ffd25660..bc908c25b1 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 b0e6fabe31..ac7bd7e3ec 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 f2173c9a58..02ee08bc4c 100644 --- a/drivers/common/cnxk/roc_nix_tm_ops.c +++ b/drivers/common/cnxk/roc_nix_tm_ops.c @@ -317,6 +317,56 @@ roc_nix_tm_node_delete(struct roc_nix *roc_nix, uint32_t node_id, bool free) return nix_tm_node_delete(roc_nix, node_id, ROC_NIX_TM_USER, free); } +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) { diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index 5df2e56ce6..388f9385e0 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; -- 2.25.1