From patchwork Fri Sep 8 11:58:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aakash Sasidharan X-Patchwork-Id: 131302 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 7F41442547; Fri, 8 Sep 2023 13:58:28 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5C984402AF; Fri, 8 Sep 2023 13:58:28 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 6E95B40042 for ; Fri, 8 Sep 2023 13:58:27 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3885dffZ020328 for ; Fri, 8 Sep 2023 04:58:26 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=CLMIPl2fw30x9xPGblDeQwY4FJCwZY4hIXZSDGnOwag=; b=Y7cI3ABLM5ceY3S+YH7lLOFxowWOhhvSn3Qbki+8fHEvxplD4dQ2GTjwuCAm2f/fgmmm DD0cpmm/fQCp+nkIPvyXxL52YA8nxM/GoggDW9SrtW9udGmHewXKPwqkobesxmL0ShkN 6MAETXEgS0IVoXvqzeue3V2z9k3VZizffi64vjuihhY5JzKpxx+RlZ97Ssj3BpZ1wGcQ ub0BnuUNKmDtVWtYjyF64WpmxXwy5NbUnd18xW1Yu7qyrdCNkZY6VWmPj324TQsbxYGz u/L4hw8YxJ8oaZjzRt/hxIebjmyr7JvzLcD1bzGrdzmxEQM8+DYfw5fkR2Nx53SShIm+ uA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3syk9akbeq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 08 Sep 2023 04:58:26 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Fri, 8 Sep 2023 04:58:24 -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.48 via Frontend Transport; Fri, 8 Sep 2023 04:58:24 -0700 Received: from localhost.localdomain (unknown [10.28.36.177]) by maili.marvell.com (Postfix) with ESMTP id B688D5B692D; Fri, 8 Sep 2023 04:58:22 -0700 (PDT) From: Aakash Sasidharan To: Anoob Joseph , Volodymyr Fialko CC: , , Subject: [PATCH 1/3] pdcp: add support for SDAP header Date: Fri, 8 Sep 2023 17:28:19 +0530 Message-ID: <20230908115821.3396269-1-asasidharan@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 3RQuNGYdc46WpMoBoCLwSzVkqg6wlRsl X-Proofpoint-GUID: 3RQuNGYdc46WpMoBoCLwSzVkqg6wlRsl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-08_09,2023-09-05_01,2023-05-22_02 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 SDAP header when enabled needs to be authenticated but not encrypted. Signed-off-by: Aakash Sasidharan --- lib/pdcp/pdcp_entity.h | 2 ++ lib/pdcp/pdcp_process.c | 22 ++++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/lib/pdcp/pdcp_entity.h b/lib/pdcp/pdcp_entity.h index 9f74b5d0e5..4fc6342a5c 100644 --- a/lib/pdcp/pdcp_entity.h +++ b/lib/pdcp/pdcp_entity.h @@ -171,6 +171,8 @@ struct entity_priv { uint8_t hdr_sz; /** PDCP AAD size. For AES-CMAC, additional message is prepended for the operation. */ uint8_t aad_sz; + /** PDCP cipher skip size. When enabled, SDAP header needs to be skipped from ciphering */ + uint8_t cipher_skip_sz; /** Device ID of the device to be used for offload. */ uint8_t dev_id; }; diff --git a/lib/pdcp/pdcp_process.c b/lib/pdcp/pdcp_process.c index c2f28d4d77..9b9b881124 100644 --- a/lib/pdcp/pdcp_process.c +++ b/lib/pdcp/pdcp_process.c @@ -391,7 +391,7 @@ pdcp_pre_process_uplane_sn_12_ul(const struct rte_pdcp_entity *entity, struct rt uint8_t *mac_i; int i; - const uint8_t data_offset = en_priv->hdr_sz + en_priv->aad_sz; + const uint8_t data_offset = en_priv->hdr_sz + en_priv->aad_sz + en_priv->cipher_skip_sz; const int is_null_auth = en_priv->flags.is_null_auth; nb_cop = rte_crypto_op_bulk_alloc(en_priv->cop_pool, RTE_CRYPTO_OP_TYPE_SYMMETRIC, cop, @@ -477,7 +477,7 @@ pdcp_pre_process_uplane_sn_18_ul(const struct rte_pdcp_entity *entity, struct rt uint8_t *mac_i; int i; - const uint8_t data_offset = en_priv->hdr_sz + en_priv->aad_sz; + const uint8_t data_offset = en_priv->hdr_sz + en_priv->aad_sz + en_priv->cipher_skip_sz; const int is_null_auth = en_priv->flags.is_null_auth; nb_cop = rte_crypto_op_bulk_alloc(en_priv->cop_pool, RTE_CRYPTO_OP_TYPE_SYMMETRIC, cop, @@ -540,7 +540,7 @@ pdcp_pre_process_cplane_sn_12_ul(const struct rte_pdcp_entity *entity, struct rt int i; const uint8_t hdr_sz = en_priv->hdr_sz; - const uint8_t data_offset = hdr_sz + en_priv->aad_sz; + const uint8_t data_offset = hdr_sz + en_priv->aad_sz + en_priv->cipher_skip_sz; const int is_null_auth = en_priv->flags.is_null_auth; nb_cop = rte_crypto_op_bulk_alloc(en_priv->cop_pool, RTE_CRYPTO_OP_TYPE_SYMMETRIC, cop, @@ -658,7 +658,7 @@ pdcp_pre_process_uplane_sn_12_dl_flags(const struct rte_pdcp_entity *entity, uint32_t count; int i; - const uint8_t data_offset = en_priv->hdr_sz + en_priv->aad_sz; + const uint8_t data_offset = en_priv->hdr_sz + en_priv->aad_sz + en_priv->cipher_skip_sz; nb_cop = rte_crypto_op_bulk_alloc(en_priv->cop_pool, RTE_CRYPTO_OP_TYPE_SYMMETRIC, cop, num); @@ -727,7 +727,7 @@ pdcp_pre_process_uplane_sn_18_dl_flags(const struct rte_pdcp_entity *entity, uint32_t count; int i; - const uint8_t data_offset = en_priv->hdr_sz + en_priv->aad_sz; + const uint8_t data_offset = en_priv->hdr_sz + en_priv->aad_sz + en_priv->cipher_skip_sz; nb_cop = rte_crypto_op_bulk_alloc(en_priv->cop_pool, RTE_CRYPTO_OP_TYPE_SYMMETRIC, cop, num); @@ -795,7 +795,7 @@ pdcp_pre_process_cplane_sn_12_dl(const struct rte_pdcp_entity *entity, struct rt int32_t rsn; int i; - const uint8_t data_offset = en_priv->hdr_sz + en_priv->aad_sz; + const uint8_t data_offset = en_priv->hdr_sz + en_priv->aad_sz + en_priv->cipher_skip_sz; nb_cop = rte_crypto_op_bulk_alloc(en_priv->cop_pool, RTE_CRYPTO_OP_TYPE_SYMMETRIC, cop, num); @@ -1202,6 +1202,16 @@ pdcp_entity_priv_populate(struct entity_priv *en_priv, const struct rte_pdcp_ent else en_priv->aad_sz = 0; + /** + * cipher_skip_sz + * + * When SDAP protocol is enabled for the PDCP entity, skip the SDAP header from ciphering. + */ + if (conf->pdcp_xfrm.sdap_enabled) + en_priv->cipher_skip_sz = 1; + else + en_priv->cipher_skip_sz = 0; + return 0; }