Esempio n. 1
0
static
void psdapl_socket_destroy(psdapl_socket_t *socket)
{
	assert(socket->magic == PSDAPL_SOCKET_MAGIC);

	psdapl_pz_destroy(socket->pz_handle);
	socket->pz_handle = 0;

	dat_ia_close(socket->ia_handle, DAT_CLOSE_DEFAULT);
	socket->ia_handle = 0;

	psdapl_mregion_cache_clear();

	socket->magic = 0;
	free(socket);
}
Esempio n. 2
0
int mca_btl_udapl_finalize(struct mca_btl_base_module_t* base_btl)
{
    mca_btl_udapl_module_t* udapl_btl = (mca_btl_udapl_module_t*) base_btl; 
    int32_t i;
    
    /*
     * Cleaning up the endpoints here because mca_btl_udapl_del_procs
     * is never called by upper layers.
     * Note: this is only looking at those endpoints which are available
     * off of the btl module rdma list. 
     */
    for (i=0; i < udapl_btl->udapl_eager_rdma_endpoint_count; i++) {
        mca_btl_udapl_endpoint_t* endpoint =
            opal_pointer_array_get_item(udapl_btl->udapl_eager_rdma_endpoints,
                i);

        OBJ_DESTRUCT(endpoint);
    }

    /* release uDAPL resources */
    dat_evd_free(udapl_btl->udapl_evd_dto);
    dat_evd_free(udapl_btl->udapl_evd_conn);
    dat_pz_free(udapl_btl->udapl_pz);
    dat_ia_close(udapl_btl->udapl_ia, DAT_CLOSE_GRACEFUL_FLAG);

    /* destroy objects */
    OBJ_DESTRUCT(&udapl_btl->udapl_lock);
    OBJ_DESTRUCT(&udapl_btl->udapl_frag_eager);
    OBJ_DESTRUCT(&udapl_btl->udapl_frag_eager_recv);
    OBJ_DESTRUCT(&udapl_btl->udapl_frag_max);
    OBJ_DESTRUCT(&udapl_btl->udapl_frag_max_recv);
    OBJ_DESTRUCT(&udapl_btl->udapl_frag_user);
    OBJ_DESTRUCT(&udapl_btl->udapl_frag_control);
    OBJ_DESTRUCT(&udapl_btl->udapl_eager_rdma_lock);
    
    /* destroy mpool */
    if (OMPI_SUCCESS !=
        mca_mpool_base_module_destroy(udapl_btl->super.btl_mpool)) {
        BTL_UDAPL_VERBOSE_OUTPUT(VERBOSE_INFORM,
            ("WARNING: Failed to release mpool"));
        return OMPI_ERROR;
    }

    free(udapl_btl);
    return OMPI_SUCCESS;
}
Esempio n. 3
0
/*--------------------------------------------------------*/
int DT_pz_case0(Params_t * params_ptr, FFT_Cmd_t * cmd)
{
	char *dev_name;
	DAT_IA_HANDLE ia_handle;
	DAT_PZ_HANDLE pz_handle;
	DAT_EVD_HANDLE evd_handle;
	DAT_RETURN rc;
	int res;
	DT_Tdep_Print_Head *phead;
	phead = params_ptr->phead;

	DT_Tdep_PT_Printf(phead, "\
	Description: Test if we can normally create pz and destroy it.\n");

	res = 1;
	ia_handle = 0;
	pz_handle = 0;
	evd_handle = DAT_HANDLE_NULL;
	dev_name = cmd->device_name;

	rc = DT_ia_open(dev_name, &ia_handle);
	DT_assert_dat(phead, rc == DAT_SUCCESS);
	rc = dat_pz_create(ia_handle, &pz_handle);
	DT_assert_dat(phead, rc == DAT_SUCCESS);

      cleanup:
	if (pz_handle) {
		rc = dat_pz_free(pz_handle);
		DT_assert_dat(phead, rc == DAT_SUCCESS);
	}
	if (ia_handle) {
		rc = dat_ia_close(ia_handle, DAT_CLOSE_ABRUPT_FLAG);
		DT_assert_dat(phead, rc == DAT_SUCCESS);
	}
	return res;
}
Esempio n. 4
0
int
mca_btl_udapl_init(DAT_NAME_PTR ia_name, mca_btl_udapl_module_t* btl)
{
    mca_mpool_base_resources_t res;
    DAT_CONN_QUAL port;
    DAT_RETURN rc;

    /* open the uDAPL interface */
    btl->udapl_evd_async = DAT_HANDLE_NULL;
    rc = dat_ia_open(ia_name, btl->udapl_async_evd_qlen,
            &btl->udapl_evd_async, &btl->udapl_ia);
    if(DAT_SUCCESS != rc) {
        char* major;
        char* minor;

        dat_strerror(rc, (const char**)&major,
            (const char**)&minor);

#if defined(__SVR4) && defined(__sun)
        if (strcmp(major, "DAT_INVALID_PARAMETER") == 0 &&
            strcmp(minor, "DAT_INVALID_RO_COOKIE") == 0) {
            /* Some platforms that Solaris runs on implement the PCI 
	     * standard for relaxed ordering(RO). Using RDMA with 
	     * polling on a memory location as the uDAPL (and openib
	     * by the way) BTL does for short messages with 
	     * relaxed ordering could potentially produce silent data
	     * corruption. For this reason we need to take extra
	     * steps and this is accomplished by setting
	     * "ro_aware_system = 1" and handling as required.
             *
	     * The uDAPL standard does not provide an interface to
	     * inform users of this scenario so Sun has implemented the
	     * following: If a platform supports relaxed ordering
	     * when the interface name is passed into the
	     * dat_ia_open() call, the call will return 
	     * DAT_INVALID_PARAMETER and DAT_INVALID_RO_COOKIE.  
	     * DAT_INVALID_RO_COOKIE is not part of the uDAPL standard
	     * at this time. The only way to open this interface is
	     * to prefix the following cookie "RO_AWARE_" to the ia
	     * name that was retreived from the dat registry.
             *
             * Example: ia_name = "ib0", new expected name will be
             * "RO_AWARE_ib0".
             * 
             * Here, since our first ia open attempt failed in the
             * standard way, add the cookie and try to open again.
             */
            DAT_NAME_PTR ro_ia_name;

            /* prefix relaxed order cookie to ia_name */
            asprintf(&ro_ia_name, "RO_AWARE_%s", ia_name);
            if (NULL == ro_ia_name) {
                return OMPI_ERR_OUT_OF_RESOURCE;
            }

            /* because this is not standard inform user in some way */
            BTL_UDAPL_VERBOSE_HELP(VERBOSE_INFORM,
                ("help-mpi-btl-udapl.txt", "relaxed order support",
                true, ia_name, ro_ia_name));

            /* try and open again */
            btl->udapl_evd_async = DAT_HANDLE_NULL;
            rc = dat_ia_open(ro_ia_name, btl->udapl_async_evd_qlen,
                &btl->udapl_evd_async, &btl->udapl_ia);

	    dat_strerror(rc, (const char**)&major,
		(const char**)&minor);

            if (DAT_SUCCESS == rc) {
                mca_btl_udapl_component.ro_aware_system = 1;
                free(ro_ia_name);
            } else {
                BTL_UDAPL_VERBOSE_HELP(VERBOSE_SHOW_HELP,
                    ("help-mpi-btl-udapl.txt",
                        "dat_ia_open fail RO", true, ro_ia_name,
                        major, minor, ia_name));

                free(ro_ia_name);
                return OMPI_ERROR;
            }
        } else {
#endif
        BTL_UDAPL_VERBOSE_HELP(VERBOSE_SHOW_HELP, ("help-mpi-btl-udapl.txt",
            "dat_ia_open fail", true, ia_name, major, minor));

        return OMPI_ERROR;
#if defined(__SVR4) && defined(__sun)	    
        }
#endif
    }

    /* create a protection zone */
    rc = dat_pz_create(btl->udapl_ia, &btl->udapl_pz);
    if(DAT_SUCCESS != rc) {
        char* major;
        char* minor;

        dat_strerror(rc, (const char**)&major,
            (const char**)&minor);
        BTL_ERROR(("ERROR: %s %s %s\n", "dat_pz_create",
            major, minor));
        goto failure;
    }

    /* query to get address information */
    rc = dat_ia_query(btl->udapl_ia, &btl->udapl_evd_async,
            DAT_IA_ALL, &(btl->udapl_ia_attr), 0, NULL);
    if(DAT_SUCCESS != rc) {
        char* major;
        char* minor;

        dat_strerror(rc, (const char**)&major,
            (const char**)&minor);
        BTL_ERROR(("ERROR: %s %s %s\n", "dat_ia_query",
            major, minor));
        goto failure;
    }

    memcpy(&btl->udapl_addr.addr, (btl->udapl_ia_attr).ia_address_ptr,
        sizeof(DAT_SOCK_ADDR));

    /* determine netmask */
    mca_btl_udapl_assign_netmask(btl);

    /* check evd qlen against adapter max */
    if (btl->udapl_dto_evd_qlen > (btl->udapl_ia_attr).max_evd_qlen) {
        BTL_UDAPL_VERBOSE_HELP(VERBOSE_SHOW_HELP, ("help-mpi-btl-udapl.txt",
            "evd_qlen adapter max", 
            true,
            "btl_udapl_dto_evd_qlen",
            btl->udapl_dto_evd_qlen,
            (btl->udapl_ia_attr).max_evd_qlen));        
        btl->udapl_dto_evd_qlen = btl->udapl_ia_attr.max_evd_qlen;
    }
    if (btl->udapl_conn_evd_qlen > (btl->udapl_ia_attr).max_evd_qlen) {
        BTL_UDAPL_VERBOSE_HELP(VERBOSE_SHOW_HELP, ("help-mpi-btl-udapl.txt",
            "evd_qlen adapter max", 
            true,
            "btl_udapl_conn_evd_qlen",
            btl->udapl_conn_evd_qlen,
            (btl->udapl_ia_attr).max_evd_qlen));        
        btl->udapl_conn_evd_qlen = btl->udapl_ia_attr.max_evd_qlen;
    }

    /* set up evd's */
    rc = dat_evd_create(btl->udapl_ia,
        btl->udapl_dto_evd_qlen, DAT_HANDLE_NULL,
        DAT_EVD_DTO_FLAG | DAT_EVD_RMR_BIND_FLAG, &btl->udapl_evd_dto);
    if(DAT_SUCCESS != rc) {
        char* major;
        char* minor;

        dat_strerror(rc, (const char**)&major,
            (const char**)&minor);
        BTL_ERROR(("ERROR: %s %s %s\n", "dat_evd_create (dto)",
            major, minor));
        goto failure;
    }

    rc = dat_evd_create(btl->udapl_ia,
            btl->udapl_conn_evd_qlen, DAT_HANDLE_NULL,
            DAT_EVD_CR_FLAG | DAT_EVD_CONNECTION_FLAG, &btl->udapl_evd_conn);
    if(DAT_SUCCESS != rc) {
        char* major;
        char* minor;

        dat_strerror(rc, (const char**)&major,
            (const char**)&minor);
        BTL_ERROR(("ERROR: %s %s %s\n", "dat_evd_create (conn)",
            major, minor));
        goto failure;
    }

    /* create our public service point */
    rc = dat_psp_create_any(btl->udapl_ia, &port, btl->udapl_evd_conn,
        DAT_PSP_CONSUMER_FLAG, &btl->udapl_psp);
    if(DAT_SUCCESS != rc) {
        char* major;
        char* minor;

        dat_strerror(rc, (const char**)&major,
            (const char**)&minor);
        BTL_ERROR(("ERROR: %s %s %s\n", "dat_psp_create_any",
            major, minor));
        goto failure;
    }

    /* establish endpoint parameters */
    rc = mca_btl_udapl_endpoint_get_params(btl, &(btl->udapl_ep_param));
    if(OMPI_SUCCESS != rc) { 
        /* by not erroring out here we can try to continue with
         * the default endpoint parameter values
         */
        BTL_UDAPL_VERBOSE_HELP(VERBOSE_SHOW_HELP, ("help-mpi-btl-udapl.txt",
            "use default endpoint params", 
            true));
    }

    /* Save the port with the address information */
    /* TODO - since we're doing the hack below, do we need our own port? */
    btl->udapl_addr.port = port;

    /* Using dat_ep_query to obtain the remote port would be ideal but
     * since the current udapl implementations don't seem to support
     * this we store the port in udapl_addr and explictly exchange the
     * information later.
     */
    ((struct sockaddr_in*)&btl->udapl_addr.addr)->sin_port = htons(port);

    /* initialize the memory pool */
    res.pool_name = "udapl";
    res.reg_data = btl;
    res.sizeof_reg = sizeof(mca_btl_udapl_reg_t);
    res.register_mem = udapl_reg_mr;
    res.deregister_mem = udapl_dereg_mr;
    btl->super.btl_mpool = mca_mpool_base_module_create(
            mca_btl_udapl_component.udapl_mpool_name, &btl->super, &res);
    if (NULL == btl->super.btl_mpool) {
        BTL_UDAPL_VERBOSE_OUTPUT(VERBOSE_INFORM,
            ("WARNING: Failed to create mpool."));
        goto failure;
    }
 
    /* initialize objects */
    OBJ_CONSTRUCT(&btl->udapl_frag_eager, ompi_free_list_t);
    OBJ_CONSTRUCT(&btl->udapl_frag_eager_recv, ompi_free_list_t);
    OBJ_CONSTRUCT(&btl->udapl_frag_max, ompi_free_list_t);
    OBJ_CONSTRUCT(&btl->udapl_frag_max_recv, ompi_free_list_t);
    OBJ_CONSTRUCT(&btl->udapl_frag_user, ompi_free_list_t);
    OBJ_CONSTRUCT(&btl->udapl_frag_control, ompi_free_list_t);
    OBJ_CONSTRUCT(&btl->udapl_lock, opal_mutex_t);
    
     /* check buffer alignment against dat library */
    if (mca_btl_udapl_component.udapl_buffer_alignment !=
        DAT_OPTIMAL_ALIGNMENT) {

        BTL_UDAPL_VERBOSE_HELP(VERBOSE_SHOW_HELP, ("help-mpi-btl-udapl.txt",
            "optimal buffer alignment mismatch", 
            true,
            DAT_OPTIMAL_ALIGNMENT,
            mca_btl_udapl_component.udapl_buffer_alignment,
            DAT_OPTIMAL_ALIGNMENT));
    }

    /* initialize free lists */
    ompi_free_list_init_ex_new(&btl->udapl_frag_eager,
        sizeof(mca_btl_udapl_frag_eager_t) +
            mca_btl_udapl_component.udapl_eager_frag_size,
        mca_btl_udapl_component.udapl_buffer_alignment,
        OBJ_CLASS(mca_btl_udapl_frag_eager_t),
        mca_btl_udapl_component.udapl_eager_frag_size,
        mca_btl_udapl_component.udapl_buffer_alignment,
        mca_btl_udapl_component.udapl_free_list_num,
        mca_btl_udapl_component.udapl_free_list_max,
        mca_btl_udapl_component.udapl_free_list_inc,
                           btl->super.btl_mpool,
                           NULL,
                           NULL);

    ompi_free_list_init_ex_new(&btl->udapl_frag_eager_recv,
        sizeof(mca_btl_udapl_frag_eager_t) +
            mca_btl_udapl_component.udapl_eager_frag_size,
        mca_btl_udapl_component.udapl_buffer_alignment,
        OBJ_CLASS(mca_btl_udapl_frag_eager_t),
        mca_btl_udapl_component.udapl_eager_frag_size,
        mca_btl_udapl_component.udapl_buffer_alignment,
        mca_btl_udapl_component.udapl_free_list_num,
        mca_btl_udapl_component.udapl_free_list_max,
        mca_btl_udapl_component.udapl_free_list_inc,
                           btl->super.btl_mpool,
                           NULL,
                           NULL);

    ompi_free_list_init_ex_new(&btl->udapl_frag_max,
        sizeof(mca_btl_udapl_frag_max_t) +
            mca_btl_udapl_component.udapl_max_frag_size,
        mca_btl_udapl_component.udapl_buffer_alignment,
        OBJ_CLASS(mca_btl_udapl_frag_max_t),
        mca_btl_udapl_component.udapl_max_frag_size,
        mca_btl_udapl_component.udapl_buffer_alignment,
        mca_btl_udapl_component.udapl_free_list_num,
        mca_btl_udapl_component.udapl_free_list_max,
        mca_btl_udapl_component.udapl_free_list_inc,
                           btl->super.btl_mpool,
                           NULL,
                           NULL);

    ompi_free_list_init_ex_new(&btl->udapl_frag_max_recv,
        sizeof(mca_btl_udapl_frag_max_t) +
            mca_btl_udapl_component.udapl_max_frag_size,
        mca_btl_udapl_component.udapl_buffer_alignment,
        OBJ_CLASS(mca_btl_udapl_frag_max_t),
        mca_btl_udapl_component.udapl_max_frag_size,
        mca_btl_udapl_component.udapl_buffer_alignment,
        mca_btl_udapl_component.udapl_free_list_num,
        mca_btl_udapl_component.udapl_free_list_max,
        mca_btl_udapl_component.udapl_free_list_inc,
                           btl->super.btl_mpool,
                           NULL,
                           NULL);

    ompi_free_list_init_ex_new(&btl->udapl_frag_user,
        sizeof(mca_btl_udapl_frag_user_t),
        mca_btl_udapl_component.udapl_buffer_alignment,
        OBJ_CLASS(mca_btl_udapl_frag_user_t),
        0,0,
        mca_btl_udapl_component.udapl_free_list_num,
        mca_btl_udapl_component.udapl_free_list_max,
        mca_btl_udapl_component.udapl_free_list_inc,
                           NULL,
                           NULL,
                           NULL);

    ompi_free_list_init_ex_new(&btl->udapl_frag_control,
        sizeof(mca_btl_udapl_frag_eager_t) +
        mca_btl_udapl_component.udapl_eager_frag_size,
        mca_btl_udapl_component.udapl_buffer_alignment,
        OBJ_CLASS(mca_btl_udapl_frag_eager_t),
        mca_btl_udapl_component.udapl_eager_frag_size,
        mca_btl_udapl_component.udapl_buffer_alignment,
        mca_btl_udapl_component.udapl_free_list_num,
        -1,
        mca_btl_udapl_component.udapl_free_list_inc,
                           btl->super.btl_mpool,
                           NULL,
                           NULL);

    /* initialize eager rdma buffer info */
    btl->udapl_eager_rdma_endpoints = OBJ_NEW(opal_pointer_array_t);
    opal_pointer_array_init(btl->udapl_eager_rdma_endpoints, 
        mca_btl_udapl_component.udapl_max_eager_rdma_peers,
        mca_btl_udapl_component.udapl_max_eager_rdma_peers, 
        0);
    btl->udapl_eager_rdma_endpoint_count = 0;
    OBJ_CONSTRUCT(&btl->udapl_eager_rdma_lock, opal_mutex_t);

    /* initialize miscellaneous variables */
    btl->udapl_async_events = 0;
    btl->udapl_connect_inprogress = 0;
    btl->udapl_num_peers = 0;

    /* TODO - Set up SRQ when it is supported */
    return OMPI_SUCCESS;

failure:
    dat_ia_close(btl->udapl_ia, DAT_CLOSE_ABRUPT_FLAG);
    return OMPI_ERROR;
}
Esempio n. 5
0
int disconnect_ep(void)
{
	DAT_RETURN status;
	DAT_EVENT event;
	DAT_COUNT nmore;
	int i;
	
	if (counters) {		/* examples of query and print */
		int ii;
		DAT_UINT64 ia_cntrs[DCNT_IA_ALL_COUNTERS];

		dat_query_counters(ia, DCNT_IA_ALL_COUNTERS, ia_cntrs, 0);
		printf(" IA Cntrs:");
		for (ii = 0; ii < DCNT_IA_ALL_COUNTERS; ii++)
			printf(" " F64u "", ia_cntrs[ii]);
		printf("\n");
		dat_print_counters(ia, DCNT_IA_ALL_COUNTERS, 0);
	}
	
	if (!ud_test) {
		status = dat_ep_disconnect(ep[0], DAT_CLOSE_DEFAULT);
		_OK2(status, "dat_ep_disconnect");

		status = dat_evd_wait(con_evd, DAT_TIMEOUT_INFINITE, 1,
				      &event, &nmore);
		_OK(status, "dat_evd_wait");
	}
	if (psp) {
		status = dat_psp_free(psp);
		_OK2(status, "dat_psp_free");
	}
	for (i = 0; i < REG_MEM_COUNT * eps; i++) {
		status = dat_lmr_free(lmr[i]);
		_OK2(status, "dat_lmr_free");
	}
	if (lmr_atomic) {
		status = dat_lmr_free(lmr_atomic);
		_OK2(status, "dat_lmr_free_atomic");
	}
	for (i = 0; i < eps; i++) {
		if (counters) {	/* examples of query and print */
			int ii;
			DAT_UINT64 ep_cntrs[DCNT_EP_ALL_COUNTERS];

			dat_query_counters(ep[i], DCNT_EP_ALL_COUNTERS,
					   ep_cntrs, 0);
			printf(" EP[%d] Cntrs:", i);
			for (ii = 0; ii < DCNT_EP_ALL_COUNTERS; ii++)
				printf(" " F64u "", ep_cntrs[ii]);
			printf("\n");
			dat_print_counters(ep[i], DCNT_EP_ALL_COUNTERS, 0);
		}
		status = dat_ep_free(ep[i]);
		_OK2(status, "dat_ep_free");
	}
	if (counters) {		/* examples of query and print */
		int ii;
		DAT_UINT64 evd_cntrs[DCNT_EVD_ALL_COUNTERS];

		dat_query_counters(dto_evd, DCNT_EVD_ALL_COUNTERS,
				   evd_cntrs, 0);
		printf(" DTO_EVD Cntrs:");
		for (ii = 0; ii < DCNT_EVD_ALL_COUNTERS; ii++)
			printf(" " F64u "", evd_cntrs[ii]);
		printf("\n");
		dat_print_counters(dto_evd, DCNT_EVD_ALL_COUNTERS, 0);

		dat_query_counters(con_evd, DCNT_EVD_ALL_COUNTERS,
				   evd_cntrs, 0);
		printf(" CONN_EVD Cntrs:");
		for (ii = 0; ii < DCNT_EVD_ALL_COUNTERS; ii++)
			printf(" " F64u "", evd_cntrs[ii]);
		printf("\n");
		dat_print_counters(con_evd, DCNT_EVD_ALL_COUNTERS, 0);

		dat_query_counters(cr_evd, DCNT_EVD_ALL_COUNTERS, evd_cntrs, 0);
		printf(" CR_EVD Cntrs:");
		for (ii = 0; ii < DCNT_EVD_ALL_COUNTERS; ii++)
			printf(" " F64u "", evd_cntrs[ii]);
		printf("\n");
		dat_print_counters(cr_evd, DCNT_EVD_ALL_COUNTERS, 0);
	}
	status = dat_evd_free(dto_evd);
	_OK2(status, "dat_evd_free DTO");

	status = dat_evd_free(con_evd);
	_OK2(status, "dat_evd_free CON");

	status = dat_evd_free(cr_evd);
	_OK2(status, "dat_evd_free CR");

	status = dat_pz_free(pz);
	_OK2(status, "dat_pz_free");

	status = dat_ia_close(ia, DAT_CLOSE_DEFAULT);
	_OK2(status, "dat_ia_close");

	return (0);
}
Esempio n. 6
0
/*--------------------------------------------------------*/
int DT_pz_case1(Params_t * params_ptr, FFT_Cmd_t * cmd)
{
	char *dev_name;
	DAT_IA_HANDLE ia_handle;
	DAT_PZ_HANDLE pz_handle;
	DAT_EP_HANDLE ep_handle;
	DAT_EVD_HANDLE conn_evd, send_evd, recv_evd, cr_evd;
	DAT_RETURN rc;
	int res;
	DT_Tdep_Print_Head *phead;
	phead = params_ptr->phead;

	DT_Tdep_PT_Printf(phead, "\
	Description: try to destroy pz with vi still associated with it\n");

	res = 1;
	ia_handle = 0;
	pz_handle = 0;
	ep_handle = 0;
	conn_evd = 0;
	send_evd = 0;
	recv_evd = 0;
	cr_evd = 0;
	dev_name = cmd->device_name;

	rc = DT_ia_open(dev_name, &ia_handle);
	DT_assert_dat(phead, rc == DAT_SUCCESS);

	rc = dat_pz_create(ia_handle, &pz_handle);
	DT_assert_dat(phead, rc == DAT_SUCCESS);

	rc = DT_ep_create(params_ptr,
			  ia_handle,
			  pz_handle,
			  &cr_evd, &conn_evd, &send_evd, &recv_evd, &ep_handle);
	DT_assert_dat(phead, rc == DAT_SUCCESS);

	if (pz_handle) {
		rc = dat_pz_free(pz_handle);
		DT_assert_dat(phead, DAT_GET_TYPE(rc) == DAT_INVALID_STATE);
	}

      cleanup:
	/* corrrect order */
	if (ep_handle) {
		rc = dat_ep_free(ep_handle);
		DT_assert_clean(phead, rc == DAT_SUCCESS);
	}
	if (conn_evd) {
		rc = DT_Tdep_evd_free(conn_evd);
		DT_assert_clean(phead, rc == DAT_SUCCESS);
	}
	if (send_evd) {
		rc = DT_Tdep_evd_free(send_evd);
		DT_assert_clean(phead, rc == DAT_SUCCESS);
	}
	if (recv_evd) {
		rc = DT_Tdep_evd_free(recv_evd);
		DT_assert_clean(phead, rc == DAT_SUCCESS);
	}
	if (pz_handle) {
		rc = dat_pz_free(pz_handle);
		DT_assert_clean(phead, rc == DAT_SUCCESS);
	}

	if (ia_handle) {
		rc = dat_ia_close(ia_handle, DAT_CLOSE_ABRUPT_FLAG);
		DT_assert_clean(phead, rc == DAT_SUCCESS);
	}

	return res;
}

