Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

vipl_priv_handles.c File Reference

#include <unistd.h>
#include <stdlib.h>
#include "vipl_priv.h"

Go to the source code of this file.

Functions

VIP_RETURN vip_init_handle_set (VIP_HANDLE_SET *set_ptr, VIP_UINT32 handle_size, VIP_UINT32 max_count, VIP_UINT32 magic_number)
VIP_HANDLEvip_allocate_handle (VIP_HANDLE_SET *set_ptr)
void vip_free_handle (VIP_HANDLE_SET *set_ptr, VIP_HANDLE *handle_ptr)
void vip_destroy_conn_handle_set (VIP_HANDLE_SET *set_ptr)
void vip_destroy_vi_handle_set (VIP_HANDLE_SET *set_ptr)
void vip_destroy_cq_handle_set (VIP_HANDLE_SET *set_ptr)
void vip_destroy_mem_handle_set (VIP_HANDLE_SET *set_ptr)
void vip_destroy_ptag_handle_set (VIP_HANDLE_SET *set_ptr)
VIP_BOOLEAN vip_is_conn_notified (VIP_PVOID ptr)
VIP_BOOLEAN vip_is_first_desc_notified (VIP_PVOID ptr)
VIP_BOOLEAN vip_is_first_cq_entry_notified (VIP_PVOID ptr)
void * vip_send_notify_thread (void *arg)
void * vip_recv_notify_thread (void *arg)
void * vip_cq_notify_thread (void *arg)


Detailed Description

This file contains various internal functions used to manage handle sets and handle checking.

Definition in file vipl_priv_handles.c.


Function Documentation

VIP_RETURN vip_init_handle_set VIP_HANDLE_SET set_ptr,
VIP_UINT32  handle_size,
VIP_UINT32  max_count,
VIP_UINT32  magic_number
 

This function initializes a handle set. It sets up a GM lookaside list to efficiently allocate the handles, and sets the maximum size of the collection.

Return values:
VIP_INVALID_PARAMETER One of the parameters was invalid.
VIP_ERROR_RESOURCE The handle set allocation failed due to lack of ressources, mainly memory.
VIP_SUCCESS The handle set has been initialized.
Parameters:
set_ptr (IN) The pointer to the handle set that needs to be initialized.
handle_size (IN) The size of the handles composing the future collection.
max_count (IN) The maximum number of handles that the collection will support.
magic_number (IN) The magic number associated to this collection.
See also:
vip_allocate_handle vip_free_handle vip_destroy_handle_set
Author:
Patrick Geoffray
Version:
1.0

Definition at line 55 of file vipl_priv_handles.c.

References VIP_HANDLE_SET::count, VIP_HANDLE_SET::cur_seq_num, VIP_HANDLE_SET::head, VIP_HANDLE_SET::lookaside, VIP_HANDLE_SET::max_count, VIP_HANDLE_SET::set_magic, VIP_HANDLE_SET::tail, VIP_CONN_MAGIC, VIP_CQ_MAGIC, VIP_DEBUG, VIP_DEBUG_LABEL, VIP_ERROR_RESOURCE, VIP_INVALID_PARAMETER, VIP_MEM_MAGIC, VIP_PTAG_MAGIC, VIP_SUCCESS, and VIP_VI_MAGIC.

Referenced by VipOpenNic().

VIP_HANDLE* vip_allocate_handle VIP_HANDLE_SET set_ptr  ) 
 

This function allocates a handle from an initialized handle set. It allocates an entry in the associated GM lookaside list, initializes it, and inserts it at the end of the integrated doubly-linked list.

Returns:
The pointer to the allocated handle.
Parameters:
set_ptr (IN) The pointer to the handle set from which to allocate the handle.
See also:
vip_init_handle_set vip_free_handle vip_destroy_handle_set
Author:
Patrick Geoffray
Version:
1.0

Definition at line 127 of file vipl_priv_handles.c.

