Lines Matching refs:mr

65 static int hermon_mr_common_rereg(hermon_state_t *state, hermon_mrhdl_t mr,
68 static int hermon_mr_rereg_xlat_helper(hermon_state_t *state, hermon_mrhdl_t mr,
179 hermon_mrhdl_t mr; in hermon_mr_register_shared() local
229 mr = (hermon_mrhdl_t)rsrc->hr_addr; in hermon_mr_register_shared()
230 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mr)) in hermon_mr_register_shared()
237 mr->mr_accflag = 0; in hermon_mr_register_shared()
239 mr->mr_accflag |= IBT_MR_WINDOW_BIND; in hermon_mr_register_shared()
241 mr->mr_accflag |= IBT_MR_LOCAL_WRITE; in hermon_mr_register_shared()
243 mr->mr_accflag |= IBT_MR_REMOTE_READ; in hermon_mr_register_shared()
245 mr->mr_accflag |= IBT_MR_REMOTE_WRITE; in hermon_mr_register_shared()
247 mr->mr_accflag |= IBT_MR_REMOTE_ATOMIC; in hermon_mr_register_shared()
258 mr->mr_rkey = mr->mr_lkey = hermon_mr_keycalc(mpt->hr_indx); in hermon_mr_register_shared()
317 mr->mr_mttrsrcp = mrhdl->mr_mttrsrcp; in hermon_mr_register_shared()
318 mr->mr_logmttpgsz = mrhdl->mr_logmttpgsz; in hermon_mr_register_shared()
319 mr->mr_bindinfo = mrhdl->mr_bindinfo; in hermon_mr_register_shared()
320 mr->mr_mttrefcntp = mrhdl->mr_mttrefcntp; in hermon_mr_register_shared()
322 bind = &mr->mr_bindinfo; in hermon_mr_register_shared()
324 mtt = mr->mr_mttrsrcp; in hermon_mr_register_shared()
330 (void) hermon_mtt_refcnt_inc(mr->mr_mttrefcntp); in hermon_mr_register_shared()
338 pgsize_msk = (((uint64_t)1 << mr->mr_logmttpgsz) - 1); in hermon_mr_register_shared()
340 (mr->mr_bindinfo.bi_addr & pgsize_msk)); in hermon_mr_register_shared()
349 mpt_entry.en_bind = (mr->mr_accflag & IBT_MR_WINDOW_BIND) ? 1 : 0; in hermon_mr_register_shared()
350 mpt_entry.atomic = (mr->mr_accflag & IBT_MR_REMOTE_ATOMIC) ? 1 : 0; in hermon_mr_register_shared()
351 mpt_entry.rw = (mr->mr_accflag & IBT_MR_REMOTE_WRITE) ? 1 : 0; in hermon_mr_register_shared()
352 mpt_entry.rr = (mr->mr_accflag & IBT_MR_REMOTE_READ) ? 1 : 0; in hermon_mr_register_shared()
353 mpt_entry.lw = (mr->mr_accflag & IBT_MR_LOCAL_WRITE) ? 1 : 0; in hermon_mr_register_shared()
356 mpt_entry.entity_sz = mr->mr_logmttpgsz; in hermon_mr_register_shared()
357 mpt_entry.mem_key = mr->mr_lkey; in hermon_mr_register_shared()
388 mr->mr_mptrsrcp = mpt; in hermon_mr_register_shared()
389 mr->mr_mttrsrcp = mtt; in hermon_mr_register_shared()
390 mr->mr_mpt_type = HERMON_MPT_DMPT; in hermon_mr_register_shared()
391 mr->mr_pdhdl = pd; in hermon_mr_register_shared()
392 mr->mr_rsrcp = rsrc; in hermon_mr_register_shared()
393 mr->mr_is_umem = mr_is_umem; in hermon_mr_register_shared()
394 mr->mr_is_fmr = 0; in hermon_mr_register_shared()
395 mr->mr_umemcookie = (mr_is_umem != 0) ? umem_cookie : NULL; in hermon_mr_register_shared()
396 mr->mr_umem_cbfunc = NULL; in hermon_mr_register_shared()
397 mr->mr_umem_cbarg1 = NULL; in hermon_mr_register_shared()
398 mr->mr_umem_cbarg2 = NULL; in hermon_mr_register_shared()
399 mr->mr_lkey = hermon_mr_key_swap(mr->mr_lkey); in hermon_mr_register_shared()
400 mr->mr_rkey = hermon_mr_key_swap(mr->mr_rkey); in hermon_mr_register_shared()
412 *mrhdl_new = mr; in hermon_mr_register_shared()
420 (void) hermon_mtt_refcnt_dec(mr->mr_mttrefcntp); in hermon_mr_register_shared()
448 hermon_mrhdl_t mr; in hermon_mr_alloc_fmr() local
499 mr = (hermon_mrhdl_t)rsrc->hr_addr; in hermon_mr_alloc_fmr()
500 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mr)) in hermon_mr_alloc_fmr()
507 mr->mr_accflag = 0; in hermon_mr_alloc_fmr()
509 mr->mr_accflag |= IBT_MR_LOCAL_WRITE; in hermon_mr_alloc_fmr()
511 mr->mr_accflag |= IBT_MR_REMOTE_READ; in hermon_mr_alloc_fmr()
513 mr->mr_accflag |= IBT_MR_REMOTE_WRITE; in hermon_mr_alloc_fmr()
515 mr->mr_accflag |= IBT_MR_REMOTE_ATOMIC; in hermon_mr_alloc_fmr()
526 mr->mr_fmr_key = 1; /* ready for the next reload */ in hermon_mr_alloc_fmr()
527 mr->mr_rkey = mr->mr_lkey = mpt->hr_indx; in hermon_mr_alloc_fmr()
553 mr->mr_logmttpgsz = mtt_pgsize_bits; in hermon_mr_alloc_fmr()
563 mpt_entry.atomic = (mr->mr_accflag & IBT_MR_REMOTE_ATOMIC) ? 1 : 0; in hermon_mr_alloc_fmr()
564 mpt_entry.rw = (mr->mr_accflag & IBT_MR_REMOTE_WRITE) ? 1 : 0; in hermon_mr_alloc_fmr()
565 mpt_entry.rr = (mr->mr_accflag & IBT_MR_REMOTE_READ) ? 1 : 0; in hermon_mr_alloc_fmr()
566 mpt_entry.lw = (mr->mr_accflag & IBT_MR_LOCAL_WRITE) ? 1 : 0; in hermon_mr_alloc_fmr()
571 mpt_entry.entity_sz = mr->mr_logmttpgsz; in hermon_mr_alloc_fmr()
577 mpt_entry.mem_key = mr->mr_lkey; in hermon_mr_alloc_fmr()
610 mr->mr_mptrsrcp = mpt; in hermon_mr_alloc_fmr()
611 mr->mr_mttrsrcp = mtt; in hermon_mr_alloc_fmr()
613 mr->mr_mpt_type = HERMON_MPT_DMPT; in hermon_mr_alloc_fmr()
614 mr->mr_pdhdl = pd; in hermon_mr_alloc_fmr()
615 mr->mr_rsrcp = rsrc; in hermon_mr_alloc_fmr()
616 mr->mr_is_fmr = 1; in hermon_mr_alloc_fmr()
617 mr->mr_lkey = hermon_mr_key_swap(mr->mr_lkey); in hermon_mr_alloc_fmr()
618 mr->mr_rkey = hermon_mr_key_swap(mr->mr_rkey); in hermon_mr_alloc_fmr()
619 mr->mr_mttaddr = mtt_addr; in hermon_mr_alloc_fmr()
620 (void) memcpy(&mr->mr_bindinfo, &bind, sizeof (hermon_bind_info_t)); in hermon_mr_alloc_fmr()
630 *mrhdl = mr; in hermon_mr_alloc_fmr()
657 ibt_pmr_attr_t *mem_pattr_p, hermon_mrhdl_t mr, ibt_pmr_desc_t *mem_desc_p) in hermon_mr_register_physical_fmr() argument
664 mutex_enter(&mr->mr_lock); in hermon_mr_register_physical_fmr()
665 mpt = mr->mr_mptrsrcp; in hermon_mr_register_physical_fmr()
678 status = hermon_mr_fast_mtt_write_fmr(state, mr->mr_mttrsrcp, in hermon_mr_register_physical_fmr()
679 mem_pattr_p, mr->mr_logmttpgsz); in hermon_mr_register_physical_fmr()
681 mutex_exit(&mr->mr_lock); in hermon_mr_register_physical_fmr()
695 key = mpt->hr_indx | (mr->mr_fmr_key++ << HERMON_MEMKEY_SHIFT); in hermon_mr_register_physical_fmr()
696 mr->mr_lkey = mr->mr_rkey = hermon_mr_key_swap(key); in hermon_mr_register_physical_fmr()
716 mem_desc_p->pmd_lkey = mr->mr_lkey; in hermon_mr_register_physical_fmr()
717 mem_desc_p->pmd_rkey = mr->mr_rkey; in hermon_mr_register_physical_fmr()
722 mr->mr_bindinfo.bi_addr = mem_pattr_p->pmr_iova; in hermon_mr_register_physical_fmr()
723 mr->mr_bindinfo.bi_flags = mem_pattr_p->pmr_flags & IBT_MR_NONCOHERENT; in hermon_mr_register_physical_fmr()
725 mutex_exit(&mr->mr_lock); in hermon_mr_register_physical_fmr()
751 hermon_mrhdl_t mr; in hermon_mr_deregister() local
774 mr = *mrhdl; in hermon_mr_deregister()
775 mutex_enter(&mr->mr_lock); in hermon_mr_deregister()
776 mpt = mr->mr_mptrsrcp; in hermon_mr_deregister()
777 mtt = mr->mr_mttrsrcp; in hermon_mr_deregister()
778 mtt_refcnt = mr->mr_mttrefcntp; in hermon_mr_deregister()
779 rsrc = mr->mr_rsrcp; in hermon_mr_deregister()
780 pd = mr->mr_pdhdl; in hermon_mr_deregister()
781 bind = &mr->mr_bindinfo; in hermon_mr_deregister()
787 if (mr->mr_is_fmr) { in hermon_mr_deregister()
788 mutex_exit(&mr->mr_lock); in hermon_mr_deregister()
797 if ((mr->mr_is_umem) && (mr->mr_umemcookie == NULL)) { in hermon_mr_deregister()
802 mr, mr->mr_rkey); in hermon_mr_deregister()
811 mutex_exit(&mr->mr_lock); in hermon_mr_deregister()
825 if (mr->mr_mpt_type >= HERMON_MPT_DMPT) { in hermon_mr_deregister()
851 mutex_enter(&mr->mr_lock); in hermon_mr_deregister()
863 if (mr->mr_is_umem) { in hermon_mr_deregister()
865 (uint64_t)(uintptr_t)mr->mr_umemcookie, in hermon_mr_deregister()
870 ddi_umem_unlock(mr->mr_umemcookie); in hermon_mr_deregister()
872 ddi_umem_unlock(mr->mr_umemcookie); in hermon_mr_deregister()
873 mr->mr_umemcookie = NULL; in hermon_mr_deregister()
912 if ((mr->mr_is_umem) && (mr->mr_umemcookie == NULL)) { in hermon_mr_deregister()
913 mutex_exit(&mr->mr_lock); in hermon_mr_deregister()
918 mutex_exit(&mr->mr_lock); in hermon_mr_deregister()
946 hermon_mrhdl_t mr; in hermon_mr_dealloc_fmr() local
954 mr = *mrhdl; in hermon_mr_dealloc_fmr()
955 mutex_enter(&mr->mr_lock); in hermon_mr_dealloc_fmr()
956 mpt = mr->mr_mptrsrcp; in hermon_mr_dealloc_fmr()
957 mtt = mr->mr_mttrsrcp; in hermon_mr_dealloc_fmr()
958 rsrc = mr->mr_rsrcp; in hermon_mr_dealloc_fmr()
959 pd = mr->mr_pdhdl; in hermon_mr_dealloc_fmr()
960 mutex_exit(&mr->mr_lock); in hermon_mr_dealloc_fmr()
987 hermon_mr_query(hermon_state_t *state, hermon_mrhdl_t mr, in hermon_mr_query() argument
996 mutex_enter(&mr->mr_lock); in hermon_mr_query()
1003 if ((mr->mr_is_umem) && (mr->mr_umemcookie == NULL)) { in hermon_mr_query()
1004 mutex_exit(&mr->mr_lock); in hermon_mr_query()
1009 mr->mr_lkey >> 8, &mpt_entry, sizeof (hermon_hw_dmpt_t), in hermon_mr_query()
1013 mutex_exit(&mr->mr_lock); in hermon_mr_query()
1019 mr->mr_lkey = mr->mr_rkey = (lkey >> 8) | (lkey << 24); in hermon_mr_query()
1020 mr->mr_bindinfo.bi_addr = mpt_entry.start_addr; in hermon_mr_query()
1021 mr->mr_bindinfo.bi_len = mpt_entry.reg_win_len; in hermon_mr_query()
1022 mr->mr_accflag = (mr->mr_accflag & IBT_MR_RO_DISABLED) | in hermon_mr_query()
1028 mr->mr_mttaddr = ((uint64_t)mpt_entry.mtt_addr_h << 32) | in hermon_mr_query()
1030 mr->mr_logmttpgsz = mpt_entry.entity_sz; in hermon_mr_query()
1038 attr->mr_attr_flags = mr->mr_accflag; in hermon_mr_query()
1039 attr->mr_pd = (ibt_pd_hdl_t)mr->mr_pdhdl; in hermon_mr_query()
1042 attr->mr_lkey = (ibt_lkey_t)mr->mr_lkey; in hermon_mr_query()
1043 attr->mr_lbounds.pb_addr = (ib_vaddr_t)mr->mr_bindinfo.bi_addr; in hermon_mr_query()
1044 attr->mr_lbounds.pb_len = (size_t)mr->mr_bindinfo.bi_len; in hermon_mr_query()
1051 if ((mr->mr_accflag & IBT_MR_REMOTE_READ) || in hermon_mr_query()
1052 (mr->mr_accflag & IBT_MR_REMOTE_WRITE) || in hermon_mr_query()
1053 (mr->mr_accflag & IBT_MR_REMOTE_ATOMIC)) { in hermon_mr_query()
1054 attr->mr_rkey = (ibt_rkey_t)mr->mr_rkey; in hermon_mr_query()
1055 attr->mr_rbounds.pb_addr = (ib_vaddr_t)mr->mr_bindinfo.bi_addr; in hermon_mr_query()
1056 attr->mr_rbounds.pb_len = (size_t)mr->mr_bindinfo.bi_len; in hermon_mr_query()
1063 attr->mr_sync_required = (mr->mr_bindinfo.bi_flags & in hermon_mr_query()
1066 mutex_exit(&mr->mr_lock); in hermon_mr_query()
1076 hermon_mr_reregister(hermon_state_t *state, hermon_mrhdl_t mr, in hermon_mr_reregister() argument
1096 status = hermon_mr_common_rereg(state, mr, pd, &bind, mrhdl_new, op); in hermon_mr_reregister()
1106 hermon_mr_reregister_buf(hermon_state_t *state, hermon_mrhdl_t mr, in hermon_mr_reregister_buf() argument
1135 status = hermon_mr_common_rereg(state, mr, pd, &bind, mrhdl_new, op); in hermon_mr_reregister_buf()
1476 hermon_mrhdl_t mr; in hermon_mr_common_reg() local
1564 mr = (hermon_mrhdl_t)rsrc->hr_addr; in hermon_mr_common_reg()
1565 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mr)) in hermon_mr_common_reg()
1572 mr->mr_accflag = 0; in hermon_mr_common_reg()
1574 mr->mr_accflag |= IBT_MR_WINDOW_BIND; in hermon_mr_common_reg()
1576 mr->mr_accflag |= IBT_MR_LOCAL_WRITE; in hermon_mr_common_reg()
1578 mr->mr_accflag |= IBT_MR_REMOTE_READ; in hermon_mr_common_reg()
1580 mr->mr_accflag |= IBT_MR_REMOTE_WRITE; in hermon_mr_common_reg()
1582 mr->mr_accflag |= IBT_MR_REMOTE_ATOMIC; in hermon_mr_common_reg()
1594 mr->mr_rkey = mr->mr_lkey = hermon_mr_keycalc(mpt->hr_indx); in hermon_mr_common_reg()
1646 bh = &mr->mr_bindinfo; in hermon_mr_common_reg()
1660 mr->mr_logmttpgsz = mtt_pgsize_bits; in hermon_mr_common_reg()
1675 mr->mr_mttrefcntp = mtt_refcnt; in hermon_mr_common_reg()
1694 mpt_entry.en_bind = (mr->mr_accflag & IBT_MR_WINDOW_BIND) ? 1 : 0; in hermon_mr_common_reg()
1695 mpt_entry.atomic = (mr->mr_accflag & IBT_MR_REMOTE_ATOMIC) ? 1 : 0; in hermon_mr_common_reg()
1696 mpt_entry.rw = (mr->mr_accflag & IBT_MR_REMOTE_WRITE) ? 1 : 0; in hermon_mr_common_reg()
1697 mpt_entry.rr = (mr->mr_accflag & IBT_MR_REMOTE_READ) ? 1 : 0; in hermon_mr_common_reg()
1698 mpt_entry.lw = (mr->mr_accflag & IBT_MR_LOCAL_WRITE) ? 1 : 0; in hermon_mr_common_reg()
1703 mpt_entry.entity_sz = mr->mr_logmttpgsz; in hermon_mr_common_reg()
1704 mpt_entry.mem_key = mr->mr_lkey; in hermon_mr_common_reg()
1715 bh->bi_addr = bh->bi_addr & ((1 << mr->mr_logmttpgsz) - 1); in hermon_mr_common_reg()
1749 mr, hermon_mr_key_swap(mr->mr_rkey)); in hermon_mr_common_reg()
1757 mr->mr_mttaddr = mtt_addr; in hermon_mr_common_reg()
1759 mr->mr_log2_pgsz = (mr->mr_logmttpgsz - HERMON_PAGESHIFT); in hermon_mr_common_reg()
1760 mr->mr_mptrsrcp = mpt; in hermon_mr_common_reg()
1761 mr->mr_mttrsrcp = mtt; in hermon_mr_common_reg()
1762 mr->mr_pdhdl = pd; in hermon_mr_common_reg()
1763 mr->mr_rsrcp = rsrc; in hermon_mr_common_reg()
1764 mr->mr_is_umem = mr_is_umem; in hermon_mr_common_reg()
1765 mr->mr_is_fmr = 0; in hermon_mr_common_reg()
1766 mr->mr_umemcookie = (mr_is_umem != 0) ? umem_cookie : NULL; in hermon_mr_common_reg()
1767 mr->mr_umem_cbfunc = NULL; in hermon_mr_common_reg()
1768 mr->mr_umem_cbarg1 = NULL; in hermon_mr_common_reg()
1769 mr->mr_umem_cbarg2 = NULL; in hermon_mr_common_reg()
1770 mr->mr_lkey = hermon_mr_key_swap(mr->mr_lkey); in hermon_mr_common_reg()
1771 mr->mr_rkey = hermon_mr_key_swap(mr->mr_rkey); in hermon_mr_common_reg()
1772 mr->mr_mpt_type = mpt_type; in hermon_mr_common_reg()
1784 *mrhdl = mr; in hermon_mr_common_reg()
1835 hermon_mrhdl_t mr; in hermon_dma_mr_register() local
1882 mr = (hermon_mrhdl_t)rsrc->hr_addr; in hermon_dma_mr_register()
1883 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mr)) in hermon_dma_mr_register()
1884 bzero(mr, sizeof (*mr)); in hermon_dma_mr_register()
1891 mr->mr_accflag = 0; in hermon_dma_mr_register()
1893 mr->mr_accflag |= IBT_MR_WINDOW_BIND; in hermon_dma_mr_register()
1895 mr->mr_accflag |= IBT_MR_LOCAL_WRITE; in hermon_dma_mr_register()
1897 mr->mr_accflag |= IBT_MR_REMOTE_READ; in hermon_dma_mr_register()
1899 mr->mr_accflag |= IBT_MR_REMOTE_WRITE; in hermon_dma_mr_register()
1901 mr->mr_accflag |= IBT_MR_REMOTE_ATOMIC; in hermon_dma_mr_register()
1913 mr->mr_rkey = mr->mr_lkey = hermon_mr_keycalc(mpt->hr_indx); in hermon_dma_mr_register()
1924 mpt_entry.en_bind = (mr->mr_accflag & IBT_MR_WINDOW_BIND) ? 1 : 0; in hermon_dma_mr_register()
1925 mpt_entry.atomic = (mr->mr_accflag & IBT_MR_REMOTE_ATOMIC) ? 1 : 0; in hermon_dma_mr_register()
1926 mpt_entry.rw = (mr->mr_accflag & IBT_MR_REMOTE_WRITE) ? 1 : 0; in hermon_dma_mr_register()
1927 mpt_entry.rr = (mr->mr_accflag & IBT_MR_REMOTE_READ) ? 1 : 0; in hermon_dma_mr_register()
1928 mpt_entry.lw = (mr->mr_accflag & IBT_MR_LOCAL_WRITE) ? 1 : 0; in hermon_dma_mr_register()
1933 mpt_entry.entity_sz = mr->mr_logmttpgsz; in hermon_dma_mr_register()
1934 mpt_entry.mem_key = mr->mr_lkey; in hermon_dma_mr_register()
1980 mr->mr_mttaddr = 0; in hermon_dma_mr_register()
1982 mr->mr_log2_pgsz = 0; in hermon_dma_mr_register()
1983 mr->mr_mptrsrcp = mpt; in hermon_dma_mr_register()
1984 mr->mr_mttrsrcp = NULL; in hermon_dma_mr_register()
1985 mr->mr_pdhdl = pd; in hermon_dma_mr_register()
1986 mr->mr_rsrcp = rsrc; in hermon_dma_mr_register()
1987 mr->mr_is_umem = 0; in hermon_dma_mr_register()
1988 mr->mr_is_fmr = 0; in hermon_dma_mr_register()
1989 mr->mr_umemcookie = NULL; in hermon_dma_mr_register()
1990 mr->mr_umem_cbfunc = NULL; in hermon_dma_mr_register()
1991 mr->mr_umem_cbarg1 = NULL; in hermon_dma_mr_register()
1992 mr->mr_umem_cbarg2 = NULL; in hermon_dma_mr_register()
1993 mr->mr_lkey = hermon_mr_key_swap(mr->mr_lkey); in hermon_dma_mr_register()
1994 mr->mr_rkey = hermon_mr_key_swap(mr->mr_rkey); in hermon_dma_mr_register()
1995 mr->mr_mpt_type = HERMON_MPT_DMPT; in hermon_dma_mr_register()
1997 *mrhdl = mr; in hermon_dma_mr_register()
2025 hermon_mrhdl_t mr; in hermon_mr_alloc_lkey() local
2061 mr = (hermon_mrhdl_t)rsrc->hr_addr; in hermon_mr_alloc_lkey()
2062 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mr)) in hermon_mr_alloc_lkey()
2063 bzero(mr, sizeof (*mr)); in hermon_mr_alloc_lkey()
2064 mr->mr_bindinfo.bi_type = HERMON_BINDHDL_LKEY; in hermon_mr_alloc_lkey()
2066 mr->mr_lkey = hermon_mr_keycalc(mpt->hr_indx); in hermon_mr_alloc_lkey()
2073 mr->mr_logmttpgsz = PAGESHIFT; in hermon_mr_alloc_lkey()
2088 mr->mr_mttrefcntp = mtt_refcnt; in hermon_mr_alloc_lkey()
2100 mpt_entry.entity_sz = mr->mr_logmttpgsz; in hermon_mr_alloc_lkey()
2101 mpt_entry.mem_key = mr->mr_lkey; in hermon_mr_alloc_lkey()
2141 mr->mr_accflag = IBT_MR_LOCAL_WRITE; in hermon_mr_alloc_lkey()
2142 mr->mr_mttaddr = mtt_addr; in hermon_mr_alloc_lkey()
2143 mr->mr_log2_pgsz = (mr->mr_logmttpgsz - HERMON_PAGESHIFT); in hermon_mr_alloc_lkey()
2144 mr->mr_mptrsrcp = mpt; in hermon_mr_alloc_lkey()
2145 mr->mr_mttrsrcp = mtt; in hermon_mr_alloc_lkey()
2146 mr->mr_pdhdl = pd; in hermon_mr_alloc_lkey()
2147 mr->mr_rsrcp = rsrc; in hermon_mr_alloc_lkey()
2148 mr->mr_lkey = hermon_mr_key_swap(mr->mr_lkey); in hermon_mr_alloc_lkey()
2149 mr->mr_rkey = mr->mr_lkey; in hermon_mr_alloc_lkey()
2150 mr->mr_mpt_type = HERMON_MPT_DMPT; in hermon_mr_alloc_lkey()
2152 *mrhdl = mr; in hermon_mr_alloc_lkey()
2378 hermon_mr_common_rereg(hermon_state_t *state, hermon_mrhdl_t mr, in hermon_mr_common_rereg() argument
2398 if (mr->mr_is_umem) { in hermon_mr_common_rereg()
2403 mutex_enter(&mr->mr_lock); in hermon_mr_common_rereg()
2406 mpt = mr->mr_mptrsrcp; in hermon_mr_common_rereg()
2419 mutex_exit(&mr->mr_lock); in hermon_mr_common_rereg()
2440 mutex_exit(&mr->mr_lock); in hermon_mr_common_rereg()
2454 if (hermon_mr_deregister(state, &mr, in hermon_mr_common_rereg()
2470 mutex_exit(&mr->mr_lock); in hermon_mr_common_rereg()
2478 if (hermon_mr_deregister(state, &mr, in hermon_mr_common_rereg()
2493 pd_to_use = mr->mr_pdhdl; in hermon_mr_common_rereg()
2507 mutex_exit(&mr->mr_lock); in hermon_mr_common_rereg()
2515 if (hermon_mr_deregister(state, &mr, in hermon_mr_common_rereg()
2543 acc_flags_to_use = mr->mr_accflag; in hermon_mr_common_rereg()
2561 status = hermon_mr_rereg_xlat_helper(state, mr, bind, op, in hermon_mr_common_rereg()
2564 mutex_exit(&mr->mr_lock); in hermon_mr_common_rereg()
2569 if (hermon_mr_deregister(state, &mr, dereg_level, in hermon_mr_common_rereg()
2576 vaddr_to_use = mr->mr_bindinfo.bi_addr; in hermon_mr_common_rereg()
2577 len_to_use = mr->mr_bindinfo.bi_len; in hermon_mr_common_rereg()
2579 mtt_addr_to_use = mr->mr_mttaddr; in hermon_mr_common_rereg()
2580 vaddr_to_use = mr->mr_bindinfo.bi_addr; in hermon_mr_common_rereg()
2581 len_to_use = mr->mr_bindinfo.bi_len; in hermon_mr_common_rereg()
2591 mr->mr_lkey = hermon_mr_keycalc(mpt->hr_indx); in hermon_mr_common_rereg()
2595 mr->mr_rkey = mr->mr_lkey; in hermon_mr_common_rereg()
2597 mr->mr_rkey = 0; in hermon_mr_common_rereg()
2617 mpt_entry.entity_sz = mr->mr_logmttpgsz; in hermon_mr_common_rereg()
2618 mpt_entry.mem_key = mr->mr_lkey; in hermon_mr_common_rereg()
2635 mutex_exit(&mr->mr_lock); in hermon_mr_common_rereg()
2647 if (hermon_mr_deregister(state, &mr, in hermon_mr_common_rereg()
2661 hermon_pd_refcnt_dec(mr->mr_pdhdl); in hermon_mr_common_rereg()
2669 mr->mr_pdhdl = pd_to_use; in hermon_mr_common_rereg()
2670 mr->mr_accflag = acc_flags_to_use; in hermon_mr_common_rereg()
2671 mr->mr_is_umem = 0; in hermon_mr_common_rereg()
2672 mr->mr_is_fmr = 0; in hermon_mr_common_rereg()
2673 mr->mr_umemcookie = NULL; in hermon_mr_common_rereg()
2674 mr->mr_lkey = hermon_mr_key_swap(mr->mr_lkey); in hermon_mr_common_rereg()
2675 mr->mr_rkey = hermon_mr_key_swap(mr->mr_rkey); in hermon_mr_common_rereg()
2678 *mrhdl_new = mr; in hermon_mr_common_rereg()
2679 mutex_exit(&mr->mr_lock); in hermon_mr_common_rereg()
2696 hermon_mr_rereg_xlat_helper(hermon_state_t *state, hermon_mrhdl_t mr, in hermon_mr_rereg_xlat_helper() argument
2707 ASSERT(MUTEX_HELD(&mr->mr_lock)); in hermon_mr_rereg_xlat_helper()
2746 nummtt_in_currrsrc = mr->mr_mttrsrcp->hr_len >> HERMON_MTT_SIZE_SHIFT; in hermon_mr_rereg_xlat_helper()
2769 swrc_old = (hermon_sw_refcnt_t *)mr->mr_mttrefcntp->hr_addr; in hermon_mr_rereg_xlat_helper()
2780 if (HERMON_MR_REUSE_DMAHDL(mr, bind->bi_flags)) { in hermon_mr_rereg_xlat_helper()
2781 mr->mr_bindinfo.bi_free_dmahdl = 0; in hermon_mr_rereg_xlat_helper()
2782 hermon_mr_mem_unbind(state, &mr->mr_bindinfo); in hermon_mr_rereg_xlat_helper()
2783 dmahdl = mr->mr_bindinfo.bi_dmahdl; in hermon_mr_rereg_xlat_helper()
2786 hermon_mr_mem_unbind(state, &mr->mr_bindinfo); in hermon_mr_rereg_xlat_helper()
2830 mtt = mr->mr_mttrsrcp; in hermon_mr_rereg_xlat_helper()
2859 mr->mr_bindinfo = *bind; in hermon_mr_rereg_xlat_helper()
2860 mr->mr_logmttpgsz = mtt_pgsize_bits; in hermon_mr_rereg_xlat_helper()
2880 if (HERMON_MR_REUSE_DMAHDL(mr, bind->bi_flags)) { in hermon_mr_rereg_xlat_helper()
2881 mr->mr_bindinfo.bi_free_dmahdl = 0; in hermon_mr_rereg_xlat_helper()
2882 hermon_mr_mem_unbind(state, &mr->mr_bindinfo); in hermon_mr_rereg_xlat_helper()
2883 dmahdl = mr->mr_bindinfo.bi_dmahdl; in hermon_mr_rereg_xlat_helper()
2886 hermon_mr_mem_unbind(state, &mr->mr_bindinfo); in hermon_mr_rereg_xlat_helper()
2995 mtt_refcnt = mr->mr_mttrefcntp; in hermon_mr_rereg_xlat_helper()
3038 (void) hermon_mtt_refcnt_dec(mr->mr_mttrefcntp); in hermon_mr_rereg_xlat_helper()
3041 hermon_rsrc_free(state, &mr->mr_mttrsrcp); in hermon_mr_rereg_xlat_helper()
3045 mr->mr_bindinfo = *bind; in hermon_mr_rereg_xlat_helper()
3046 mr->mr_logmttpgsz = mtt_pgsize_bits; in hermon_mr_rereg_xlat_helper()
3047 mr->mr_mttrsrcp = mtt; in hermon_mr_rereg_xlat_helper()
3048 mr->mr_mttrefcntp = mtt_refcnt; in hermon_mr_rereg_xlat_helper()