1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2020 Mellanox Technologies, Ltd
13 /* ISO C doesn't support unnamed structs/unions, disabling -pedantic. */
14 #include "mlx5_autoconf.h"
16 #pragma GCC diagnostic ignored "-Wpedantic"
18 #ifdef HAVE_INFINIBAND_VERBS_H
19 #include <infiniband/verbs.h>
21 #ifdef HAVE_INFINIBAND_MLX5DV_H
22 #include <infiniband/mlx5dv.h>
25 #pragma GCC diagnostic error "-Wpedantic"
29 #include <rte_malloc.h>
30 #include <rte_ethdev_driver.h>
31 #include <rte_common.h>
33 #include <mlx5_glue.h>
34 #include <mlx5_common.h>
35 #include <mlx5_common_mr.h>
36 #include <mlx5_verbs.h>
38 * Register mr. Given protection domain pointer, pointer to addr and length
39 * register the memory region.
42 * Pointer to protection domain context.
44 * Pointer to memory start address.
46 * Length of the memory to register.
48 * pmd_mr struct set with lkey, address, length and pointer to mr object
51 * 0 on successful registration, -1 otherwise
54 mlx5_reg_mr(void *pd, void *addr, size_t length,
55 struct mlx5_pmd_mr *pmd_mr)
57 return mlx5_common_verbs_reg_mr(pd, addr, length, pmd_mr);
61 * Deregister mr. Given the mlx5 pmd MR - deregister the MR
64 * pmd_mr struct set with lkey, address, length and pointer to mr object
68 mlx5_dereg_mr(struct mlx5_pmd_mr *pmd_mr)
70 mlx5_common_verbs_dereg_mr(pmd_mr);
73 /* verbs operations. */
74 const struct mlx5_verbs_ops mlx5_verbs_ops = {
75 .reg_mr = mlx5_reg_mr,
76 .dereg_mr = mlx5_dereg_mr,