/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
*
* MODULE: dapl_evd_dto_callback.c
*
* PURPOSE: implements DTO callbacks from verbs
*
* $Id: dapl_evd_dto_callb.c,v 1.17 2003/07/30 18:13:38 hobie16 Exp $
*/
#include "dapl.h"
#include "dapl_evd_util.h"
#include "dapl_cno_util.h"
#include "dapl_cookie.h"
#include "dapl_adapter_util.h"
/*
* dapl_evd_dto_callback
*
* Input:
* hca_handle_in,
* cq_handle_in,
* user_context_cq_p
*
* Output:
* none
*
* This is invoked for both DTO and MW bind completions. Strictly
* speaking it is an event callback rather than just a DTO callback.
*
*/
void
IN void *user_context)
{
"dapl_evd_dto_callback(%p, %p, %p)\n",
/* Read once. */
"-- dapl_evd_dto_callback: CQ %p, state %x\n",
(void *)evd_ptr->ib_cq_handle,
state);
/*
* This function does not dequeue from the CQ; only the consumer
* can do that. Instead, it wakes up waiters if any exist.
* It rearms the completion only if completions should always occur
* (specifically if a CNO is associated with the EVD and the
* EVD is enabled.
*/
if (state == DAPL_EVD_STATE_WAITED) {
/*
* If we could, it would be best to avoid this wakeup
* waiting for the waiter was its threshold. We don't
* currently have the ability to determine that without
* dequeueing the events, and we can't do that for
* synchronization reasons (racing with the waiter waking
* up and dequeuing, sparked by other callbacks).
*/
/*
* We don't need to worry about taking the lock for the
* wakeup because wakeups are sticky.
*/
} else if (state == DAPL_EVD_STATE_OPEN) {
/*
* Re-enable callback, *then* trigger.
* This guarantees we won't miss any events.
*/
if (DAT_SUCCESS != dat_status) {
(void) dapls_evd_post_async_error_event(
}
}
}
}
/*
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* tab-width: 8
* End:
*/