xref: /titanic_44/usr/src/lib/udapl/udapl_tavor/common/dapl_evd_un_async_error_callb.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 2004 Sun Microsystems, Inc.  All rights reserved.
28  * Use is subject to license terms.
29  */
30 
31 /*
32  *
33  * MODULE: dapl_evd_un_async_error_callback.c
34  *
35  * PURPOSE: implements Unaffiliated callbacks from verbs
36  *
37  * $Id: dapl_evd_un_async_error_callb.c,v 1.9 2003/07/31 13:55:18 hobie16 Exp $
38  */
39 
40 #include "dapl.h"
41 #include "dapl_evd_util.h"
42 #include "dapl_adapter_util.h"
43 
44 /*
45  * dapl_evd_un_async_error_callback
46  *
47  * The callback function registered with verbs for unaffiliated async errors
48  *
49  * Input:
50  * 	ib_cm_handle,
51  * 	ib_cm_event
52  * 	cause_ptr
53  * 	context (evd)
54  *
55  * Output:
56  * 	None
57  *
58  */
59 
60 void
dapl_evd_un_async_error_callback(IN ib_hca_handle_t ib_hca_handle,IN ib_error_record_t * cause_ptr,IN void * context)61 dapl_evd_un_async_error_callback(
62 	IN	ib_hca_handle_t		ib_hca_handle,
63 	IN	ib_error_record_t	*cause_ptr,
64 	IN	void			*context)
65 {
66 	DAPL_EVD		*async_evd;
67 	DAT_EVENT_NUMBER	async_event;
68 	DAT_RETURN		dat_status;
69 
70 	dapl_dbg_log(DAPL_DBG_TYPE_CALLBACK | DAPL_DBG_TYPE_EXCEPTION,
71 	    "dapl_evd_un_async_error_callback (%p, %p, %p)\n",
72 	    ib_hca_handle,
73 	    cause_ptr,
74 	    context);
75 
76 	if (NULL == context) {
77 		dapl_os_assert(!"NULL == context\n");
78 		return;
79 	}
80 
81 	async_evd = (DAPL_EVD *) context;
82 
83 	dat_status = dapls_ib_get_async_event(cause_ptr, &async_event);
84 
85 	if (dat_status == DAT_SUCCESS) {
86 		/*
87 		 * If dapls_ib_get_async_event is not successful,
88 		 * an event has been generated by the provider that
89 		 * we are not interested in. E.g. LINK_UP.
90 		 */
91 		(void) dapls_evd_post_async_error_event(async_evd,
92 		    async_event,
93 		    async_evd->header.owner_ia);
94 	}
95 	dapl_dbg_log(DAPL_DBG_TYPE_CALLBACK | DAPL_DBG_TYPE_EXCEPTION,
96 	    "dapl_evd_un_async_error_callback () returns\n");
97 }
98