9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * CDDL HEADER START
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The contents of this file are subject to the terms of the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Common Development and Distribution License (the "License").
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * You may not use this file except in compliance with the License.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * See the License for the specific language governing permissions
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * and limitations under the License.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * When distributing Covered Code, include this CDDL HEADER in each
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * If applicable, add the following below this CDDL HEADER, with the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * fields enclosed by brackets "[]" replaced with your own identifying
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * information: Portions Copyright [yyyy] [name of copyright owner]
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * CDDL HEADER END
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Use is subject to license terms.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * PURPOSE: implements QP callbacks from verbs
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * $Id: dapl_evd_qp_async_error_callb.c,v 1.17 2003/07/31 13:55:18 hobie16 Exp $
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * dapl_evd_qp_async_error_callback
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The callback function registered with verbs for qp async erros
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * ib_cm_handle,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * ib_cm_event
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * context (evd)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * This is an affiliated error and hence should be able to
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * supply us with exact information on the error type and QP.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * However the Mellanox and IBM APIs for registering this callback
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * are different.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The IBM API allows consumers to register the callback with
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * ib_int32_t
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * ib_set_qp_async_error_eh_us (
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * ib_hca_handle_t hca_handle,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * ib_qp_async_handler_t handler )
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Notice that this function does not take a context. The context is
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * specified per QP in the call to ib_qp_create_us().
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * In contrast the Mellanox API requires that the context be specified
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * when the funciton is registered:
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * VAPI_ret_t
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * VAPI_set_async_event_handler (
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * IN VAPI_hca_hndl_t hca_hndl,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * IN VAPI_async_event_handler_t handler,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * IN void* private_data )
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Therefore we always specify the context as the asyncronous EVD
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * to be compatible with both APIs.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor async_evd = (DAPL_EVD *) ia_ptr->async_error_evd;
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor dapl_dbg_log(DAPL_DBG_TYPE_CALLBACK | DAPL_DBG_TYPE_EXCEPTION,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor "--> dapl_evd_qp_async_error_callback: ep %p qp %p (%x) state %d\n",
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Transition to ERROR if we are connected; other states need to
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * complete first (e.g. pending states)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor if (ep_ptr->param.ep_state == DAT_EP_STATE_CONNECTED) {
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor dat_status = dapls_ib_get_async_event(cause_ptr, &async_event);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * If dapls_ib_get_async_event is not successful,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * an event has been generated by the provide that
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * we are not interested in.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor (void) dapls_evd_post_async_error_event(async_evd,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor dapl_dbg_log(DAPL_DBG_TYPE_CALLBACK | DAPL_DBG_TYPE_EXCEPTION,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor "dapl_evd_qp_async_error_callback () returns\n");
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Local variables:
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * c-indent-level: 4
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * c-basic-offset: 4
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * tab-width: 8