/*--------------------------------------------------------*/
int DT_pz_case2(Params_t * params_ptr, FFT_Cmd_t * cmd)
{
	char *dev_name;
	DAT_IA_HANDLE ia_handle;
	DAT_PZ_HANDLE pz_handle;
	Bpool *bpool;
	DAT_RETURN rc;
	int res;
	DT_Tdep_Print_Head *phead;
	phead = params_ptr->phead;

	DT_Tdep_PT_Printf(phead, "\
	Description: try to destroy pz with registered memory still\n");
	DT_Tdep_PT_Printf(phead, "\
	associated with it\n");

	res = 1;
	ia_handle = 0;
	pz_handle = 0;
	bpool = 0;
	dev_name = cmd->device_name;

	rc = DT_ia_open(dev_name, &ia_handle);
	DT_assert_dat(phead, rc == DAT_SUCCESS);

	rc = dat_pz_create(ia_handle, &pz_handle);
	DT_assert_dat(phead, rc == DAT_SUCCESS);

	/* allocate and register bpool */
	bpool = DT_BpoolAlloc(0, phead, ia_handle, pz_handle, NULL,
			      NULL, BUFFSIZE, 1, DAT_OPTIMAL_ALIGNMENT,
			      false, false);
	DT_assert(phead, bpool != 0);

	if (pz_handle) {
		rc = dat_pz_free(pz_handle);
		DT_assert_dat(phead, DAT_GET_TYPE(rc) == DAT_INVALID_STATE);
	}

      cleanup:

	/* deregister and free bpool */
	if (DT_Bpool_Destroy(0, phead, bpool) == false) {
		DT_Tdep_PT_Printf(phead,
				  "Warning: Destroy bpool fails, reboot for cleanup\n");
		return 0;
	}
	if (pz_handle) {
		rc = dat_pz_free(pz_handle);
		DT_assert_clean(phead, rc == DAT_SUCCESS);
	}

	if (ia_handle) {
		rc = dat_ia_close(ia_handle, DAT_CLOSE_ABRUPT_FLAG);
		DT_assert_clean(phead, rc == DAT_SUCCESS);
	}

	return res;
}

