/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
*
* MODULE: dapl_ep_util.c
*
* PURPOSE: Manage EP Info structure
*
* $Id: dapl_ep_util.c,v 1.36 2003/08/04 16:50:27 sjs2 Exp $
*/
#include "dapl_ep_util.h"
#include "dapl_ring_buffer_util.h"
#include "dapl_cookie.h"
#include "dapl_adapter_util.h"
#include "dapl_evd_util.h"
#include "dapl_ia_util.h"
/*
* Local definitions
*/
/*
* Default number of I/O operations on an end point
*/
/*
*/
/*
* Default number of RDMA operations in progress at a time
*/
extern void dapli_ep_default_attrs(
/*
* dapl_ep_alloc
*
* alloc and initialize an EP INFO struct
*
* Input:
* IA INFO struct ptr
*
* Output:
* ep_ptr
*
* Returns:
* none
*
*/
DAPL_EP *
{
/* Allocate EP */
goto bail;
}
/* zero the structure */
/*
* initialize the header
*/
/*
* Initialize the body
*/
/* Set the remote address pointer */
/*
* Set up default parameters if the user passed in a NULL
*/
} else {
}
/*
* IBM OS API specific fields
*/
ep_ptr->recv_count = 0;
goto bail;
}
if (!srq_attached) {
goto bail;
}
}
bail:
return (ep_ptr);
}
/*
* dapl_ep_dealloc
*
* Free the passed in EP structure.
*
* Input:
* entry point pointer
*
* Output:
* none
*
* Returns:
* none
*
*/
void
{
/* reset magic to prevent reuse */
}
/*
* dapl_ep_default_attrs
*
* Set default values in the parameter fields
*
* Input:
* entry point pointer
*
* Output:
* none
*
* Returns:
* none
*
*/
void
{
/* Set up defaults */
/*
* mtu and rdma sizes fixed in IB as per IBTA 1.1, 9.4.3, 9.4.4,
* 9.7.7.
*/
/*
* Unspecified defaults:
* - ep_privileges: No RDMA capabilities
* - num_transport_specific_params: none
* - transport_specific_params: none
* - num_provider_specific_params: 0
* - provider_specific_params: 0
*/
}
{
/*
* InfiniBand will not allow unsignaled/suppressed RECV completions,
* see the 1.0.1 spec section 10.7.3.1, 10.8.6
*/
if ((flags & DAT_COMPLETION_UNSIGNALLED_FLAG) ||
return (DAT_INVALID_PARAMETER);
}
return (DAT_SUCCESS);
}
/* ARGSUSED */
{
return (DAT_SUCCESS);
}
{
return (DAT_INVALID_PARAMETER);
}
return (DAT_SUCCESS);
}
{
goto bail;
}
/*
* Synchronization ok since this buffer is only used for send
* requests, which aren't allowed to race with each other.
*/
&cookie);
if (dat_status != DAT_SUCCESS) {
goto bail;
}
/*
* Invoke provider specific routine to post DTO
*/
if (num_segments != 1 ||
else
if (dat_status != DAT_SUCCESS) {
} else {
}
bail:
return (dat_status);
}
/*
* dapli_ep_timeout
*
* If this routine is invoked before a connection occurs, generate an
* event
*/
void
unsigned long arg)
{
/* reset the EP state */
(void) dapls_evd_post_connection_event(
(DAT_HANDLE) ep_ptr,
0,
0);
}
/*
* dapls_ep_state_subtype
*
* Return the INVALID_STATE connection subtype associated with an
* INVALID_STATE on an EP. Strictly for error reporting.
*/
{
case DAT_EP_STATE_RESERVED:
{
break;
}
{
break;
}
{
break;
}
{
break;
}
case DAT_EP_STATE_CONNECTED:
{
break;
}
{
break;
}
{
break;
}
{
break;
}
default:
{
dat_status = 0;
break;
}
}
return (dat_status);
}
/*
* dapl_ep_create_common
*
* Common code used by dapl_ep_create and dapl_ep_create_srq
*
* Input:
* ia_handle
* pz_handle
* recv_evd_handle (recv DTOs)
* request_evd_handle (xmit DTOs)
* connect_evd_handle
* srq_handle
* ep_attrs
*
* Output:
* ep_handle
*
* Returns:
* DAT_SUCCESS
* DAT_INSUFFICIENT_RESOURCES
* DAT_INVALID_PARAMETER
* DAT_INVALID_ATTRIBUTE
* DAT_MODEL_NOT_SUPPORTED
*/
{
if (ep_attr_arg) {
epa = *ep_attr_arg;
} else
/*
* Verify parameters
*/
goto bail;
}
/*
* Verify non-required parameters.
* N.B. Assumption: any parameter that can be
* modified by dat_ep_modify() is not strictly
* required when the EP is created
*/
goto bail;
}
/* If connect handle is !NULL verify handle is good */
if (connect_evd_handle != DAT_HANDLE_NULL &&
goto bail;
}
/* If recv_evd is !NULL, verify handle is good and flags are valid */
if ((recv_evd_handle != DAT_HANDLE_NULL) &&
goto bail;
}
/* If req_evd is !NULL, verify handle is good and flags are valid */
if ((request_evd_handle != DAT_HANDLE_NULL) &&
DAT_EVD_DTO_FLAG))) {
goto bail;
}
/* if srq_handle is not null validate it */
if (srq_handle != DAT_HANDLE_NULL) {
goto bail;
} else if (pz_handle !=
goto bail;
}
}
goto bail;
}
/* For EPs with SRQ ep_attr is required */
goto bail;
}
/*
* Qualify EP Attributes are legal and make sense. Note that if one
* or both of the DTO handles are NULL, then the corresponding
* max_*_dtos must 0 as the user will not be able to post dto ops on
* the respective queue.
*/
ep_attr->max_request_dtos != 0) ||
ep_attr->max_request_dtos == 0) ||
ep_attr->max_request_iov == 0 ||
ep_attr->recv_completion_flags))) {
goto bail;
}
if (srq_attached) {
0);
goto bail;
}
} else {
/* These checks are needed only for EPs without SRQ */
if ((recv_evd_handle == DAT_HANDLE_NULL &&
ep_attr->max_recv_dtos != 0) ||
(recv_evd_handle != DAT_HANDLE_NULL &&
ep_attr->max_recv_dtos == 0) ||
ep_attr->max_recv_iov == 0) {
goto bail;
}
}
}
/* Verify the attributes against the transport */
if (dat_status != DAT_SUCCESS) {
goto bail;
}
goto bail;
}
/* if inlining enabled, recompute max_request_iov */
/* Only EPs without SRQ need the following check */
if ((!srq_attached) &&
goto bail;
}
}
/*
* Verify the completion flags for the EVD and the EP
*/
} else {
/*
* Currently we support only thresholds -
* eventually it'll depend on
* ep_attr->recv_completion_flags;
*/
}
}
} else {
/*
* Currently we support only thresholds -
* eventually it'll depend on
* ep_attr->recv_completion_flags;
*/
}
}
/* Allocate EP */
goto bail;
}
/*
* Fill in the EP
*/
/*
* Make sure we handle the NULL DTO EVDs
*/
}
}
/*
* If the user has specified a PZ handle we allocate a QP for
* this EP; else we defer until it is assigned via ep_modify().
* As much as possible we try to keep QP creation out of the
* connect path to avoid resource errors in strange places.
*/
if (pz_handle != DAT_HANDLE_NULL) {
/* Take a reference on the PZ handle */
/*
* Get a QP from the IB provider
*/
if (dat_status != DAT_SUCCESS) {
goto bail;
}
} else {
}
/*
* Update ref counts. See the spec where the endpoint marks
* a data object as 'in use'
* pz_handle: dat_pz_free, uDAPL Document, 6.6.1.2
* evd_handles:
*
* N.B. This should really be done by a util routine.
*/
/* Optional handles */
if (recv_evd_handle != NULL) {
}
if (request_evd_handle != NULL) {
}
if (srq_handle != NULL) {
}
/* Link it onto the IA */
bail:
return (dat_status);
}
/*
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* tab-width: 8
* End:
*/