Beispiel #1
0
void FreeBuff(char *buff1, char *buff2)
{
  VAPI_ret_t ret;

  if(s_mr_hndl != VAPI_INVAL_HNDL) {
    LOGPRINTF("Deregistering send buffer\n");
    ret = VAPI_deregister_mr(hca_hndl, s_mr_hndl);
    if(ret != VAPI_OK) {
      fprintf(stderr, "Error deregistering send mr: %s\n", VAPI_strerror(ret));
    } else {
      s_mr_hndl = VAPI_INVAL_HNDL;
    }
  }

  if(r_mr_hndl != VAPI_INVAL_HNDL) {
    LOGPRINTF("Deregistering recv buffer\n");
    ret = VAPI_deregister_mr(hca_hndl, r_mr_hndl);
    if(ret != VAPI_OK) {
      fprintf(stderr, "Error deregistering recv mr: %s\n", VAPI_strerror(ret));
    } else {
      r_mr_hndl = VAPI_INVAL_HNDL;
    }
  }

  if(buff1 != NULL)
    free(buff1);

  if(buff2 != NULL)
    free(buff2);
}
VAPI_ret_t osmt_mtl_mad_cleanup(osmt_mtl_mad_res_t * res)
{
	if (res->qp_hndl != VAPI_INVAL_HNDL) {
		VAPI_destroy_qp(res->hca_hndl, res->qp_hndl);
	}
	if (res->sq_cq_eventh != VAPI_INVAL_HNDL) {
		EVAPI_clear_comp_eventh(res->hca_hndl, res->sq_cq_eventh);
	}
	if (res->rq_cq_eventh != VAPI_INVAL_HNDL) {
		EVAPI_clear_comp_eventh(res->hca_hndl, res->rq_cq_eventh);
	}
	if (res->rq_cq_hndl != VAPI_INVAL_HNDL) {
		VAPI_destroy_cq(res->hca_hndl, res->rq_cq_hndl);
	}
	if (res->sq_cq_hndl != VAPI_INVAL_HNDL) {
		VAPI_destroy_cq(res->hca_hndl, res->sq_cq_hndl);
	}
	if (res->mr_hndl != VAPI_INVAL_HNDL) {
		VAPI_deregister_mr(res->hca_hndl, res->mr_hndl);
	}
	if (res->pd_hndl != VAPI_INVAL_HNDL) {
		VAPI_dealloc_pd(res->hca_hndl, res->pd_hndl);
	}
#if 0
	/* open/close of HCA should be done system wide - not per application */
	if (res->hca_hndl != VAPI_INVAL_HNDL) {
		VAPI_close_hca(res->hca_hndl);	/* TBD: HCA_open/close should be done on a system wide basis */
	}
#endif
	return VAPI_OK;
}
Beispiel #3
0
int finalizeIB(ArgStruct *p)
{
  VAPI_ret_t ret;

  LOGPRINTF("Finalizing IB stuff\n");

  /* Clear completion event handler */

  if(p->prot.comptype == NP_COMP_EVENT ) {
     LOGPRINTF("Clearing comp handler\n");
     ret = EVAPI_clear_comp_eventh(hca_hndl, ceh_hndl);
     if(ret != VAPI_OK) {
        fprintf(stderr, "Error clearing event handler: %s\n",
                VAPI_strerror(ret));
     }
  }

  if(qp_hndl != VAPI_INVAL_HNDL) {
    LOGPRINTF("Destroying QP\n");
    ret = VAPI_destroy_qp(hca_hndl, qp_hndl);
    if(ret != VAPI_OK) {
      fprintf(stderr, "Error destroying Queue Pair: %s\n", VAPI_strerror(ret));
    }
  }

  if(r_cq_hndl != VAPI_INVAL_HNDL) {
    LOGPRINTF("Destroying Recv CQ\n");
    ret = VAPI_destroy_cq(hca_hndl, r_cq_hndl);
    if(ret != VAPI_OK) {
      fprintf(stderr, "Error destroying recv CQ: %s\n", VAPI_strerror(ret));
    }
  }

  if(s_cq_hndl != VAPI_INVAL_HNDL) {
    LOGPRINTF("Destroying Send CQ\n");
    ret = VAPI_destroy_cq(hca_hndl, s_cq_hndl);
    if(ret != VAPI_OK) {
      fprintf(stderr, "Error destroying send CQ: %s\n", VAPI_strerror(ret));
    }
  }

  /* Check memory registrations just in case user bailed out */
  if(s_mr_hndl != VAPI_INVAL_HNDL) {
    LOGPRINTF("Deregistering send buffer\n");
    ret = VAPI_deregister_mr(hca_hndl, s_mr_hndl);
    if(ret != VAPI_OK) {
      fprintf(stderr, "Error deregistering send mr: %s\n", VAPI_strerror(ret));
    }
  }

  if(r_mr_hndl != VAPI_INVAL_HNDL) {
    LOGPRINTF("Deregistering recv buffer\n");
    ret = VAPI_deregister_mr(hca_hndl, r_mr_hndl);
    if(ret != VAPI_OK) {
      fprintf(stderr, "Error deregistering recv mr: %s\n", VAPI_strerror(ret));
    }
  }

  if(pd_hndl != VAPI_INVAL_HNDL) {
    LOGPRINTF("Deallocating PD\n");
    ret = VAPI_dealloc_pd(hca_hndl, pd_hndl);
    if(ret != VAPI_OK) {
      fprintf(stderr, "Error deallocating PD: %s\n", VAPI_strerror(ret));
    }
  }

  /* Application code should not close HCA, just release handle */

  if(hca_hndl != VAPI_INVAL_HNDL) {
    LOGPRINTF("Releasing HCA\n");
    ret = EVAPI_release_hca_hndl(hca_hndl);
    if(ret != VAPI_OK) {
      fprintf(stderr, "Error releasing HCA: %s\n", VAPI_strerror(ret));
    }
  }

  return 0;
}
Beispiel #4
0
static
void psib_vapi_free(IN hca_info_t *hca_info,IN mem_info_t *mem_info)
{
    VAPI_deregister_mr(hca_info->hca_hndl, mem_info->mr_hndl);
}