19e39c5baSBill Taylor /* 29e39c5baSBill Taylor * CDDL HEADER START 39e39c5baSBill Taylor * 49e39c5baSBill Taylor * The contents of this file are subject to the terms of the 59e39c5baSBill Taylor * Common Development and Distribution License (the "License"). 69e39c5baSBill Taylor * You may not use this file except in compliance with the License. 79e39c5baSBill Taylor * 89e39c5baSBill Taylor * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 99e39c5baSBill Taylor * or http://www.opensolaris.org/os/licensing. 109e39c5baSBill Taylor * See the License for the specific language governing permissions 119e39c5baSBill Taylor * and limitations under the License. 129e39c5baSBill Taylor * 139e39c5baSBill Taylor * When distributing Covered Code, include this CDDL HEADER in each 149e39c5baSBill Taylor * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 159e39c5baSBill Taylor * If applicable, add the following below this CDDL HEADER, with the 169e39c5baSBill Taylor * fields enclosed by brackets "[]" replaced with your own identifying 179e39c5baSBill Taylor * information: Portions Copyright [yyyy] [name of copyright owner] 189e39c5baSBill Taylor * 199e39c5baSBill Taylor * CDDL HEADER END 209e39c5baSBill Taylor */ 219e39c5baSBill Taylor 229e39c5baSBill Taylor /* 23*17a2b317SBill Taylor * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. 249e39c5baSBill Taylor */ 259e39c5baSBill Taylor 269e39c5baSBill Taylor #ifndef _SYS_IB_ADAPTERS_HERMON_MR_H 279e39c5baSBill Taylor #define _SYS_IB_ADAPTERS_HERMON_MR_H 289e39c5baSBill Taylor 299e39c5baSBill Taylor /* 309e39c5baSBill Taylor * hermon_mr.h 319e39c5baSBill Taylor * Contains all of the prototypes, #defines, and structures necessary 329e39c5baSBill Taylor * for the Hermon Memory Region/Window routines. 339e39c5baSBill Taylor * Specifically it contains #defines, macros, and prototypes for each of 349e39c5baSBill Taylor * the required memory region/window verbs that can be accessed through 359e39c5baSBill Taylor * the IBTF's CI interfaces. In particular each of the prototypes defined 369e39c5baSBill Taylor * below is called from a corresponding CI interface routine (as specified 379e39c5baSBill Taylor * in the hermon_ci.c file). 389e39c5baSBill Taylor */ 399e39c5baSBill Taylor 409e39c5baSBill Taylor #include <sys/types.h> 419e39c5baSBill Taylor #include <sys/conf.h> 429e39c5baSBill Taylor #include <sys/ddi.h> 439e39c5baSBill Taylor #include <sys/sunddi.h> 449e39c5baSBill Taylor 459e39c5baSBill Taylor #ifdef __cplusplus 469e39c5baSBill Taylor extern "C" { 479e39c5baSBill Taylor #endif 489e39c5baSBill Taylor 499e39c5baSBill Taylor /* 509e39c5baSBill Taylor * The following defines specify the default number of MPT entries to 519e39c5baSBill Taylor * configure. This value is controllable through the "hermon_log_num_mpt" 529e39c5baSBill Taylor * configuration variable. 539e39c5baSBill Taylor */ 549e39c5baSBill Taylor #define HERMON_NUM_DMPT_SHIFT 0x16 559e39c5baSBill Taylor 569e39c5baSBill Taylor /* 579e39c5baSBill Taylor * The following defines specify the default number of MPT entries to 589e39c5baSBill Taylor * configure. This value is controllable through the "hermon_log_num_mtt" 599e39c5baSBill Taylor * configuration variable. This default value expects an averages of 8 609e39c5baSBill Taylor * MTTs per MPT. We also define a log MTT size, since it's not likely 619e39c5baSBill Taylor * to change. 629e39c5baSBill Taylor */ 63*17a2b317SBill Taylor #define HERMON_NUM_MTT_SHIFT 0x1d 649e39c5baSBill Taylor #define HERMON_MTT_SIZE_SHIFT 0x3 659e39c5baSBill Taylor 669e39c5baSBill Taylor /* 679e39c5baSBill Taylor * This define is the maximum size of a memory region or window (log 2), which 689e39c5baSBill Taylor * is used to initialize the "hermon_log_max_mrw_sz" configuration variable. 699e39c5baSBill Taylor */ 709e39c5baSBill Taylor #define HERMON_MAX_MEM_MPT_SHIFT 0x24 719e39c5baSBill Taylor 729e39c5baSBill Taylor /* 739e39c5baSBill Taylor * Defines used by hermon_mr_deregister() to specify how much/to what extent 749e39c5baSBill Taylor * a given memory regions resources should be freed up. HERMON_MR_DEREG_ALL 759e39c5baSBill Taylor * says what it means, free up all the resources associated with the region. 769e39c5baSBill Taylor * HERMON_MR_DEREG_NO_HW2SW_MPT indicates that it is unnecessary to attempt 779e39c5baSBill Taylor * the ownership transfer (from hardware to software) for the given MPT entry. 789e39c5baSBill Taylor * And HERMON_MR_DEREG_NO_HW2SW_MPT_OR_UNBIND indicates that it is not only 799e39c5baSBill Taylor * unnecessary to attempt the ownership transfer for MPT, but it is also 809e39c5baSBill Taylor * unnecessary to attempt to unbind the memory. 819e39c5baSBill Taylor * In general, these last two are specified when hermon_mr_deregister() is 829e39c5baSBill Taylor * called from hermon_mr_reregister(), where the MPT ownership transfer or 839e39c5baSBill Taylor * memory unbinding may have already been successfully performed. 849e39c5baSBill Taylor */ 859e39c5baSBill Taylor #define HERMON_MR_DEREG_ALL 3 869e39c5baSBill Taylor #define HERMON_MR_DEREG_NO_HW2SW_MPT 2 879e39c5baSBill Taylor #define HERMON_MR_DEREG_NO_HW2SW_MPT_OR_UNBIND 1 889e39c5baSBill Taylor 899e39c5baSBill Taylor /* 909e39c5baSBill Taylor * The following define is used by hermon_mr_rereg_xlat_helper() to determine 919e39c5baSBill Taylor * whether or not a given DMA handle can be reused. If the DMA handle was 929e39c5baSBill Taylor * previously initialized for IOMMU bypass mapping, then it can not be reused 939e39c5baSBill Taylor * to reregister a region for DDI_DMA_STREAMING access. 949e39c5baSBill Taylor */ 959e39c5baSBill Taylor #define HERMON_MR_REUSE_DMAHDL(mr, flags) \ 969e39c5baSBill Taylor (((mr)->mr_bindinfo.bi_bypass != HERMON_BINDMEM_BYPASS) || \ 979e39c5baSBill Taylor !((flags) & IBT_MR_NONCOHERENT)) 989e39c5baSBill Taylor 999e39c5baSBill Taylor /* 1009e39c5baSBill Taylor * The hermon_sw_refcnt_t structure is used internally by the Hermon driver to 1019e39c5baSBill Taylor * track all the information necessary to manage shared memory regions. Since 1029e39c5baSBill Taylor * a shared memory region _will_ have its own distinct MPT entry, but will 1039e39c5baSBill Taylor * _share_ its MTT entries with another region, it is necessary to track the 1049e39c5baSBill Taylor * number of times a given MTT structure is shared. This ensures that it will 1059e39c5baSBill Taylor * not be prematurely freed up and that can be destroyed only when it is 1069e39c5baSBill Taylor * appropriate to do so. 1079e39c5baSBill Taylor * 1089e39c5baSBill Taylor * Each hermon_sw_refcnt_t structure contains a lock and a reference count 1099e39c5baSBill Taylor * variable which are used to track the necessary information. 1109e39c5baSBill Taylor * 1119e39c5baSBill Taylor * The following macros (below) are used to manipulate and query the MTT 1129e39c5baSBill Taylor * reference count parameters. HERMON_MTT_REFCNT_INIT() is used to initialize 1139e39c5baSBill Taylor * a newly allocated hermon_sw_refcnt_t struct (setting the "swrc_refcnt" to 1). 1149e39c5baSBill Taylor * And the HERMON_MTT_IS_NOT_SHARED() and HERMON_MTT_IS_SHARED() macros are 1159e39c5baSBill Taylor * used to query the current status of hermon_sw_refcnt_t struct to determine 1169e39c5baSBill Taylor * if its "swrc_refcnt" is one or not. 1179e39c5baSBill Taylor */ 1189e39c5baSBill Taylor typedef struct hermon_sw_refcnt_s { 1199e39c5baSBill Taylor kmutex_t swrc_lock; 1209e39c5baSBill Taylor uint_t swrc_refcnt; 1219e39c5baSBill Taylor } hermon_sw_refcnt_t; 1229e39c5baSBill Taylor _NOTE(DATA_READABLE_WITHOUT_LOCK(hermon_sw_refcnt_t::swrc_refcnt)) 1239e39c5baSBill Taylor _NOTE(MUTEX_PROTECTS_DATA(hermon_sw_refcnt_t::swrc_lock, 1249e39c5baSBill Taylor hermon_sw_refcnt_t::swrc_refcnt)) 1259e39c5baSBill Taylor #define HERMON_MTT_REFCNT_INIT(swrc_tmp) ((swrc_tmp)->swrc_refcnt = 1) 1269e39c5baSBill Taylor #define HERMON_MTT_IS_NOT_SHARED(swrc_tmp) ((swrc_tmp)->swrc_refcnt == 1) 1279e39c5baSBill Taylor #define HERMON_MTT_IS_SHARED(swrc_tmp) ((swrc_tmp)->swrc_refcnt != 1) 1289e39c5baSBill Taylor 1299e39c5baSBill Taylor 1309e39c5baSBill Taylor /* 1319e39c5baSBill Taylor * The hermon_bind_info_t structure is used internally by the Hermon driver to 1329e39c5baSBill Taylor * track all the information necessary to perform the DMA mappings necessary 1339e39c5baSBill Taylor * for memory registration. It is specifically passed into both the 1349e39c5baSBill Taylor * hermon_mr_mem_bind() and hermon_mr_mtt_write() functions which perform most 1359e39c5baSBill Taylor * of the necessary operations for Hermon memory registration. 1369e39c5baSBill Taylor * 1379e39c5baSBill Taylor * This structure is used to pass all the information necessary for a call 1389e39c5baSBill Taylor * to either ddi_dma_addr_bind_handle() or ddi_dma_buf_bind_handle(). Note: 1399e39c5baSBill Taylor * the fields which need to be valid for each type of binding are slightly 1409e39c5baSBill Taylor * different and that it indicated by the value in the "bi_type" field. The 1419e39c5baSBill Taylor * "bi_type" field may be set to either of the following defined values: 1429e39c5baSBill Taylor * HERMON_BINDHDL_VADDR (to indicate an "addr" bind) or HERMON_BINDHDL_BUF (to 1439e39c5baSBill Taylor * indicate a "buf" bind). 1449e39c5baSBill Taylor * 1459e39c5baSBill Taylor * Upon return from hermon_mr_mem_bind(), the hermon_bind_info_t struct will 1469e39c5baSBill Taylor * have its "bi_dmahdl", "bi_dmacookie", and "bi_cookiecnt" fields filled in. 1479e39c5baSBill Taylor * It is these values which are of particular interest to the 1489e39c5baSBill Taylor * hermon_mr_mtt_write() routine (they hold the PCI mapped addresses). 1499e39c5baSBill Taylor * 1509e39c5baSBill Taylor * Once initialized and used in this way, the hermon_bind_info_t will not to be 1519e39c5baSBill Taylor * modified in anyway until it is subsequently passed to hermon_mr_mem_unbind() 1529e39c5baSBill Taylor * where the memory and resources will be unbound and reclaimed. Note: the 1539e39c5baSBill Taylor * "bi_free_dmahdl" flag indicated whether the ddi_dma_handle_t should be 1549e39c5baSBill Taylor * freed as part of the hermon_mr_mem_unbind() operation or whether it will 1559e39c5baSBill Taylor * be freed later elsewhere. 1569e39c5baSBill Taylor */ 1579e39c5baSBill Taylor typedef struct hermon_bind_info_s { 1589e39c5baSBill Taylor uint64_t bi_addr; 1599e39c5baSBill Taylor uint64_t bi_len; 1609e39c5baSBill Taylor struct as *bi_as; 1619e39c5baSBill Taylor struct buf *bi_buf; 1629e39c5baSBill Taylor ddi_dma_handle_t bi_dmahdl; 1639e39c5baSBill Taylor ddi_dma_cookie_t bi_dmacookie; 1649e39c5baSBill Taylor uint_t bi_cookiecnt; 1659e39c5baSBill Taylor uint_t bi_type; 1669e39c5baSBill Taylor uint_t bi_flags; 1679e39c5baSBill Taylor uint_t bi_bypass; 1689e39c5baSBill Taylor uint_t bi_free_dmahdl; 1699e39c5baSBill Taylor } hermon_bind_info_t; 1709e39c5baSBill Taylor #define HERMON_BINDHDL_NONE 0 1719e39c5baSBill Taylor #define HERMON_BINDHDL_VADDR 1 1729e39c5baSBill Taylor #define HERMON_BINDHDL_BUF 2 1739e39c5baSBill Taylor #define HERMON_BINDHDL_UBUF 3 174*17a2b317SBill Taylor #define HERMON_BINDHDL_LKEY 4 1759e39c5baSBill Taylor 1769e39c5baSBill Taylor /* 1779e39c5baSBill Taylor * The hermon_sw_mr_s structure is also referred to using the "hermon_mrhdl_t" 1789e39c5baSBill Taylor * typedef (see hermon_typedef.h). It encodes all the information necessary 1799e39c5baSBill Taylor * to track the various resources needed to register, reregister, deregister, 1809e39c5baSBill Taylor * and perform all the myriad other operations on both memory regions _and_ 1819e39c5baSBill Taylor * memory windows. 1829e39c5baSBill Taylor * 1839e39c5baSBill Taylor * A pointer to this structure is returned from many of the IBTF's CI verbs 1849e39c5baSBill Taylor * interfaces for memory registration. 1859e39c5baSBill Taylor * 1869e39c5baSBill Taylor * It contains pointers to the various resources allocated for a memory 1879e39c5baSBill Taylor * region, i.e. MPT resource, MTT resource, and MTT reference count resource. 1889e39c5baSBill Taylor * In addition it contains the hermon_bind_info_t struct used for the memory 1899e39c5baSBill Taylor * bind operation on a given memory region. 1909e39c5baSBill Taylor * 1919e39c5baSBill Taylor * It also has a pointers to the associated PD handle, placeholders for access 1929e39c5baSBill Taylor * flags, memory keys, and suggested page size for the region. It also has 1939e39c5baSBill Taylor * the necessary backpointer to the resource that corresponds to the structure 1949e39c5baSBill Taylor * itself. And lastly, it contains a placeholder for a callback which should 1959e39c5baSBill Taylor * be called on memory region unpinning. 1969e39c5baSBill Taylor */ 1979e39c5baSBill Taylor struct hermon_sw_mr_s { 1989e39c5baSBill Taylor kmutex_t mr_lock; 1999e39c5baSBill Taylor hermon_rsrc_t *mr_mptrsrcp; 2009e39c5baSBill Taylor hermon_rsrc_t *mr_mttrsrcp; 2019e39c5baSBill Taylor hermon_rsrc_t *mr_mttrefcntp; 2029e39c5baSBill Taylor hermon_pdhdl_t mr_pdhdl; 2039e39c5baSBill Taylor hermon_bind_info_t mr_bindinfo; 2049e39c5baSBill Taylor ibt_mr_attr_flags_t mr_accflag; 2059e39c5baSBill Taylor uint32_t mr_lkey; 2069e39c5baSBill Taylor uint32_t mr_rkey; 2079e39c5baSBill Taylor uint32_t mr_logmttpgsz; 2089e39c5baSBill Taylor hermon_mpt_rsrc_type_t mr_mpt_type; 2099e39c5baSBill Taylor uint64_t mr_mttaddr; /* for cMPTs */ 2109e39c5baSBill Taylor uint64_t mr_log2_pgsz; 2119e39c5baSBill Taylor /* entity_size (in bytes), for cMPTS */ 2129e39c5baSBill Taylor hermon_rsrc_t *mr_rsrcp; 2139e39c5baSBill Taylor uint_t mr_is_fmr; 214c7facc54SBill Taylor uint8_t mr_fmr_key; /* per FMR 8-bit key */ 2159e39c5baSBill Taylor hermon_fmr_list_t *mr_fmr; 2169e39c5baSBill Taylor uint_t mr_is_umem; 2179e39c5baSBill Taylor ddi_umem_cookie_t mr_umemcookie; 2189e39c5baSBill Taylor void (*mr_umem_cbfunc)(void *, void *); 2199e39c5baSBill Taylor void *mr_umem_cbarg1; 2209e39c5baSBill Taylor void *mr_umem_cbarg2; 2219e39c5baSBill Taylor }; 2229e39c5baSBill Taylor _NOTE(DATA_READABLE_WITHOUT_LOCK(hermon_sw_mr_s::mr_bindinfo 2239e39c5baSBill Taylor hermon_sw_mr_s::mr_lkey 224c7facc54SBill Taylor hermon_sw_mr_s::mr_mttaddr 2259e39c5baSBill Taylor hermon_sw_mr_s::mr_is_umem 2269e39c5baSBill Taylor hermon_sw_mr_s::mr_is_fmr 2279e39c5baSBill Taylor hermon_sw_mr_s::mr_fmr)) 2289e39c5baSBill Taylor _NOTE(MUTEX_PROTECTS_DATA(hermon_sw_mr_s::mr_lock, 2299e39c5baSBill Taylor hermon_sw_mr_s::mr_mptrsrcp 2309e39c5baSBill Taylor hermon_sw_mr_s::mr_mttrsrcp 2319e39c5baSBill Taylor hermon_sw_mr_s::mr_mttrefcntp 2329e39c5baSBill Taylor hermon_sw_mr_s::mr_bindinfo 2339e39c5baSBill Taylor hermon_sw_mr_s::mr_lkey 2349e39c5baSBill Taylor hermon_sw_mr_s::mr_rkey 2359e39c5baSBill Taylor hermon_sw_mr_s::mr_logmttpgsz 2369e39c5baSBill Taylor hermon_sw_mr_s::mr_rsrcp 2379e39c5baSBill Taylor hermon_sw_mr_s::mr_is_umem 2389e39c5baSBill Taylor hermon_sw_mr_s::mr_umemcookie 2399e39c5baSBill Taylor hermon_sw_mr_s::mr_umem_cbfunc 2409e39c5baSBill Taylor hermon_sw_mr_s::mr_umem_cbarg1 2419e39c5baSBill Taylor hermon_sw_mr_s::mr_umem_cbarg2)) 2429e39c5baSBill Taylor 2439e39c5baSBill Taylor /* 2449e39c5baSBill Taylor * The hermon_mr_options_t structure is used in several of the Hermon memory 2459e39c5baSBill Taylor * registration routines to provide additional option functionality. When 2469e39c5baSBill Taylor * a NULL pointer is passed in place of a pointer to this struct, it is a 2479e39c5baSBill Taylor * way of specifying the "default" behavior. Using this structure, however, 2489e39c5baSBill Taylor * is a way of controlling any extended behavior. 2499e39c5baSBill Taylor * 2509e39c5baSBill Taylor * Currently, the only defined "extended" behaviors are for specifying whether 2519e39c5baSBill Taylor * a given memory region should bypass the PCI IOMMU (HERMON_BINDMEM_BYPASS) 2529e39c5baSBill Taylor * or be mapped into the IOMMU (HERMON_BINDMEM_NORMAL), for specifying whether 2539e39c5baSBill Taylor * a given ddi_dma_handle_t should be used in the bind operation, and for 2549e39c5baSBill Taylor * specifying whether a memory registration should attempt to return an IB 2559e39c5baSBill Taylor * vaddr which is "zero-based" (aids in alignment contraints for QPs). 2569e39c5baSBill Taylor * 2579e39c5baSBill Taylor * This defaults today to always bypassing the IOMMU (can be changed by using 2589e39c5baSBill Taylor * the "hermon_iommu_bypass" configuration variable), to always allocating 2599e39c5baSBill Taylor * a new dma handle, and to using the virtual address passed in (i.e. not 2609e39c5baSBill Taylor * "zero-based"). 2619e39c5baSBill Taylor */ 2629e39c5baSBill Taylor typedef struct hermon_mr_options_s { 2639e39c5baSBill Taylor ddi_dma_handle_t mro_bind_dmahdl; 2649e39c5baSBill Taylor uint_t mro_bind_type; 2659e39c5baSBill Taylor uint_t mro_bind_override_addr; 2669e39c5baSBill Taylor } hermon_mr_options_t; 2679e39c5baSBill Taylor #define HERMON_BINDMEM_NORMAL 1 2689e39c5baSBill Taylor #define HERMON_BINDMEM_BYPASS 0 2699e39c5baSBill Taylor 2709e39c5baSBill Taylor #define HERMON_NO_MPT_OWNERSHIP 0 /* for cMPTs */ 2719e39c5baSBill Taylor #define HERMON_PASS_MPT_OWNERSHIP 1 2729e39c5baSBill Taylor 2739e39c5baSBill Taylor /* 2749e39c5baSBill Taylor * Memory Allocation/Deallocation 2759e39c5baSBill Taylor * 2769e39c5baSBill Taylor * Although this is not strictly related to "memory regions", this is 2779e39c5baSBill Taylor * the most logical place to define the struct used for the memory 2789e39c5baSBill Taylor * allocation/deallocation CI entry points. 2799e39c5baSBill Taylor * 2809e39c5baSBill Taylor * ibc_mem_alloc_s structure is used to store DMA handles for 2819e39c5baSBill Taylor * for these allocations. 2829e39c5baSBill Taylor */ 2839e39c5baSBill Taylor struct ibc_mem_alloc_s { 2849e39c5baSBill Taylor ddi_dma_handle_t ibc_dma_hdl; 2859e39c5baSBill Taylor ddi_acc_handle_t ibc_acc_hdl; 2869e39c5baSBill Taylor }; 2879e39c5baSBill Taylor _NOTE(SCHEME_PROTECTS_DATA("safe sharing", 2889e39c5baSBill Taylor ibc_mem_alloc_s::ibc_dma_hdl 2899e39c5baSBill Taylor ibc_mem_alloc_s::ibc_acc_hdl)) 2909e39c5baSBill Taylor 291*17a2b317SBill Taylor int hermon_dma_mr_register(hermon_state_t *state, hermon_pdhdl_t pdhdl, 292*17a2b317SBill Taylor ibt_dmr_attr_t *attr_p, hermon_mrhdl_t *mrhdl); 2939e39c5baSBill Taylor int hermon_mr_register(hermon_state_t *state, hermon_pdhdl_t pdhdl, 2949e39c5baSBill Taylor ibt_mr_attr_t *attr_p, hermon_mrhdl_t *mrhdl, hermon_mr_options_t *op, 2959e39c5baSBill Taylor hermon_mpt_rsrc_type_t mpt_type); 2969e39c5baSBill Taylor int hermon_mr_register_buf(hermon_state_t *state, hermon_pdhdl_t pdhdl, 2979e39c5baSBill Taylor ibt_smr_attr_t *attrp, struct buf *buf, hermon_mrhdl_t *mrhdl, 2989e39c5baSBill Taylor hermon_mr_options_t *op, hermon_mpt_rsrc_type_t mpt_type); 2999e39c5baSBill Taylor int hermon_mr_mtt_bind(hermon_state_t *state, hermon_bind_info_t *bind, 3009e39c5baSBill Taylor ddi_dma_handle_t bind_dmahdl, hermon_rsrc_t **mtt, uint_t *mtt_pgsz_bits, 3019e39c5baSBill Taylor uint_t is_buffer); 3029e39c5baSBill Taylor int hermon_mr_mtt_unbind(hermon_state_t *state, hermon_bind_info_t *bind, 3039e39c5baSBill Taylor hermon_rsrc_t *mtt); 3049e39c5baSBill Taylor int hermon_mr_register_shared(hermon_state_t *state, hermon_mrhdl_t mrhdl, 3059e39c5baSBill Taylor hermon_pdhdl_t pdhdl, ibt_smr_attr_t *attr_p, hermon_mrhdl_t *mrhdl_new); 3069e39c5baSBill Taylor int hermon_mr_deregister(hermon_state_t *state, hermon_mrhdl_t *mrhdl, 3079e39c5baSBill Taylor uint_t level, uint_t sleep); 3089e39c5baSBill Taylor int hermon_mr_query(hermon_state_t *state, hermon_mrhdl_t mrhdl, 3099e39c5baSBill Taylor ibt_mr_query_attr_t *attr); 3109e39c5baSBill Taylor int hermon_mr_reregister(hermon_state_t *state, hermon_mrhdl_t mrhdl, 3119e39c5baSBill Taylor hermon_pdhdl_t pdhdl, ibt_mr_attr_t *attr_p, hermon_mrhdl_t *mrhdl_new, 3129e39c5baSBill Taylor hermon_mr_options_t *op); 3139e39c5baSBill Taylor int hermon_mr_reregister_buf(hermon_state_t *state, hermon_mrhdl_t mr, 3149e39c5baSBill Taylor hermon_pdhdl_t pd, ibt_smr_attr_t *mr_attr, struct buf *buf, 3159e39c5baSBill Taylor hermon_mrhdl_t *mrhdl_new, hermon_mr_options_t *op); 3169e39c5baSBill Taylor int hermon_mr_sync(hermon_state_t *state, ibt_mr_sync_t *mr_segs, 3179e39c5baSBill Taylor size_t num_segs); 3189e39c5baSBill Taylor int hermon_mw_alloc(hermon_state_t *state, hermon_pdhdl_t pdhdl, 3199e39c5baSBill Taylor ibt_mw_flags_t flags, hermon_mwhdl_t *mwhdl); 3209e39c5baSBill Taylor int hermon_mw_free(hermon_state_t *state, hermon_mwhdl_t *mwhdl, uint_t sleep); 3219e39c5baSBill Taylor uint32_t hermon_mr_keycalc(uint32_t indx); 3229e39c5baSBill Taylor uint32_t hermon_mr_key_swap(uint32_t indx); 3239e39c5baSBill Taylor uint32_t hermon_index_to_mkey(uint32_t indx); 3249e39c5baSBill Taylor int hermon_mr_alloc_fmr(hermon_state_t *state, hermon_pdhdl_t pd, 3259e39c5baSBill Taylor hermon_fmrhdl_t fmr_pool, hermon_mrhdl_t *mrhdl); 3269e39c5baSBill Taylor int hermon_mr_dealloc_fmr(hermon_state_t *state, hermon_mrhdl_t *mrhdl); 3279e39c5baSBill Taylor int hermon_mr_register_physical_fmr(hermon_state_t *state, 3289e39c5baSBill Taylor ibt_pmr_attr_t *mem_pattr_p, hermon_mrhdl_t mr, ibt_pmr_desc_t *mem_desc_p); 329*17a2b317SBill Taylor int hermon_mr_alloc_lkey(hermon_state_t *state, hermon_pdhdl_t pd, 330*17a2b317SBill Taylor ibt_lkey_flags_t flags, uint_t sz, hermon_mrhdl_t *mr); 331*17a2b317SBill Taylor int hermon_mr_fexch_mpt_init(hermon_state_t *state, hermon_pdhdl_t pd, 332*17a2b317SBill Taylor uint32_t mpt_indx, uint_t nummtt, uint64_t mtt_addr, uint_t sleep); 333*17a2b317SBill Taylor int hermon_mr_fexch_mpt_fini(hermon_state_t *state, hermon_pdhdl_t pd, 334*17a2b317SBill Taylor uint32_t mpt_indx, uint_t sleep); 3359e39c5baSBill Taylor 3369e39c5baSBill Taylor 3379e39c5baSBill Taylor #ifdef __cplusplus 3389e39c5baSBill Taylor } 3399e39c5baSBill Taylor #endif 3409e39c5baSBill Taylor 3419e39c5baSBill Taylor #endif /* _SYS_IB_ADAPTERS_HERMON_MR_H */ 342