1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright 2020 Mellanox Technologies, Ltd 3 */ 4 5 #include <stddef.h> 6 #include <errno.h> 7 #include <string.h> 8 #include <stdint.h> 9 #include <unistd.h> 10 #include <inttypes.h> 11 12 #include "mlx5_autoconf.h" 13 14 #include <rte_mbuf.h> 15 #include <rte_malloc.h> 16 #include <rte_ethdev_driver.h> 17 #include <rte_common.h> 18 19 #include <mlx5_glue.h> 20 #include <mlx5_common.h> 21 #include <mlx5_common_mr.h> 22 #include <mlx5_verbs.h> 23 /** 24 * Register mr. Given protection domain pointer, pointer to addr and length 25 * register the memory region. 26 * 27 * @param[in] pd 28 * Pointer to protection domain context. 29 * @param[in] addr 30 * Pointer to memory start address. 31 * @param[in] length 32 * Length of the memory to register. 33 * @param[out] pmd_mr 34 * pmd_mr struct set with lkey, address, length and pointer to mr object 35 * 36 * @return 37 * 0 on successful registration, -1 otherwise 38 */ 39 static int 40 mlx5_reg_mr(void *pd, void *addr, size_t length, 41 struct mlx5_pmd_mr *pmd_mr) 42 { 43 return mlx5_common_verbs_reg_mr(pd, addr, length, pmd_mr); 44 } 45 46 /** 47 * Deregister mr. Given the mlx5 pmd MR - deregister the MR 48 * 49 * @param[in] pmd_mr 50 * pmd_mr struct set with lkey, address, length and pointer to mr object 51 * 52 */ 53 static void 54 mlx5_dereg_mr(struct mlx5_pmd_mr *pmd_mr) 55 { 56 mlx5_common_verbs_dereg_mr(pmd_mr); 57 } 58 59 /* verbs operations. */ 60 const struct mlx5_verbs_ops mlx5_verbs_ops = { 61 .reg_mr = mlx5_reg_mr, 62 .dereg_mr = mlx5_dereg_mr, 63 }; 64