References VIP_HANDLE_SET::count, VIP_HANDLE_SET::cur_seq_num, VIP_HANDLE_SET::head, VIP_NIC::lock, VIP_HANDLE_SET::lookaside, VIP_HANDLE::magic, VIP_HANDLE_SET::max_count, VIP_HANDLE::next, VIP_HANDLE::prev, VIP_HANDLE::ref_count, VIP_HANDLE::seq_num, VIP_HANDLE_SET::set_magic, VIP_HANDLE_SET::tail, VIP_ASSERT, VIP_ASSERT_MUTEX_LOCKED, VIP_DEBUG, VIP_DEBUG_LABEL, VIP_HANDLE::vip_nic_ptr, and VIP_HANDLE_SET::vip_nic_ptr.

Referenced by VipConnectPeerRequest(), VipConnectRequest(), VipConnectWait(), VipCreateCQ(), VipCreatePtag(), VipCreateVi(), and VipRegisterMem().

void vip_free_handle VIP_HANDLE_SET set_ptr,
VIP_HANDLE handle_ptr
 

This function frees a previously allocated handle from a handle set. It first disables the handle, then removes it from the doubly-linked list and finally releases it from the GM lookaside.

Parameters:
set_ptr (IN) The pointer to the handle set from which to allocate the handle.
handle_ptr (IN) The pointer to the handle to free.
See also:
vip_init_handle_set vip_free_handle vip_destroy_handle_set
Author:
Patrick Geoffray
Version:
1.0

Definition at line 199 of file vipl_priv_handles.c.

References VIP_HANDLE_SET::count, VIP_HANDLE_SET::head, VIP_NIC::lock, VIP_HANDLE::magic, VIP_HANDLE::next, VIP_HANDLE::prev, VIP_HANDLE::ref_count, VIP_HANDLE_SET::tail, VIP_ASSERT, VIP_ASSERT_MUTEX_LOCKED, VIP_DEBUG, VIP_DEBUG_LABEL, VIP_HANDLE::vip_nic_ptr, and VIP_HANDLE_SET::vip_nic_ptr.

Referenced by vip_destroy_conn_handle_set(), vip_destroy_cq_handle_set(), vip_destroy_mem_handle_set(), vip_destroy_ptag_handle_set(), vip_destroy_vi_handle_set(), VipConnectAccept(), VipConnectPeerDone(), VipConnectPeerRequest(), VipConnectPeerWait(), VipConnectReject(), VipConnectRequest(), VipConnectWait(), VipCreateCQ(), VipDeregisterMem(), VipDestroyCQ(), VipDestroyPtag(), VipDestroyVi(), VipDisconnect(), and VipRegisterMem().

void vip_destroy_conn_handle_set VIP_HANDLE_SET set_ptr  ) 
 

This function destroys a previously initialized CONN handle set. For each entry in the set, it locks the handle, eventually wakes up all processes waiting for it and calls vip_free_handle(). It then destroys the GM lookaside list and all collateral structures.

Parameters:
set_ptr (IN) The pointer to the handle set to destroy.
See also:
vip_init_handle_set vip_allocate_handle vip_free_handle
Author:
Patrick Geoffray
Version:
1.0

Definition at line 251 of file vipl_priv_handles.c.

References VIP_HANDLE_SET::count, VIP_CONN::event, VIP_CONN::handle, VIP_HANDLE_SET::head, VIP_NIC::lock, VIP_HANDLE_SET::lookaside, VIP_HANDLE_SET::max_count, VIP_HANDLE::ref_count, VIP_HANDLE_SET::set_magic, VIP_HANDLE_SET::tail, VIP_ABORT, VIP_ASSERT, VIP_ASSERT_MUTEX_LOCKED, VIP_CONN_MAGIC, VIP_DEBUG, VIP_DEBUG_LABEL, VIP_EVENT_SIGNAL, vip_free_handle(), vip_millisleep(), VIP_MUTEX_LOCK, VIP_MUTEX_UNLOCK, and VIP_HANDLE_SET::vip_nic_ptr.

