From patchwork Thu Oct 15 09:56:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ray Kinsella X-Patchwork-Id: 80853 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8DE6BA04DB; Thu, 15 Oct 2020 11:59:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 100321DDE4; Thu, 15 Oct 2020 11:59:30 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 41ECD1DBA0 for ; Thu, 15 Oct 2020 11:59:27 +0200 (CEST) IronPort-SDR: z30yXDNBNqq/H25tGilXcxzk/Ptob42cPNvy1JP7eVPEFW+xGJQCWvZlZa3R01jY4Ul+3Tiuat SIKHX/bqewYg== X-IronPort-AV: E=McAfee;i="6000,8403,9774"; a="145622425" X-IronPort-AV: E=Sophos;i="5.77,378,1596524400"; d="scan'208";a="145622425" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Oct 2020 02:59:24 -0700 IronPort-SDR: xaCiWkb3EuSXK5Rr03kHli7J9+Y0CbdaJlY1mhAoB5ukKJgnPyszjz/SQGgkbJJbczRt5ZZy8a 6rBbfWGf/WhA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,378,1596524400"; d="scan'208";a="531192409" Received: from silpixa00396680.ir.intel.com (HELO silpixa00396680.ger.corp.intel.com) ([10.237.223.54]) by orsmga005.jf.intel.com with ESMTP; 15 Oct 2020 02:59:22 -0700 From: Ray Kinsella To: Declan Doherty , Ray Kinsella , Neil Horman , Anoob Joseph , Fiona Trahe , Akhil Goyal , Arek Kusztal Cc: thomas@monjalon.net, david.marchand@redhat.com, dev@dpdk.org Date: Thu, 15 Oct 2020 10:56:03 +0100 Message-Id: <20201015095603.4141566-1-mdr@ashroe.eu> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] cryptodev: revert support for 20.0 node 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" Function versioning to preserve the ABI was added to crytodev in commit a0f0de06d457 ("cryptodev: fix ABI compatibility for ChaCha20-Poly1305"). This is no longer required in the DPDK_21 version node. Fixes: b922dbd38ced ("cryptodev: add ChaCha20-Poly1305 AEAD algorithm") Signed-off-by: Ray Kinsella --- lib/librte_cryptodev/rte_cryptodev.c | 139 +----------------- lib/librte_cryptodev/rte_cryptodev.h | 33 ----- .../rte_cryptodev_version.map | 6 - 3 files changed, 4 insertions(+), 174 deletions(-) diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index 1dd795bcb..a74daee46 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -36,8 +36,6 @@ #include #include #include -#include -#include #include "rte_crypto.h" #include "rte_cryptodev.h" @@ -59,11 +57,6 @@ static struct rte_cryptodev_global cryptodev_globals = { /* spinlock for crypto device callbacks */ static rte_spinlock_t rte_cryptodev_cb_lock = RTE_SPINLOCK_INITIALIZER; -static const struct rte_cryptodev_capabilities - cryptodev_undefined_capabilities[] = { - RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() -}; - static struct rte_cryptodev_capabilities *capability_copy[RTE_CRYPTO_MAX_DEVS]; static uint8_t is_capability_checked[RTE_CRYPTO_MAX_DEVS]; @@ -291,43 +284,8 @@ rte_crypto_auth_operation_strings[] = { [RTE_CRYPTO_AUTH_OP_GENERATE] = "generate" }; -const struct rte_cryptodev_symmetric_capability __vsym * -rte_cryptodev_sym_capability_get_v20(uint8_t dev_id, - const struct rte_cryptodev_sym_capability_idx *idx) -{ - const struct rte_cryptodev_capabilities *capability; - struct rte_cryptodev_info dev_info; - int i = 0; - - rte_cryptodev_info_get_v20(dev_id, &dev_info); - - while ((capability = &dev_info.capabilities[i++])->op != - RTE_CRYPTO_OP_TYPE_UNDEFINED) { - if (capability->op != RTE_CRYPTO_OP_TYPE_SYMMETRIC) - continue; - - if (capability->sym.xform_type != idx->type) - continue; - - if (idx->type == RTE_CRYPTO_SYM_XFORM_AUTH && - capability->sym.auth.algo == idx->algo.auth) - return &capability->sym; - - if (idx->type == RTE_CRYPTO_SYM_XFORM_CIPHER && - capability->sym.cipher.algo == idx->algo.cipher) - return &capability->sym; - - if (idx->type == RTE_CRYPTO_SYM_XFORM_AEAD && - capability->sym.aead.algo == idx->algo.aead) - return &capability->sym; - } - - return NULL; -} -VERSION_SYMBOL(rte_cryptodev_sym_capability_get, _v20, 20.0); - -const struct rte_cryptodev_symmetric_capability __vsym * -rte_cryptodev_sym_capability_get_v21(uint8_t dev_id, +const struct rte_cryptodev_symmetric_capability * +rte_cryptodev_sym_capability_get(uint8_t dev_id, const struct rte_cryptodev_sym_capability_idx *idx) { const struct rte_cryptodev_capabilities *capability; @@ -359,11 +317,6 @@ rte_cryptodev_sym_capability_get_v21(uint8_t dev_id, return NULL; } -MAP_STATIC_SYMBOL(const struct rte_cryptodev_symmetric_capability * - rte_cryptodev_sym_capability_get(uint8_t dev_id, - const struct rte_cryptodev_sym_capability_idx *idx), - rte_cryptodev_sym_capability_get_v21); -BIND_DEFAULT_SYMBOL(rte_cryptodev_sym_capability_get, _v21, 21); static int param_range_check(uint16_t size, const struct rte_crypto_param_range *range) @@ -1233,89 +1186,8 @@ rte_cryptodev_stats_reset(uint8_t dev_id) (*dev->dev_ops->stats_reset)(dev); } -static void -get_v20_capabilities(uint8_t dev_id, struct rte_cryptodev_info *dev_info) -{ - const struct rte_cryptodev_capabilities *capability; - uint8_t found_invalid_capa = 0; - uint8_t counter = 0; - - for (capability = dev_info->capabilities; - capability->op != RTE_CRYPTO_OP_TYPE_UNDEFINED; - ++capability, ++counter) { - if (capability->op == RTE_CRYPTO_OP_TYPE_SYMMETRIC && - capability->sym.xform_type == - RTE_CRYPTO_SYM_XFORM_AEAD - && capability->sym.aead.algo >= - RTE_CRYPTO_AEAD_CHACHA20_POLY1305) { - found_invalid_capa = 1; - counter--; - } - } - is_capability_checked[dev_id] = 1; - if (!found_invalid_capa) - return; - capability_copy[dev_id] = malloc(counter * - sizeof(struct rte_cryptodev_capabilities)); - if (capability_copy[dev_id] == NULL) { - /* - * error case - no memory to store the trimmed - * list, so have to return an empty list - */ - dev_info->capabilities = - cryptodev_undefined_capabilities; - is_capability_checked[dev_id] = 0; - } else { - counter = 0; - for (capability = dev_info->capabilities; - capability->op != - RTE_CRYPTO_OP_TYPE_UNDEFINED; - capability++) { - if (!(capability->op == - RTE_CRYPTO_OP_TYPE_SYMMETRIC - && capability->sym.xform_type == - RTE_CRYPTO_SYM_XFORM_AEAD - && capability->sym.aead.algo >= - RTE_CRYPTO_AEAD_CHACHA20_POLY1305)) { - capability_copy[dev_id][counter++] = - *capability; - } - } - dev_info->capabilities = - capability_copy[dev_id]; - } -} - -void __vsym -rte_cryptodev_info_get_v20(uint8_t dev_id, struct rte_cryptodev_info *dev_info) -{ - struct rte_cryptodev *dev; - - if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) { - CDEV_LOG_ERR("Invalid dev_id=%d", dev_id); - return; - } - - dev = &rte_crypto_devices[dev_id]; - - memset(dev_info, 0, sizeof(struct rte_cryptodev_info)); - - RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get); - (*dev->dev_ops->dev_infos_get)(dev, dev_info); - - if (capability_copy[dev_id] == NULL) { - if (!is_capability_checked[dev_id]) - get_v20_capabilities(dev_id, dev_info); - } else - dev_info->capabilities = capability_copy[dev_id]; - - dev_info->driver_name = dev->device->driver->name; - dev_info->device = dev->device; -} -VERSION_SYMBOL(rte_cryptodev_info_get, _v20, 20.0); - -void __vsym -rte_cryptodev_info_get_v21(uint8_t dev_id, struct rte_cryptodev_info *dev_info) +void +rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info) { struct rte_cryptodev *dev; @@ -1334,9 +1206,6 @@ rte_cryptodev_info_get_v21(uint8_t dev_id, struct rte_cryptodev_info *dev_info) dev_info->driver_name = dev->device->driver->name; dev_info->device = dev->device; } -MAP_STATIC_SYMBOL(void rte_cryptodev_info_get(uint8_t dev_id, - struct rte_cryptodev_info *dev_info), rte_cryptodev_info_get_v21); -BIND_DEFAULT_SYMBOL(rte_cryptodev_info_get, _v21, 21); int rte_cryptodev_callback_register(uint8_t dev_id, diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h index 7b3ebc20f..f4767b52c 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -219,14 +219,6 @@ struct rte_cryptodev_asym_capability_idx { * - Return NULL if the capability not exist. */ const struct rte_cryptodev_symmetric_capability * -rte_cryptodev_sym_capability_get_v20(uint8_t dev_id, - const struct rte_cryptodev_sym_capability_idx *idx); - -const struct rte_cryptodev_symmetric_capability * -rte_cryptodev_sym_capability_get_v21(uint8_t dev_id, - const struct rte_cryptodev_sym_capability_idx *idx); - -const struct rte_cryptodev_symmetric_capability * rte_cryptodev_sym_capability_get(uint8_t dev_id, const struct rte_cryptodev_sym_capability_idx *idx); @@ -789,34 +781,9 @@ rte_cryptodev_stats_reset(uint8_t dev_id); * the last valid element has it's op field set to * RTE_CRYPTO_OP_TYPE_UNDEFINED. */ - void rte_cryptodev_info_get(uint8_t dev_id, struct rte_cryptodev_info *dev_info); -/* An extra element RTE_CRYPTO_AEAD_CHACHA20_POLY1305 is added - * to enum rte_crypto_aead_algorithm, also changing the value of - * RTE_CRYPTO_AEAD_LIST_END. To maintain ABI compatibility with applications - * which linked against earlier versions, preventing them, for example, from - * picking up the new value and using it to index into an array sized too small - * for it, it is necessary to have two versions of rte_cryptodev_info_get() - * The latest version just returns directly the capabilities retrieved from - * the device. The compatible version inspects the capabilities retrieved - * from the device, but only returns them directly if the new value - * is not included. If the new value is included, it allocates space - * for a copy of the device capabilities, trims the new value from this - * and returns this copy. It only needs to do this once per device. - * For the corner case of a corner case when the alloc may fail, - * an empty capability list is returned, as there is no mechanism to return - * an error and adding such a mechanism would itself be an ABI breakage. - * The compatible version can be removed after the next major ABI release. - */ - -void -rte_cryptodev_info_get_v20(uint8_t dev_id, struct rte_cryptodev_info *dev_info); - -void -rte_cryptodev_info_get_v21(uint8_t dev_id, struct rte_cryptodev_info *dev_info); - /** * Register a callback function for specific device id. * diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map index 02f6dcf72..7727286ac 100644 --- a/lib/librte_cryptodev/rte_cryptodev_version.map +++ b/lib/librte_cryptodev/rte_cryptodev_version.map @@ -58,12 +58,6 @@ DPDK_21 { local: *; }; -DPDK_20.0 { - global: - rte_cryptodev_info_get; - rte_cryptodev_sym_capability_get; -}; - EXPERIMENTAL { global: