1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2020 Mellanox Technologies, Ltd
14 /* ISO C doesn't support unnamed structs/unions, disabling -pedantic. */
15 #include "mlx5_autoconf.h"
17 #pragma GCC diagnostic ignored "-Wpedantic"
19 #ifdef HAVE_INFINIBAND_VERBS_H
20 #include <infiniband/verbs.h>
22 #ifdef HAVE_INFINIBAND_MLX5DV_H
23 #include <infiniband/mlx5dv.h>
26 #pragma GCC diagnostic error "-Wpedantic"
30 #include <rte_malloc.h>
31 #include <rte_ethdev_driver.h>
32 #include <rte_common.h>
34 #include <mlx5_glue.h>
35 #include <mlx5_common.h>
36 #include <mlx5_common_mr.h>
37 #include <mlx5_verbs.h>
39 * Register mr. Given protection domain pointer, pointer to addr and length
40 * register the memory region.
43 * Pointer to protection domain context.
45 * Pointer to memory start address.
47 * Length of the memory to register.
49 * pmd_mr struct set with lkey, address, length and pointer to mr object
52 * 0 on successful registration, -1 otherwise
55 mlx5_reg_mr(void *pd, void *addr, size_t length,
56 struct mlx5_pmd_mr *pmd_mr)
58 return mlx5_common_verbs_reg_mr(pd, addr, length, pmd_mr);
62 * Deregister mr. Given the mlx5 pmd MR - deregister the MR
65 * pmd_mr struct set with lkey, address, length and pointer to mr object
69 mlx5_dereg_mr(struct mlx5_pmd_mr *pmd_mr)
71 mlx5_common_verbs_dereg_mr(pmd_mr);
74 /* verbs operations. */
75 const struct mlx5_verbs_ops mlx5_verbs_ops = {
76 .reg_mr = mlx5_reg_mr,
77 .dereg_mr = mlx5_dereg_mr,