2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved. 2N/A * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A * PURPOSE: Endpoint management 2N/A * Description: Interfaces in this file are completely described in 2N/A * the DAPL 1.1 API, Chapter 6, section 5 2N/A * DAPL Requirements Version xxx, 6.5.7 2N/A * Request a connection be established between the local Endpoint 2N/A * side of a connection 2N/A * DAT_INSUFFICIENT_RESOUCRES 2N/A * DAT_INVALID_PARAMETER 2N/A * DAT_MODLE_NOT_SUPPORTED 2N/A "dapl_ep_connect (%p, {%u.%u.%u.%u}, %X, %d, %d, %p, %x, %x)\n",
2N/A * Verify parameter & state. The connection handle must be good 2N/A * If the endpoint needs a QP, associated the QP with it. 2N/A * This needs to be done carefully, in order to: 2N/A * * Avoid allocating under a lock. 2N/A * * Not step on data structures being altered by 2N/A * routines with which we are racing. 2N/A * * Confirm that a new QP is needed and is not forbidden by the 2N/A * * Allocate it into a separate EP. 2N/A * * Take the EP lock. 2N/A * * Reconfirm that the EP is in a state where it needs a QP. 2N/A * * Assign the QP and release the lock. 2N/A * PZ shouldn't have changed since we're only racing with 2N/A /* Bail, cleaning up. */ 2N/A "ep_connect: ib_qp_free failed with %x\n",
2N/A * We do state checks and transitions under lock. 2N/A * The only code we're racing against is dapl_cr_accept. 2N/A * Verify the attributes of the EP handle before we connect it. Test 2N/A * all of the handles to make sure they are currently valid. 2N/A * pz_handle required 2N/A * recv_evd_handle optional, but must be valid 2N/A * request_evd_handle optional, but must be valid 2N/A * connect_evd_handle required 2N/A * Check both the EP state and the QP state: if we don't have a QP 2N/A * we need to attach one now. 2N/A * At this point we only support one QOS level 2N/A * Verify the private data size doesn't exceed the max 2N/A * transition the state before requesting a connection to avoid 2N/A * At this point we're committed, and done with the endpoint 2N/A * except for the connect, so we can drop the lock. 2N/A * fill in the private data 2N/A /* Copy the connection qualifiers */ 2N/A /* Unreachable IP address */ 2N/A /* Non-existant connection qualifier */