Support MLX5 crypto driver on Windows
Subsystems (5)
cover Support MLX5 crypto driver on Windows
Support the MLX5 crypto driver on Windows OS by moving the driver's control path communication with the Kernel to be OS agnostic.
---
Depends-on: series-19421 ("mlx5: sharing global MR cache between drivers")
---
Tal Shnaiderman (5):
common/mlx5: add DV enums to Windows defs file crypto/mlx5: replace UNIX functions with EAL functions crypto/mlx5: use OS agnostic functions for UMEM operations crypto/mlx5: fix size of UMR WQE
crypto/mlx5: support on Windows
doc/guides/cryptodevs/mlx5.rst | 15 ++++++++++++--- doc/guides/rel_notes/release_21_11.rst | 1 + drivers/common/mlx5/version.map | 2 +- drivers/common/mlx5/windows/mlx5_common_os.c | 2 +- drivers/common/mlx5/windows/mlx5_win_defs.h | 12 ++++++++++++ drivers/crypto/aesni_gcm/meson.build | 6 ++++++ drivers/crypto/aesni_mb/meson.build | 6 ++++++ drivers/crypto/armv8/meson.build | 6 ++++++ drivers/crypto/bcmfs/meson.build | 6 ++++++ drivers/crypto/ccp/meson.build | 1 + drivers/crypto/kasumi/meson.build | 6 ++++++ drivers/crypto/meson.build | 3 --- drivers/crypto/mlx5/meson.build | 4 ++-- drivers/crypto/mlx5/mlx5_crypto.c | 18 +++++++++++------- drivers/crypto/mlx5/mlx5_crypto.h | 2 +- drivers/crypto/mvsam/meson.build | 6 ++++++ drivers/crypto/null/meson.build | 6 ++++++ drivers/crypto/octeontx/meson.build | 6 ++++++ drivers/crypto/openssl/meson.build | 6 ++++++ drivers/crypto/qat/meson.build | 6 ++++++ drivers/crypto/scheduler/meson.build | 6 ++++++ drivers/crypto/snow3g/meson.build | 6 ++++++ drivers/crypto/virtio/meson.build | 6 ++++++ drivers/crypto/zuc/meson.build | 6 ++++++ 24 files changed, 126 insertions(+), 18 deletions(-)
Signature · 1 line
2.16.1.windows.4
PATCH 1/5 common/mlx5: add DV enums to Windows defs file
Add needed DV enums used by the crypto PMD and missing for Windows OS.
--- drivers/common/mlx5/windows/mlx5_win_defs.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/common/mlx5/windows/mlx5_win_defs.h +12 -0
@@ -93,6 +93,18 @@ enum { MLX5_ETH_WQE_L4_CSUM = (1 << 7), }; +enum { +MLX5_WQE_CTRL_CQ_UPDATE =2 <<2 , +MLX5_WQE_CTRL_SOLICITED =1 <<1 , +MLX5_WQE_CTRL_FENCE =4 <<5 , +MLX5_WQE_CTRL_INITIATOR_SMALL_FENCE =1 <<5 , +}; + +enum { +MLX5_SEND_WQE_BB =64 , +MLX5_SEND_WQE_SHIFT =6 , +}; +/* * RX Hash fields enable to set which incoming packet's field should * participates in RX Hash. Each flag represent certain packet's field,
Signature · 1 line
2.16.1.windows.4
PATCH 2/5 crypto/mlx5: replace UNIX functions with EAL functions
In reply to Tal ShnaidermanUse the OS agnostic EAL function rte_mem_page_size to get page size value instead of the Linux specific implementation.
Also remove the usage of PTHREAD_MUTEX_INITIALIZER which is not support in Windows and initialize priv_list_lock in RTE_INIT.
--- drivers/crypto/mlx5/mlx5_crypto.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/crypto/mlx5/mlx5_crypto.c +4 -2
@@ -4,6 +4,7 @@#include <rte_malloc.h> #include <rte_mempool.h> +#include <rte_eal_paging.h> #include <rte_errno.h> #include <rte_log.h> #include <rte_bus_pci.h>
@@ -33,7 +34,7 @@ TAILQ_HEAD(mlx5_crypto_privs, mlx5_crypto_priv) mlx5_crypto_priv_list =TAILQ_HEAD_INITIALIZER (mlx5_crypto_priv_list); -static pthread_mutex_t priv_list_lock =PTHREAD_MUTEX_INITIALIZER ; +static pthread_mutex_t priv_list_lock;int mlx5_crypto_logtype;
@@ -688,7 +689,7 @@ mlx5_crypto_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id, attr.pd = priv->cdev->pdn; attr.uar_index =mlx5_os_get_devx_uar_page_id (priv->uar); attr.cqn = qp->cq_obj.cq->id; - attr.log_page_size =rte_log2_u32 (sysconf (_SC_PAGESIZE)); + attr.log_page_size =rte_log2_u32 (rte_mem_page_size ()); attr.rq_size =0 ; attr.sq_size =RTE_BIT32 (log_nb_desc); attr.dbr_umem_valid =1 ;
@@ -1014,6 +1015,7 @@ static struct mlx5_class_driver mlx5_crypto_driver = {RTE_INIT (rte_mlx5_crypto_init) { +pthread_mutex_init (&priv_list_lock,NULL );mlx5_common_init ();if (mlx5_glue !=NULL )mlx5_class_driver_register (&mlx5_crypto_driver);
Signature · 1 line
2.16.1.windows.4
PATCH 3/5 crypto/mlx5: use OS agnostic functions for UMEM operations
In reply to Tal Shnaidermanuse the functions mlx5_os_umem_reg, mlx5_os_umem_dereg mlx5_os_get_umem_id instead of the glue functions to support UMEM operations on all OSs.
--- drivers/crypto/mlx5/mlx5_crypto.c | 8 ++++---- drivers/crypto/mlx5/mlx5_crypto.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/crypto/mlx5/mlx5_crypto.c +4 -4
@@ -272,7 +272,7 @@ mlx5_crypto_qp_release(struct mlx5_crypto_qp *qp)if (qp->qp_obj !=NULL )claim_zero (mlx5_devx_cmd_destroy (qp->qp_obj));if (qp->umem_obj !=NULL ) -claim_zero (mlx5_glue->devx_umem_dereg (qp->umem_obj)); +claim_zero (mlx5_os_umem_dereg (qp->umem_obj));if (qp->umem_buf !=NULL )rte_free (qp->umem_buf);mlx5_mr_btree_free (&qp->mr_ctrl.cache_bh);
@@ -671,7 +671,7 @@ mlx5_crypto_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id, rte_errno =ENOMEM ; goto error; } - qp->umem_obj = mlx5_glue->devx_umem_reg (priv->cdev->ctx, + qp->umem_obj =mlx5_os_umem_reg (priv->cdev->ctx, (void *)(uintptr_t )qp->umem_buf, umem_size,IBV_ACCESS_LOCAL_WRITE );
@@ -693,9 +693,9 @@ mlx5_crypto_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id, attr.rq_size =0 ; attr.sq_size =RTE_BIT32 (log_nb_desc); attr.dbr_umem_valid =1 ; - attr.wq_umem_id = qp->umem_obj->umem_id; + attr.wq_umem_id =mlx5_os_get_umem_id (qp->umem_obj); attr.wq_umem_offset =0 ; - attr.dbr_umem_id = qp->umem_obj->umem_id; + attr.dbr_umem_id =mlx5_os_get_umem_id (qp->umem_obj); attr.ts_format =mlx5_ts_format_conv (priv->cdev->config.hca_attr.qp_ts_format); attr.dbr_address =RTE_BIT64 (log_nb_desc) * priv->wqe_set_size;
drivers/crypto/mlx5/mlx5_crypto.h +1 -1
@@ -42,7 +42,7 @@ struct mlx5_crypto_qp {struct mlx5_devx_cq cq_obj;struct mlx5_devx_obj *qp_obj;struct rte_cryptodev_stats stats; -struct mlx5dv_devx_umem *umem_obj; +void *umem_obj;void *umem_buf;volatile uint32_t *db_rec;struct rte_crypto_op **ops;
Signature · 1 line
2.16.1.windows.4
PATCH 4/5 crypto/mlx5: fix size of UMR WQE
In reply to Tal ShnaidermanThe size of the UMR WQE allocated object is decided by a sizof operation on the struct, however since the struct contains a union of flexible array members this sizeof results can differ between compilers.
GCC for example treats the union as 0 sized, MSVC adds a padding of 16Bits.
To resolve the ambiguity the allocation size will be calculated by the sizes of the members excluding the flexible union.
--- drivers/crypto/mlx5/mlx5_crypto.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/crypto/mlx5/mlx5_crypto.c +3 -1
@@ -959,7 +959,9 @@ mlx5_crypto_dev_probe(struct mlx5_common_device *cdev) priv->keytag =rte_cpu_to_be_64 (devarg_prms.keytag); priv->max_segs_num = devarg_prms.max_segs_num; priv->umr_wqe_size =sizeof (struct mlx5_wqe_umr_bsf_seg ) + -sizeof (struct mlx5_umr_wqe ) + +sizeof (struct mlx5_wqe_cseg ) + +sizeof (struct mlx5_wqe_umr_cseg ) + +sizeof (struct mlx5_wqe_mkey_cseg ) +RTE_ALIGN (priv->max_segs_num,4 ) *sizeof (struct mlx5_wqe_dseg ); rdmw_wqe_size = sizeof(struct mlx5_rdma_write_wqe) +
Signature · 1 line
2.16.1.windows.4
PATCH 5/5 crypto/mlx5: support on Windows
In reply to Tal ShnaidermanAdd support for mlx5 crypto pmd on Windows OS.
Add changes to release note and pmd guide.
--- doc/guides/cryptodevs/mlx5.rst | 15 ++++++++++++--- doc/guides/rel_notes/release_21_11.rst | 1 + drivers/common/mlx5/version.map | 2 +- drivers/common/mlx5/windows/mlx5_common_os.c | 2 +- drivers/crypto/aesni_gcm/meson.build | 6 ++++++ drivers/crypto/aesni_mb/meson.build | 6 ++++++ drivers/crypto/armv8/meson.build | 6 ++++++ drivers/crypto/bcmfs/meson.build | 6 ++++++ drivers/crypto/ccp/meson.build | 1 + drivers/crypto/kasumi/meson.build | 6 ++++++ drivers/crypto/meson.build | 3 --- drivers/crypto/mlx5/meson.build | 4 ++-- drivers/crypto/mvsam/meson.build | 6 ++++++ drivers/crypto/null/meson.build | 6 ++++++ drivers/crypto/octeontx/meson.build | 6 ++++++ drivers/crypto/openssl/meson.build | 6 ++++++ drivers/crypto/qat/meson.build | 6 ++++++ drivers/crypto/scheduler/meson.build | 6 ++++++ drivers/crypto/snow3g/meson.build | 6 ++++++ drivers/crypto/virtio/meson.build | 6 ++++++ drivers/crypto/zuc/meson.build | 6 ++++++ 21 files changed, 102 insertions(+), 10 deletions(-)
doc/guides/cryptodevs/mlx5.rst +12 -3
@@ -39,12 +39,12 @@ or to access the hardware components directly. There are different levels of objects and bypassing abilities. To get the best performances: -- Verbs is a complete high-level generic API. -- Direct Verbs is a device-specific API. +- Verbs is a complete high-level generic API (Linux only). +- Direct Verbs is a device-specific API (Linux only). - DevX allows to access firmware objects. Enabling ``librte_crypto_mlx5`` causes DPDK applications -to be linked against libibverbs. +to be linked against libibverbs on Linux OS. In order to move the device to crypto operational mode, credential and KEK (Key Encrypting Key) should be set as the first step.
@@ -155,8 +155,17 @@ Limitations Prerequisites ------------- +Linux Prerequisites +~~~~~~~~~~~~~~~~~~~ + - Mellanox OFED version: **5.3** see :doc:`../../nics/mlx5` guide for more Mellanox OFED details. - Compilation can be done also with rdma-core v15+. see :doc:`../../nics/mlx5` guide for more rdma-core details. + +Windows Prerequisites +~~~~~~~~~~~~~~~~~~~~~ + +- Mellanox WINOF-2 version: **2.60** or higher. + see :doc:`../../nics/mlx5` guide for more Mellanox WINOF-2 details.
doc/guides/rel_notes/release_21_11.rst +1 -0
@@ -135,6 +135,7 @@ New Features Updated the Mellanox mlx5 driver with new features and improvements, including: * Added implicit mempool registration to avoid data path hiccups (opt-out). + * Added support for mlx5 crypto PMD on Windows operating system. Removed Items
drivers/common/mlx5/version.map +1 -1
@@ -16,7 +16,7 @@ INTERNAL { mlx5_dev_mempool_unregister; mlx5_dev_mempool_subscribe; - mlx5_devx_alloc_uar; # WINDOWS_NO_EXPORT + mlx5_devx_alloc_uar; mlx5_devx_cmd_alloc_pd; mlx5_devx_cmd_create_conn_track_offload_obj;
drivers/common/mlx5/windows/mlx5_common_os.c +1 -1
@@ -202,7 +202,7 @@ mlx5_os_open_device(struct mlx5_common_device *cdev, uint32_t classes)struct mlx5_context *mlx5_ctx =NULL ;int n; -if (classes !=MLX5_CLASS_ETH ) { +if (classes !=MLX5_CLASS_ETH && classes !=MLX5_CLASS_CRYPTO ) {DRV_LOG (ERR ,"The chosen classes are not supported on Windows." ); rte_errno =ENOTSUP ;
drivers/crypto/aesni_gcm/meson.build +6 -0
@@ -1,6 +1,12 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 Intel Corporation +if is_windows + build = false + reason = 'not supported on Windows' + subdir_done() +endif + IMB_required_ver = '0.52.0' lib = cc.find_library('IPSec_MB', required: false) if not lib.found()
drivers/crypto/aesni_mb/meson.build +6 -0
@@ -1,6 +1,12 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 Intel Corporation +if is_windows + build = false + reason = 'not supported on Windows' + subdir_done() +endif + IMB_required_ver = '0.52.0' lib = cc.find_library('IPSec_MB', required: false) if not lib.found()
drivers/crypto/armv8/meson.build +6 -0
@@ -1,6 +1,12 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2019 Arm Limited +if is_windows + build = false + reason = 'not supported on Windows' + subdir_done() +endif + dep = dependency('libAArch64crypto', required: false, method: 'pkg-config') if not dep.found() build = false
drivers/crypto/bcmfs/meson.build +6 -0
@@ -3,6 +3,12 @@ # All rights reserved. # +if is_windows + build = false + reason = 'not supported on Windows' + subdir_done() +endif + deps += ['eal', 'bus_vdev'] sources = files( 'bcmfs_logs.c',
drivers/crypto/ccp/meson.build +1 -0
@@ -4,6 +4,7 @@ if not is_linux build = false reason = 'only supported on Linux' + subdir_done() endif dep = dependency('libcrypto', required: false, method: 'pkg-config') if not dep.found()
drivers/crypto/kasumi/meson.build +6 -0
@@ -1,6 +1,12 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018-2020 Intel Corporation +if is_windows + build = false + reason = 'not supported on Windows' + subdir_done() +endif + IMB_required_ver = '0.53.0' lib = cc.find_library('IPSec_MB', required: false) if not lib.found()
drivers/crypto/meson.build +0 -3
@@ -1,9 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation -if is_windows - subdir_done() -endif drivers = [ 'aesni_gcm',
drivers/crypto/mlx5/meson.build +2 -2
@@ -1,9 +1,9 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2021 NVIDIA Corporation & Affiliates -if not is_linux +if not (is_linux or is_windows) build = false - reason = 'only supported on Linux' + reason = 'only supported on Linux and Windows' subdir_done() endif
drivers/crypto/mvsam/meson.build +6 -0
@@ -3,6 +3,12 @@ # Copyright(c) 2018 Semihalf. # All rights reserved. +if is_windows + build = false + reason = 'not supported on Windows' + subdir_done() +endif + dep = dependency('libmusdk', required: false, method: 'pkg-config') if not dep.found() build = false
drivers/crypto/null/meson.build +6 -0
@@ -1,5 +1,11 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation +if is_windows + build = false + reason = 'not supported on Windows' + subdir_done() +endif + deps += 'bus_vdev' sources = files('null_crypto_pmd.c', 'null_crypto_pmd_ops.c')
drivers/crypto/octeontx/meson.build +6 -0
@@ -1,6 +1,12 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 Cavium, Inc +if is_windows + build = false + reason = 'not supported on Windows' + subdir_done() +endif + deps += ['bus_pci'] deps += ['bus_vdev'] deps += ['common_cpt']
drivers/crypto/openssl/meson.build +6 -0
@@ -1,6 +1,12 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation +if is_windows + build = false + reason = 'not supported on Windows' + subdir_done() +endif + dep = dependency('libcrypto', required: false, method: 'pkg-config') if not dep.found() build = false
drivers/crypto/qat/meson.build +6 -0
@@ -1,6 +1,12 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017-2018 Intel Corporation +if is_windows + build = false + reason = 'not supported on Windows' + subdir_done() +endif + # this does not build the QAT driver, instead that is done in the compression # driver which comes later. Here we just add our sources files to the list build = false
drivers/crypto/scheduler/meson.build +6 -0
@@ -1,6 +1,12 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 Luca Boccassi <[email protected]> +if is_windows + build = false + reason = 'not supported on Windows' + subdir_done() +endif + deps += ['bus_vdev', 'reorder'] sources = files( 'rte_cryptodev_scheduler.c',
drivers/crypto/snow3g/meson.build +6 -0
@@ -1,6 +1,12 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2019-2020 Intel Corporation +if is_windows + build = false + reason = 'not supported on Windows' + subdir_done() +endif + IMB_required_ver = '0.53.0' lib = cc.find_library('IPSec_MB', required: false) if not lib.found()
drivers/crypto/virtio/meson.build +6 -0
@@ -1,6 +1,12 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 HUAWEI TECHNOLOGIES CO., LTD. +if is_windows + build = false + reason = 'not supported on Windows' + subdir_done() +endif + includes += include_directories('../../../lib/vhost') deps += 'bus_pci' sources = files(
drivers/crypto/zuc/meson.build +6 -0
@@ -1,6 +1,12 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018-2020 Intel Corporation +if is_windows + build = false + reason = 'not supported on Windows' + subdir_done() +endif + IMB_required_ver = '0.53.0' lib = cc.find_library('IPSec_MB', required: false) if not lib.found()
Signature · 1 line
2.16.1.windows.4
Re: [dpdk-dev] [EXT] [PATCH 5/5] crypto/mlx5: support on Windows
Quoted 19 lines
Add support for mlx5 crypto pmd on Windows OS.
Add changes to release note and pmd guide.Signed-off-by Tal Shnaiderman <[email protected]>--- doc/guides/cryptodevs/mlx5.rst | 15 ++++++++++++--- doc/guides/rel_notes/release_21_11.rst | 1 + drivers/common/mlx5/version.map | 2 +- drivers/common/mlx5/windows/mlx5_common_os.c | 2 +- drivers/crypto/aesni_gcm/meson.build | 6 ++++++ drivers/crypto/aesni_mb/meson.build | 6 ++++++ drivers/crypto/armv8/meson.build | 6 ++++++ drivers/crypto/bcmfs/meson.build | 6 ++++++ drivers/crypto/ccp/meson.build | 1 + drivers/crypto/kasumi/meson.build | 6 ++++++ drivers/crypto/meson.build | 3 --- drivers/crypto/mlx5/meson.build | 4 ++-- drivers/crypto/mvsam/meson.build | 6 ++++++ drivers/crypto/null/meson.build | 6 ++++++
Quoted 9 lines
drivers/crypto/octeontx/meson.build | 6 ++++++ drivers/crypto/openssl/meson.build | 6 ++++++ drivers/crypto/qat/meson.build | 6 ++++++ drivers/crypto/scheduler/meson.build | 6 ++++++ drivers/crypto/snow3g/meson.build | 6 ++++++ drivers/crypto/virtio/meson.build | 6 ++++++ drivers/crypto/zuc/meson.build | 6 ++++++ 21 files changed, 102 insertions(+), 10 deletions(-)
Please split this patch into two
- one for all drivers meson.build changes and
- one for enabling Windows compilation for mlx5.
Re: [dpdk-dev] [EXT] [PATCH 5/5] crypto/mlx5: support on Windows
Quoted 34 lines
Subject: RE: [EXT] [PATCH 5/5]
crypto/mlx5: support on WindowsExternal email: Use caution opening links or attachments
Quoted 19 lines
Add support for mlx5 crypto pmd on Windows OS.
Add changes to release note and pmd guide.Signed-off-by Tal Shnaiderman <[email protected]>--- doc/guides/cryptodevs/mlx5.rst | 15 ++++++++++++--- doc/guides/rel_notes/release_21_11.rst | 1 + drivers/common/mlx5/version.map | 2 +- drivers/common/mlx5/windows/mlx5_common_os.c | 2 +- drivers/crypto/aesni_gcm/meson.build | 6 ++++++ drivers/crypto/aesni_mb/meson.build | 6 ++++++ drivers/crypto/armv8/meson.build | 6 ++++++ drivers/crypto/bcmfs/meson.build | 6 ++++++ drivers/crypto/ccp/meson.build | 1 + drivers/crypto/kasumi/meson.build | 6 ++++++ drivers/crypto/meson.build | 3 --- drivers/crypto/mlx5/meson.build | 4 ++-- drivers/crypto/mvsam/meson.build | 6 ++++++ drivers/crypto/null/meson.build | 6 ++++++Quoted 9 lines
drivers/crypto/octeontx/meson.build | 6 ++++++ drivers/crypto/openssl/meson.build | 6 ++++++ drivers/crypto/qat/meson.build | 6 ++++++ drivers/crypto/scheduler/meson.build | 6 ++++++ drivers/crypto/snow3g/meson.build | 6 ++++++ drivers/crypto/virtio/meson.build | 6 ++++++ drivers/crypto/zuc/meson.build | 6 ++++++ 21 files changed, 102 insertions(+), 10 deletions(-)
Quoted 3 lines
Please split this patch into two
- one for all drivers meson.build changes and
- one for enabling Windows compilation for mlx5.
Sure, I'll split and send a v2.