Lines Matching defs:hcap

59 static ibt_status_t	ibcm_hca_init_port(ibcm_hca_info_t *hcap,
61 static ibcm_status_t ibcm_hca_fini_port(ibcm_hca_info_t *hcap,
71 static ibcm_status_t ibcm_check_avl_clean(ibcm_hca_info_t *hcap);
72 static ibcm_status_t ibcm_check_sidr_clean(ibcm_hca_info_t *hcap);
789 ibcm_hca_info_t *hcap, *next;
795 hcap = ibcm_hca_listp;
796 while (hcap != NULL) {
797 next = hcap->hca_next;
798 if (ibcm_hca_detach(hcap) != IBCM_SUCCESS) {
799 ibcm_hca_listp = hcap;
802 hcap = next;
829 ibcm_hca_info_t *hcap;
836 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*hcap))
848 if ((hcap = ibcm_add_hca_entry(hcaguid, nports)) == NULL)
851 hcap->hca_guid = hcaguid; /* Set GUID */
852 hcap->hca_num_ports = nports; /* Set number of ports */
854 if (ibcm_init_hca_ids(hcap) != IBCM_SUCCESS) {
855 ibcm_delete_hca_entry(hcap);
860 hcap->hca_caps = hca_attrs.hca_flags;
861 hcap->hca_vendor_id = hca_attrs.hca_vendor_id;
862 hcap->hca_device_id = hca_attrs.hca_device_id;
863 hcap->hca_ack_delay = hca_attrs.hca_local_ack_delay;
864 hcap->hca_max_rdma_in_qp = hca_attrs.hca_max_rdma_in_qp;
865 hcap->hca_max_rdma_out_qp = hca_attrs.hca_max_rdma_out_qp;
868 for (i = 0; i < hcap->hca_num_ports; i++) {
875 hcap->hca_port_info[i].port_hcap = hcap;
876 hcap->hca_port_info[i].port_num = i+1;
878 if (ibcm_hca_init_port(hcap, i) != IBT_SUCCESS)
885 avl_create(&hcap->hca_active_tree, ibcm_active_node_compare,
890 avl_create(&hcap->hca_passive_tree, ibcm_passive_node_compare,
895 avl_create(&hcap->hca_passive_comid_tree,
904 hcap->hca_state = IBCM_HCA_ACTIVE;
906 _NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*hcap))
925 ibcm_hca_detach(ibcm_hca_info_t *hcap)
931 IBTF_DPRINTF_L3(cmlog, "ibcm_hca_detach: hcap = 0x%p guid = 0x%llX",
932 hcap, hcap->hca_guid);
940 hcap->hca_state = IBCM_HCA_NOT_ACTIVE;
946 while (hcap->hca_acc_cnt > 0)
951 if (hcap->hca_acc_cnt != 0) {
956 "(ibcm_wait_for_acc_cnt_timeout).", hcap->hca_acc_cnt);
957 hcap->hca_state = IBCM_HCA_ACTIVE;
967 if (hcap->hca_svc_cnt != 0) {
969 "Active services still there %d", hcap->hca_svc_cnt);
970 hcap->hca_state = IBCM_HCA_ACTIVE;
974 if (ibcm_check_sidr_clean(hcap) != IBCM_SUCCESS) {
977 hcap->hca_state = IBCM_HCA_ACTIVE;
981 if (ibcm_check_avl_clean(hcap) != IBCM_SUCCESS) {
984 hcap->hca_state = IBCM_HCA_ACTIVE;
994 hcap->hca_guid, hcap->hca_res_cnt);
996 while (hcap->hca_res_cnt > 0)
1000 ASSERT(hcap->hca_sidr_list == NULL);
1001 avl_destroy(&hcap->hca_active_tree);
1002 avl_destroy(&hcap->hca_passive_tree);
1003 avl_destroy(&hcap->hca_passive_comid_tree);
1011 for (port_index = 0; port_index < hcap->hca_num_ports; port_index++) {
1012 if ((status = ibcm_hca_fini_port(hcap, port_index)) !=
1024 if (ibcm_hca_init_port(hcap, i) != IBT_SUCCESS)
1029 hcap->hca_state = IBCM_HCA_ACTIVE;
1033 ibcm_fini_hca_ids(hcap);
1034 ibcm_delete_hca_entry(hcap);
1042 ibcm_check_sidr_clean(ibcm_hca_info_t *hcap)
1049 rw_enter(&hcap->hca_sidr_list_lock, RW_WRITER);
1050 usp = hcap->hca_sidr_list; /* Point to the list */
1062 rw_exit(&hcap->hca_sidr_list_lock);
1071 rw_exit(&hcap->hca_sidr_list_lock);
1081 ibcm_check_avl_clean(ibcm_hca_info_t *hcap)
1093 avl_tree = &hcap->hca_active_tree;
1095 rw_enter(&hcap->hca_state_rwlock, RW_WRITER);
1107 rw_exit(&hcap->hca_state_rwlock);
1115 rw_exit(&hcap->hca_state_rwlock);
1127 ibcm_hca_info_t *hcap;
1139 hcap = ibcm_hca_listp;
1142 while (hcap != NULL) {
1143 if (hcap->hca_guid == hcaguid) {
1146 "hcap %p guid 0x%llX, entry already exists !!",
1147 hcap, hcap->hca_guid);
1150 hcap = hcap->hca_next;
1154 hcap = kmem_zalloc(sizeof (ibcm_hca_info_t) +
1158 rw_init(&hcap->hca_state_rwlock, NULL, RW_DRIVER, NULL);
1160 rw_init(&hcap->hca_sidr_list_lock, NULL, RW_DRIVER, NULL);
1161 /* Insert "hcap" into the global HCA list maintained by CM */
1162 hcap->hca_next = ibcm_hca_listp;
1163 ibcm_hca_listp = hcap;
1165 IBTF_DPRINTF_L5(cmlog, "ibcm_add_hca_entry: done hcap = 0x%p", hcap);
1167 return (hcap);
1173 ibcm_delete_hca_entry(ibcm_hca_info_t *hcap)
1179 "hcap = 0x%p", hcap->hca_guid, hcap);
1185 if (headp == hcap) {
1187 "deleting hcap %p hcaguid %llX", hcap,
1188 hcap->hca_guid);
1195 rw_destroy(&hcap->hca_state_rwlock);
1196 rw_destroy(&hcap->hca_sidr_list_lock);
1197 kmem_free(hcap, sizeof (ibcm_hca_info_t) +
1198 (hcap->hca_num_ports - 1) *
1225 * hcap - if a match is found, else NULL
1230 ibcm_hca_info_t *hcap;
1236 hcap = ibcm_hca_listp;
1238 while (hcap != NULL) {
1239 if (hcap->hca_guid == hca_guid)
1241 hcap = hcap->hca_next;
1244 /* if no hcap for the hca_guid, return NULL */
1245 if (hcap == NULL) {
1250 /* return hcap, only if it valid to use */
1251 if (hcap->hca_state == IBCM_HCA_ACTIVE) {
1252 ++(hcap->hca_acc_cnt);
1255 "found hcap = 0x%p hca_acc_cnt %u", hcap,
1256 hcap->hca_acc_cnt);
1259 return (hcap);
1264 "found hcap = 0x%p not in active state", hcap);
1272 * is attempting to delete hcap itself and hence acc_cnt cannot be incremented
1273 * OR assumes that valid hcap must be available in ibcm's global hca list.
1278 ibcm_hca_info_t *hcap;
1284 hcap = ibcm_hca_listp;
1286 while (hcap != NULL) {
1287 if (hcap->hca_guid == hca_guid)
1289 hcap = hcap->hca_next;
1292 if (hcap == NULL)
1293 IBTF_DPRINTF_L2(cmlog, "ibcm_find_hcap_entry: No hcap found for"
1296 IBTF_DPRINTF_L5(cmlog, "ibcm_find_hcap_entry: hcap found for"
1299 return (hcap);
1304 ibcm_inc_hca_acc_cnt(ibcm_hca_info_t *hcap)
1307 if (hcap->hca_state == IBCM_HCA_ACTIVE) {
1308 ++(hcap->hca_acc_cnt);
1310 "hcap = 0x%p acc_cnt = %d ", hcap, hcap->hca_acc_cnt);
1315 "hcap INACTIVE 0x%p acc_cnt = %d ", hcap,
1316 hcap->hca_acc_cnt);
1324 ibcm_dec_hca_acc_cnt(ibcm_hca_info_t *hcap)
1327 ASSERT(hcap->hca_acc_cnt > 0);
1328 --(hcap->hca_acc_cnt);
1329 IBTF_DPRINTF_L5(cmlog, "ibcm_dec_hca_acc_cnt: hcap = 0x%p "
1330 "acc_cnt = %d", hcap, hcap->hca_acc_cnt);
1331 if ((hcap->hca_state == IBCM_HCA_NOT_ACTIVE) &&
1332 (hcap->hca_acc_cnt == 0)) {
1334 "cv_broadcast for hcap = 0x%p", hcap);
1342 ibcm_inc_hca_res_cnt(ibcm_hca_info_t *hcap)
1346 ++(hcap->hca_res_cnt);
1347 IBTF_DPRINTF_L5(cmlog, "ibcm_inc_hca_res_cnt: hcap = 0x%p "
1348 "ref_cnt = %d", hcap, hcap->hca_res_cnt);
1354 ibcm_dec_hca_res_cnt(ibcm_hca_info_t *hcap)
1357 ASSERT(hcap->hca_res_cnt > 0);
1358 --(hcap->hca_res_cnt);
1359 IBTF_DPRINTF_L5(cmlog, "ibcm_dec_hca_res_cnt: hcap = 0x%p "
1360 "ref_cnt = %d", hcap, hcap->hca_res_cnt);
1361 if ((hcap->hca_state == IBCM_HCA_NOT_ACTIVE) &&
1362 (hcap->hca_res_cnt == 0)) {
1364 "cv_broadcast for hcap = 0x%p", hcap);
1372 ibcm_inc_hca_svc_cnt(ibcm_hca_info_t *hcap)
1376 ++(hcap->hca_svc_cnt);
1377 IBTF_DPRINTF_L5(cmlog, "ibcm_inc_hca_svc_cnt: hcap = 0x%p "
1378 "svc_cnt = %d", hcap, hcap->hca_svc_cnt);
1384 ibcm_dec_hca_svc_cnt(ibcm_hca_info_t *hcap)
1387 ASSERT(hcap->hca_svc_cnt > 0);
1388 --(hcap->hca_svc_cnt);
1389 IBTF_DPRINTF_L5(cmlog, "ibcm_dec_hca_svc_cnt: hcap = 0x%p "
1390 "svc_cnt = %d", hcap, hcap->hca_svc_cnt);
1917 ibcm_hca_info_t *hcap;
1937 hcap = ibcm_hca_listp;
1938 while (hcap != NULL) {
1939 portp = hcap->hca_port_info;
1940 for (port = 0; port < hcap->hca_num_ports; port++) {
1946 hcap = hcap->hca_next;
1954 hcap = ibcm_hca_listp;
1955 while (hcap != NULL) {
1956 portp = hcap->hca_port_info;
1957 for (port = 0; port < hcap->hca_num_ports; port++) {
1963 hcap = hcap->hca_next;
2010 ibcm_init_saa_handle(ibcm_hca_info_t *hcap, uint8_t port)
2014 ibcm_port_info_t *portp = &hcap->hca_port_info[port_index];
2017 if (port_index >= hcap->hca_num_ports)
2060 ibcm_get_saa_handle(ibcm_hca_info_t *hcap, uint8_t port)
2064 ibcm_port_info_t *portp = &hcap->hca_port_info[port_index];
2067 if (port_index >= hcap->hca_num_ports)
2114 * hcap - HCA's guid
2121 ibcm_hca_init_port(ibcm_hca_info_t *hcap, uint8_t port_index)
2126 IBTF_DPRINTF_L4(cmlog, "ibcm_hca_init_port: hcap = 0x%p port_num %d",
2127 hcap, port_index + 1);
2131 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(hcap->hca_port_info))
2133 if (hcap->hca_port_info[port_index].port_ibmf_hdl == NULL) {
2135 ibmf_reg = &hcap->hca_port_info[port_index].port_ibmf_reg;
2136 ibmf_reg->ir_ci_guid = hcap->hca_guid;
2145 &(hcap->hca_port_info[port_index].port_ibmf_hdl),
2146 &(hcap->hca_port_info[port_index].port_ibmf_caps));
2155 hcap->hca_port_info[port_index].port_qp1.qp_cm =
2157 hcap->hca_port_info[port_index].port_qp1.qp_port =
2158 &(hcap->hca_port_info[port_index]);
2170 hcap->hca_port_info[port_index].port_ibmf_hdl,
2172 &(hcap->hca_port_info[port_index].port_qp1), 0);
2177 hcap->hca_port_info[port_index].port_ibmf_hdl);
2180 ibcm_init_saa_handle(hcap, port_index + 1);
2191 ibcm_hca_reinit_port(ibcm_hca_info_t *hcap, uint8_t port_index)
2195 IBTF_DPRINTF_L5(cmlog, "ibcm_hca_reinit_port: hcap 0x%p port_num %d",
2196 hcap, port_index + 1);
2199 status = ibcm_hca_init_port(hcap, port_index);
2210 * hcap - HCA's guid
2217 ibcm_hca_fini_port(ibcm_hca_info_t *hcap, uint8_t port_index)
2222 IBTF_DPRINTF_L4(cmlog, "ibcm_hca_fini_port: hcap = 0x%p port_num %d ",
2223 hcap, port_index + 1);
2227 if (hcap->hca_port_info[port_index].port_ibmf_saa_hdl != NULL) {
2230 hcap->hca_port_info[port_index].port_ibmf_saa_hdl);
2233 &hcap->hca_port_info[port_index].port_ibmf_saa_hdl, 0);
2242 if (hcap->hca_port_info[port_index].port_ibmf_hdl != NULL) {
2245 hcap->hca_port_info[port_index].port_ibmf_hdl);
2248 ibcm_status = ibcm_free_allqps(hcap, port_index + 1);
2260 hcap->hca_port_info[port_index].port_ibmf_hdl,
2272 &hcap->hca_port_info[port_index].port_ibmf_hdl, 0);
2278 hcap->hca_port_info[port_index].port_ibmf_hdl = NULL;
2384 ibcm_hca_info_t *hcap;
2437 if ((hcap = ibcm_find_hcap_entry(eventp->ev_hca_guid)) ==
2444 (void) ibcm_hca_detach(hcap);