From patchwork Fri Oct 1 13:40:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 100261 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 F39B8A0032; Fri, 1 Oct 2021 15:42:16 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 51DD3411EA; Fri, 1 Oct 2021 15:41:12 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 95EED411F2 for ; Fri, 1 Oct 2021 15:41:10 +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 1919hdjX021664 for ; Fri, 1 Oct 2021 06:41:10 -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=UlYNxlQx9c+CJVUKpFO5aOQLcZH5SAB+aLl499ypGpq5NURwZpTl8/rsAXOnn5flwD97 YxJxAvgmCZJuuKVxts5UXkLkaizSwkIxAlFLTDG1gaCFjmr1hJp1WTdqoTNWmpMEknmt XO84MqYzw0QnLwyc+xLdJve5mCBWzD4rqTVjGLg7BfW3PEhSDJ1+QUtuRQAsC5FKSaqN 9OeeU10NquIOgQxj4xL+Zp2LM4KvYZRl1eB3lFT9lELH/XLzUzjTVH7+GNNLCY6oqie6 sSCB8uULpM//HK0GyOxMvC+tqWfUqaWZ9IYmMi5LGPzIlfGqYbFCTafrFtUMHuD1W3lh ow== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com with ESMTP id 3bdrxmhxbk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 01 Oct 2021 06:41:09 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 1 Oct 2021 06:41:07 -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; Fri, 1 Oct 2021 06:41:07 -0700 Received: from hyd1588t430.marvell.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 5DA3C3F7055; Fri, 1 Oct 2021 06:41:05 -0700 (PDT) From: Nithin Dabilpuram To: , Nithin Dabilpuram , "Kiran Kumar K" , Sunil Kumar Kori , Satha Rao CC: , Satheesh Paul Date: Fri, 1 Oct 2021 19:10:09 +0530 Message-ID: <20211001134022.22700-16-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20211001134022.22700-1-ndabilpuram@marvell.com> References: <20210902021505.17607-1-ndabilpuram@marvell.com> <20211001134022.22700-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: lglr1UTDwTlDO1q4Cr0QMBdQn27coocV X-Proofpoint-ORIG-GUID: lglr1UTDwTlDO1q4Cr0QMBdQn27coocV 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-10-01_02,2021-10-01_02,2020-04-07_01 Subject: [dpdk-dev] [PATCH v3 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;