From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id A27404C8B for ; Tue, 19 Jun 2018 17:58:36 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jun 2018 08:58:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,243,1526367600"; d="scan'208";a="65871484" Received: from irsmsx153.ger.corp.intel.com ([163.33.192.75]) by orsmga001.jf.intel.com with ESMTP; 19 Jun 2018 08:58:27 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.139]) by IRSMSX153.ger.corp.intel.com ([169.254.9.60]) with mapi id 14.03.0319.002; Tue, 19 Jun 2018 16:58:26 +0100 From: "De Lara Guarch, Pablo" To: Anoob Joseph , Akhil Goyal , Thomas Monjalon CC: Srisivasubramanian Srinivasan , Ankur Dwivedi , Jerin Jacob , Murthy NSSR , Narayana Prasad , "Nithin Dabilpuram" , Ragothaman Jayaraman , "dev@dpdk.org" Thread-Topic: [PATCH 11/16] crypto/cpt: add the basic device callback functions Thread-Index: AQHT/0jLdFrBXLkZ70iLbl40BOe9aaRnxYBg Date: Tue, 19 Jun 2018 15:58:25 +0000 Message-ID: References: <1528476325-15585-1-git-send-email-anoob.joseph@caviumnetworks.com> <1528476325-15585-12-git-send-email-anoob.joseph@caviumnetworks.com> In-Reply-To: <1528476325-15585-12-git-send-email-anoob.joseph@caviumnetworks.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiN2M0ZTY0NTktODlmMy00ZjFlLWE4NjYtZTRlYzQ3NzgwOGJjIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiUHlpN3hQNFwvb0k4cUpwN29QQVRudjdxUTFpM0x3cjlQRVNrYzRqZFR6QUU5REQ2K0Z5VzJGaVpuNjZzc0tEZmYifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 11/16] crypto/cpt: add the basic device callback functions 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: , X-List-Received-Date: Tue, 19 Jun 2018 15:58:37 -0000 > -----Original Message----- > From: Anoob Joseph [mailto:anoob.joseph@caviumnetworks.com] > Sent: Friday, June 8, 2018 5:45 PM > To: Akhil Goyal ; De Lara Guarch, Pablo > ; Thomas Monjalon > Cc: Srisivasubramanian Srinivasan > ; Ankur Dwivedi > ; Jerin Jacob > ; Murthy NSSR > ; Narayana Prasad > ; Nithin Dabilpuram > ; Ragothaman Jayaraman > ; dev@dpdk.org > Subject: [PATCH 11/16] crypto/cpt: add the basic device callback function= s >=20 > From: Srisivasubramanian Srinivasan > >=20 > This patch addresses the following: > 1. Adds the basic device operation functions for the cpt vf. > 2. The probe/remove functions are staic so no need to declare in the head= er file. > 3. Removing extra declaration for cpt_dev_periodic_alarm_stop in the head= er > file. >=20 > Signed-off-by: Ankur Dwivedi > Signed-off-by: Murthy NSSR > Signed-off-by: Nithin Dabilpuram > Signed-off-by: Ragothaman Jayaraman > > Signed-off-by: Srisivasubramanian Srinivasan > > --- > drivers/crypto/cpt/Makefile | 1 + > drivers/crypto/cpt/cpt_pmd_cryptodev.c | 13 +- > drivers/crypto/cpt/cpt_pmd_ops.c | 544 > +++++++++++++++++++++++++++++++++ > drivers/crypto/cpt/cpt_pmd_ops.h | 64 ++++ > 4 files changed, 616 insertions(+), 6 deletions(-) create mode 100644 > drivers/crypto/cpt/cpt_pmd_ops.c create mode 100644 > drivers/crypto/cpt/cpt_pmd_ops.h >=20 > diff --git a/drivers/crypto/cpt/Makefile b/drivers/crypto/cpt/Makefile in= dex > 40ec9e2..bf22c2b 100644 ... > +++ b/drivers/crypto/cpt/cpt_pmd_ops.c > @@ -0,0 +1,544 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2017 Cavium, Inc > + */ > + > +#include > +#include > +#include > + > +#include "cpt_pmd_logs.h" > +#include "cpt_pmd_ops.h" > +#include "base/cpt.h" > +#include "base/cpt_device.h" > + > +struct cpt_sess_misc { > + uint16_t cpt_op:4; > + uint16_t zsk_flag:4; > + uint16_t aes_gcm:1; > + uint16_t aes_ctr:1; > + uint16_t dir_dma_supp:1; /* Single frag DMA supported? */ > + uint16_t is_gmac:1; > + uint16_t aad_length; > + uint8_t mac_len; > + uint8_t iv_length; /**< IV length in bytes */ > + uint8_t auth_iv_length; /**< Auth IV length in bytes */ > + uint8_t rsvd1; > + uint16_t iv_offset; /**< IV offset in bytes */ > + uint16_t auth_iv_offset; /**< Auth IV offset in bytes */ > + uint32_t salt; > + phys_addr_t ctx_dma_addr; > +}; > + > +/* Helper macros */ > + > +#define SRC_IOV_SIZE \ > + (sizeof(iov_ptr_t) + (sizeof(buf_ptr_t) * MAX_SG_CNT)) #define > +DST_IOV_SIZE \ > + (sizeof(iov_ptr_t) + (sizeof(buf_ptr_t) * MAX_SG_CNT)) > + > +#define SESS_PRIV(__sess) \ > + (void *)((uint8_t *)__sess + sizeof(struct cpt_sess_misc)) > + > +#define BYTE_LEN 8 > + > +/* #define CPT_ALWAYS_USE_SG_MODE */ > +#define CPT_ALWAYS_USE_SEPARATE_BUF > + > +/* TODO: Add all other capabilities */ > +static const struct rte_cryptodev_capabilities cpt_capabilities[] =3D { > + { /* SHA1 HMAC */ > + .op =3D RTE_CRYPTO_OP_TYPE_SYMMETRIC, > + {.sym =3D { > + .xform_type =3D RTE_CRYPTO_SYM_XFORM_AUTH, > + {.auth =3D { > + .algo =3D RTE_CRYPTO_AUTH_SHA1_HMAC, > + .block_size =3D 64, > + .key_size =3D { > + .min =3D 64, > + .max =3D 64, > + .increment =3D 0 > + }, > + .digest_size =3D { > + .min =3D 1, > + .max =3D 20, > + .increment =3D 1 > + }, > + .aad_size =3D { 0 } Aad_size is not needed for authentication only algorithm, so it can be remo= ved from these ones. Unfortunately, it was left in the capabilities and to avoid breaking the AP= I, it won't be removed for the moment. ... > + { /* 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 8, > + .max =3D 16, > + .increment =3D 4 > + }, > + .aad_size =3D { > + .min =3D 1, > + .max =3D 65535, > + .increment =3D 1 > + } GMAC does not use AAD. All the message is passing in m_src. > + }, } > + }, } > + }, > + { /* SNOW 3G (UIA2) */ > + .op =3D RTE_CRYPTO_OP_TYPE_SYMMETRIC, > + {.sym =3D { > + .xform_type =3D RTE_CRYPTO_SYM_XFORM_AUTH, > + {.auth =3D { > + .algo =3D RTE_CRYPTO_AUTH_SNOW3G_UIA2, > + .block_size =3D 16, > + .key_size =3D { > + .min =3D 16, > + .max =3D 16, > + .increment =3D 0 > + }, > + .digest_size =3D { > + .min =3D 4, > + .max =3D 4, > + .increment =3D 0 > + }, > + .aad_size =3D { > + .min =3D 16, > + .max =3D 16, > + .increment =3D 0 > + } AAD is not used in SNOW3G/ZUC/KASUMI algorithms. ... > +void > +cptvf_dev_info_get(struct rte_cryptodev *dev, struct rte_cryptodev_info > +*info) { > + PMD_INIT_FUNC_TRACE(); > + if (info !=3D NULL) { > + info->max_nb_queue_pairs =3D CPT_NUM_QS_PER_VF; > + info->feature_flags =3D dev->feature_flags; > + info->capabilities =3D cpt_capabilities; > + /* TODO: Hardcoding as of now */ > + info->sym.max_nb_sessions =3D 128; Looks like "max_nb_sessions" will remain and if the PMD has no limitation, = it should be set to 0. Watch out for these series http://patches.dpdk.org/user/todo/dpdk/?series= =3D70. > + info->driver_id =3D cryptodev_cpt_driver_id;