void osm_sa_shutdown(IN osm_sa_t * p_sa) { OSM_LOG_ENTER(p_sa->p_log); cl_timer_stop(&p_sa->sr_timer); /* unbind from the mad service */ osm_sa_mad_ctrl_unbind(&p_sa->mad_ctrl); /* remove any registered dispatcher message */ cl_disp_unregister(p_sa->nr_disp_h); cl_disp_unregister(p_sa->pir_disp_h); cl_disp_unregister(p_sa->gir_disp_h); cl_disp_unregister(p_sa->lr_disp_h); cl_disp_unregister(p_sa->pr_disp_h); #if defined (VENDOR_RMPP_SUPPORT) && defined (DUAL_SIDED_RMPP) cl_disp_unregister(p_sa->mpr_disp_h); #endif cl_disp_unregister(p_sa->smir_disp_h); cl_disp_unregister(p_sa->mcmr_disp_h); cl_disp_unregister(p_sa->sr_disp_h); cl_disp_unregister(p_sa->infr_disp_h); cl_disp_unregister(p_sa->infir_disp_h); cl_disp_unregister(p_sa->vlarb_disp_h); cl_disp_unregister(p_sa->slvl_disp_h); cl_disp_unregister(p_sa->pkey_disp_h); cl_disp_unregister(p_sa->lft_disp_h); cl_disp_unregister(p_sa->sir_disp_h); cl_disp_unregister(p_sa->mft_disp_h); osm_sa_mad_ctrl_destroy(&p_sa->mad_ctrl); OSM_LOG_EXIT(p_sa->p_log); }
void cl_timer_destroy(IN cl_timer_t * const p_timer) { CL_ASSERT(p_timer); CL_ASSERT(cl_is_state_valid(p_timer->state)); if (p_timer->state == CL_INITIALIZED) cl_timer_stop(p_timer); p_timer->state = CL_UNINITIALIZED; /* is it possible we have some threads waiting on the cond now? */ pthread_cond_broadcast(&p_timer->cond); pthread_cond_destroy(&p_timer->cond); }
ib_api_status_t osm_transaction_mgr_insert_madw(IN osm_bind_handle_t * const p_bind, IN osm_madw_t * p_madw) { #ifdef OSM_VENDOR_INTF_MTL osm_vendor_t *const p_vend = ((osm_mtl_bind_info_t *) p_bind)->p_vend; #else osm_vendor_t *const p_vend = ((osm_ts_bind_info_t *) p_bind)->p_vend; #endif osm_transaction_mgr_t *trans_mgr_p; osm_madw_req_t *osm_madw_req_p; uint64_t timeout; uint64_t waking_time; cl_status_t cl_status; uint64_t key; const ib_mad_t *mad_p = p_madw->p_mad; OSM_LOG_ENTER(p_vend->p_log); CL_ASSERT(mad_p); trans_mgr_p = (osm_transaction_mgr_t *) p_vend->p_transaction_mgr; timeout = (uint64_t) (p_vend->timeout) * 1000; /* change the miliseconds value of timeout to microseconds. */ waking_time = timeout + cl_get_time_stamp(); osm_madw_req_p = (osm_madw_req_t *) malloc(sizeof(osm_madw_req_t)); osm_madw_req_p->p_madw = p_madw; osm_madw_req_p->waking_time = waking_time; osm_madw_req_p->retry_cnt = OSM_DEFAULT_RETRY_COUNT; osm_madw_req_p->p_bind = p_bind; osm_log(p_vend->p_log, OSM_LOG_DEBUG, "osm_transaction_mgr_insert_madw: " "Inserting MADW:%p with waking_time: <0x%" PRIx64 "> TID:<0x%" PRIx64 ">.\n", p_madw, waking_time, p_madw->p_mad->trans_id); /* Get the lock on the manager */ cl_spinlock_acquire(&(trans_mgr_p->transaction_mgr_lock)); /* If the list is empty - need to start the timer with timer of timeout (in miliseconds) */ if (cl_is_qlist_empty(trans_mgr_p->madw_reqs_list_p)) { /* stop the timer if it is running */ cl_timer_stop(&trans_mgr_p->madw_list_timer); /* start the timer to the timeout (in miliseconds) */ cl_status = cl_timer_start(&trans_mgr_p->madw_list_timer, p_vend->timeout); if (cl_status != CL_SUCCESS) { osm_log(p_vend->p_log, OSM_LOG_ERROR, "osm_transaction_mgr_insert_madw : ERROR 1000: " "Failed to start timer\n"); } } /* insert the object to the qlist and the qmap */ cl_qlist_insert_tail(trans_mgr_p->madw_reqs_list_p, &(osm_madw_req_p->list_item)); /* get the key */ key = (uint64_t) mad_p->trans_id; cl_qmap_insert(trans_mgr_p->madw_by_tid_map_p, key, &(osm_madw_req_p->map_item)); cl_spinlock_release(&trans_mgr_p->transaction_mgr_lock); OSM_LOG_EXIT(p_vend->p_log); return (IB_SUCCESS); }