xref: /titanic_50/usr/src/lib/udapl/udapl_tavor/common/dapl_cr_handoff.c (revision 9e39c5ba00a55fa05777cc94b148296af305e135)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.
24  */
25 
26 /*
27  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
28  * Use is subject to license terms.
29  */
30 
31 /*
32  *
33  * MODULE: dapl_cr_handoff.c
34  *
35  * PURPOSE: Connection management
36  * Description: Interfaces in this file are completely described in
37  *		the DAPL 1.1 API, Chapter 6, section 4
38  *
39  * $Id: dapl_cr_handoff.c,v 1.4 2003/06/16 17:53:32 sjs2 Exp $
40  */
41 
42 #include "dapl.h"
43 #include "dapl_cr_util.h"
44 #include "dapl_sp_util.h"
45 #include "dapl_adapter_util.h"
46 
47 /*
48  * dapl_cr_handoff
49  *
50  * DAPL Requirements Version xxx, 6.4.2.4
51  *
52  * Hand the connection request to another Sevice pont specified by the
53  * Connectin Qualifier.
54  *
55  * Input:
56  *	cr_handle
57  *	cr_handoff
58  *
59  * Output:
60  *	none
61  *
62  * Returns:
63  *	DAT_SUCCESS
64  *	DAT_INVALID_HANDLE
65  *	DAT_INVALID_PARAMETER
66  */
67 
68 DAT_RETURN
dapl_cr_handoff(IN DAT_CR_HANDLE cr_handle,IN DAT_CONN_QUAL cr_handoff)69 dapl_cr_handoff(
70 	IN DAT_CR_HANDLE cr_handle,
71 	IN DAT_CONN_QUAL cr_handoff)		/* handoff */
72 {
73 	DAPL_CR *cr_ptr;
74 	DAT_RETURN dat_status;
75 
76 	if (DAPL_BAD_HANDLE(cr_handle, DAPL_MAGIC_CR)) {
77 		return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_CR));
78 	}
79 
80 	cr_ptr = (DAPL_CR *)cr_handle;
81 	dat_status = dapls_ib_handoff_connection(cr_ptr, cr_handoff);
82 
83 	/* Remove the CR from the queue, then free it */
84 	dapl_sp_remove_cr(cr_ptr->sp_ptr, cr_ptr);
85 	dapls_cr_free(cr_ptr);
86 
87 	return (dat_status);
88 }
89