From mboxrd@z Thu Jan 1 00:00:00 1970 From: "De Lara Guarch, Pablo" Subject: Re: [PATCH 11/16] crypto/cpt: add the basic device callback functions 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> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: Srisivasubramanian Srinivasan , Ankur Dwivedi , Jerin Jacob , Murthy NSSR , Narayana Prasad , "Nithin Dabilpuram" , Ragothaman Jayaraman , "dev@dpdk.org" To: Anoob Joseph , Akhil Goyal , Thomas Monjalon 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) In-Reply-To: <1528476325-15585-12-git-send-email-anoob.joseph@caviumnetworks.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----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;