Referenced by VipCloseNic().

void vip_destroy_vi_handle_set VIP_HANDLE_SET set_ptr  ) 
 

This function destroys a previously initialized VI handle set. For each entry in the set, it locks the handle, eventually wakes up all processes waiting for it and calls vip_free_handle(). It then destroys the GM lookaside list and all collateral structures.

Parameters:
set_ptr (IN) The pointer to the handle set to destroy.
See also:
vip_init_handle_set vip_allocate_handle vip_free_handle
Author:
Patrick Geoffray
Version:
1.0

Definition at line 316 of file vipl_priv_handles.c.

References VIP_HANDLE_SET::count, VIP_VI_QUEUE::event, VIP_PTAG::handle, VIP_CQ::handle, VIP_VI::handle, VIP_HANDLE_SET::head, VIP_NIC::lock, VIP_HANDLE_SET::lookaside, VIP_HANDLE_SET::max_count, VIP_VI::recv_queue, VIP_HANDLE::ref_count, VIP_VI::send_queue, VIP_HANDLE_SET::set_magic, VIP_HANDLE_SET::tail, VIP_ABORT, VIP_ASSERT, VIP_ASSERT_MUTEX_LOCKED, VIP_VI_QUEUE::vip_cq_ptr, VIP_DEBUG, VIP_DEBUG_LABEL, VIP_EVENT_SIGNAL, vip_free_handle(), vip_millisleep(), VIP_MUTEX_LOCK, VIP_MUTEX_UNLOCK, VIP_HANDLE_SET::vip_nic_ptr, VIP_VI::vip_ptag_ptr, and VIP_VI_MAGIC.

Referenced by VipCloseNic(), and VipOpenNic().

void vip_destroy_cq_handle_set VIP_HANDLE_SET set_ptr  ) 
 

This function destroys a previously initialized CQ handle set. For each entry in the set, it locks the handle, eventually wakes up all processes waiting for it and calls vip_free_handle(). It then destroys the GM lookaside list and all collateral structures.

Parameters:
set_ptr (IN) The pointer to the handle set to destroy.
See also:
vip_init_handle_set vip_allocate_handle vip_free_handle
Author:
Patrick Geoffray
Version:
1.0

Definition at line 398 of file vipl_priv_handles.c.

References VIP_HANDLE_SET::count, VIP_CQ::event, VIP_CQ::handle, VIP_HANDLE_SET::head, VIP_NIC::lock, VIP_HANDLE_SET::lookaside, VIP_HANDLE_SET::max_count, VIP_HANDLE::ref_count, VIP_HANDLE_SET::set_magic, VIP_HANDLE_SET::tail, VIP_ABORT, VIP_ASSERT, VIP_ASSERT_MUTEX_LOCKED, VIP_CQ_MAGIC, VIP_DEBUG, VIP_DEBUG_LABEL, VIP_EVENT_SIGNAL, vip_free_handle(), vip_millisleep(), VIP_MUTEX_LOCK, VIP_MUTEX_UNLOCK, and VIP_HANDLE_SET::vip_nic_ptr.

Referenced by VipCloseNic(), and VipOpenNic().

void vip_destroy_mem_handle_set VIP_HANDLE_SET set_ptr  ) 
 

This function destroys a previously initialized MEM handle set. For each entry in the set, it locks the handle, eventually wakes up all processes waiting for it and calls vip_free_handle(). It then destroys the GM lookaside list and all collateral structures.

Parameters:
set_ptr (IN) The pointer to the handle set to destroy.
See also:
vip_init_handle_set vip_allocate_handle vip_free_handle
Author:
Patrick Geoffray
Version:
1.0

Definition at line 464 of file vipl_priv_handles.c.

