From 27e71c7fdce4b843ce79308f18ad342d0ddf7536 Mon Sep 17 00:00:00 2001 From: Konstantin Ananyev Date: Thu, 7 Mar 2019 14:13:14 +0000 Subject: [PATCH] cryptodev: restore crypto op alignment and layout in 18.08 new cache-aligned structure rte_crypto_asym_op was introduced. As it also was included into rte_crypto_op, it caused implicit change in rte_crypto_op layout and alignment: now rte_crypto_op is cache-line aligned has a hole of 40/104 bytes between phys_addr and sym/asym op. It looks like unintended ABI breakage, plus such change can cause negative performance effects: - now status and sym[0].m_src lies on different cache-lines, so post-process code would need extra cache-line read. - new alignment causes grow of the space requirements and cache-line reads/updates for structures that contain rte_crypto_op inside. As there seems no actual need to have rte_crypto_asym_op cache-line aligned, and rte_crypto_asym_op is not intended to be used on it's own - the simplest fix is just to remove cache-line alignment for it. As the immediate positive effect: on IA ipsec-secgw performance increased by 5-10% (depending on the crypto-dev and algo used). My guess that on machines with 128B cache-line and lookaside-protocol capable crypto devices the impact will be even more noticeable. Fixes: 26008aaed14c ("cryptodev: add asymmetric xform and op definitions") Cc: stable@dpdk.org Signed-off-by: Konstantin Ananyev Acked-by: Fiona Trahe Acked-by: Shally Verma Acked-by: Akhil Goyal --- doc/guides/rel_notes/release_19_05.rst | 9 ++++++++- lib/librte_cryptodev/Makefile | 2 +- lib/librte_cryptodev/meson.build | 2 +- lib/librte_cryptodev/rte_crypto_asym.h | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst index 6f76de3ff7..c4d32fe548 100644 --- a/doc/guides/rel_notes/release_19_05.rst +++ b/doc/guides/rel_notes/release_19_05.rst @@ -141,6 +141,13 @@ ABI Changes Also, make sure to start the actual text at the margin. ========================================================= +* cryptodev: in 18.08 new structure ``rte_crypto_asym_op`` was introduced and + included into ``rte_crypto_op``. As ``rte_crypto_asym_op`` structure was + defined as cache-line aligned that caused unintended changes in + ``rte_crypto_op`` structure layout and alignment. Remove cache-line + alignment for ``rte_crypto_asym_op`` to restore expected ``rte_crypto_op`` + layout and alignment. + Shared Library Versions ----------------------- @@ -172,7 +179,7 @@ The libraries prepended with a plus sign were incremented in this version. librte_cfgfile.so.2 librte_cmdline.so.2 librte_compressdev.so.1 - librte_cryptodev.so.6 + + librte_cryptodev.so.7 librte_distributor.so.1 librte_eal.so.9 librte_efd.so.1 diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile index 859c4f0f13..c20e090a8f 100644 --- a/lib/librte_cryptodev/Makefile +++ b/lib/librte_cryptodev/Makefile @@ -7,7 +7,7 @@ include $(RTE_SDK)/mk/rte.vars.mk LIB = librte_cryptodev.a # library version -LIBABIVER := 6 +LIBABIVER := 7 # build flags CFLAGS += -O3 diff --git a/lib/librte_cryptodev/meson.build b/lib/librte_cryptodev/meson.build index bcd9694378..9e009d4669 100644 --- a/lib/librte_cryptodev/meson.build +++ b/lib/librte_cryptodev/meson.build @@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017-2019 Intel Corporation -version = 6 +version = 7 allow_experimental_apis = true sources = files('rte_cryptodev.c', 'rte_cryptodev_pmd.c') headers = files('rte_cryptodev.h', diff --git a/lib/librte_cryptodev/rte_crypto_asym.h b/lib/librte_cryptodev/rte_crypto_asym.h index 0a50cd5c0d..265559c7a7 100644 --- a/lib/librte_cryptodev/rte_crypto_asym.h +++ b/lib/librte_cryptodev/rte_crypto_asym.h @@ -500,7 +500,7 @@ struct rte_crypto_asym_op { struct rte_crypto_dh_op_param dh; struct rte_crypto_dsa_op_param dsa; }; -} __rte_cache_aligned; +}; #ifdef __cplusplus } -- 2.20.1