From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 41070A04BF; Thu, 3 Sep 2020 18:07:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 955B21C11D; Thu, 3 Sep 2020 18:07:08 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 8C5EA1C0D5 for ; Thu, 3 Sep 2020 18:07:04 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 68CF91A0BB6; Thu, 3 Sep 2020 18:07:04 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 87C761A0D53; Thu, 3 Sep 2020 18:07:01 +0200 (CEST) Received: from lsv03273.swis.in-blr01.nxp.com (lsv03273.swis.in-blr01.nxp.com [92.120.147.113]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 2F268402F0; Thu, 3 Sep 2020 18:06:57 +0200 (CEST) From: akhil.goyal@nxp.com To: dev@dpdk.org Cc: hemant.agrawal@nxp.com, anoobj@marvell.com, declan.doherty@intel.com, david.coyle@intel.com, Akhil Goyal Date: Thu, 3 Sep 2020 21:36:49 +0530 Message-Id: <20200903160652.31654-5-akhil.goyal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200903160652.31654-1-akhil.goyal@nxp.com> References: <20200903160652.31654-1-akhil.goyal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH 4/7] crypto/dpaa_sec: enable PDCP-SDAP sessions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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: Akhil Goyal Based on the new field in PDCP xform, a decision is made to create a PDCP session with or without SDAP enabled. Signed-off-by: Akhil Goyal --- drivers/crypto/dpaa_sec/dpaa_sec.c | 63 +++++++++++++++++++++--------- drivers/crypto/dpaa_sec/dpaa_sec.h | 3 +- 2 files changed, 47 insertions(+), 19 deletions(-) diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c index c4339336d..192dba064 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -293,24 +294,49 @@ dpaa_sec_prep_pdcp_cdb(dpaa_sec_session *ses) &cipherdata, &authdata, 0); } else { - if (ses->dir == DIR_ENC) - shared_desc_len = cnstr_shdsc_pdcp_u_plane_encap( - cdb->sh_desc, 1, swap, - ses->pdcp.sn_size, - ses->pdcp.hfn, - ses->pdcp.bearer, - ses->pdcp.pkt_dir, - ses->pdcp.hfn_threshold, - &cipherdata, p_authdata, 0); - else if (ses->dir == DIR_DEC) - shared_desc_len = cnstr_shdsc_pdcp_u_plane_decap( - cdb->sh_desc, 1, swap, - ses->pdcp.sn_size, - ses->pdcp.hfn, - ses->pdcp.bearer, - ses->pdcp.pkt_dir, - ses->pdcp.hfn_threshold, - &cipherdata, p_authdata, 0); + if (ses->dir == DIR_ENC) { + if (ses->pdcp.sdap_enabled) + shared_desc_len = + cnstr_shdsc_pdcp_sdap_u_plane_encap( + cdb->sh_desc, 1, swap, + ses->pdcp.sn_size, + ses->pdcp.hfn, + ses->pdcp.bearer, + ses->pdcp.pkt_dir, + ses->pdcp.hfn_threshold, + &cipherdata, p_authdata, 0); + else + shared_desc_len = + cnstr_shdsc_pdcp_u_plane_encap( + cdb->sh_desc, 1, swap, + ses->pdcp.sn_size, + ses->pdcp.hfn, + ses->pdcp.bearer, + ses->pdcp.pkt_dir, + ses->pdcp.hfn_threshold, + &cipherdata, p_authdata, 0); + } else if (ses->dir == DIR_DEC) { + if (ses->pdcp.sdap_enabled) + shared_desc_len = + cnstr_shdsc_pdcp_sdap_u_plane_decap( + cdb->sh_desc, 1, swap, + ses->pdcp.sn_size, + ses->pdcp.hfn, + ses->pdcp.bearer, + ses->pdcp.pkt_dir, + ses->pdcp.hfn_threshold, + &cipherdata, p_authdata, 0); + else + shared_desc_len = + cnstr_shdsc_pdcp_u_plane_decap( + cdb->sh_desc, 1, swap, + ses->pdcp.sn_size, + ses->pdcp.hfn, + ses->pdcp.bearer, + ses->pdcp.pkt_dir, + ses->pdcp.hfn_threshold, + &cipherdata, p_authdata, 0); + } } return shared_desc_len; } @@ -2950,6 +2976,7 @@ dpaa_sec_set_pdcp_session(struct rte_cryptodev *dev, session->pdcp.hfn_threshold = pdcp_xform->hfn_threshold; session->pdcp.hfn_ovd = pdcp_xform->hfn_ovrd; session->pdcp.hfn_ovd_offset = cipher_xform->iv.offset; + session->pdcp.sdap_enabled = pdcp_xform->sdap_enabled; rte_spinlock_lock(&dev_priv->lock); for (i = 0; i < MAX_DPAA_CORES; i++) { diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.h b/drivers/crypto/dpaa_sec/dpaa_sec.h index 2cd50cc8d..ddba52982 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.h +++ b/drivers/crypto/dpaa_sec/dpaa_sec.h @@ -109,7 +109,8 @@ struct sec_pdcp_ctxt { int8_t pkt_dir;/*!< PDCP Frame Direction 0:UL 1:DL*/ int8_t hfn_ovd;/*!< Overwrite HFN per packet*/ uint8_t sn_size; /*!< Sequence number size, 5/7/12/15/18 */ - uint32_t hfn_ovd_offset;/*!< offset from rte_crypto_op at which + uint8_t sdap_enabled; /*!< SDAP header is enabled */ + uint16_t hfn_ovd_offset;/*!< offset from rte_crypto_op at which * per packet hfn is stored */ uint32_t hfn; /*!< Hyper Frame Number */ -- 2.17.1