References VIP_HANDLE_SET::count, VIP_HANDLE_SET::head, VIP_NIC::lock, VIP_HANDLE_SET::lookaside, VIP_HANDLE_SET::max_count, VIP_HANDLE::ref_count, VIP_HANDLE_SET::set_magic, VIP_HANDLE_SET::tail, VIP_ABORT, VIP_ASSERT, VIP_ASSERT_MUTEX_LOCKED, VIP_DEBUG, VIP_DEBUG_LABEL, vip_free_handle(), VIP_MEM_MAGIC, and VIP_HANDLE_SET::vip_nic_ptr.

Referenced by VipCloseNic(), and VipOpenNic().

void vip_destroy_ptag_handle_set VIP_HANDLE_SET set_ptr  ) 
 

This function destroys a previously initialized PTAG handle set. For each entry in the set, it locks the handle, eventually wakes up all processes waiting for it and calls vip_free_handle(). It then destroys the GM lookaside list and all collateral structures.

Parameters:
set_ptr (IN) The pointer to the handle set to destroy.
See also:
vip_init_handle_set vip_allocate_handle vip_free_handle
Author:
Patrick Geoffray
Version:
1.0

Definition at line 515 of file vipl_priv_handles.c.

References VIP_HANDLE_SET::count, VIP_HANDLE_SET::head, VIP_NIC::lock, VIP_HANDLE_SET::lookaside, VIP_HANDLE_SET::max_count, VIP_HANDLE::ref_count, VIP_HANDLE_SET::set_magic, VIP_HANDLE_SET::tail, VIP_ABORT, VIP_ASSERT, VIP_ASSERT_MUTEX_LOCKED, VIP_DEBUG, VIP_DEBUG_LABEL, vip_free_handle(), VIP_HANDLE_SET::vip_nic_ptr, and VIP_PTAG_MAGIC.

Referenced by VipCloseNic(), and VipOpenNic().

VIP_BOOLEAN vip_is_conn_notified VIP_PVOID  ptr  ) 
 

This function checks if a connection handle has received an event.

Return values:
VIP_TRUE The Connection has been notified of an event.
VIP_FALSE The Connection has not been notified of an event.
Parameters:
ptr (IN) The pointer to the Connection handle.
Author:
Patrick Geoffray
Version:
1.0

Definition at line 560 of file vipl_priv_handles.c.

References VIP_CONN::status, VIP_FALSE, VIP_NOT_DONE, and VIP_TRUE.

Referenced by VipConnectAccept(), VipConnectPeerWait(), VipConnectRequest(), and VipConnectWait().

VIP_BOOLEAN vip_is_first_desc_notified VIP_PVOID  ptr  ) 
 

This function checks if the first descriptor of a VI queue has received an event.

Return values:
VIP_TRUE The first descriptor of the VI queue has been notified of an event.
VIP_FALSE The first descriptor of the VI queue has not been notified of an event.
Parameters:
ptr (IN) The pointer to the VI queue.
Author:
Patrick Geoffray
Version:
1.0

Definition at line 592 of file vipl_priv_handles.c.

References VIP_DESCRIPTOR::CS, VIP_VI_QUEUE::first, VIP_CONTROL_SEGMENT::Status, VIP_FALSE, VIP_STATUS_DONE, and VIP_TRUE.

Referenced by VipRecvWait(), and VipSendWait().

VIP_BOOLEAN vip_is_first_cq_entry_notified VIP_PVOID  ptr  ) 
 

This function checks if the next entry in the completion queue has received an event.

Return values:
VIP_TRUE The next entry in the completion queue has been notified of an event.
VIP_FALSE The next entry in the completion queue has not been notified of an event.
Parameters:
ptr (IN) The pointer to the Completion Queue.
Author:
Patrick Geoffray
Version:
1.0

Definition at line 624 of file vipl_priv_handles.c.

References VIP_CQ::next_poll, VIP_CQ::queue, VIP_FALSE, and VIP_TRUE.

Referenced by VipCQWait().

void* vip_send_notify_thread void *  arg  ) 
 

