From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 48C0C5B20 for ; Mon, 25 Jun 2018 18:55:12 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jun 2018 09:55:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,270,1526367600"; d="scan'208";a="66194072" Received: from silpixa00399466.ir.intel.com (HELO silpixa00399466.ger.corp.intel.com) ([10.237.223.220]) by fmsmga004.fm.intel.com with ESMTP; 25 Jun 2018 09:55:09 -0700 From: Pablo de Lara To: declan.doherty@intel.com, akhil.goyal@nxp.com, shally.verma@caviumnetworks.com, ravi1.kumar@amd.com, jerin.jacob@caviumnetworks.com, roy.fan.zhang@intel.com, fiona.trahe@intel.com, tdu@semihalf.com, jianjay.zhou@huawei.com Cc: dev@dpdk.org, Pablo de Lara Date: Mon, 25 Jun 2018 09:48:54 +0100 Message-Id: <20180625084856.25205-14-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180625084856.25205-1-pablo.de.lara.guarch@intel.com> References: <20180608220234.10170-1-pablo.de.lara.guarch@intel.com> <20180625084856.25205-1-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH v2 13/15] cryptodev: replace mbuf scatter gather flag 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: Mon, 25 Jun 2018 16:55:12 -0000 The current mbuf scatter gatter feature flag is too ambiguous, as it is not clear if input and/or output buffers can be scatter gather mbufs or not, plus if in-place and/or out-of-place is supported. Therefore, five new flags will replace this flag: - RTE_CRYPTODEV_FF_IN_PLACE_SGL - RTE_CRYPTODEV_FF_OUT_OF_PLACE_SGL_IN_SGL_OUT - RTE_CRYPTODEV_FF_OUT_OF_PLACE_SGL_IN_FB_OUT - RTE_CRYPTODEV_FF_OUT_OF_PLACE_FB_IN_SGL_OUT - RTE_CRYPTODEV_FF_OUT_OF_PLACE_FB_IN_FB_OUT Signed-off-by: Pablo de Lara --- doc/guides/rel_notes/deprecation.rst | 2 -- doc/guides/rel_notes/release_18_08.rst | 8 +++++ drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 2 +- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 6 +++- drivers/crypto/dpaa_sec/dpaa_sec.c | 6 +++- drivers/crypto/null/null_crypto_pmd.c | 2 +- drivers/crypto/openssl/rte_openssl_pmd.c | 2 +- drivers/crypto/qat/qat_sym_pmd.c | 6 +++- lib/librte_cryptodev/rte_cryptodev.c | 12 ++++++-- lib/librte_cryptodev/rte_cryptodev.h | 46 +++++++++++++++++++---------- test/test/test_cryptodev.c | 31 +++++++++++++------ test/test/test_cryptodev_blockcipher.c | 21 ++++++++++--- 12 files changed, 106 insertions(+), 38 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 9a73b1d8e..62d635b74 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -105,5 +105,3 @@ Deprecation Notices ``rte_cryptodev_queue_pair_dettach_sym_session()`` will be deprecated from 18.05 and removed in 18.08, as there are no drivers doing anything useful with them. - - Some feature flags such as ``RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER`` are ambiguous, - so some will be replaced by more explicit flags. diff --git a/doc/guides/rel_notes/release_18_08.rst b/doc/guides/rel_notes/release_18_08.rst index e482d3d5f..2a136d88c 100644 --- a/doc/guides/rel_notes/release_18_08.rst +++ b/doc/guides/rel_notes/release_18_08.rst @@ -78,6 +78,14 @@ API Changes - ``rte_cryptodev_get_private_session_size`` is replaced with ``rte_cryptodev_sym_get_private_session_size`` +* cryptodev: Feature flag ``RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER`` is + replaced with the following more explicit flags: + - ``RTE_CRYPTODEV_FF_IN_PLACE_SGL`` + - ``RTE_CRYPTODEV_FF_OUT_OF_PLACE_SGL_IN_SGL_OUT`` + - ``RTE_CRYPTODEV_FF_OUT_OF_PLACE_SGL_IN_FB_OUT`` + - ``RTE_CRYPTODEV_FF_OUT_OF_PLACE_FB_IN_SGL_OUT`` + - ``RTE_CRYPTODEV_FF_OUT_OF_PLACE_FB_IN_FB_OUT`` + ABI Changes ----------- diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c index cd5b1952b..03917f220 100644 --- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c +++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c @@ -492,7 +492,7 @@ aesni_gcm_create(const char *name, dev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO | RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING | RTE_CRYPTODEV_FF_CPU_AESNI | - RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER; + RTE_CRYPTODEV_FF_OUT_OF_PLACE_SGL_IN_FB_OUT; switch (vector_mode) { case RTE_AESNI_GCM_SSE: diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index 1b1c30d85..4daee5f59 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -2762,7 +2762,11 @@ dpaa2_sec_dev_init(struct rte_cryptodev *cryptodev) RTE_CRYPTODEV_FF_HW_ACCELERATED | RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING | RTE_CRYPTODEV_FF_SECURITY | - RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER; + RTE_CRYPTODEV_FF_IN_PLACE_SGL | + RTE_CRYPTODEV_FF_OUT_OF_PLACE_SGL_IN_SGL_OUT | + RTE_CRYPTODEV_FF_OUT_OF_PLACE_SGL_IN_FB_OUT | + RTE_CRYPTODEV_FF_OUT_OF_PLACE_FB_IN_SGL_OUT | + RTE_CRYPTODEV_FF_OUT_OF_PLACE_FB_IN_FB_OUT; internals = cryptodev->data->dev_private; diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c index b96552c57..8ad25f2be 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c @@ -2271,7 +2271,11 @@ dpaa_sec_dev_init(struct rte_cryptodev *cryptodev) RTE_CRYPTODEV_FF_HW_ACCELERATED | RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING | RTE_CRYPTODEV_FF_SECURITY | - RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER; + RTE_CRYPTODEV_FF_IN_PLACE_SGL | + RTE_CRYPTODEV_FF_OUT_OF_PLACE_SGL_IN_SGL_OUT | + RTE_CRYPTODEV_FF_OUT_OF_PLACE_SGL_IN_FB_OUT | + RTE_CRYPTODEV_FF_OUT_OF_PLACE_FB_IN_SGL_OUT | + RTE_CRYPTODEV_FF_OUT_OF_PLACE_FB_IN_FB_OUT; internals = cryptodev->data->dev_private; internals->max_nb_queue_pairs = RTE_DPAA_MAX_NB_SEC_QPS; diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c index 478ac0b62..224ba7233 100644 --- a/drivers/crypto/null/null_crypto_pmd.c +++ b/drivers/crypto/null/null_crypto_pmd.c @@ -177,7 +177,7 @@ cryptodev_null_create(const char *name, dev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO | RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING | - RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER; + RTE_CRYPTODEV_FF_IN_PLACE_SGL; internals = dev->data->dev_private; diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c index 972e2adfe..94b6e2de9 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd.c +++ b/drivers/crypto/openssl/rte_openssl_pmd.c @@ -1660,7 +1660,7 @@ cryptodev_openssl_create(const char *name, dev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO | RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING | RTE_CRYPTODEV_FF_CPU_AESNI | - RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER; + RTE_CRYPTODEV_FF_OUT_OF_PLACE_SGL_IN_FB_OUT; /* Set vector instructions mode supported */ internals = dev->data->dev_private; diff --git a/drivers/crypto/qat/qat_sym_pmd.c b/drivers/crypto/qat/qat_sym_pmd.c index ee8633b85..629904e2f 100644 --- a/drivers/crypto/qat/qat_sym_pmd.c +++ b/drivers/crypto/qat/qat_sym_pmd.c @@ -274,7 +274,11 @@ qat_sym_dev_create(struct qat_pci_device *qat_pci_dev) cryptodev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO | RTE_CRYPTODEV_FF_HW_ACCELERATED | RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING | - RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER; + RTE_CRYPTODEV_FF_IN_PLACE_SGL | + RTE_CRYPTODEV_FF_OUT_OF_PLACE_SGL_IN_SGL_OUT | + RTE_CRYPTODEV_FF_OUT_OF_PLACE_SGL_IN_FB_OUT | + RTE_CRYPTODEV_FF_OUT_OF_PLACE_FB_IN_SGL_OUT | + RTE_CRYPTODEV_FF_OUT_OF_PLACE_FB_IN_FB_OUT; internals = cryptodev->data->dev_private; internals->qat_dev = qat_pci_dev; diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index 381330f3d..15110661b 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -361,8 +361,16 @@ rte_cryptodev_get_feature_name(uint64_t flag) return "CPU_AESNI"; case RTE_CRYPTODEV_FF_HW_ACCELERATED: return "HW_ACCELERATED"; - case RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER: - return "MBUF_SCATTER_GATHER"; + case RTE_CRYPTODEV_FF_IN_PLACE_SGL: + return "IN_PLACE_SGL"; + case RTE_CRYPTODEV_FF_OUT_OF_PLACE_SGL_IN_SGL_OUT: + return "OUT_OF_PLACE_SGL_IN_SGL_OUT"; + case RTE_CRYPTODEV_FF_OUT_OF_PLACE_SGL_IN_FB_OUT: + return "OUT_OF_PLACE_SGL_IN_FB_OUT"; + case RTE_CRYPTODEV_FF_OUT_OF_PLACE_FB_IN_SGL_OUT: + return "OUT_OF_PLACE_FB_IN_SGL_OUT"; + case RTE_CRYPTODEV_FF_OUT_OF_PLACE_FB_IN_FB_OUT: + return "OUT_OF_PLACE_FB_IN_FB_OUT"; case RTE_CRYPTODEV_FF_CPU_NEON: return "CPU_NEON"; case RTE_CRYPTODEV_FF_CPU_ARM_CE: diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h index a60eb38e4..c897dc6e2 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -327,31 +327,47 @@ rte_cryptodev_get_aead_algo_enum(enum rte_crypto_aead_algorithm *algo_enum, * * Keep these flags synchronised with rte_cryptodev_get_feature_name() */ -#define RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO (1ULL << 0) +#define RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO (1ULL << 0) /**< Symmetric crypto operations are supported */ -#define RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO (1ULL << 1) +#define RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO (1ULL << 1) /**< Asymmetric crypto operations are supported */ -#define RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING (1ULL << 2) +#define RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING (1ULL << 2) /**< Chaining symmetric crypto operations are supported */ -#define RTE_CRYPTODEV_FF_CPU_SSE (1ULL << 3) +#define RTE_CRYPTODEV_FF_CPU_SSE (1ULL << 3) /**< Utilises CPU SIMD SSE instructions */ -#define RTE_CRYPTODEV_FF_CPU_AVX (1ULL << 4) +#define RTE_CRYPTODEV_FF_CPU_AVX (1ULL << 4) /**< Utilises CPU SIMD AVX instructions */ -#define RTE_CRYPTODEV_FF_CPU_AVX2 (1ULL << 5) +#define RTE_CRYPTODEV_FF_CPU_AVX2 (1ULL << 5) /**< Utilises CPU SIMD AVX2 instructions */ -#define RTE_CRYPTODEV_FF_CPU_AESNI (1ULL << 6) +#define RTE_CRYPTODEV_FF_CPU_AESNI (1ULL << 6) /**< Utilises CPU AES-NI instructions */ -#define RTE_CRYPTODEV_FF_HW_ACCELERATED (1ULL << 7) -/**< Operations are off-loaded to an external hardware accelerator */ -#define RTE_CRYPTODEV_FF_CPU_AVX512 (1ULL << 8) +#define RTE_CRYPTODEV_FF_HW_ACCELERATED (1ULL << 7) +/**< Operations are off-loaded to an + * external hardware accelerator + */ +#define RTE_CRYPTODEV_FF_CPU_AVX512 (1ULL << 8) /**< Utilises CPU SIMD AVX512 instructions */ -#define RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER (1ULL << 9) -/**< Scatter-gather mbufs are supported */ -#define RTE_CRYPTODEV_FF_CPU_NEON (1ULL << 10) +#define RTE_CRYPTODEV_FF_IN_PLACE_SGL (1ULL << 9) +/**< In-place Scatter-gather (SGL) mbufs are supported */ +#define RTE_CRYPTODEV_FF_OUT_OF_PLACE_SGL_IN_SGL_OUT (1ULL << 10) +/**< Out-of-place Scatter-gather (SGL) mbufs are + * supported in input and output + */ +#define RTE_CRYPTODEV_FF_OUT_OF_PLACE_SGL_IN_FB_OUT (1ULL << 11) +/**< Out-of-place Scatter-gather (SGL) mbufs are supported + * in input, but only flat buffers (FB) are supported in output + */ +#define RTE_CRYPTODEV_FF_OUT_OF_PLACE_FB_IN_SGL_OUT (1ULL << 12) +/**< Out-of-place Scatter-gather (SGL) mbufs are supported + * in output, but only flat buffers (FB) are supported in input + */ +#define RTE_CRYPTODEV_FF_OUT_OF_PLACE_FB_IN_FB_OUT (1ULL << 13) +/**< Only flat buffers (FB) are supported in input and output */ +#define RTE_CRYPTODEV_FF_CPU_NEON (1ULL << 14) /**< Utilises CPU NEON instructions */ -#define RTE_CRYPTODEV_FF_CPU_ARM_CE (1ULL << 11) +#define RTE_CRYPTODEV_FF_CPU_ARM_CE (1ULL << 15) /**< Utilises ARM CPU Cryptographic Extensions */ -#define RTE_CRYPTODEV_FF_SECURITY (1ULL << 12) +#define RTE_CRYPTODEV_FF_SECURITY (1ULL << 16) /**< Support Security Protocol Processing */ diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c index 73aadaced..84fcf0651 100644 --- a/test/test/test_cryptodev.c +++ b/test/test/test_cryptodev.c @@ -3160,8 +3160,11 @@ test_kasumi_encryption_sgl(const struct kasumi_test_data *tdata) struct rte_cryptodev_info dev_info; rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info); - if (!(dev_info.feature_flags & RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER)) { - printf("Device doesn't support scatter-gather. " + + uint64_t feat_flags = dev_info.feature_flags; + + if (!(feat_flags & RTE_CRYPTODEV_FF_IN_PLACE_SGL)) { + printf("Device doesn't support in-place scatter-gather. " "Test Skipped.\n"); return 0; } @@ -3308,8 +3311,11 @@ test_kasumi_encryption_oop_sgl(const struct kasumi_test_data *tdata) struct rte_cryptodev_info dev_info; rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info); - if (!(dev_info.feature_flags & RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER)) { - printf("Device doesn't support scatter-gather. " + + uint64_t feat_flags = dev_info.feature_flags; + if (!(feat_flags & RTE_CRYPTODEV_FF_OUT_OF_PLACE_SGL_IN_SGL_OUT)) { + printf("Device doesn't support out-of-place scatter-gather " + "in both input and output mbufs. " "Test Skipped.\n"); return 0; } @@ -3659,8 +3665,12 @@ test_snow3g_encryption_oop_sgl(const struct snow3g_test_data *tdata) struct rte_cryptodev_info dev_info; rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info); - if (!(dev_info.feature_flags & RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER)) { - printf("Device doesn't support scatter-gather. " + + uint64_t feat_flags = dev_info.feature_flags; + + if (!(feat_flags & RTE_CRYPTODEV_FF_OUT_OF_PLACE_SGL_IN_SGL_OUT)) { + printf("Device doesn't support out-of-place scatter-gather " + "in both input and output mbufs. " "Test Skipped.\n"); return 0; } @@ -4493,10 +4503,13 @@ test_zuc_encryption_sgl(const struct wireless_test_data *tdata) return -ENOTSUP; rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info); - if (!(dev_info.feature_flags & RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER)) { - printf("Device doesn't support scatter-gather. " + + uint64_t feat_flags = dev_info.feature_flags; + + if (!(feat_flags & RTE_CRYPTODEV_FF_IN_PLACE_SGL)) { + printf("Device doesn't support in-place scatter-gather. " "Test Skipped.\n"); - return -ENOTSUP; + return 0; } plaintext_len = ceil_byte_length(tdata->plaintext.len); diff --git a/test/test/test_cryptodev_blockcipher.c b/test/test/test_cryptodev_blockcipher.c index 256a7daa2..7a11b3af8 100644 --- a/test/test/test_cryptodev_blockcipher.c +++ b/test/test/test_cryptodev_blockcipher.c @@ -77,12 +77,25 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t, if (t->feature_mask & BLOCKCIPHER_TEST_FEATURE_SG) { rte_cryptodev_info_get(dev_id, &dev_info); - if (!(dev_info.feature_flags & - RTE_CRYPTODEV_FF_MBUF_SCATTER_GATHER)) { - printf("Device doesn't support scatter-gather. " + uint64_t feat_flags = dev_info.feature_flags; + uint64_t oop_flag = RTE_CRYPTODEV_FF_OUT_OF_PLACE_SGL_IN_FB_OUT; + + if (t->feature_mask && BLOCKCIPHER_TEST_FEATURE_OOP) { + if (!(feat_flags & oop_flag)) { + printf("Device doesn't support out-of-place " + "scatter-gather in input mbuf. " + "Test Skipped.\n"); + return 0; + } + } else { + if (!(feat_flags & RTE_CRYPTODEV_FF_IN_PLACE_SGL)) { + printf("Device doesn't support in-place " + "scatter-gather mbufs. " "Test Skipped.\n"); - return 0; + return 0; + } } + nb_segs = 3; } -- 2.14.4