From patchwork Fri Jun 25 05:36:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anoob Joseph X-Patchwork-Id: 94819 X-Patchwork-Delegate: gakhil@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 87D34A0C40; Fri, 25 Jun 2021 07:38:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B9B0C410FC; Fri, 25 Jun 2021 07:38:18 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 83CB2410D7 for ; Fri, 25 Jun 2021 07:38:17 +0200 (CEST) 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 15P5ab9h018611; Thu, 24 Jun 2021 22:38:16 -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-transfer-encoding : content-type; s=pfpt0220; bh=upfKLzL/gh7Yv4wfTTAdQJjEzOkMFWkuRxVGAE18my4=; b=lEIxpCiKPciLuwIvafgL88mpgzXNf6X+uOQ5FGH9J5vmTss10GFN6hJQeL0Uum/ML5jI 7QzEI/Po8BYd6Tc50B7eSwBU85O1MzezNeGonJmee5T2PPdQKT2xY+Lr1rMTYAyUf9B2 eAnRCOOo2nGPBsjBqQMNB1AXpzQXZyCgzvvr8jt1KaIu6YHW6KI84elSge8XaS4VIOB/ OSu1Ejl0Q8i3h/sdeRX7TB9m3Jrpfb5lXBKyQ20Lj9FAqQgoe/H/DGE311pAXAAiJJ0U 5456j78pD7c5CiP+CcyGNCV3vD5m3bmDKBoQafqfdS9bcD8N0T2X7MhW09P7FqoqqvWy mQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com with ESMTP id 39d24dhh6b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 24 Jun 2021 22:38:16 -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; Thu, 24 Jun 2021 22:38: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; Thu, 24 Jun 2021 22:38:14 -0700 Received: from HY-LT1002.marvell.com (HY-LT1002.marvell.com [10.28.176.218]) by maili.marvell.com (Postfix) with ESMTP id D36453F7068; Thu, 24 Jun 2021 22:38:11 -0700 (PDT) From: Anoob Joseph To: Akhil Goyal , Thomas Monjalon CC: Anoob Joseph , Jerin Jacob , "Ankur Dwivedi" , Tejasree Kondoj , Date: Fri, 25 Jun 2021 11:06:45 +0530 Message-ID: <1624599410-29689-14-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1624599410-29689-1-git-send-email-anoobj@marvell.com> References: <1624599410-29689-1-git-send-email-anoobj@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: pBINZaI99R4eAaVVUJAWGlZUZWFty6NP X-Proofpoint-ORIG-GUID: pBINZaI99R4eAaVVUJAWGlZUZWFty6NP X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-06-25_01:2021-06-24, 2021-06-25 signatures=0 Subject: [dpdk-dev] [PATCH v2 13/17] common/cnxk: add lmtline init 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" Add routine to initialize LMTLINE which facilitates instruction submission to CPT. Add common macros required in the enqueue operations. Signed-off-by: Anoob Joseph Signed-off-by: Ankur Dwivedi --- drivers/common/cnxk/roc_cpt.c | 20 ++++++++++++++++++++ drivers/common/cnxk/roc_cpt.h | 32 ++++++++++++++++++++++++++++++++ drivers/common/cnxk/version.map | 1 + 3 files changed, 53 insertions(+) diff --git a/drivers/common/cnxk/roc_cpt.c b/drivers/common/cnxk/roc_cpt.c index 81e8b15..788b28a 100644 --- a/drivers/common/cnxk/roc_cpt.c +++ b/drivers/common/cnxk/roc_cpt.c @@ -806,3 +806,23 @@ roc_cpt_iq_disable(struct roc_cpt_lf *lf) lf_inprog.s.eena = 0x0; plt_write64(lf_inprog.u, lf->rbase + CPT_LF_INPROG); } + +int +roc_cpt_lmtline_init(struct roc_cpt *roc_cpt, struct roc_cpt_lmtline *lmtline, + int lf_id) +{ + struct roc_cpt_lf *lf; + + lf = roc_cpt->lf[lf_id]; + if (lf == NULL) + return -ENOTSUP; + + lmtline->io_addr = lf->io_addr; + if (roc_model_is_cn10k()) + lmtline->io_addr |= ROC_CN10K_CPT_INST_DW_M1 << 4; + + lmtline->fc_addr = lf->fc_addr; + lmtline->lmt_base = lf->lmt_base; + + return 0; +} diff --git a/drivers/common/cnxk/roc_cpt.h b/drivers/common/cnxk/roc_cpt.h index 5577fea..8dd2b5e 100644 --- a/drivers/common/cnxk/roc_cpt.h +++ b/drivers/common/cnxk/roc_cpt.h @@ -16,6 +16,30 @@ #define ROC_CPT_DFLT_ENG_GRP_AE 2UL #define ROC_CPT_MAX_LFS 64 +#define ROC_CN10K_CPT_INST_DW_M1 \ + ((uint64_t)(((sizeof(struct cpt_inst_s) / 16) - 1) & 0x7)) +#define ROC_CN10K_TWO_CPT_INST_DW_M1 \ + ((uint64_t)(((sizeof(struct cpt_inst_s) * 2 / 16) - 1) & 0x7)) + +/* Vector of sizes in the burst of 16 CPT inst except first in 63:19 of + * APT_LMT_ARG_S + */ +#define ROC_CN10K_CPT_LMT_ARG \ + (ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 0) | \ + ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 1) | \ + ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 2) | \ + ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 3) | \ + ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 4) | \ + ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 5) | \ + ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 6) | \ + ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 7) | \ + ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 8) | \ + ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 9) | \ + ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 10) | \ + ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 11) | \ + ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 12) | \ + ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 13) | \ + ROC_CN10K_CPT_INST_DW_M1 << (19 + 3 * 14)) /* CPT helper macros */ #define ROC_CPT_AH_HDR_LEN 12 @@ -51,6 +75,12 @@ #define ROC_CPT_TUNNEL_IPV4_HDR_LEN 20 #define ROC_CPT_TUNNEL_IPV6_HDR_LEN 40 +struct roc_cpt_lmtline { + uint64_t io_addr; + uint64_t *fc_addr; + uintptr_t lmt_base; +}; + struct roc_cpt_lf { /* Input parameters */ uint16_t lf_id; @@ -109,5 +139,7 @@ int __roc_api roc_cpt_inline_ipsec_inb_cfg(struct roc_cpt *roc_cpt, int __roc_api roc_cpt_afs_print(struct roc_cpt *roc_cpt); int __roc_api roc_cpt_lfs_print(struct roc_cpt *roc_cpt); void __roc_api roc_cpt_iq_disable(struct roc_cpt_lf *lf); +int __roc_api roc_cpt_lmtline_init(struct roc_cpt *roc_cpt, + struct roc_cpt_lmtline *lmtline, int lf_id); #endif /* _ROC_CPT_H_ */ diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index 59d7d91..e079bc7 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -24,6 +24,7 @@ INTERNAL { roc_cpt_lf_init; roc_cpt_lf_fini; roc_cpt_lfs_print; + roc_cpt_lmtline_init; roc_cpt_rxc_time_cfg; roc_error_msg_get; roc_idev_cpt_get;