Lines Matching refs:state

51 static int tavor_mcg_qplist_add(tavor_state_t *state, tavor_mcghdl_t mcg,
57 static uint_t tavor_mcg_walk_mgid_hash(tavor_state_t *state,
61 static int tavor_mcg_hash_list_remove(tavor_state_t *state, uint_t curr_indx,
63 static int tavor_mcg_entry_invalidate(tavor_state_t *state,
74 tavor_ah_alloc(tavor_state_t *state, tavor_pdhdl_t pd, in tavor_ah_alloc() argument
94 if (!tavor_portnum_is_valid(state, attr_p->av_port_num)) { in tavor_ah_alloc()
104 status = tavor_rsrc_alloc(state, TAVOR_UDAV, 1, sleepflag, &udav); in tavor_ah_alloc()
114 status = tavor_rsrc_alloc(state, TAVOR_AHHDL, 1, sleepflag, &rsrc); in tavor_ah_alloc()
132 status = tavor_set_addr_path(state, attr_p, in tavor_ah_alloc()
136 tavor_rsrc_free(state, &rsrc); in tavor_ah_alloc()
137 tavor_rsrc_free(state, &udav); in tavor_ah_alloc()
141 udav_entry.msg_sz = state->ts_cfg_profile->cp_max_mtu - 1; in tavor_ah_alloc()
155 op.mro_bind_type = state->ts_cfg_profile->cp_iommu_bypass; in tavor_ah_alloc()
158 status = tavor_mr_register(state, pd, &mr_attr, &mr, &op); in tavor_ah_alloc()
205 ah->ah_sync = TAVOR_UDAV_IS_SYNC_REQ(state); in tavor_ah_alloc()
214 tavor_rsrc_free(state, &rsrc); in tavor_ah_alloc()
216 tavor_rsrc_free(state, &udav); in tavor_ah_alloc()
228 tavor_ah_free(tavor_state_t *state, tavor_ahhdl_t *ahhdl, uint_t sleepflag) in tavor_ah_free() argument
256 status = tavor_mr_deregister(state, &mr, TAVOR_MR_DEREG_ALL, in tavor_ah_free()
277 tavor_rsrc_free(state, &rsrc); in tavor_ah_free()
280 tavor_rsrc_free(state, &udav); in tavor_ah_free()
295 tavor_ah_query(tavor_state_t *state, tavor_ahhdl_t ah, tavor_pdhdl_t *pd, in tavor_ah_query() argument
335 tavor_get_addr_path(state, (tavor_hw_addr_path_t *)&udav_entry, in tavor_ah_query()
352 tavor_ah_modify(tavor_state_t *state, tavor_ahhdl_t ah, in tavor_ah_modify() argument
362 if (!tavor_portnum_is_valid(state, attr_p->av_port_num)) { in tavor_ah_modify()
390 status = tavor_set_addr_path(state, attr_p, in tavor_ah_modify()
508 tavor_mcg_attach(tavor_state_t *state, tavor_qphdl_t qp, ib_gid_t gid, in tavor_mcg_attach() argument
553 status = tavor_mgid_hash_cmd_post(state, gid.gid_prefix, gid.gid_guid, in tavor_mcg_attach()
566 mutex_enter(&state->ts_mcglock); in tavor_mcg_attach()
567 mcg_entry = state->ts_mcgtmp; in tavor_mcg_attach()
569 bzero(mcg_entry, TAVOR_MCGMEM_SZ(state)); in tavor_mcg_attach()
587 end_indx = tavor_mcg_walk_mgid_hash(state, mgid_hash, gid, NULL); in tavor_mcg_attach()
588 mcg = &state->ts_mcghdl[end_indx]; in tavor_mcg_attach()
609 status = tavor_mcg_qplist_add(state, mcg, mcg_entry_qplist, qp, in tavor_mcg_attach()
613 mutex_exit(&state->ts_mcglock); in tavor_mcg_attach()
627 status = tavor_write_mgm_cmd_post(state, mcg_entry, end_indx, in tavor_mcg_attach()
631 mutex_exit(&state->ts_mcglock); in tavor_mcg_attach()
632 TAVOR_WARNING(state, "failed to write MCG entry"); in tavor_mcg_attach()
661 mutex_exit(&state->ts_mcglock); in tavor_mcg_attach()
682 status = tavor_read_mgm_cmd_post(state, mcg_entry, end_indx, in tavor_mcg_attach()
685 mutex_exit(&state->ts_mcglock); in tavor_mcg_attach()
686 TAVOR_WARNING(state, "failed to read MCG entry"); in tavor_mcg_attach()
704 status = tavor_mcg_qplist_add(state, mcg, mcg_entry_qplist, qp, in tavor_mcg_attach()
707 mutex_exit(&state->ts_mcglock); in tavor_mcg_attach()
720 status = tavor_write_mgm_cmd_post(state, mcg_entry, end_indx, in tavor_mcg_attach()
723 mutex_exit(&state->ts_mcglock); in tavor_mcg_attach()
724 TAVOR_WARNING(state, "failed to write MCG entry"); in tavor_mcg_attach()
753 mutex_exit(&state->ts_mcglock); in tavor_mcg_attach()
769 status = tavor_rsrc_alloc(state, TAVOR_MCG, 1, TAVOR_NOSLEEP, &rsrc); in tavor_mcg_attach()
771 mutex_exit(&state->ts_mcglock); in tavor_mcg_attach()
781 newmcg = &state->ts_mcghdl[rsrc->tr_indx]; in tavor_mcg_attach()
796 status = tavor_mcg_qplist_add(state, newmcg, mcg_entry_qplist, qp, in tavor_mcg_attach()
800 tavor_rsrc_free(state, &rsrc); in tavor_mcg_attach()
801 mutex_exit(&state->ts_mcglock); in tavor_mcg_attach()
813 status = tavor_write_mgm_cmd_post(state, mcg_entry, rsrc->tr_indx, in tavor_mcg_attach()
817 tavor_rsrc_free(state, &rsrc); in tavor_mcg_attach()
818 mutex_exit(&state->ts_mcglock); in tavor_mcg_attach()
819 TAVOR_WARNING(state, "failed to write MCG entry"); in tavor_mcg_attach()
836 status = tavor_read_mgm_cmd_post(state, mcg_entry, end_indx, in tavor_mcg_attach()
840 tavor_rsrc_free(state, &rsrc); in tavor_mcg_attach()
841 mutex_exit(&state->ts_mcglock); in tavor_mcg_attach()
842 TAVOR_WARNING(state, "failed to read MCG entry"); in tavor_mcg_attach()
861 status = tavor_write_mgm_cmd_post(state, mcg_entry, end_indx, in tavor_mcg_attach()
865 tavor_rsrc_free(state, &rsrc); in tavor_mcg_attach()
866 mutex_exit(&state->ts_mcglock); in tavor_mcg_attach()
867 TAVOR_WARNING(state, "failed to write MCG entry"); in tavor_mcg_attach()
872 mcg = &state->ts_mcghdl[end_indx]; in tavor_mcg_attach()
890 mutex_exit(&state->ts_mcglock); in tavor_mcg_attach()
903 tavor_mcg_detach(tavor_state_t *state, tavor_qphdl_t qp, ib_gid_t gid, in tavor_mcg_detach() argument
931 status = tavor_mgid_hash_cmd_post(state, gid.gid_prefix, gid.gid_guid, in tavor_mcg_detach()
943 mutex_enter(&state->ts_mcglock); in tavor_mcg_detach()
944 mcg_entry = state->ts_mcgtmp; in tavor_mcg_detach()
956 end_indx = tavor_mcg_walk_mgid_hash(state, mgid_hash, gid, &prev_indx); in tavor_mcg_detach()
957 mcg = &state->ts_mcghdl[end_indx]; in tavor_mcg_detach()
968 mutex_exit(&state->ts_mcglock); in tavor_mcg_detach()
978 status = tavor_read_mgm_cmd_post(state, mcg_entry, end_indx, in tavor_mcg_detach()
981 mutex_exit(&state->ts_mcglock); in tavor_mcg_detach()
982 TAVOR_WARNING(state, "failed to read MCG entry"); in tavor_mcg_detach()
995 mutex_exit(&state->ts_mcglock); in tavor_mcg_detach()
1019 status = tavor_mcg_hash_list_remove(state, end_indx, prev_indx, in tavor_mcg_detach()
1022 mutex_exit(&state->ts_mcglock); in tavor_mcg_detach()
1036 status = tavor_write_mgm_cmd_post(state, mcg_entry, end_indx, in tavor_mcg_detach()
1039 mutex_exit(&state->ts_mcglock); in tavor_mcg_detach()
1040 TAVOR_WARNING(state, "failed to write MCG entry"); in tavor_mcg_detach()
1048 mutex_exit(&state->ts_mcglock); in tavor_mcg_detach()
1085 tavor_mcg_qplist_add(tavor_state_t *state, tavor_mcghdl_t mcg, in tavor_mcg_qplist_add() argument
1091 ASSERT(MUTEX_HELD(&state->ts_mcglock)); in tavor_mcg_qplist_add()
1099 if (qplist_indx >= state->ts_cfg_profile->cp_num_qp_per_mcg) { in tavor_mcg_qplist_add()
1179 tavor_mcg_walk_mgid_hash(tavor_state_t *state, uint64_t start_indx, in tavor_mcg_walk_mgid_hash() argument
1185 ASSERT(MUTEX_HELD(&state->ts_mcglock)); in tavor_mcg_walk_mgid_hash()
1190 curr_mcghdl = &state->ts_mcghdl[curr_indx]; in tavor_mcg_walk_mgid_hash()
1208 curr_mcghdl = &state->ts_mcghdl[curr_indx]; in tavor_mcg_walk_mgid_hash()
1262 tavor_mcg_hash_list_remove(tavor_state_t *state, uint_t curr_indx, in tavor_mcg_hash_list_remove() argument
1270 curr_mcg = &state->ts_mcghdl[curr_indx]; in tavor_mcg_hash_list_remove()
1290 status = tavor_mcg_entry_invalidate(state, mcg_entry, in tavor_mcg_hash_list_remove()
1300 next_mcg = &state->ts_mcghdl[next_indx]; in tavor_mcg_hash_list_remove()
1308 status = tavor_read_mgm_cmd_post(state, mcg_entry, next_indx, in tavor_mcg_hash_list_remove()
1311 TAVOR_WARNING(state, "failed to read MCG entry"); in tavor_mcg_hash_list_remove()
1329 status = tavor_write_mgm_cmd_post(state, mcg_entry, curr_indx, in tavor_mcg_hash_list_remove()
1332 TAVOR_WARNING(state, "failed to write MCG entry"); in tavor_mcg_hash_list_remove()
1353 tavor_rsrc_free(state, &curr_mcg->mcg_rsrcp); in tavor_mcg_hash_list_remove()
1375 status = tavor_read_mgm_cmd_post(state, mcg_entry, prev_indx, in tavor_mcg_hash_list_remove()
1378 TAVOR_WARNING(state, "failed to read MCG entry"); in tavor_mcg_hash_list_remove()
1395 status = tavor_write_mgm_cmd_post(state, mcg_entry, prev_indx, in tavor_mcg_hash_list_remove()
1398 TAVOR_WARNING(state, "failed to write MCG entry"); in tavor_mcg_hash_list_remove()
1410 prev_mcg = &state->ts_mcghdl[prev_indx]; in tavor_mcg_hash_list_remove()
1419 tavor_rsrc_free(state, &curr_mcg->mcg_rsrcp); in tavor_mcg_hash_list_remove()
1431 tavor_mcg_entry_invalidate(tavor_state_t *state, tavor_hw_mcg_t *mcg_entry, in tavor_mcg_entry_invalidate() argument
1443 bzero(mcg_entry, TAVOR_MCGMEM_SZ(state)); in tavor_mcg_entry_invalidate()
1444 status = tavor_write_mgm_cmd_post(state, mcg_entry, indx, in tavor_mcg_entry_invalidate()
1447 TAVOR_WARNING(state, "failed to write MCG entry"); in tavor_mcg_entry_invalidate()
1536 tavor_pd_alloc(tavor_state_t *state, tavor_pdhdl_t *pdhdl, uint_t sleepflag) in tavor_pd_alloc() argument
1549 status = tavor_rsrc_alloc(state, TAVOR_PDHDL, 1, sleepflag, &rsrc); in tavor_pd_alloc()
1568 tavor_pd_free(tavor_state_t *state, tavor_pdhdl_t *pdhdl) in tavor_pd_free() argument
1594 tavor_rsrc_free(state, &rsrc); in tavor_pd_free()
1638 tavor_port_query(tavor_state_t *state, uint_t port, ibt_hca_portinfo_t *pi) in tavor_port_query() argument
1650 if (!tavor_portnum_is_valid(state, port)) { in tavor_port_query()
1661 status = tavor_getportinfo_cmd_post(state, port, in tavor_port_query()
1691 tbl_size = state->ts_cfg_profile->cp_log_max_gidtbl; in tavor_port_query()
1693 tbl_size = state->ts_cfg_profile->cp_log_max_pkeytbl; in tavor_port_query()
1721 status = tavor_getguidinfo_cmd_post(state, port, i >> 3, in tavor_port_query()
1749 status = tavor_getpkeytable_cmd_post(state, port, i, in tavor_port_query()
1775 tavor_port_modify(tavor_state_t *state, uint8_t port, in tavor_port_modify() argument
1796 if (!tavor_portnum_is_valid(state, port)) { in tavor_port_modify()
1808 status = tavor_getportinfo_cmd_post(state, port, in tavor_port_modify()
1848 status = tavor_set_ib_cmd_post(state, capmask, port, reset_qkey, in tavor_port_modify()
1851 TAVOR_WARNING(state, "failed to modify port capabilities"); in tavor_port_modify()
1872 tavor_set_addr_path(tavor_state_t *state, ibt_adds_vect_t *av, in tavor_set_addr_path() argument
1895 if (state->ts_devlim.stat_rate_sup) { in tavor_set_addr_path()
1930 gidtbl_sz = (1 << state->ts_devlim.log_max_gid); in tavor_set_addr_path()
1993 tavor_get_addr_path(tavor_state_t *state, tavor_hw_addr_path_t *path, in tavor_get_addr_path() argument
2021 if (state->ts_devlim.stat_rate_sup) { in tavor_get_addr_path()
2056 gidtbl_sz = (1 << state->ts_devlim.log_max_gid); in tavor_get_addr_path()
2073 tavor_portnum_is_valid(tavor_state_t *state, uint_t portnum) in tavor_portnum_is_valid() argument
2077 max_port = state->ts_cfg_profile->cp_num_ports; in tavor_portnum_is_valid()
2091 tavor_pkeyindex_is_valid(tavor_state_t *state, uint_t pkeyindx) in tavor_pkeyindex_is_valid() argument
2095 max_pkeyindx = 1 << state->ts_cfg_profile->cp_log_max_pkeytbl; in tavor_pkeyindex_is_valid()
2109 tavor_queue_alloc(tavor_state_t *state, tavor_qalloc_info_t *qa_info, in tavor_queue_alloc() argument
2131 type = state->ts_cfg_profile->cp_iommu_bypass; in tavor_queue_alloc()
2137 status = ddi_dma_alloc_handle(state->ts_dip, &dma_attr, callback, NULL, in tavor_queue_alloc()
2177 dma_xfer_mode = state->ts_cfg_profile->cp_streaming_consistent; in tavor_queue_alloc()
2181 &state->ts_reg_accattr, dma_xfer_mode, callback, NULL, in tavor_queue_alloc()
2218 state->ts_ddrvmem, realsize, qa_info->qa_bind_align, 0, 0, in tavor_queue_alloc()
2233 state->ts_reg_ddr_baseaddr) + ((uintptr_t) in tavor_queue_alloc()
2234 qa_info->qa_buf_real - state->ts_ddr.ddr_baseaddr)); in tavor_queue_alloc()
2236 qa_info->qa_acchdl = state->ts_reg_ddrhdl; in tavor_queue_alloc()
2258 tavor_queue_free(tavor_state_t *state, tavor_qalloc_info_t *qa_info) in tavor_queue_free() argument
2277 vmem_xfree(state->ts_ddrvmem, qa_info->qa_buf_real, in tavor_queue_free()