Test(vc_management_auto, vc_lookup_by_id) { int ret; struct gnix_vc *vc[2], *vc_chk; struct gnix_fid_ep *ep_priv; ep_priv = container_of(ep[0], struct gnix_fid_ep, ep_fid); ret = _gnix_vc_alloc(ep_priv, gnix_addr[0], &vc[0]); cr_assert_eq(ret, FI_SUCCESS); ret = _gnix_vc_alloc(ep_priv, gnix_addr[1], &vc[1]); cr_assert_eq(ret, FI_SUCCESS); vc_chk = __gnix_nic_elem_by_rem_id(ep_priv->nic, vc[0]->vc_id); cr_assert_eq(vc_chk, vc[0]); vc_chk = __gnix_nic_elem_by_rem_id(ep_priv->nic, vc[1]->vc_id); cr_assert_eq(vc_chk, vc[1]); ret = _gnix_vc_destroy(vc[0]); cr_assert_eq(ret, FI_SUCCESS); ret = _gnix_vc_destroy(vc[1]); cr_assert_eq(ret, FI_SUCCESS); }
static int __process_rx_cqe(struct gnix_nic *nic, gni_cq_entry_t cqe) { int ret = FI_SUCCESS, vc_id = 0; struct gnix_vc *vc; vc_id = GNI_CQ_GET_INST_ID(cqe); /* * its possible this vc has been destroyed, so may get NULL * back. */ vc = __gnix_nic_elem_by_rem_id(nic, vc_id); if (vc != NULL) { switch (vc->conn_state) { case GNIX_VC_CONNECTING: GNIX_DEBUG(FI_LOG_EP_DATA, "Scheduling VC for RX processing (%p)\n", vc); ret = _gnix_vc_rx_schedule(vc); assert(ret == FI_SUCCESS); break; case GNIX_VC_CONNECTED: GNIX_DEBUG(FI_LOG_EP_DATA, "Processing VC RX (%p)\n", vc); ret = _gnix_vc_dequeue_smsg(vc); if (ret != FI_SUCCESS) { GNIX_WARN(FI_LOG_EP_DATA, "_gnix_vc_dqueue_smsg returned %d\n", ret); } break; default: break; /* VC not in a state for scheduling or SMSG processing */ } } return ret; }
static int __nic_rx_overrun(struct gnix_nic *nic) { int i, max_id, ret; struct gnix_vc *vc; gni_return_t status; gni_cq_entry_t cqe; GNIX_WARN(FI_LOG_EP_DATA, "\n"); /* clear out the CQ */ /* * TODO: really need to process CQEs better for error reporting, * etc. */ while ((status = GNI_CqGetEvent(nic->rx_cq, &cqe)) == GNI_RC_SUCCESS); assert(status == GNI_RC_NOT_DONE); COND_ACQUIRE(nic->requires_lock, &nic->vc_id_lock); max_id = nic->vc_id_table_count; COND_RELEASE(nic->requires_lock, &nic->vc_id_lock); /* * TODO: optimization would * be to keep track of last time * this happened and where smsg msgs. * were found. */ for (i = 0; i < max_id; i++) { ret = _gnix_test_bit(&nic->vc_id_bitmap, i); if (ret) { vc = __gnix_nic_elem_by_rem_id(nic, i); ret = _gnix_vc_dequeue_smsg(vc); if (ret != FI_SUCCESS) { GNIX_WARN(FI_LOG_EP_DATA, "_gnix_vc_dqueue_smsg returned %d\n", ret); } } } return FI_SUCCESS; }