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 6A7A4A0C43; Thu, 30 Sep 2021 19:03:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A923E41161; Thu, 30 Sep 2021 19:02:48 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 9F7D441102 for ; Thu, 30 Sep 2021 19:02:06 +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 18UD6gaw025697 for ; Thu, 30 Sep 2021 10:02:06 -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=br/4Qf+/mUqfxcC4+TPsoseVh0/bTd+W+15KYdGWJGI=; b=UpEtl4CkajtNybjThTwTao3pG0Oy+Pi3jHF5/87Vd0Z041t7P1uLEI7HNNpl1clFHGMn fXUsj3+n0A5o6n1mjTIfEPe5Kt4SsQam14kSnWFVRAitdtAH+DJInTSuIrbDk3g7YUim mlkQNVF8YBtaO7jS4xvpSDD+7KcVLuXsaPlb7VU7cBMHQfaLYptlgS6FVmHKaNlQPGzV K1Kqf6mhiydmaHqBxgTgo3gFyMV5PuWe9Ih67ynsIIUFghqU1IwAQftc/mEjLYDdxjLh bcDxrhlx3y2ex0cNOkBSQ1192lA/RM0pIKclF3Y77tNAVEk7RQL0Z5bUF8k74NFIefq2 pw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com with ESMTP id 3bd3g3b9w3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 30 Sep 2021 10:02:04 -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, 30 Sep 2021 10:02:01 -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, 30 Sep 2021 10:02:01 -0700 Received: from hyd1588t430.marvell.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 32F043F706B; Thu, 30 Sep 2021 10:01:58 -0700 (PDT) From: Nithin Dabilpuram To: , Nithin Dabilpuram , "Kiran Kumar K" , Sunil Kumar Kori , Satha Rao CC: , Satheesh Paul Date: Thu, 30 Sep 2021 22:31:00 +0530 Message-ID: <20210930170113.29030-16-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20210930170113.29030-1-ndabilpuram@marvell.com> References: <20210902021505.17607-1-ndabilpuram@marvell.com> <20210930170113.29030-1-ndabilpuram@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-GUID: YE_7T70pQBWKJS_afU14KeWO4p4Vx-Zt X-Proofpoint-ORIG-GUID: YE_7T70pQBWKJS_afU14KeWO4p4Vx-Zt 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-30_06,2021-09-30_01,2020-04-07_01 Subject: [dpdk-dev] [PATCH v2 15/28] common/cnxk: support inline IPsec rte flow action 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: Satheesh Paul Add support to configure flow rules with inline IPsec action. Signed-off-by: Satheesh Paul --- drivers/common/cnxk/roc_nix_inl.h | 3 +++ drivers/common/cnxk/roc_nix_inl_dev.c | 3 +++ drivers/common/cnxk/roc_nix_inl_priv.h | 3 +++ drivers/common/cnxk/roc_npc_mcam.c | 28 ++++++++++++++++++++++++++-- 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/drivers/common/cnxk/roc_nix_inl.h b/drivers/common/cnxk/roc_nix_inl.h index 6b8c268..ae5e022 100644 --- a/drivers/common/cnxk/roc_nix_inl.h +++ b/drivers/common/cnxk/roc_nix_inl.h @@ -107,6 +107,9 @@ struct roc_nix_inl_dev { struct plt_pci_device *pci_dev; uint16_t ipsec_in_max_spi; bool selftest; + bool is_multi_channel; + uint16_t channel; + uint16_t chan_mask; bool attach_cptlf; /* End of input parameters */ diff --git a/drivers/common/cnxk/roc_nix_inl_dev.c b/drivers/common/cnxk/roc_nix_inl_dev.c index 0789f99..495dd19 100644 --- a/drivers/common/cnxk/roc_nix_inl_dev.c +++ b/drivers/common/cnxk/roc_nix_inl_dev.c @@ -543,6 +543,9 @@ roc_nix_inl_dev_init(struct roc_nix_inl_dev *roc_inl_dev) inl_dev->pci_dev = pci_dev; inl_dev->ipsec_in_max_spi = roc_inl_dev->ipsec_in_max_spi; inl_dev->selftest = roc_inl_dev->selftest; + inl_dev->is_multi_channel = roc_inl_dev->is_multi_channel; + inl_dev->channel = roc_inl_dev->channel; + inl_dev->chan_mask = roc_inl_dev->chan_mask; inl_dev->attach_cptlf = roc_inl_dev->attach_cptlf; /* Initialize base device */ diff --git a/drivers/common/cnxk/roc_nix_inl_priv.h b/drivers/common/cnxk/roc_nix_inl_priv.h index 4729a38..3dc526f 100644 --- a/drivers/common/cnxk/roc_nix_inl_priv.h +++ b/drivers/common/cnxk/roc_nix_inl_priv.h @@ -50,6 +50,9 @@ struct nix_inl_dev { /* Device arguments */ uint8_t selftest; + uint16_t channel; + uint16_t chan_mask; + bool is_multi_channel; uint16_t ipsec_in_max_spi; bool attach_cptlf; }; diff --git a/drivers/common/cnxk/roc_npc_mcam.c b/drivers/common/cnxk/roc_npc_mcam.c index 8ccaaad..4985d22 100644 --- a/drivers/common/cnxk/roc_npc_mcam.c +++ b/drivers/common/cnxk/roc_npc_mcam.c @@ -503,8 +503,11 @@ npc_mcam_alloc_and_write(struct npc *npc, struct roc_npc_flow *flow, { int use_ctr = (flow->ctr_id == NPC_COUNTER_NONE ? 0 : 1); struct npc_mcam_write_entry_req *req; + struct nix_inl_dev *inl_dev = NULL; struct mbox *mbox = npc->mbox; struct mbox_msghdr *rsp; + struct idev_cfg *idev; + uint16_t pf_func = 0; uint16_t ctr = ~(0); int rc, idx; int entry; @@ -553,9 +556,30 @@ npc_mcam_alloc_and_write(struct npc *npc, struct roc_npc_flow *flow, req->entry_data.kw_mask[idx] = flow->mcam_mask[idx]; } + idev = idev_get_cfg(); + if (idev) + inl_dev = idev->nix_inl_dev; + if (flow->nix_intf == NIX_INTF_RX) { - req->entry_data.kw[0] |= (uint64_t)npc->channel; - req->entry_data.kw_mask[0] |= (BIT_ULL(12) - 1); + if (inl_dev && inl_dev->is_multi_channel && + (flow->npc_action & NIX_RX_ACTIONOP_UCAST_IPSEC)) { + req->entry_data.kw[0] |= (uint64_t)inl_dev->channel; + req->entry_data.kw_mask[0] |= + (uint64_t)inl_dev->chan_mask; + pf_func = nix_inl_dev_pffunc_get(); + req->entry_data.action &= ~(GENMASK(19, 4)); + req->entry_data.action |= (uint64_t)pf_func << 4; + + flow->npc_action &= ~(GENMASK(19, 4)); + flow->npc_action |= (uint64_t)pf_func << 4; + flow->mcam_data[0] |= (uint64_t)inl_dev->channel; + flow->mcam_mask[0] |= (uint64_t)inl_dev->chan_mask; + } else { + req->entry_data.kw[0] |= (uint64_t)npc->channel; + req->entry_data.kw_mask[0] |= (BIT_ULL(12) - 1); + flow->mcam_data[0] |= (uint64_t)npc->channel; + flow->mcam_mask[0] |= (BIT_ULL(12) - 1); + } } else { uint16_t pf_func = (flow->npc_action >> 4) & 0xffff; -- 2.8.4