/*
* 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_modify.c
*
* PURPOSE: Endpoint management
* Description: Interfaces in this file are completely described in
* the DAPL 1.0 API, Chapter 6, section 5
*
* $Id: dapl_ep_modify.c,v 1.23 2003/07/11 18:42:17 hobie16 Exp $
*/
#include "dapl.h"
#include "dapl_cookie.h"
#include "dapl_ep_util.h"
#include "dapl_adapter_util.h"
/*
* Internal prototypes
*/
static _INLINE_ DAT_RETURN
/*
* dapl_ep_modify
*
* DAPL Requirements Version xxx, 6.5.6
*
* Provide the consumer parameters, including attributes and status of
* the Endpoint.
*
* Input:
* ep_handle
* ep_args_mask
*
* Output:
* ep_args
*
* Returns:
* DAT_SUCCESS
* DAT_INVALID_PARAMETER
* DAT_INVALID_ATTRIBUTE
* DAT_INVALID_STATE
*/
{
/* Flag indicating we've allocated a new one of these. */
/* Flag indicating we've used (assigned to QP) a new one of these. */
if (DAT_SUCCESS != dat_status) {
goto bail;
}
/*
* Setup the alloc_ep with the appropriate parameters (primarily
* for allocating the QP.
*/
if (ep_param_mask & DAT_EP_FIELD_PZ_HANDLE) {
}
}
}
}
/*
* Allocate everything that might be needed.
* We allocate separately, and into a different "holding"
* ep, since we a) want the copy of the old ep into the new ep to
* be atomic with the assignment back (under lock), b) want the
* assignment of the allocated materials to be after the copy of the
* old ep into the new ep, and c) don't want the allocation done
* under lock.
*/
if (DAT_SUCCESS != dat_status) {
goto bail;
}
if (!ep1->srq_attached) {
if (DAT_SUCCESS != dat_status) {
goto bail;
}
}
if (dat_status != DAT_SUCCESS) {
goto bail;
}
/*
* Now we atomically modify the EP, under lock
* There's a lot of work done here, but there should be no
* allocation or blocking.
*/
/*
* Revalidate parameters; make sure that races haven't
* changed anything important.
*/
if (DAT_SUCCESS != dat_status) {
goto bail;
}
/*
* All of the following should be impossible, if validation
* occurred. But they're important to the logic of this routine,
* so we check.
*/
copy_of_old_ep = *ep2;
/*
* Setup new ep.
*/
/*
* We can initialize the PZ and EVD handles from the alloc_ep because
* the only thing that could have changed since we setup the alloc_ep
* is stuff changed by dapl_cr_accept, and neither PZ nor EVD is in that
* list.
*/
/* Deal with each of the allocation fields. */
}
}
/*
* We need to change the QP only if there already was a QP
* (leave things the way you found them!) and one of the
*/
/*
* We shouldn't be racing with connection establishment
* because the parameter validate routine should protect us,
* but it's an important enough point that we assert it.
*/
}
/*
* The actual assignment, including modifying QP parameters.
* Modifying QP parameters needs to come first, as if it fails
* we need to exit.
*/
if (dat_status != DAT_SUCCESS) {
goto bail;
}
}
/*
* Modify reference counts, incrementing new ones
* and then decrementing old ones (so if they're the same
* the refcount never drops to zero).
*/
}
}
}
}
/* decreament the old reference counts */
}
}
}
}
bail:
if (qp_allocated) {
} else {
}
if (local_dat_status != DAT_SUCCESS) {
"ep_modify: Failed to free QP; status %x\n",
}
}
if (rqst_cb_allocated) {
} else {
}
}
if (recv_cb_allocated) {
} else {
}
}
return (dat_status);
}
/*
* dapli_ep_modify_validate_parameters
*
* Validate parameters
*
* The space for the ep_attr_ptr parameter should be allocated by the
* consumer. Upon success, this parameter will contain the current ep
* attribute values with the requested modifications made.
*
*/
static DAT_RETURN
{
goto bail;
}
/*
* Verify parameters valid in current EP state
*/
if (ep_param_mask & (DAT_EP_FIELD_IA_HANDLE |
goto bail;
}
/*
* Can only change the PZ handle if we are UNCONNECTED or
* TENTATIVE_CONNECTION_PENDING(psp PROVIDER allocated EP)
*/
if ((ep_param_mask & DAT_EP_FIELD_PZ_HANDLE) &&
goto bail;
}
if ((ep_param_mask & (DAT_EP_FIELD_RECV_EVD_HANDLE |
goto bail;
}
/*
* Validate handles being modified
*/
if (ep_param_mask & DAT_EP_FIELD_PZ_HANDLE) {
goto bail;
}
}
DAPL_MAGIC_EVD) ||
DAT_EVD_DTO_FLAG)) {
goto bail;
}
}
DAPL_MAGIC_EVD)) {
goto bail;
}
}
DAPL_MAGIC_EVD) &&
goto bail;
}
}
/*
* Validate the attributes against the HCA limits
*/
if (dat_status != DAT_SUCCESS) {
goto bail;
}
goto bail;
}
}
goto bail;
} else {
}
}
/*
* Do nothing if the DAT_EP_FIELD_EP_ATTR_MAX_RDMA_SIZE flag is
* on the size of an RDMA DTO. For InfiniBand, this parameter is
* validated in the implementation of the dapls_ib_qp_modify()
* function.
*/
/* LINTED: E_NOP_IF_STMT */
if (ep_param_mask & DAT_EP_FIELD_EP_ATTR_QOS) {
/* Do nothing, not defined in the spec yet */
}
if (dat_status != DAT_SUCCESS) {
goto bail;
} else {
}
}
if (dat_status != DAT_SUCCESS) {
goto bail;
} else {
}
}
(ep_attr_request.max_recv_dtos > 0))) {
goto bail;
} else {
}
}
(ep_attr_request.max_request_dtos > 0))) {
goto bail;
} else {
}
}
goto bail;
} else {
}
}
goto bail;
} else {
}
}
*ep_attr_ptr = ep_attr;
bail:
return (dat_status);
}