From patchwork Thu Sep 2 02:14:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 97735 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 521C2A0C4C; Thu, 2 Sep 2021 04:17:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B4D1F4115E; Thu, 2 Sep 2021 04:17:14 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id E63FF4114E for ; Thu, 2 Sep 2021 04:17:12 +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 181HQSfB012709 for ; Wed, 1 Sep 2021 19:17:12 -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=MlliJfOB98bbeqKpWHM5td6qAumeFPvgTlrjWE2/mMY=; b=V6IOxwN+PkBbrYx/n4wKEbgh0RfqoKqEU5c/EwX/oF1Ic4pmffwTz41ixtby6hE9xF/u cZxWxDo1cJAfQJxBBd9qML22BbBxom1+ZusFULAYndeRja5J1jKlGHGgt6eHEYDCXQ2Y G+h47pakNtTWlsPR+ZGuek2FbTIIv0Jn3qLYU0EF2T2Z5cAP+fuZ4DjLq+Fb+P1Sed6d 6xeK4jweWJJgoewDcf6GDLXm8x2DZ2pp2Zg+wgRzlymp0aVWXb4ktWFpeWl4V5PSvtou YvvQmG6yIHIES/95Vi20QPgP6XAIDQVssGqgtGOmtt7mpHiGxP47yPFOXLVbWh1heu30 nQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com with ESMTP id 3atdwq9hs2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 01 Sep 2021 19:17:12 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 1 Sep 2021 19:17:10 -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; Wed, 1 Sep 2021 19:17:10 -0700 Received: from hyd1588t430.marvell.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 0933E3F7040; Wed, 1 Sep 2021 19:17:07 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Date: Thu, 2 Sep 2021 07:44:47 +0530 Message-ID: <20210902021505.17607-10-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20210902021505.17607-1-ndabilpuram@marvell.com> References: <20210902021505.17607-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 4BTilk5xaZ-ZGJsRfLvLH0yZwP17-zGM X-Proofpoint-GUID: 4BTilk5xaZ-ZGJsRfLvLH0yZwP17-zGM 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-01_05,2021-09-01_01,2020-04-07_01 Subject: [dpdk-dev] [PATCH 09/27] common/cnxk: align cpt lf enable/disable sequence 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" For CPT LF IQ enable, set CPT_LF_CTL[ENA] before setting CPT_LF_INPROG[EENA] to true. For CPT LF IQ disable, align sequence to that of HRM. Also this patch aligns space for instructions in CPT LF to ROC_ALIGN to make complete memory cache aligned and has other minor fixes/additions. Signed-off-by: Nithin Dabilpuram --- drivers/common/cnxk/hw/cpt.h | 11 +++++++++++ drivers/common/cnxk/roc_cpt.c | 42 ++++++++++++++++++++++++++++++++++-------- drivers/common/cnxk/roc_cpt.h | 8 ++++++++ 3 files changed, 53 insertions(+), 8 deletions(-) diff --git a/drivers/common/cnxk/hw/cpt.h b/drivers/common/cnxk/hw/cpt.h index 975139f..4d9df59 100644 --- a/drivers/common/cnxk/hw/cpt.h +++ b/drivers/common/cnxk/hw/cpt.h @@ -124,6 +124,17 @@ union cpt_lf_misc_int { } s; }; +union cpt_lf_q_grp_ptr { + uint64_t u; + struct { + uint64_t dq_ptr : 15; + uint64_t reserved_31_15 : 17; + uint64_t nq_ptr : 15; + uint64_t reserved_47_62 : 16; + uint64_t xq_xor : 1; + } s; +}; + union cpt_inst_w4 { uint64_t u64; struct { diff --git a/drivers/common/cnxk/roc_cpt.c b/drivers/common/cnxk/roc_cpt.c index f08b5d0..b30f44e 100644 --- a/drivers/common/cnxk/roc_cpt.c +++ b/drivers/common/cnxk/roc_cpt.c @@ -437,8 +437,10 @@ cpt_lf_iq_mem_calc(uint32_t nb_desc) len += CPT_IQ_FC_LEN; /* For instruction queues */ - len += CPT_IQ_NB_DESC_SIZE_DIV40(nb_desc) * CPT_IQ_NB_DESC_MULTIPLIER * - sizeof(struct cpt_inst_s); + len += PLT_ALIGN(CPT_IQ_NB_DESC_SIZE_DIV40(nb_desc) * + CPT_IQ_NB_DESC_MULTIPLIER * + sizeof(struct cpt_inst_s), + ROC_ALIGN); return len; } @@ -550,6 +552,7 @@ cpt_lf_init(struct roc_cpt_lf *lf) iq_mem = plt_zmalloc(cpt_lf_iq_mem_calc(lf->nb_desc), ROC_ALIGN); if (iq_mem == NULL) return -ENOMEM; + plt_atomic_thread_fence(__ATOMIC_ACQ_REL); blkaddr = cpt_get_blkaddr(dev); lf->rbase = dev->bar2 + ((blkaddr << 20) | (lf->lf_id << 12)); @@ -634,7 +637,7 @@ roc_cpt_dev_init(struct roc_cpt *roc_cpt) } /* Reserve 1 CPT LF for inline inbound */ - nb_lf_avail = PLT_MIN(nb_lf_avail, ROC_CPT_MAX_LFS - 1); + nb_lf_avail = PLT_MIN(nb_lf_avail, (uint16_t)(ROC_CPT_MAX_LFS - 1)); roc_cpt->nb_lf_avail = nb_lf_avail; @@ -770,8 +773,10 @@ void roc_cpt_iq_disable(struct roc_cpt_lf *lf) { union cpt_lf_ctl lf_ctl = {.u = 0x0}; + union cpt_lf_q_grp_ptr grp_ptr; union cpt_lf_inprog lf_inprog; int timeout = 20; + int cnt; /* Disable instructions enqueuing */ plt_write64(lf_ctl.u, lf->rbase + CPT_LF_CTL); @@ -795,6 +800,27 @@ roc_cpt_iq_disable(struct roc_cpt_lf *lf) */ lf_inprog.s.eena = 0x0; plt_write64(lf_inprog.u, lf->rbase + CPT_LF_INPROG); + + /* Wait for instruction queue to become empty */ + cnt = 0; + do { + lf_inprog.u = plt_read64(lf->rbase + CPT_LF_INPROG); + if (lf_inprog.s.grb_partial) + cnt = 0; + else + cnt++; + grp_ptr.u = plt_read64(lf->rbase + CPT_LF_Q_GRP_PTR); + } while ((cnt < 10) && (grp_ptr.s.nq_ptr != grp_ptr.s.dq_ptr)); + + cnt = 0; + do { + lf_inprog.u = plt_read64(lf->rbase + CPT_LF_INPROG); + if ((lf_inprog.s.inflight == 0) && (lf_inprog.s.gwb_cnt < 40) && + ((lf_inprog.s.grb_cnt == 0) || (lf_inprog.s.grb_cnt == 40))) + cnt++; + else + cnt = 0; + } while (cnt < 10); } void @@ -806,11 +832,6 @@ roc_cpt_iq_enable(struct roc_cpt_lf *lf) /* Disable command queue */ roc_cpt_iq_disable(lf); - /* Enable command queue execution */ - lf_inprog.u = plt_read64(lf->rbase + CPT_LF_INPROG); - lf_inprog.s.eena = 1; - plt_write64(lf_inprog.u, lf->rbase + CPT_LF_INPROG); - /* Enable instruction queue enqueuing */ lf_ctl.u = plt_read64(lf->rbase + CPT_LF_CTL); lf_ctl.s.ena = 1; @@ -819,6 +840,11 @@ roc_cpt_iq_enable(struct roc_cpt_lf *lf) lf_ctl.s.fc_hyst_bits = lf->fc_hyst_bits; plt_write64(lf_ctl.u, lf->rbase + CPT_LF_CTL); + /* Enable command queue execution */ + lf_inprog.u = plt_read64(lf->rbase + CPT_LF_INPROG); + lf_inprog.s.eena = 1; + plt_write64(lf_inprog.u, lf->rbase + CPT_LF_INPROG); + cpt_lf_dump(lf); } diff --git a/drivers/common/cnxk/roc_cpt.h b/drivers/common/cnxk/roc_cpt.h index 9b55303..2ac3197 100644 --- a/drivers/common/cnxk/roc_cpt.h +++ b/drivers/common/cnxk/roc_cpt.h @@ -75,6 +75,14 @@ #define ROC_CPT_TUNNEL_IPV4_HDR_LEN 20 #define ROC_CPT_TUNNEL_IPV6_HDR_LEN 40 +#define ROC_CPT_CCM_AAD_DATA 1 +#define ROC_CPT_CCM_MSG_LEN 4 +#define ROC_CPT_CCM_ICV_LEN 16 +#define ROC_CPT_CCM_FLAGS \ + ((ROC_CPT_CCM_AAD_DATA << 6) | \ + (((ROC_CPT_CCM_ICV_LEN - 2) / 2) << 3) | (ROC_CPT_CCM_MSG_LEN - 1)) +#define ROC_CPT_CCM_SALT_LEN 3 + struct roc_cpt_lmtline { uint64_t io_addr; uint64_t *fc_addr;