1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2020 Mellanox Technologies, Ltd
9 #include <rte_mempool.h>
10 #include <rte_malloc.h>
11 #include <rte_errno.h>
13 #include "mlx5_devx_cmds.h"
14 #include "mlx5_common_utils.h"
15 #include "mlx5_common.h"
18 * Initialization routine for run-time dependency on external lib
21 mlx5_glue_constructor(void)
26 * Allocate PD. Given a devx context object
27 * return an mlx5-pd object.
33 * The mlx5_pd if pd is valid, NULL and errno otherwise.
36 mlx5_os_alloc_pd(void *ctx)
38 struct mlx5_pd *ppd = mlx5_malloc(MLX5_MEM_ZERO,
39 sizeof(struct mlx5_pd), 0, SOCKET_ID_ANY);
43 struct mlx5_devx_obj *obj = mlx5_devx_cmd_alloc_pd(ctx);
55 * Release PD. Releases a given mlx5_pd object
61 * Zero if pd is released successfully, negative number otherwise.
64 mlx5_os_dealloc_pd(void *pd)
68 mlx5_devx_cmd_destroy(((struct mlx5_pd *)pd)->obj);