2N/A/*
2N/A * CDDL HEADER START
2N/A *
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 *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
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 *
2N/A * CDDL HEADER END
2N/A */
2N/A
2N/A/*
2N/A * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.
2N/A */
2N/A
2N/A/*
2N/A * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A/*
2N/A *
2N/A * MODULE: dapl_evd_qp_async_error_callback.c
2N/A *
2N/A * PURPOSE: implements QP callbacks from verbs
2N/A *
2N/A * $Id: dapl_evd_qp_async_error_callb.c,v 1.17 2003/07/31 13:55:18 hobie16 Exp $
2N/A */
2N/A
2N/A#include "dapl.h"
2N/A#include "dapl_evd_util.h"
2N/A#include "dapl_adapter_util.h"
2N/A
2N/A/*
2N/A * dapl_evd_qp_async_error_callback
2N/A *
2N/A * The callback function registered with verbs for qp async erros
2N/A *
2N/A * Input:
2N/A * ib_cm_handle,
2N/A * ib_cm_event
2N/A * cause_ptr
2N/A * context (evd)
2N/A *
2N/A * Output:
2N/A * None
2N/A *
2N/A */
2N/A
2N/Avoid
2N/Adapl_evd_qp_async_error_callback(
2N/A IN ib_hca_handle_t ib_hca_handle,
2N/A IN ib_qp_handle_t ib_qp_handle,
2N/A IN ib_error_record_t *cause_ptr,
2N/A IN void *context) /* ARGSUSED */
2N/A
2N/A{
2N/A /*
2N/A * This is an affiliated error and hence should be able to
2N/A * supply us with exact information on the error type and QP.
2N/A *
2N/A * However the Mellanox and IBM APIs for registering this callback
2N/A * are different.
2N/A *
2N/A * The IBM API allows consumers to register the callback with
2N/A *
2N/A * ib_int32_t
2N/A * ib_set_qp_async_error_eh_us (
2N/A * ib_hca_handle_t hca_handle,
2N/A * ib_qp_async_handler_t handler )
2N/A *
2N/A * Notice that this function does not take a context. The context is
2N/A * specified per QP in the call to ib_qp_create_us().
2N/A *
2N/A * In contrast the Mellanox API requires that the context be specified
2N/A * when the funciton is registered:
2N/A *
2N/A * VAPI_ret_t
2N/A * VAPI_set_async_event_handler (
2N/A * IN VAPI_hca_hndl_t hca_hndl,
2N/A * IN VAPI_async_event_handler_t handler,
2N/A * IN void* private_data )
2N/A *
2N/A * Therefore we always specify the context as the asyncronous EVD
2N/A * to be compatible with both APIs.
2N/A */
2N/A
2N/A DAPL_IA *ia_ptr;
2N/A DAPL_EP *ep_ptr;
2N/A DAPL_EVD *async_evd;
2N/A DAT_EVENT_NUMBER async_event;
2N/A DAT_RETURN dat_status;
2N/A
2N/A ep_ptr = (DAPL_EP *) context;
2N/A ia_ptr = ep_ptr->header.owner_ia;
2N/A async_evd = (DAPL_EVD *) ia_ptr->async_error_evd;
2N/A
2N/A dapl_dbg_log(DAPL_DBG_TYPE_CALLBACK | DAPL_DBG_TYPE_EXCEPTION,
2N/A "--> dapl_evd_qp_async_error_callback: ep %p qp %p (%x) state %d\n",
2N/A ep_ptr,
2N/A ep_ptr->qp_handle,
2N/A ep_ptr->qpn,
2N/A ep_ptr->param.ep_state);
2N/A
2N/A /*
2N/A * Transition to ERROR if we are connected; other states need to
2N/A * complete first (e.g. pending states)
2N/A */
2N/A if (ep_ptr->param.ep_state == DAT_EP_STATE_CONNECTED) {
2N/A ep_ptr->param.ep_state = DAT_EP_STATE_ERROR;
2N/A }
2N/A
2N/A dapl_os_assert(async_evd != NULL);
2N/A
2N/A dat_status = dapls_ib_get_async_event(cause_ptr, &async_event);
2N/A if (dat_status == DAT_SUCCESS) {
2N/A /*
2N/A * If dapls_ib_get_async_event is not successful,
2N/A * an event has been generated by the provide that
2N/A * we are not interested in.
2N/A */
2N/A (void) dapls_evd_post_async_error_event(async_evd,
2N/A async_event,
2N/A async_evd->header.owner_ia);
2N/A }
2N/A dapl_dbg_log(DAPL_DBG_TYPE_CALLBACK | DAPL_DBG_TYPE_EXCEPTION,
2N/A "dapl_evd_qp_async_error_callback () returns\n");
2N/A}
2N/A
2N/A/*
2N/A * Local variables:
2N/A * c-indent-level: 4
2N/A * c-basic-offset: 4
2N/A * tab-width: 8
2N/A * End:
2N/A */