ib_api_status_t __osmv_txnmgr_remove_txn(IN osmv_txn_mgr_t * p_tx_mgr, IN uint64_t key, OUT osmv_txn_ctx_t ** pp_txn) { cl_map_obj_t *p_obj; cl_map_item_t *p_item; OSM_LOG_ENTER(p_tx_mgr->p_log); CL_ASSERT(p_tx_mgr); CL_ASSERT(pp_txn); p_item = cl_qmap_remove(p_tx_mgr->p_txn_map, key); if (p_item == cl_qmap_end(p_tx_mgr->p_txn_map)) { osm_log(p_tx_mgr->p_log, OSM_LOG_ERROR, "__osmv_txnmgr_remove_txn: ERR 6701: " "Could not remove the transaction 0x%llX - " "something is really wrong!\n", key); OSM_LOG_EXIT(p_tx_mgr->p_log); return IB_NOT_FOUND; } p_obj = PARENT_STRUCT(p_item, cl_map_obj_t, item); *pp_txn = cl_qmap_obj(p_obj); free(p_obj); OSM_LOG_EXIT(p_tx_mgr->p_log); return IB_SUCCESS; }
perfmgr_db_err_t perfmgr_db_delete_entry(perfmgr_db_t * db, uint64_t guid) { cl_map_item_t * rc = cl_qmap_remove(&db->pc_data, guid); if (rc == cl_qmap_end(&db->pc_data)) return(PERFMGR_EVENT_DB_GUIDNOTFOUND); db_node_t *pc_node = (db_node_t *)rc; free_node(pc_node); return(PERFMGR_EVENT_DB_SUCCESS); }
void close_node_name_map(nn_map_t * map) { name_map_item_t *item = NULL; if (!map) return; item = (name_map_item_t *) cl_qmap_head(map); while (item != (name_map_item_t *) cl_qmap_end(map)) { item = (name_map_item_t *) cl_qmap_remove(map, item->guid); free(item->name); free(item); item = (name_map_item_t *) cl_qmap_head(map); } free(map); }
static void pi_rcv_process_endport(IN osm_sm_t * sm, IN osm_physp_t * p_physp, IN const ib_port_info_t * p_pi) { osm_madw_context_t context; ib_api_status_t status; ib_net64_t port_guid; int extended; uint8_t rate, mtu, mpb; unsigned data_vls; cl_qmap_t *p_sm_tbl; osm_remote_sm_t *p_sm; OSM_LOG_ENTER(sm->p_log); port_guid = osm_physp_get_port_guid(p_physp); /* HACK extended port 0 should be handled too! */ if (osm_physp_get_port_num(p_physp) != 0 && ib_port_info_get_port_state(p_pi) != IB_LINK_DOWN) { /* track the minimal endport MTU, rate, and operational VLs */ mtu = ib_port_info_get_mtu_cap(p_pi); if (mtu < sm->p_subn->min_ca_mtu) { OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "Setting endport minimal MTU to:%u defined by port:0x%" PRIx64 "\n", mtu, cl_ntoh64(port_guid)); sm->p_subn->min_ca_mtu = mtu; } extended = p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS; rate = ib_port_info_compute_rate(p_pi, extended); if (ib_path_compare_rates(rate, sm->p_subn->min_ca_rate) < 0) { OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "Setting endport minimal rate to:%u defined by port:0x%" PRIx64 "\n", rate, cl_ntoh64(port_guid)); sm->p_subn->min_ca_rate = rate; } data_vls = 1U << (ib_port_info_get_vl_cap(p_pi) - 1); if (data_vls > 1U << (sm->p_subn->opt.max_op_vls - 1)) data_vls = 1U << (sm->p_subn->opt.max_op_vls - 1); if (data_vls >= IB_MAX_NUM_VLS) data_vls = IB_MAX_NUM_VLS - 1; if ((uint8_t)data_vls < sm->p_subn->min_data_vls) { OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "Setting endport minimal data VLs to:%u defined by port:0x%" PRIx64 "\n", data_vls, cl_ntoh64(port_guid)); sm->p_subn->min_data_vls = data_vls; } } /* Check M_Key vs M_Key protect, can we control the port ? */ mpb = ib_port_info_get_mpb(p_pi); if (mpb > 0 && p_pi->m_key == 0) { OSM_LOG(sm->p_log, OSM_LOG_INFO, "Port 0x%" PRIx64 " has unknown M_Key, protection level %u\n", cl_ntoh64(port_guid), mpb); } if (port_guid != sm->p_subn->sm_port_guid) { p_sm_tbl = &sm->p_subn->sm_guid_tbl; if (p_pi->capability_mask & IB_PORT_CAP_IS_SM) { /* * Before querying the SM - we want to make sure we * clean its state, so if the querying fails we * recognize that this SM is not active. */ p_sm = (osm_remote_sm_t *) cl_qmap_get(p_sm_tbl, port_guid); if (p_sm != (osm_remote_sm_t *) cl_qmap_end(p_sm_tbl)) /* clean it up */ p_sm->smi.pri_state = 0xF0 & p_sm->smi.pri_state; if (sm->p_subn->opt.ignore_other_sm) OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "Ignoring SM on port 0x%" PRIx64 "\n", cl_ntoh64(port_guid)); else { OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "Detected another SM. Requesting SMInfo " "from port 0x%" PRIx64 "\n", cl_ntoh64(port_guid)); /* This port indicates it's an SM and it's not our own port. Acquire the SMInfo Attribute. */ memset(&context, 0, sizeof(context)); context.smi_context.set_method = FALSE; context.smi_context.port_guid = port_guid; status = osm_req_get(sm, osm_physp_get_dr_path_ptr (p_physp), IB_MAD_ATTR_SM_INFO, 0, FALSE, ib_port_info_get_m_key(&p_physp->port_info), CL_DISP_MSGID_NONE, &context); if (status != IB_SUCCESS) OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0F05: " "Failure requesting SMInfo (%s) " "from port 0x%" PRIx64 "\n", ib_get_err_str(status), cl_ntoh64(port_guid)); } } else { p_sm = (osm_remote_sm_t *) cl_qmap_remove(p_sm_tbl, port_guid); if (p_sm != (osm_remote_sm_t *) cl_qmap_end(p_sm_tbl)) free(p_sm); } } OSM_LOG_EXIT(sm->p_log); }
static void __osm_pi_rcv_process_endport(IN osm_sm_t * sm, IN osm_physp_t * const p_physp, IN const ib_port_info_t * const p_pi) { osm_madw_context_t context; ib_api_status_t status; ib_net64_t port_guid; uint8_t rate, mtu; cl_qmap_t *p_sm_tbl; osm_remote_sm_t *p_sm; OSM_LOG_ENTER(sm->p_log); port_guid = osm_physp_get_port_guid(p_physp); /* HACK extended port 0 should be handled too! */ if (osm_physp_get_port_num(p_physp) != 0) { /* track the minimal endport MTU and rate */ mtu = ib_port_info_get_mtu_cap(p_pi); if (mtu < sm->p_subn->min_ca_mtu) { OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "Setting endport minimal MTU to:%u defined by port:0x%" PRIx64 "\n", mtu, cl_ntoh64(port_guid)); sm->p_subn->min_ca_mtu = mtu; } rate = ib_port_info_compute_rate(p_pi); if (rate < sm->p_subn->min_ca_rate) { OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "Setting endport minimal rate to:%u defined by port:0x%" PRIx64 "\n", rate, cl_ntoh64(port_guid)); sm->p_subn->min_ca_rate = rate; } } if (port_guid == sm->p_subn->sm_port_guid) { /* We received the PortInfo for our own port. */ if (!(p_pi->capability_mask & IB_PORT_CAP_IS_SM)) /* Set the IS_SM bit to indicate our port hosts an SM. */ __osm_pi_rcv_set_sm(sm, p_physp); } else { p_sm_tbl = &sm->p_subn->sm_guid_tbl; if (p_pi->capability_mask & IB_PORT_CAP_IS_SM) { /* * Before querying the SM - we want to make sure we * clean its state, so if the querying fails we * recognize that this SM is not active. */ p_sm = (osm_remote_sm_t *) cl_qmap_get(p_sm_tbl, port_guid); if (p_sm != (osm_remote_sm_t *) cl_qmap_end(p_sm_tbl)) /* clean it up */ p_sm->smi.pri_state = 0xF0 & p_sm->smi.pri_state; if (sm->p_subn->opt.ignore_other_sm) OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "Ignoring SM on port 0x%" PRIx64 "\n", cl_ntoh64(port_guid)); else { OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "Detected another SM. Requesting SMInfo" "\n\t\t\t\tPort 0x%" PRIx64 "\n", cl_ntoh64(port_guid)); /* This port indicates it's an SM and it's not our own port. Acquire the SMInfo Attribute. */ memset(&context, 0, sizeof(context)); context.smi_context.set_method = FALSE; context.smi_context.port_guid = port_guid; status = osm_req_get(sm, osm_physp_get_dr_path_ptr (p_physp), IB_MAD_ATTR_SM_INFO, 0, CL_DISP_MSGID_NONE, &context); if (status != IB_SUCCESS) OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0F05: " "Failure requesting SMInfo (%s)\n", ib_get_err_str(status)); } } else { p_sm = (osm_remote_sm_t *) cl_qmap_remove(p_sm_tbl, port_guid); if (p_sm != (osm_remote_sm_t *) cl_qmap_end(p_sm_tbl)) free(p_sm); } } OSM_LOG_EXIT(sm->p_log); }