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 E0362A0577; Tue, 7 Apr 2020 20:51:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CC3AF1BF54; Tue, 7 Apr 2020 20:51:30 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 2ACFD1BF3C for ; Tue, 7 Apr 2020 20:51:27 +0200 (CEST) IronPort-SDR: B8NwDaa9a7uzoQ5IXo5WgLb6BLpDmz+PE6EJdTNQnM6BTe6wHTc0ZAe9g8fUjNBYJkn+N3/vMA tcP5ui6vH+bA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2020 11:51:26 -0700 IronPort-SDR: vyk6MvBKjdlDhSxiF05qKP0pTKSPH5V6T7uBQTyV6xh9wUhjtLJz3cTaW4WKvu27Ae1Qb8BONK MMIcLtdJjcPg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,356,1580803200"; d="scan'208";a="251321387" Received: from orsmsx107.amr.corp.intel.com ([10.22.240.5]) by orsmga003.jf.intel.com with ESMTP; 07 Apr 2020 11:51:26 -0700 Received: from orsmsx115.amr.corp.intel.com (10.22.240.11) by ORSMSX107.amr.corp.intel.com (10.22.240.5) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 7 Apr 2020 11:51:26 -0700 Received: from ORSEDG001.ED.cps.intel.com (10.7.248.4) by ORSMSX115.amr.corp.intel.com (10.22.240.11) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 7 Apr 2020 11:51:25 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.103) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 7 Apr 2020 11:51:25 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KiaQFCVCEI8bcBGUTzJusCylbAYptXrs158cjmywdWRvpRisZ0b3bjeJs+RRHtvHu4UYtA/iGuQmdx4ZlIsP+7OtSUk5WI7ZKkLct1b8Qjl+HsMRYU63+05JXdlSRXajjek1OMMq2FarBQwxZ+Dvu75R7F6H49BODReyFrRy8bJIfTVZOnnCM0u+CD6IoNs5JUU8xIEgKc/Ejgi6dCKRyELNSNn3iEV6mycsy6O5bSnarxm6lonCGqKY9Gz0AUgXxUUEnGzcx+zlJfaoFp/EhwlPIktGhcSlndxrsO/5CpgU30A0mix5c/72PVdVWovV22TWXbErcP5+wL18rO5fDQ== 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-SenderADCheck; bh=wng1IMRClbWoDeqyNLZoXVvbSrdRgBYl3lbmSazrJxA=; b=TqH+KDp017xbpj+C2Yte0wPW8tTFnJbZyIIYS4Gi9gnvIwK33xK9gbjqWl8TGIRNSYmAP9uMB9t+M2mBThXDOGXwvh/WpAzYHH9pb473M6eIspos1u2hLD9vUlKiCj0rtQaWsIDGdxun+S18+2IHujxUu1bkGkpZjRXtlhnFm8VK28wUf43XMwymsz4B5VF4KARLJC+FRtp5w1utZNlbIABNcXwPlxZ3HZL0kJSBdMNxuy0Cf2P9cSiti/mpjeR8P3XEDlyKG2X7DafMgTegho6826S/LVSf0Sh9/rFCXa0qiHNE7CNlCiDDTR0APwCXr6RdeunDvzzn2R86A/uI1A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wng1IMRClbWoDeqyNLZoXVvbSrdRgBYl3lbmSazrJxA=; b=R/BCpC1opPsnaP7MDpwkKKLuGweEbicmt+IGAc/QAwygqtedaKNSXQV5HOGBdDhedSyUn1GmRdJkhoG25y8DSmn3SlxYPw9C1rPL0SlTpdKv1bT9vXWAJ0bESdLEtDKgja++xqwZB9iAsdJkDEbPV4teEJD5Fa/uA+N+Vrj0/ZI= Received: from SN6PR11MB3101.namprd11.prod.outlook.com (2603:10b6:805:d8::23) by SN6PR11MB2880.namprd11.prod.outlook.com (2603:10b6:805:58::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.15; Tue, 7 Apr 2020 18:51:22 +0000 Received: from SN6PR11MB3101.namprd11.prod.outlook.com ([fe80::f9a3:b1f8:9a17:911a]) by SN6PR11MB3101.namprd11.prod.outlook.com ([fe80::f9a3:b1f8:9a17:911a%7]) with mapi id 15.20.2878.018; Tue, 7 Apr 2020 18:51:22 +0000 From: "De Lara Guarch, Pablo" To: "Coyle, David" , "dev@dpdk.org" CC: "Doherty, Declan" , "Trahe, Fiona" , "Ryan, Brendan" , "shreyansh.jain@nxp.com" , "hemant.agrawal@nxp.com" , "O'loingsigh, Mairtin" Thread-Topic: [PATCH v2 2/4] raw/aesni_mb: add aesni_mb raw device Thread-Index: AQHWCdfYn3OdRvhLuUW9PGtZ1mM2LahsSKig Date: Tue, 7 Apr 2020 18:51:22 +0000 Message-ID: References: <20200403163656.60545-1-david.coyle@intel.com> <20200403163656.60545-3-david.coyle@intel.com> In-Reply-To: <20200403163656.60545-3-david.coyle@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.2.0.6 authentication-results: spf=none (sender IP is ) smtp.mailfrom=pablo.de.lara.guarch@intel.com; x-originating-ip: [192.198.151.184] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 46b1cd5a-47d0-44fc-16b8-08d7db24aaa6 x-ms-traffictypediagnostic: SN6PR11MB2880: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-forefront-prvs: 036614DD9C x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR11MB3101.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(10019020)(366004)(71200400001)(81166006)(52536014)(8676002)(186003)(8936002)(66476007)(66946007)(4326008)(66556008)(33656002)(2906002)(64756008)(76116006)(7696005)(110136005)(107886003)(81156014)(66446008)(55016002)(9686003)(498600001)(54906003)(26005)(53546011)(5660300002)(86362001)(6506007); DIR:OUT; SFP:1102; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 2+lrS8HtDlpg9Xr/ys0wFkoik56T3iHVW1bYc173QHjQCJ9Bdwp0p/JVodCw8YeOBM3Sgkaryw3A1rZ6VUaK4xo4c2JTSiotlvLys+KRft5qedZgSsbrp0JasrDbTVswwFz7lToPRm5xdUWxCHmwb/Nx8SXUhLv7PRVTr93pqqthjVE3e89hyeqilejNd8j2IlduWRm5meL7F3qmalmJbTn2O3+SMJtKWjK1XhoP7C1eXhMBfdTsizYUKquK9p2VaKJfIbtIR1dC65PK9/0/4a0hv6TLs1hW5EauTS6ZZZzv1YBy5/TmMYdCgcFtj+fcfcm0bWE0jEtrzHTtXdVLVVWHmiwppT/hnLB0fGBioz0azM7KJCmxjDlUuHhr7E8sRzCADlnwlJK8HwYOWBal2P0wpG3HPqLACyPaxr8BQrqYlOs60+JssdnhhQI57oGG x-ms-exchange-antispam-messagedata: CJcBJuT72Ot7e1ldiY8mudZj/O33tyCD9wi2evqYlt4vZLPNhgSOZOJbnjqN+hpRrKBqVPGNdtIf//mxXBxqsAXsXtFsg0nsnaFuWUd7Xh1bq3Hc30xyLmMwoje7mtccFwuB29XAzUcRwssGHB6Khg== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 46b1cd5a-47d0-44fc-16b8-08d7db24aaa6 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Apr 2020 18:51:22.1843 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: CwRRD/L0AVDx6+ss6hQgITTPL51RFPAFJGoAkklC9Xvelu+prgPTzREjaq0uz7iOl7G7hRoArRVK0lKyvB0BzTPLqxgFGorxS7ax+el7u5E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB2880 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2 2/4] raw/aesni_mb: add aesni_mb raw device 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" Hi David, > -----Original Message----- > From: Coyle, David > Sent: Friday, April 3, 2020 5:37 PM > To: dev@dpdk.org > Cc: Doherty, Declan ; Trahe, Fiona > ; De Lara Guarch, Pablo > ; Ryan, Brendan ; > shreyansh.jain@nxp.com; hemant.agrawal@nxp.com; Coyle, David > ; O'loingsigh, Mairtin > Subject: [PATCH v2 2/4] raw/aesni_mb: add aesni_mb raw device >=20 > Adding an AESNI-MB raw device, thereby exposing AESNI-MB to the > rawdev API. The AESNI-MB raw device will use the multi-function > interface to allow combined operations be sent to the AESNI-MB > software library. >=20 > Signed-off-by: David Coyle > Signed-off-by: Mairtin o Loingsigh > --- > config/common_base | 6 + > drivers/raw/Makefile | 2 + > drivers/raw/aesni_mb/Makefile | 47 + > drivers/raw/aesni_mb/aesni_mb_rawdev.c | 1536 +++++++++++++++++ > drivers/raw/aesni_mb/aesni_mb_rawdev.h | 112 ++ > drivers/raw/aesni_mb/aesni_mb_rawdev_test.c | 1102 ++++++++++++ > .../aesni_mb/aesni_mb_rawdev_test_vectors.h | 1183 +++++++++++++ > drivers/raw/aesni_mb/meson.build | 26 + > .../aesni_mb/rte_rawdev_aesni_mb_version.map | 3 + > drivers/raw/meson.build | 3 +- > mk/rte.app.mk | 2 + You missed adding the PMD to the MAINTAINERS file. > 11 files changed, 4021 insertions(+), 1 deletion(-) > create mode 100644 drivers/raw/aesni_mb/Makefile > create mode 100644 drivers/raw/aesni_mb/aesni_mb_rawdev.c > create mode 100644 drivers/raw/aesni_mb/aesni_mb_rawdev.h > create mode 100644 drivers/raw/aesni_mb/aesni_mb_rawdev_test.c > create mode 100644 drivers/raw/aesni_mb/aesni_mb_rawdev_test_vectors.h > create mode 100644 drivers/raw/aesni_mb/meson.build > create mode 100644 > drivers/raw/aesni_mb/rte_rawdev_aesni_mb_version.map >=20 > diff --git a/config/common_base b/config/common_base > index 4f004968b..7ac6a3428 100644 > --- a/config/common_base > +++ b/config/common_base > @@ -818,6 +818,12 @@ > CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV=3Dy > # > CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV=3Dy >=20 > +# > +# Compile PMD for AESNI raw device > +# > +CONFIG_RTE_LIBRTE_PMD_AESNI_MB_RAWDEV=3Dn > +CONFIG_RTE_LIBRTE_PMD_AESNI_MB_RAWDEV_DEBUG=3Dn > + > # > # Compile multi-fn raw device interface > # > diff --git a/drivers/raw/Makefile b/drivers/raw/Makefile > index e16da8d95..5aa608e1e 100644 > --- a/drivers/raw/Makefile > +++ b/drivers/raw/Makefile > @@ -15,5 +15,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_NTB_RAWDEV) +=3D ntb > DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_DMA_RAWDEV) +=3D > octeontx2_dma > DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX2_EP_RAWDEV) +=3D > octeontx2_ep > DIRS-y +=3D common > +DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB_RAWDEV) +=3D aesni_mb > +DEPDIRS-aesni_mb :=3D common >=20 > include $(RTE_SDK)/mk/rte.subdir.mk > diff --git a/drivers/raw/aesni_mb/Makefile b/drivers/raw/aesni_mb/Makefil= e > new file mode 100644 > index 000000000..0a40b75b4 > --- /dev/null > +++ b/drivers/raw/aesni_mb/Makefile > @@ -0,0 +1,47 @@ > +# SPDX-License-Identifier: BSD-3-Clause > +# Copyright(c) 2020 Intel Corporation. > + > +include $(RTE_SDK)/mk/rte.vars.mk > + > +# library name > +LIB =3D librte_pmd_aesni_mb_rawdev.a > + > +# build flags > +CFLAGS +=3D -O3 > +CFLAGS +=3D $(WERROR_FLAGS) > +CFLAGS +=3D -DALLOW_EXPERIMENTAL_API > + > +# versioning export map > +EXPORT_MAP :=3D rte_rawdev_aesni_mb_version.map > + > +# external library dependencies > +LDLIBS +=3D -lIPSec_MB > +LDLIBS +=3D -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring > +LDLIBS +=3D -lrte_rawdev > +LDLIBS +=3D -lrte_bus_vdev > +LDLIBS +=3D -lrte_multi_fn > + > +ifneq ($(CONFIG_RTE_LIBRTE_MULTI_FN_COMMON),y) > +$(error "RTE_LIBRTE_MULTI_FN_COMMON is required to build aesni_mb raw > device") > +endif > + > +IMB_HDR =3D $(shell echo '\#include ' | \ > + $(CC) -E $(EXTRA_CFLAGS) - | grep 'intel-ipsec-mb.h' | \ > + head -n1 | cut -d'"' -f2) > + > +# Detect library version > +IMB_VERSION =3D $(shell grep -e "IMB_VERSION_STR" $(IMB_HDR) | cut -d'"'= - > f2) > +IMB_VERSION_NUM =3D $(shell grep -e "IMB_VERSION_NUM" $(IMB_HDR) | cut > -d' ' -f3) > + > +ifeq ($(IMB_VERSION),) > +$(error "IPSec_MB version >=3D 0.53.3 is required to build aesni_mb raw = device") > +endif > + > +ifeq ($(shell expr $(IMB_VERSION_NUM) \< 0x3503), 1) > +$(error "IPSec_MB version >=3D 0.53.3 is required to build aesni_mb raw = device") > +endif > + > +SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB_RAWDEV) +=3D > aesni_mb_rawdev.c > +SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB_RAWDEV) +=3D > aesni_mb_rawdev_test.c > + > +include $(RTE_SDK)/mk/rte.lib.mk > diff --git a/drivers/raw/aesni_mb/aesni_mb_rawdev.c > b/drivers/raw/aesni_mb/aesni_mb_rawdev.c > new file mode 100644 > index 000000000..946bdd871 > --- /dev/null > +++ b/drivers/raw/aesni_mb/aesni_mb_rawdev.c > @@ -0,0 +1,1536 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2020 Intel Corporation. > + */ > + > +#include > + > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include No need for , , , and . I think is missing, though, for "rte_crypto_sym_xform". ... > +static bool > +docsis_crc_crypto_encrypt_check(struct rte_multi_fn_xform *xform) > +{ > + struct rte_crypto_sym_xform *crypto_sym; > + struct rte_multi_fn_err_detect_xform *err_detect; > + struct rte_multi_fn_xform *next; > + > + if (xform->type =3D=3D RTE_MULTI_FN_XFORM_TYPE_ERR_DETECT) { > + > + err_detect =3D &xform->err_detect; > + next =3D xform->next; > + > + if (err_detect->algo =3D=3D > + RTE_MULTI_FN_ERR_DETECT_CRC32_ETH && > + err_detect->op =3D=3D > + RTE_MULTI_FN_ERR_DETECT_OP_GENERATE > && I don't think leading spaces are allowed. Generally, double tab is used in multi-line if's. Same applies in other parts of the code. > + next !=3D NULL && > + next->type =3D=3D RTE_MULTI_FN_XFORM_TYPE_CRYPTO_SYM) { > + ... > +static bool > +docsis_crypto_decrypt_crc_check(struct rte_multi_fn_xform *xform) > +{ > + struct rte_crypto_sym_xform *crypto_sym; > + struct rte_multi_fn_err_detect_xform *err_detect; > + struct rte_multi_fn_xform *next; > + > + if (xform->type =3D=3D RTE_MULTI_FN_XFORM_TYPE_CRYPTO_SYM) { I think in order to reduce this many indentation levels, you can check for = the opposite here and return false. If (xform->type !=3D RTE...) return false ... > + > +static bool > +pon_crc_crypto_encrypt_bip_check(struct rte_multi_fn_xform *xform) > +{ > + struct rte_crypto_sym_xform *crypto_sym; > + struct rte_multi_fn_err_detect_xform *err_detect; > + struct rte_multi_fn_xform *next; > + > + if (xform->type =3D=3D RTE_MULTI_FN_XFORM_TYPE_ERR_DETECT) { > + > + err_detect =3D &xform->err_detect; > + next =3D xform->next; Same as above here. > + > + if (err_detect->algo =3D=3D > + RTE_MULTI_FN_ERR_DETECT_CRC32_ETH && > + err_detect->op =3D=3D > +static bool > +pon_bip_crypto_decrypt_crc_check(struct rte_multi_fn_xform *xform) > +{ > + struct rte_crypto_sym_xform *crypto_sym; > + struct rte_multi_fn_err_detect_xform *err_detect; > + struct rte_multi_fn_xform *next; > + > + if (xform->type =3D=3D RTE_MULTI_FN_XFORM_TYPE_ERR_DETECT) { > + > + err_detect =3D &xform->err_detect; > + next =3D xform->next; Same as above. > +} > + > +static enum aesni_mb_rawdev_op > +session_support_check(struct rte_multi_fn_xform *xform) > +{ > + enum aesni_mb_rawdev_op op =3D > AESNI_MB_RAWDEV_OP_NOT_SUPPORTED; > + ... > +static inline int > +docsis_crypto_crc_check(struct rte_multi_fn_op *first_op, > + struct rte_multi_fn_op *cipher_op, > + struct rte_multi_fn_op *crc_op) > +{ > + struct rte_multi_fn_op *err_op =3D NULL; > + uint8_t err_op_status; > + const uint32_t offset_diff =3D DOCSIS_CIPHER_CRC_OFFSET_DIFF; > + > + if (cipher_op->crypto_sym.cipher.data.length && > + crc_op->err_detect.data.length) { > + /* Cipher offset must be at least 12 greater than CRC offset */ > + if (cipher_op->crypto_sym.cipher.data.offset < > + ((uint32_t)crc_op->err_detect.data.offset + offset_diff)) { > + err_op =3D crc_op; > + err_op_status =3D > RTE_MULTI_FN_ERR_DETECT_OP_STATUS_ERROR; > + /* > + * Cipher length must be at least 8 less than CRC length, taking > + * known differences of what is ciphered and what is crc'ed into > + * account > + */ > + } else if ((cipher_op->crypto_sym.cipher.data.length + > + DOCSIS_CIPHER_CRC_LENGTH_DIFF) > For consistency, you can use offset_diff here too, instead of the macro. > + crc_op->err_detect.data.length) { > + err_op =3D crc_op; > + err_op_status =3D > RTE_MULTI_FN_ERR_DETECT_OP_STATUS_ERROR; > + } > + } ... > +static inline int > +mb_job_params_set(JOB_AES_HMAC *job, > + struct aesni_mb_rawdev_qp *qp, > + struct rte_multi_fn_op *op, > + uint8_t *output_idx) > +{ > + struct rte_mbuf *m_src, *m_dst; > + struct rte_multi_fn_op *cipher_op; > + struct rte_multi_fn_op *crc_op; > + struct rte_multi_fn_op *bip_op; > + uint32_t cipher_offset; > + struct aesni_mb_rawdev_session *session; > + ... > + cipher_op->crypto_sym.cipher.data.length; I would declare a variable like sym_op to reduce the length of these. Maybe also for err_dectect. > + > + switch (session->op) { > + case AESNI_MB_RAWDEV_OP_DOCSIS_CRC_CRYPTO: > + case AESNI_MB_RAWDEV_OP_DOCSIS_CRYPTO_CRC: > + job->hash_start_src_offset_in_bytes =3D > + crc_op- ... > +++ b/drivers/raw/aesni_mb/aesni_mb_rawdev_test.c > @@ -0,0 +1,1102 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2020 Intel Corporation. Could this be moved under the test app? Looks odd here. Thanks, Pablo