From patchwork Fri Mar 5 13:39:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 88574 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 F3CEBA0547; Fri, 5 Mar 2021 14:47:59 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E743622A489; Fri, 5 Mar 2021 14:41:54 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id D068222A3A3 for ; Fri, 5 Mar 2021 14:41:52 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 125DerQc001873 for ; Fri, 5 Mar 2021 05:41:52 -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-type; s=pfpt0220; bh=ElO/yOIDpermh6kPKTz0E/YtBjxKM3TdmtMVUlnF6/0=; b=cwPfpMCwCVv8kjGjHJvNT2jFnggOL1g482rD+3Y4g5xThDY8R4GcpImb2seFLEtihwU7 KEugyX/5ZNOOGuccIfVPK+Ao2WR2YhcDGSBifL+/4wE5rUBpwtGYrlMQRtyube+WrkFl H0AFcmbB9WUWd/8z4gelBT6N3/DzYhitB1SmkwM84RELdMedP+4bzifMhXPdh13aUxOm hDgiYPkjdNBlCBUfzojyUaIs3GsBgFPKb5My3qvHyIrLD9rJ/8my303m3V9oJ/H44tjw rGxtz/o9AfZCc6a9XENamKgpzXa1jSUnalkJzpc5DzT7jby/zL3aMmxt2cTRIdfH1iNi eQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com with ESMTP id 372s2umrt9-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 05 Mar 2021 05:41:52 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 5 Mar 2021 05:41:50 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 5 Mar 2021 05:41:49 -0800 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.2 via Frontend Transport; Fri, 5 Mar 2021 05:41:49 -0800 Received: from hyd1588t430.marvell.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 645043F7041; Fri, 5 Mar 2021 05:41:47 -0800 (PST) From: Nithin Dabilpuram To: CC: , , , , , , Date: Fri, 5 Mar 2021 19:09:13 +0530 Message-ID: <20210305133918.8005-48-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20210305133918.8005-1-ndabilpuram@marvell.com> References: <20210305133918.8005-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-03-05_08:2021-03-03, 2021-03-05 signatures=0 Subject: [dpdk-dev] [PATCH 47/52] common/cnxk: add sso hwgrp interface 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: Pavan Nikhilesh Add SSO HWGRP interface for configuring XAQ pool, setting priority and internal HW buffer limits for each HWGRP. Signed-off-by: Pavan Nikhilesh --- drivers/common/cnxk/roc_sso.c | 110 ++++++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_sso.h | 21 ++++++++ drivers/common/cnxk/version.map | 6 +++ 3 files changed, 137 insertions(+) diff --git a/drivers/common/cnxk/roc_sso.c b/drivers/common/cnxk/roc_sso.c index 52a7a6c..acb9be8 100644 --- a/drivers/common/cnxk/roc_sso.c +++ b/drivers/common/cnxk/roc_sso.c @@ -174,6 +174,14 @@ roc_sso_hws_base_get(struct roc_sso *roc_sso, uint8_t hws) return dev->bar2 + (RVU_BLOCK_ADDR_SSOW << 20 | hws << 12); } +uintptr_t +roc_sso_hwgrp_base_get(struct roc_sso *roc_sso, uint16_t hwgrp) +{ + struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev; + + return dev->bar2 + (RVU_BLOCK_ADDR_SSO << 20 | hwgrp << 12); +} + uint64_t roc_sso_ns_to_gw(struct roc_sso *roc_sso, uint64_t ns) { @@ -241,6 +249,108 @@ roc_sso_hws_unlink(struct roc_sso *roc_sso, uint8_t hws, uint16_t hwgrp[], } int +roc_sso_hwgrp_hws_link_status(struct roc_sso *roc_sso, uint8_t hws, + uint16_t hwgrp) +{ + struct sso *sso; + + sso = roc_sso_to_sso_priv(roc_sso); + return plt_bitmap_get(sso->link_map[hws], hwgrp); +} + +int +roc_sso_hwgrp_qos_config(struct roc_sso *roc_sso, struct roc_sso_hwgrp_qos *qos, + uint8_t nb_qos, uint32_t nb_xaq) +{ + struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev; + struct sso_grp_qos_cfg *req; + int i, rc; + + for (i = 0; i < nb_qos; i++) { + uint8_t xaq_prcnt = qos[i].xaq_prcnt; + uint8_t iaq_prcnt = qos[i].iaq_prcnt; + uint8_t taq_prcnt = qos[i].taq_prcnt; + + req = mbox_alloc_msg_sso_grp_qos_config(dev->mbox); + if (req == NULL) { + rc = mbox_process(dev->mbox); + if (rc < 0) + return rc; + req = mbox_alloc_msg_sso_grp_qos_config(dev->mbox); + if (req == NULL) + return -ENOSPC; + } + req->grp = qos[i].hwgrp; + req->xaq_limit = (nb_xaq * (xaq_prcnt ? xaq_prcnt : 100)) / 100; + req->taq_thr = (SSO_HWGRP_IAQ_MAX_THR_MASK * + (iaq_prcnt ? iaq_prcnt : 100)) / + 100; + req->iaq_thr = (SSO_HWGRP_TAQ_MAX_THR_MASK * + (taq_prcnt ? taq_prcnt : 100)) / + 100; + } + + return mbox_process(dev->mbox); +} + +int +roc_sso_hwgrp_alloc_xaq(struct roc_sso *roc_sso, uint32_t npa_aura_id, + uint16_t hwgrps) +{ + struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev; + struct sso_hw_setconfig *req; + int rc = -ENOSPC; + + req = mbox_alloc_msg_sso_hw_setconfig(dev->mbox); + if (req == NULL) + return rc; + req->npa_pf_func = idev_npa_pffunc_get(); + req->npa_aura_id = npa_aura_id; + req->hwgrps = hwgrps; + + return mbox_process(dev->mbox); +} + +int +roc_sso_hwgrp_release_xaq(struct roc_sso *roc_sso, uint16_t hwgrps) +{ + struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev; + struct sso_hw_xaq_release *req; + + req = mbox_alloc_msg_sso_hw_release_xaq_aura(dev->mbox); + if (req == NULL) + return -EINVAL; + req->hwgrps = hwgrps; + + return mbox_process(dev->mbox); +} + +int +roc_sso_hwgrp_set_priority(struct roc_sso *roc_sso, uint16_t hwgrp, + uint8_t weight, uint8_t affinity, uint8_t priority) +{ + struct dev *dev = &roc_sso_to_sso_priv(roc_sso)->dev; + struct sso_grp_priority *req; + int rc = -ENOSPC; + + req = mbox_alloc_msg_sso_grp_set_priority(dev->mbox); + if (req == NULL) + return rc; + req->grp = hwgrp; + req->weight = weight; + req->affinity = affinity; + req->priority = priority; + + rc = mbox_process(dev->mbox); + if (rc < 0) + return rc; + plt_sso_dbg("HWGRP %d weight %d affinity %d priority %d", hwgrp, weight, + affinity, priority); + + return 0; +} + +int roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp) { struct sso_lf_alloc_rsp *rsp_hwgrp; diff --git a/drivers/common/cnxk/roc_sso.h b/drivers/common/cnxk/roc_sso.h index c4f5c40..fa5f4ea 100644 --- a/drivers/common/cnxk/roc_sso.h +++ b/drivers/common/cnxk/roc_sso.h @@ -5,6 +5,13 @@ #ifndef _ROC_SSO_H_ #define _ROC_SSO_H_ +struct roc_sso_hwgrp_qos { + uint16_t hwgrp; + uint8_t xaq_prcnt; + uint8_t iaq_prcnt; + uint8_t taq_prcnt; +}; + struct roc_sso { struct plt_pci_device *pci_dev; /* Public data. */ @@ -30,11 +37,25 @@ int __roc_api roc_sso_dev_fini(struct roc_sso *roc_sso); int __roc_api roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp); void __roc_api roc_sso_rsrc_fini(struct roc_sso *roc_sso); +int __roc_api roc_sso_hwgrp_qos_config(struct roc_sso *roc_sso, + struct roc_sso_hwgrp_qos *qos, + uint8_t nb_qos, uint32_t nb_xaq); +int __roc_api roc_sso_hwgrp_alloc_xaq(struct roc_sso *roc_sso, + uint32_t npa_aura_id, uint16_t hwgrps); +int __roc_api roc_sso_hwgrp_release_xaq(struct roc_sso *roc_sso, + uint16_t hwgrps); +int __roc_api roc_sso_hwgrp_set_priority(struct roc_sso *roc_sso, + uint16_t hwgrp, uint8_t weight, + uint8_t affinity, uint8_t priority); uint64_t __roc_api roc_sso_ns_to_gw(struct roc_sso *roc_sso, uint64_t ns); int __roc_api roc_sso_hws_link(struct roc_sso *roc_sso, uint8_t hws, uint16_t hwgrp[], uint16_t nb_hwgrp); int __roc_api roc_sso_hws_unlink(struct roc_sso *roc_sso, uint8_t hws, uint16_t hwgrp[], uint16_t nb_hwgrp); +int __roc_api roc_sso_hwgrp_hws_link_status(struct roc_sso *roc_sso, + uint8_t hws, uint16_t hwgrp); uintptr_t __roc_api roc_sso_hws_base_get(struct roc_sso *roc_sso, uint8_t hws); +uintptr_t __roc_api roc_sso_hwgrp_base_get(struct roc_sso *roc_sso, + uint16_t hwgrp); #endif /* _ROC_SSOW_H_ */ diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index 5675a39..7dde169 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -174,6 +174,12 @@ INTERNAL { roc_npc_profile_name_get; roc_sso_dev_fini; roc_sso_dev_init; + roc_sso_hwgrp_alloc_xaq; + roc_sso_hwgrp_base_get; + roc_sso_hwgrp_hws_link_status; + roc_sso_hwgrp_qos_config; + roc_sso_hwgrp_release_xaq; + roc_sso_hwgrp_set_priority; roc_sso_hws_base_get; roc_sso_hws_link; roc_sso_hws_unlink;