[RFC,05/10] crypto/mlx5: replace UNIX functions with EAL functions
Checks
Commit Message
Use 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.
Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
---
drivers/crypto/mlx5/mlx5_crypto.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
@@ -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;
@@ -700,7 +701,7 @@ mlx5_crypto_queue_pair_setup(struct rte_cryptodev *dev, uint16_t qp_id,
attr.pd = priv->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;
@@ -1134,6 +1135,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);