static inline int mca_btl_ugni_progress_wait_list (mca_btl_ugni_module_t *ugni_module) { int rc = OPAL_SUCCESS; mca_btl_base_endpoint_t *endpoint = NULL; int count; OPAL_THREAD_LOCK(&ugni_module->ep_wait_list_lock); count = opal_list_get_size(&ugni_module->ep_wait_list); do { endpoint = (mca_btl_base_endpoint_t *) opal_list_remove_first (&ugni_module->ep_wait_list); if (endpoint != NULL) { rc = mca_btl_ugni_progress_send_wait_list (endpoint); if (OPAL_SUCCESS != rc) { opal_list_append (&ugni_module->ep_wait_list, &endpoint->super); } else { endpoint->wait_listed = false; } } } while (endpoint != NULL && --count > 0) ; OPAL_THREAD_UNLOCK(&ugni_module->ep_wait_list_lock); return rc; }
static inline int mca_btl_ugni_ep_connect_finish (mca_btl_base_endpoint_t *ep) { mca_btl_ugni_module_t *ugni_module = mca_btl_ugni_ep_btl (ep); gni_return_t grc; int rc; BTL_VERBOSE(("finishing connection. remote attributes: msg_type = %d, msg_buffer = %p, buff_size = %d, " "mem_hndl = {qword1 = %" PRIu64 ", qword2 = %" PRIu64 "}, mbox = %d, mbox_maxcredit = %d, " "msg_maxsize = %d", ep->remote_attr->smsg_attr.msg_type, ep->remote_attr->smsg_attr.msg_buffer, ep->remote_attr->smsg_attr.buff_size, ep->remote_attr->smsg_attr.mem_hndl.qword1, ep->remote_attr->smsg_attr.mem_hndl.qword2, ep->remote_attr->smsg_attr.mbox_offset, ep->remote_attr->smsg_attr.mbox_maxcredit, ep->remote_attr->smsg_attr.msg_maxsize)); BTL_VERBOSE(("finishing connection. local attributes: msg_type = %d, msg_buffer = %p, buff_size = %d, " "mem_hndl = {qword1 = %" PRIu64 ", qword2 = %" PRIu64 "}, mbox = %d, mbox_maxcredit = %d, " "msg_maxsize = %d", ep->mailbox->attr.smsg_attr.msg_type, ep->mailbox->attr.smsg_attr.msg_buffer, ep->mailbox->attr.smsg_attr.buff_size, ep->mailbox->attr.smsg_attr.mem_hndl.qword1, ep->mailbox->attr.smsg_attr.mem_hndl.qword2, ep->mailbox->attr.smsg_attr.mbox_offset, ep->mailbox->attr.smsg_attr.mbox_maxcredit, ep->mailbox->attr.smsg_attr.msg_maxsize)); grc = GNI_SmsgInit (ep->smsg_ep_handle.gni_handle, &ep->mailbox->attr.smsg_attr, &ep->remote_attr->smsg_attr); if (OPAL_UNLIKELY(GNI_RC_SUCCESS != grc)) { BTL_ERROR(("error initializing SMSG protocol. rc = %d", grc)); return mca_btl_rc_ugni_to_opal (grc); } /* set the local event data to the local index and the remote event data to my * index on the remote peer. This makes lookup of endpoints on completion take * a single lookup in the endpoints array. we will not be able to change the * remote peer's index in the endpoint's array after this point. */ GNI_EpSetEventData (ep->smsg_ep_handle.gni_handle, ep->index, ep->remote_attr->index); ep->rmt_irq_mem_hndl = ep->remote_attr->rmt_irq_mem_hndl; ep->state = MCA_BTL_UGNI_EP_STATE_CONNECTED; (void) opal_atomic_add_fetch_32 (&ep->smsg_ep_handle.device->smsg_connections, 1); /* send all pending messages */ BTL_VERBOSE(("endpoint connected. posting %u sends", (unsigned int) opal_list_get_size (&ep->frag_wait_list))); rc = mca_btl_ugni_progress_send_wait_list (ep); if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) { OPAL_THREAD_LOCK(&ugni_module->ep_wait_list_lock); if (false == ep->wait_listed) { opal_list_append (&ugni_module->ep_wait_list, &ep->super); ep->wait_listed = true; } OPAL_THREAD_UNLOCK(&ugni_module->ep_wait_list_lock); } free (ep->remote_attr); ep->remote_attr = NULL; return OPAL_SUCCESS; }
static inline int mca_btl_ugni_progress_wait_list (mca_btl_ugni_module_t *ugni_module) { int count = opal_list_get_size (&ugni_module->ep_wait_list); int rc, i; for (i = 0 ; i < count ; ++i) { mca_btl_base_endpoint_t *endpoint = (mca_btl_base_endpoint_t *) opal_list_remove_first (&ugni_module->ep_wait_list); assert (NULL != endpoint); endpoint->wait_listed = false; rc = mca_btl_ugni_progress_send_wait_list (endpoint); if (OMPI_SUCCESS != rc && false == endpoint->wait_listed) { opal_list_append (&ugni_module->ep_wait_list, &endpoint->super); endpoint->wait_listed = true; } } return count; }