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 1E730A0C41; Wed, 6 Oct 2021 16:31:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 047CE41158; Wed, 6 Oct 2021 16:31:19 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id E76CB41137 for ; Wed, 6 Oct 2021 16:31:17 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19696tLe020671; Wed, 6 Oct 2021 07:31:14 -0700 Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2048.outbound.protection.outlook.com [104.47.66.48]) by mx0a-0016f401.pphosted.com with ESMTP id 3bh8v3sa1j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 06 Oct 2021 07:31:14 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VhPViMMNnWNBxdHXnwao6nHvkC4vB9Epuk5SncwyKjGoFwDNNklvWCtkx5aQr9CPOMjJJWzg9qJF6idVQS96pk5mpepdogTGxJpZrJR6T2d+aofKc3+dHkIoNjTnp81UB1hh8EjlhAqPzMzXPNO5us302thEy4sBhgbahC596zzXGR2U1qtNa1AvJB4dS8QWPlsxmugZt4dCDVBmiCfI2xbrY9tg9tb2WJi1T6Qs3hpTtMMrv9FnrlDXOrmjGCiJtaAAyJj3+85KeWvThktLiho0Ln75GQB9Sov3m6wUVbxQcQNKTB9Z2GAcgdD5khPaxOHU/RTxvXZvbJ8Pzvj1yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lPYqIn9vnirbJq94q0h4Uqe5RN9ra0GYjMvMS+F6Of0=; b=Dre5LeOGs3oOWuuvl2+ICyrVd1SdpEEfPfqSKgSmllGntfvqKq2CLyxGnXLh85Cdhg7+i/Q8mdDvaLBFB5/e7zH0Jo3fNtzj1XjZSq37rB5e4m2I1VLJasVHW5F1l7hqocKRW1UWtw87THN4RYYN8Fr8jiiih51JcPwLzLOPloAgy9iSch1/EZK/z0/EZAji9iHF5VfvzKs51Dp/uhLh7lnQXc/OiFoTotQ5zqLSzNXcJq4SASh6zpni0ntqhtrNFYgg30cCgdczLlDOxAt7B8RC8hk28YnQvS8k6QLCKPS/or01Wzl8zMwKKfHh3b4oefSUS8qFY54gXecqLL/8vQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lPYqIn9vnirbJq94q0h4Uqe5RN9ra0GYjMvMS+F6Of0=; b=Ikz2tNYbWSfSfwtMZbDpoafSDrpjdiXQEmb7+7/qHRLB06S7U9tVD6rfXhHOSwAKk+0xP6NLLpEmXv2I0ZTrf3D/HHTUjaShjgUXXtUCkn4pSOJFPZHjjII1m2DgPHcxz1yOCZfMLE8548cz5P269l08WHQ94EOvrUbnvh2XMY4= Received: from CO6PR18MB4484.namprd18.prod.outlook.com (2603:10b6:5:359::9) by CO1PR18MB4667.namprd18.prod.outlook.com (2603:10b6:303:e6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.19; Wed, 6 Oct 2021 14:31:12 +0000 Received: from CO6PR18MB4484.namprd18.prod.outlook.com ([fe80::c41e:707:3f91:71b8]) by CO6PR18MB4484.namprd18.prod.outlook.com ([fe80::c41e:707:3f91:71b8%6]) with mapi id 15.20.4566.023; Wed, 6 Oct 2021 14:31:12 +0000 From: Akhil Goyal To: Ciara Power , "dev@dpdk.org" CC: "roy.fan.zhang@intel.com" , "piotrx.bronowski@intel.com" , Thomas Monjalon , Pablo de Lara , Ray Kinsella Thread-Topic: [EXT] [PATCH v3 04/10] drivers/crypto: move aesni-gcm PMD to IPsec-mb framework Thread-Index: AQHXtU9lwNJdXp6wWUSOD9CfvGN5WavGEQjQ Date: Wed, 6 Oct 2021 14:31:12 +0000 Message-ID: References: <20210727083832.291687-1-roy.fan.zhang@intel.com> <20210929163035.608387-1-ciara.power@intel.com> <20210929163035.608387-5-ciara.power@intel.com> In-Reply-To: <20210929163035.608387-5-ciara.power@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 39720d40-f55f-472f-adca-08d988d5f261 x-ms-traffictypediagnostic: CO1PR18MB4667: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5236; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ZMBLTTod1dSJht8vwofzItpa2V0hxaIs/ePCyhn4m/1+P3sl74a0Pvgb18JWPKYnHvLvEcFjlnQnEyPi5o73/uXAtC6OYXmteli6aj3p2rE0+RJPUtGgO9DfgC+AgKT29mZJEbti6nRZ5GjHBI+Sr6X3Umcot1t1Saztg25ecxp7FH6nLL7MpI+8Af+PhkOhe8PY/IDvH2Ok8MCr0Yr2SxWCZXQN55Koj3eVir+TQpoD5Oielz5sAu7N1chzofk+K64s+dUEHghtFrEsE4wSEewvOsVnaHk7/QS+k5BhgTwcWBCt/HBvMEEwDhOdEMWBXNXCyKyT7ziauQ5+tXY8XszMCmDhxdfAkjq47yQXy5PYkyvq2vGcPkm8/jWG8XbzyKx0/ElrIzq8o0kRsJOUoOLLttjtsSgmwCzGRoiu17MvJBEKqGAVJyLXFS0G2L8Z3hImQRsCqbSjj3piENSz6dD516FCpcpcBPZ2JlYTi4r1gpbC296hK59MLhw+Zv1M44uSv/wixEsnlmeg+56apdTQkWnteAYZ3cxgV+ad59TXO6fNdRsx9/iZAo3hTuJQojIVGDrLH0WKYs4kNNDN6Rbjn0LT36E3EtcvgJYjBkQiF1eW+eprrzEHsJGWUyrTA6b4NapcVoviAzuFF2VN75x8DJPKS/TMtkH1sq/Pic+ghV1pbO/rGSGgm3G5rrSwv/uPbBXshGkLxRQXrPAkDQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR18MB4484.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(186003)(38070700005)(316002)(55236004)(26005)(7696005)(8676002)(8936002)(5660300002)(508600001)(83380400001)(6506007)(71200400001)(64756008)(66556008)(66476007)(52536014)(55016002)(122000001)(9686003)(38100700002)(86362001)(4326008)(2906002)(110136005)(54906003)(33656002)(66946007)(66446008)(76116006); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?+ccJRAcqtT6vqQ/0+2BRJ4BMnLW+3Apva0JBFTdlqc2nOIvKNucCthrc9qqI?= =?us-ascii?Q?rLYxyYiVyqPX2kRbrHcX8cHAC2/MArD1Ptn6tKbdza1UQp/2SnAsN60doi8B?= =?us-ascii?Q?8dQUNttENg6RjOyuqabCY22E4jwjJLF1H4DDk9yCI+MHIU22PH8F7zWLlDD6?= =?us-ascii?Q?HXm+hRcptPq9G8iZu82RxkrxmJBJXEuzdSHQii9rT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DkpcSJadKnk22cy7Uhqy9905UB+rqVea+ZlfcIaym1CB?= =?us-ascii?Q?KuJpeCSxgbFmR+0sdq6d6VfZQyFV9Y35+rAblDWg0RZDp8TV/E7ad3DYwy2L?= =?us-ascii?Q?sxhqaritVeY9RcRqS2kgeJrL7HGmHDYWk2WiJlS7Q8bX98j697iRfEIoYK0u?= =?us-ascii?Q?ll4eruyo3VbwCKv2YWcLu0eLwHgeH2huQQcHXWeKCYU9nAB+adINn65wKSBO?= =?us-ascii?Q?rPCvgeZjCtdBJsD9IK0DkABI?= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: marvell.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO6PR18MB4484.namprd18.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 39720d40-f55f-472f-adca-08d988d5f261 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Oct 2021 14:31:12.3842 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: fyQLvDDSkympt28eiGnK2qvoKc4OMWz4Dp3EZtUjmLuvkYUXYyPhGOojFWKmOoHSV+9hkb+DTAtxZ7rdYDyJzA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR18MB4667 X-Proofpoint-GUID: O2S295BjyqeRPq9cvF3N1cY-B_3ytkwR X-Proofpoint-ORIG-GUID: O2S295BjyqeRPq9cvF3N1cY-B_3ytkwR 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-06_03,2021-10-06_01,2020-04-07_01 Subject: Re: [dpdk-dev] [EXT] [PATCH v3 04/10] drivers/crypto: move aesni-gcm PMD to IPsec-mb framework 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" > diff --git a/drivers/crypto/ipsec_mb/meson.build > b/drivers/crypto/ipsec_mb/meson.build > index bac5d85e26..8550eaee9a 100644 > --- a/drivers/crypto/ipsec_mb/meson.build > +++ b/drivers/crypto/ipsec_mb/meson.build > @@ -23,6 +23,7 @@ endif >=20 > sources =3D files('rte_ipsec_mb_pmd.c', > 'rte_ipsec_mb_pmd_ops.c', > - 'pmd_aesni_mb.c' > + 'pmd_aesni_mb.c', > + 'pmd_aesni_gcm.c' > ) > deps +=3D ['bus_vdev', 'net', 'security'] > diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c > b/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c > new file mode 100644 > index 0000000000..2fcfa97a63 > --- /dev/null > +++ b/drivers/crypto/ipsec_mb/pmd_aesni_gcm.c > @@ -0,0 +1,1003 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2015-2021 Intel Corporation Copyright years are different from the original file > + */ > + > +#include > + > +#if defined(RTE_LIB_SECURITY) > +#define AESNI_MB_DOCSIS_SEC_ENABLED 1 > +#include > +#include > +#include > +#endif > + > +#include "rte_ipsec_mb_pmd_private.h" > + > +#define AESNI_GCM_IV_LENGTH 12 > + > +static const struct rte_cryptodev_capabilities aesni_gcm_capabilities[] = =3D { > + { /* AES GMAC (AUTH) */ > + .op =3D RTE_CRYPTO_OP_TYPE_SYMMETRIC, > + {.sym =3D { > + .xform_type =3D RTE_CRYPTO_SYM_XFORM_AUTH, > + {.auth =3D { > + .algo =3D RTE_CRYPTO_AUTH_AES_GMAC, > + .block_size =3D 16, > + .key_size =3D { > + .min =3D 16, > + .max =3D 32, > + .increment =3D 8 > + }, > + .digest_size =3D { > + .min =3D 1, > + .max =3D 16, > + .increment =3D 1 > + }, > + .iv_size =3D { > + .min =3D AESNI_GCM_IV_LENGTH, > + .max =3D AESNI_GCM_IV_LENGTH, > + .increment =3D 0 > + } > + }, } > + }, } > + }, > + { /* AES GCM */ > + .op =3D RTE_CRYPTO_OP_TYPE_SYMMETRIC, > + {.sym =3D { > + .xform_type =3D RTE_CRYPTO_SYM_XFORM_AEAD, > + {.aead =3D { > + .algo =3D RTE_CRYPTO_AEAD_AES_GCM, > + .block_size =3D 16, > + .key_size =3D { > + .min =3D 16, > + .max =3D 32, > + .increment =3D 8 > + }, > + .digest_size =3D { > + .min =3D 1, > + .max =3D 16, > + .increment =3D 1 > + }, > + .aad_size =3D { > + .min =3D 0, > + .max =3D 65535, > + .increment =3D 1 > + }, > + .iv_size =3D { > + .min =3D AESNI_GCM_IV_LENGTH, > + .max =3D AESNI_GCM_IV_LENGTH, > + .increment =3D 0 > + } > + }, } > + }, } > + }, > + RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() > +}; > + > +uint8_t pmd_driver_id_aesni_gcm; > + > +enum aesni_gcm_key_length { > + GCM_KEY_128 =3D 0, > + GCM_KEY_192, > + GCM_KEY_256, > + GCM_NUM_KEY_TYPES > +}; > + > +typedef void (*aesni_gcm_t)(const struct gcm_key_data *gcm_key_data, > + struct gcm_context_data *gcm_ctx_data, > + uint8_t *out, const uint8_t *in, > + uint64_t plaintext_len, const uint8_t *iv, > + const uint8_t *aad, uint64_t aad_len, > + uint8_t *auth_tag, uint64_t auth_tag_len); > + > +typedef void (*aesni_gcm_pre_t)(const void *key, > + struct gcm_key_data *gcm_data); > + > +typedef void (*aesni_gcm_init_t)(const struct gcm_key_data > *gcm_key_data, > + struct gcm_context_data *gcm_ctx_data, > + const uint8_t *iv, uint8_t const *aad, > + uint64_t aad_len); > + > +typedef void (*aesni_gcm_update_t)(const struct gcm_key_data > *gcm_key_data, > + struct gcm_context_data *gcm_ctx_data, > + uint8_t *out, const uint8_t *in, > + uint64_t plaintext_len); > + > +typedef void (*aesni_gcm_finalize_t)(const struct gcm_key_data > *gcm_key_data, > + struct gcm_context_data *gcm_ctx_data, > + uint8_t *auth_tag, uint64_t auth_tag_len); > + > +typedef void (*aesni_gmac_init_t)(const struct gcm_key_data > *gcm_key_data, > + struct gcm_context_data *gcm_ctx_data, > + const uint8_t *iv, const uint64_t iv_len); > + > +typedef void (*aesni_gmac_update_t)(const struct gcm_key_data > *gcm_key_data, > + struct gcm_context_data *gcm_ctx_data, > + const uint8_t *in, > + const uint64_t plaintext_len); > + > +typedef void (*aesni_gmac_finalize_t)(const struct gcm_key_data > *gcm_key_data, > + struct gcm_context_data *gcm_ctx_data, > + uint8_t *auth_tag, > + const uint64_t auth_tag_len); > + > +/** GCM operation handlers */ > +struct aesni_gcm_ops { > + aesni_gcm_t enc; > + aesni_gcm_t dec; > + aesni_gcm_pre_t pre; > + aesni_gcm_init_t init; > + aesni_gcm_update_t update_enc; > + aesni_gcm_update_t update_dec; > + aesni_gcm_finalize_t finalize_enc; > + aesni_gcm_finalize_t finalize_dec; > + aesni_gmac_init_t gmac_init; > + aesni_gmac_update_t gmac_update; > + aesni_gmac_finalize_t gmac_finalize; > +}; > + > +RTE_DEFINE_PER_LCORE(struct aesni_gcm_ops[GCM_NUM_KEY_TYPES], > gcm_ops); > + > +struct aesni_gcm_qp_data { > + struct gcm_context_data gcm_ctx_data; > + uint8_t temp_digest[DIGEST_LENGTH_MAX]; > + /* *< Buffers used to store the digest generated > + * by the driver when verifying a digest provided > + * by the user (using authentication verify operation) > + */ > + struct aesni_gcm_ops ops[GCM_NUM_KEY_TYPES]; > + /**< Operation Handlers */ > +}; > + > +/** AESNI GCM private session structure */ > +struct aesni_gcm_session { > + struct { > + uint16_t length; > + uint16_t offset; > + } iv; > + /**< IV parameters */ > + uint16_t aad_length; > + /**< AAD length */ > + uint16_t req_digest_length; > + /**< Requested digest length */ > + uint16_t gen_digest_length; > + /**< Generated digest length */ > + enum ipsec_mb_operation op; > + /**< GCM operation type */ > + struct gcm_key_data gdata_key; > + /**< GCM parameters */ > + enum aesni_gcm_key_length key_length; > + /** Key Length */ > +}; Is it not better to move the above code in a header file? aesni_gcm_priv.h = ?? Similarly for others also?