/*-------------------------------------------------------------*/
void DT_pz_test(Params_t * params_ptr, FFT_Cmd_t * cmd)
{
	int i;
	int res;
	DT_Tdep_Print_Head *phead;

	FFT_Testfunc_t cases_func[] = {
		{DT_pz_case0},
		{DT_pz_case1},
		{DT_pz_case2},
	};

	phead = params_ptr->phead;
	for (i = 0; i < cmd->size; i++) {
		if (cmd->cases_flag[i]) {
			DT_Tdep_PT_Printf(phead, "\
		*********************************************************************\n");
			DT_Tdep_PT_Printf(phead, "\
		Function feature: Protection Zone management         case: %d\n", i);
			res = cases_func[i].fun(params_ptr, cmd);
			if (res == 1) {
				DT_Tdep_PT_Printf(phead, "Result: PASS\n");
			} else if (res == 0) {
				DT_Tdep_PT_Printf(phead, "Result: FAIL\n");
			} else if (res == -1) {
				DT_Tdep_PT_Printf(phead,
						  "Result: use other test tool\n");
			} else if (res == -2) {
				DT_Tdep_PT_Printf(phead,
						  "Result: not support or next stage to develop\n");
			}

			DT_Tdep_PT_Printf(phead, "\
		*********************************************************************\n");
		}
	}
Esempio n. 7
0
static
void psdapl_ia_close(DAT_IA_HANDLE ia_handle)
{
	dat_ia_close(ia_handle, DAT_CLOSE_DEFAULT);
}