This thread waits for send notify handles to be added to the list and then wait for the first send descriptor to complete. It then executes the send notify handler. If the send queue becomes empty, it will process the notify handler with a null descriptor.

Parameters:
arg (IN) The pointer to the VI.
See also:
VipSendNotify VipSendWait
Author:
Patrick Geoffray
Version:
1.0

Definition at line 656 of file vipl_priv_handles.c.

References VIP_NOTIFY::context, VIP_VI::handle, VIP_NOTIFY::handler, VIP_NIC::lock, VIP_GM::lock, VIP_NOTIFY::next, VIP_VI_QUEUE::notify_cancelled, VIP_VI_QUEUE::notify_tokens, VIP_VI::send_queue, VIP_ABORT, VIP_ASSERT, VIP_DEBUG, VIP_DEBUG_LABEL, VIP_DESCRIPTOR_ERROR, VIP_NIC::vip_gm_ptr, VIP_INFINITE, VIP_MUTEX_LOCK, VIP_MUTEX_UNLOCK, VIP_HANDLE::vip_nic_ptr, VIP_SEMAPHORE_WAIT, VIP_SUCCESS, VIP_THREAD_EXIT, VIP_TRUE, and VipSendWait().

Referenced by VipSendNotify().

void* vip_recv_notify_thread void *  arg  ) 
 

This thread waits for receive notify handles to be added to the list and then wait for the first receive descriptor to complete. It then executes the receive notify handler. If the receive queue becomes empty, it will process the notify handler with a null descriptor.

Parameters:
arg (IN) The pointer to the VI.
See also:
VipRecvNotify VipWaitRecv
Author:
Patrick Geoffray
Version:
1.0

Definition at line 743 of file vipl_priv_handles.c.

References VIP_NOTIFY::context, VIP_VI::handle, VIP_NOTIFY::handler, VIP_NIC::lock, VIP_GM::lock, VIP_NOTIFY::next, VIP_VI_QUEUE::notify_cancelled, VIP_VI_QUEUE::notify_tokens, VIP_VI::recv_queue, VIP_ABORT, VIP_ASSERT, VIP_DEBUG, VIP_DEBUG_LABEL, VIP_DESCRIPTOR_ERROR, VIP_NIC::vip_gm_ptr, VIP_INFINITE, VIP_MUTEX_LOCK, VIP_MUTEX_UNLOCK, VIP_HANDLE::vip_nic_ptr, VIP_SEMAPHORE_WAIT, VIP_SUCCESS, VIP_THREAD_EXIT, VIP_TRUE, and VipRecvWait().

Referenced by VipRecvNotify().

void* vip_cq_notify_thread void *  arg  ) 
 

This thread waits for receive notify handles to be added to the list and then wait for the first CQ entry to complete. It then executes the CQ notify handler. If the CQ becomes empty, it will process the notify handler with a null descriptor.

Parameters:
arg (IN) The pointer to the Completion Queue (CQ).
See also:
VipCQNotify VipCQWait
Author:
Patrick Geoffray
Version:
1.0

Definition at line 830 of file vipl_priv_handles.c.

References VIP_NOTIFY::context, VIP_CQ::handle, VIP_NOTIFY::handler, VIP_NIC::lock, VIP_GM::lock, VIP_NOTIFY::next, VIP_CQ::notify_cancelled, VIP_CQ::notify_tokens, VIP_ABORT, VIP_ASSERT, VIP_DEBUG, VIP_DEBUG_LABEL, VIP_NIC::vip_gm_ptr, VIP_INFINITE, VIP_MUTEX_LOCK, VIP_MUTEX_UNLOCK, VIP_HANDLE::vip_nic_ptr, VIP_SEMAPHORE_WAIT, VIP_SUCCESS, VIP_THREAD_EXIT, VIP_TRUE, and VipCQWait().

Referenced by VipCQNotify().

VI-GM-1.3 by Myricom © 1997-2006. Documentation generated on 20 May 2006 by doxygen 1.4.4.