162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright(c) 2016 Intel Corporation. 462306a36Sopenharmony_ci */ 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci#ifndef DEF_RVTMR_H 762306a36Sopenharmony_ci#define DEF_RVTMR_H 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#include <rdma/rdma_vt.h> 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_cistruct rvt_mr { 1262306a36Sopenharmony_ci struct ib_mr ibmr; 1362306a36Sopenharmony_ci struct ib_umem *umem; 1462306a36Sopenharmony_ci struct rvt_mregion mr; /* must be last */ 1562306a36Sopenharmony_ci}; 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_cistatic inline struct rvt_mr *to_imr(struct ib_mr *ibmr) 1862306a36Sopenharmony_ci{ 1962306a36Sopenharmony_ci return container_of(ibmr, struct rvt_mr, ibmr); 2062306a36Sopenharmony_ci} 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ciint rvt_driver_mr_init(struct rvt_dev_info *rdi); 2362306a36Sopenharmony_civoid rvt_mr_exit(struct rvt_dev_info *rdi); 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci/* Mem Regions */ 2662306a36Sopenharmony_cistruct ib_mr *rvt_get_dma_mr(struct ib_pd *pd, int acc); 2762306a36Sopenharmony_cistruct ib_mr *rvt_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, 2862306a36Sopenharmony_ci u64 virt_addr, int mr_access_flags, 2962306a36Sopenharmony_ci struct ib_udata *udata); 3062306a36Sopenharmony_ciint rvt_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata); 3162306a36Sopenharmony_cistruct ib_mr *rvt_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type, 3262306a36Sopenharmony_ci u32 max_num_sg); 3362306a36Sopenharmony_ciint rvt_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, 3462306a36Sopenharmony_ci int sg_nents, unsigned int *sg_offset); 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ci#endif /* DEF_RVTMR_H */ 37