/*
* 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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
*
* MODULE: dapl_evd_wait.c
*
* PURPOSE: EVENT management
*
* Description: Interfaces in this file are completely defined in
* the uDAPL 1.1 API specification
*
* $Id: dapl_evd_wait.c,v 1.22 2003/08/20 13:18:36 sjs2 Exp $
*/
#include "dapl.h"
#include "dapl_evd_util.h"
#include "dapl_ring_buffer_util.h"
#include "dapl_adapter_util.h"
/*
* dapl_evd_wait
*
* UDAPL Requirements Version xxx,
*
* Wait, up to specified timeout, for notification event on EVD.
* Then return first available event.
*
* Input:
* evd_handle
* timeout
*
* Output:
* event
*
* Returns:
* DAT_SUCCESS
* DAT_INVALID_PARAMETER
* DAT_INVALID_STATE
*/
{
"dapl_evd_wait (%p, %d, %d, %p, %p)\n",
nmore);
/*
* We return directly rather than bailing because
* bailing attempts to update the evd, and we don't have
* one.
*/
goto bail;
}
if (!event) {
goto bail;
}
if (!nmore) {
goto bail;
}
if (threshold <= 0 ||
(threshold > 1 &&
goto bail;
}
if (evd_ptr->catastrophic_overflow) {
goto bail;
}
"dapl_evd_wait: EVD %p, CQ %p\n",
(void *)evd_ptr->ib_cq_handle);
/*
* Make sure there are no other waiters and the evd is active.
* Currently this means only the OPEN state is allowed.
* We need to take a lock to synchronize with dapl_evd_dequeue().
*/
goto bail;
}
/*
* We now own the EVD, we don't have the lock anymore,
* because we're in the WAITED state.
*/
/* return pending events immediately without further polling */
} else {
goto bail;
}
if (!evd_ptr->evd_waitable) {
/* See if we were awakened by evd_set_unwaitable */
goto bail;
}
}
}
if (dat_status == DAT_SUCCESS) {
*event = *local_event;
}
/*
* Valid if dat_status == DAT_SUCCESS || dat_status == DAT_TIMEOUT
* Undefined otherwise, so ok to set it.
*/
bail:
"dapl_evd_wait () returns 0x%x\n",
return (dat_status);
}