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

vipl_priv.c File Reference

#include <unistd.h>
#include <sys/time.h>
#include <syslog.h>
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include "vipl_priv.h"

Go to the source code of this file.

Functions

VIP_UINT64 vip_addr2addrbits (VIP_PVOID Address)
VIP_PVOID vip_addrbits2addr (VIP_UINT64 AddressBits)
VIP_ENTRY_POINT void vip_millisleep (unsigned int milliseconds)
VIP_ENTRY_POINT int vip_gettimeofday (struct timeval *tv, void *p)
VIP_ENTRY_POINT int vip_gethostname (char *name, size_t len)
VIP_ENTRY_POINT void vip_notice (char *msg,...)
VIP_ENTRY_POINT char * vip_vsprintf (const char *msg,...)
void vip_debug (const char *function_name, const char *file, VIP_UINT32 line, const char *msg,...)
void vip_debug_gm (const char *function_name, const char *file, VIP_UINT32 line, gm_status_t gm_status, const char *msg,...)
void vi_gm_debug_checksum_compute (VIP_CHKSUM *cksum_ptr, void *ptr, VIP_UINT32 len)
void vi_gm_debug_checksum_check (VIP_UCHAR *msg, void *buf, VIP_CHKSUM *chksum_ptr)
void vi_gm_debug_checksum_copy (VIP_CHKSUM *cksum_target, VIP_CHKSUM *cksum_source)
VIP_RETURN vip_wait_for_notification (VIP_ULONG timeout, VIP_HANDLE *handle_ptr, VIP_EVENT_T *event_ptr, VIP_BOOLEAN(*check)(VIP_PVOID), VIP_PVOID context)
void vip_default_error_callback (VIP_PVOID Context, VIP_ERROR_DESCRIPTOR *ErrorDesc)
void vip_generate_async_error (VIP_NIC *vip_nic_ptr, VIP_VI *vip_vi_ptr, VIP_CQ *vip_cq_ptr, VIP_DESCRIPTOR *vip_desc_ptr, VIP_RESOURCE_CODE resource_code, VIP_ERROR_CODE error_code, VIP_UINT32 opcode)
void vip_notify_desc_completion (VIP_DESCRIPTOR *vip_desc_ptr, VIP_VI *vip_vi_ptr, VIP_BOOLEAN recv_queue)
void vip_vi_transition_to_error_state (VIP_VI *vip_vi_ptr, VIP_BOOLEAN send_conn_lost)
VIP_RETURN vip_check_memory_handle (VIP_NIC *vip_nic_ptr, VIP_MEM_HANDLE vip_mem_handle, VIP_UINT64 range_start, VIP_UINT64 range_length, VIP_UINT32 vip_vi_ptag_id)
void vip_alive_alarm_callback (void *ptr)
void vip_alive_sent_callback (struct gm_port *gm_port, void *context, gm_status_t status)
void vip_remove_conn_waiting_list (VIP_GM *vip_gm_ptr, VIP_CONN *vip_conn_ptr)
void vip_conn_peer_request_alarm_callback (void *ptr)
int vip_avl_compare_function (const void *a, const void *b, void *param)
void vip_avl_free_function (void *data, void *param)
VIP_UINT32 vip_avl_register_memory (VIP_GM *vip_gm_ptr, VIP_UINTPTR start, VIP_UINTPTR end)
VIP_RETURN vip_avl_deregister_memory (VIP_GM *vip_gm_ptr, VIP_UINTPTR start, VIP_UINTPTR end)

Variables

 VIP_MUTEX_ATTR
VIP_MUTEX_T vip_glob_lock = PTHREAD_MUTEX_INITIALIZER
VIP_MUTEX_T vip_gm_host_name_lock = PTHREAD_MUTEX_INITIALIZER
gm_lookaside * vip_glob_nic_lookaside = NULL
VIP_GMvip_glob_gm_ptrs [VI_GM_MAX_NICS] = { 0 }


Detailed Description

This file contains various internal functions used for debugging, handle set management, handle checking and GM low level interaction.

Definition in file vipl_priv.c.


Function Documentation

VIP_UINT64 vip_addr2addrbits VIP_PVOID  Address  ) 
 

This function converts a VIP_PVOID address type into a VIP_UINT64 address bits field coded on 64 bits.

Returns:
The address represented in a 64 bits integer.
Parameters:
Address (IN) The pointer containing the address to convert.
See also:
VIP_PVOID VIP_PVOID64 vip_addrbits2addr
Author:
Eugene Chun
Version:
1.0

Definition at line 75 of file vipl_priv.c.

References VIP_PVOID64::Address, and VIP_PVOID64::AddressBits.

Referenced by vip_handle_conn_req(), vip_send_conn_request(), VipConnectAccept(), VipConnectPeerRequest(), and VipConnectRequest().

VIP_PVOID vip_addrbits2addr VIP_UINT64  AddressBits  ) 
 

This function converts an address as a 64 bits integer into a pointer.

Returns:
The address in a pointer format.
Parameters:
AddressBits (IN) The integer containing the address to convert.
See also:
VIP_PVOID VIP_PVOID64 vip_addr2addrbits
Author:
Eugene Chun
Version:
1.0

Definition at line 99 of file vipl_priv.c.

References VIP_PVOID64::Address, and VIP_PVOID64::AddressBits.

Referenced by vip_handle_conn_accept(), vip_handle_conn_ack(), vip_handle_conn_list(), vip_handle_conn_nomatch(), vip_handle_conn_reject(), and vip_handle_conn_req().

VIP_ENTRY_POINT void vip_millisleep unsigned int  milliseconds  ) 
 

This function sleeps during a specified number of milliseconds.

Parameters:
milliseconds (IN) The number of milliseconds to sleep.
Author:
Eugene Chun
Version:
1.0

Definition at line 118 of file vipl_priv.c.

Referenced by main(), vip_destroy_conn_handle_set(), vip_destroy_cq_handle_set(), vip_destroy_vi_handle_set(), vip_vi_transition_to_error_state(), and VipDisconnect().

VIP_ENTRY_POINT int vip_gettimeofday struct timeval *  tv,
void *  p
 

This function returns the current time of the day.

Return values:
0 Success.
-1 Failure.
Parameters:
tv (IN) The structure used to get the current time.
p (IN) The timezone, should be NULL.
Author:
Eugene Chun
Version:
1.0

Definition at line 142 of file vipl_priv.c.

Referenced by vip_plumber_periodic(), vip_wait_for_notification(), and VipOpenNic().

VIP_ENTRY_POINT int vip_gethostname char *  name,
size_t  len
 

This function returns the current host name.

Return values:
0 Success.
-1 Failure.
Parameters:
name (IN) The string used to get the host name.
len (IN) The length to the allocated string.
Author:
Eugene Chun
Version:
1.0

Definition at line 173 of file vipl_priv.c.

VIP_ENTRY_POINT void vip_notice char *  msg,
  ...
 

This function formats a message with eventually multiple arguments and prints it to the standard error.

Parameters:
msg (IN) The message to format.
Author:
Eugene Chun
Version:
1.0

Definition at line 202 of file vipl_priv.c.

VIP_ENTRY_POINT char* vip_vsprintf const char *  msg,
  ...
 

This function formats a message with eventually multiple arguments and returns it in a allocated string.

Parameters:
msg (IN) The message to format.
Author:
Eugene Chun
Version:
1.0

Definition at line 223 of file vipl_priv.c.

void vip_debug const char *  function_name,
const char *  file,
VIP_UINT32  line,
const char *  msg,
  ...
 

This function prints debug information in a special format. The debug statement includes the name of the function producing the debug output, the thread id, the content of the message, the name of the file and the line number in the file.

The number of arguments for the message is variable and the output is directed to the stderr file descriptor.

Parameters:
function_name (IN) The name of the function producing the debug ouput.
file (IN) The name of the source file.
line (IN) The line number of the call in the source file.
msg (IN) The formatted debug statement.
See also:
vip_debug_gm
Author:
Patrick Geoffray
Version:
1.0

Definition at line 263 of file vipl_priv.c.

References VIP_ASSERT, and VIP_THREAD_SELF.

void vip_debug_gm const char *  function_name,
const char *  file,
VIP_UINT32  line,
gm_status_t  gm_status,
const char *  msg,
  ...
 

This function prints GM debug information in a special format. The debug statement includes the name of the function producing the debug output, the content of the message with the last GM status code, the name of the file and the line number in the file.

The number of arguments for the message is variable and the output is directed to the stderr file descriptor.

Parameters:
function_name (IN) The name of the function producing the debug ouput.
file (IN) The name of the source file.
line (IN) The line number of the call in the source file.
gm_status (IN) The status code returned by the failing GM call.
msg (IN) The formatted debug statement with the lastest GM return code about the GM error.
See also:
vip_debug
Author:
Patrick Geoffray
Version:
1.0

Definition at line 306 of file vipl_priv.c.

void vi_gm_debug_checksum_compute VIP_CHKSUM cksum_ptr,
void *  ptr,
VIP_UINT32  len
 

This function computes the CRC32 checksum of a memory area.

Parameters:
cksum_ptr (IN) The pointer to the checksum part of the packet.
ptr (IN) The pointer to the memory area.
len (IN) The length of the memory area.
Author:
Patrick Geoffray
Version:
1.0

Definition at line 332 of file vipl_priv.c.

References VIP_CHKSUM::len, and VIP_CHKSUM::sum.

Referenced by vi_gm_debug_checksum_check().

void vi_gm_debug_checksum_check VIP_UCHAR msg,
void *  buf,
VIP_CHKSUM chksum_ptr
 

This function computes the CRC32 checksum of a memory area and check it with a previuous value to detect data corruption.

Parameters:
msg (IN) The message to print in case of failure of the check.
buf (IN) The pointer to the data.
chksum_ptr (IN) The pointer to the checksum part of the packet.
Author:
Patrick Geoffray
Version:
1.0

Definition at line 353 of file vipl_priv.c.

References VIP_CHKSUM::len, VIP_CHKSUM::sum, vi_gm_debug_checksum_compute(), VIP_ABORT, and VIP_DEBUG_LABEL.

void vi_gm_debug_checksum_copy VIP_CHKSUM cksum_target,
VIP_CHKSUM cksum_source
 

This function copies the checksum part of one packet to another one.

Parameters:
cksum_target (IN) The pointer to the checksum part of the target packet.
cksum_source (IN) The pointer to the checksum part of the source packet.
Author:
Patrick Geoffray
Version:
1.0

Definition at line 380 of file vipl_priv.c.

References VIP_CHKSUM::len, and VIP_CHKSUM::sum.

VIP_RETURN vip_wait_for_notification VIP_ULONG  timeout,
VIP_HANDLE handle_ptr,
VIP_EVENT_T *  event_ptr,
VIP_BOOLEAN(*)(VIP_PVOID check,
VIP_PVOID  context
 

This function blocks until an event occurs, or the timeout expires, or the NIC has been destroyed during the waiting time.

Return values:
VIP_SUCCESS The event has been notified and is complete.
VIP_TIMEOUT The event has not been notified in the timeout.
VIP_INVALID_PARAMETER The NIC has been destroyed.
Parameters:
timeout (IN) Timeout value in microseconds.
handle_ptr (IN) The pointer to the generic handle subject to the event notification.
event_ptr (IN) The pointer to the abstracted condition variable.
check (IN) The function used to check if the event is complete.
context (IN) The parameter to the check function.
Author:
Patrick Geoffray
Version:
1.0

Definition at line 415 of file vipl_priv.c.

References VIP_GM::blocking_plumber_tokens, VIP_GM::lock, VIP_NIC::magic, VIP_HANDLE::ref_count, timespec::tv_nsec, timespec::tv_sec, VIP_ASSERT, VIP_ASSERT_MUTEX_LOCKED, VIP_DEBUG, VIP_DEBUG_LABEL, VIP_EVENT_WAIT, VIP_EVENT_WAIT_TIMEOUT, VIP_FALSE, vip_gettimeofday(), VIP_NIC::vip_gm_ptr, VIP_INFINITE, VIP_INVALID_PARAMETER, VIP_NIC_MAGIC, VIP_HANDLE::vip_nic_ptr, VIP_SEMAPHORE_POST, VIP_SEMAPHORE_WAIT, VIP_SUCCESS, and VIP_TIMEOUT.

Referenced by VipConnectAccept(), VipConnectPeerWait(), VipConnectRequest(), VipConnectWait(), VipCQWait(), VipRecvWait(), and VipSendWait().

void vip_default_error_callback VIP_PVOID  Context,
VIP_ERROR_DESCRIPTOR ErrorDesc
 

This function is the default error callback function. The VI specs require that a specific function is called for each error reported by the VI implementation. This default error handler just prints a description of the error to the system log. It can be dynamically replaced by the application.

Parameters:
Context (IN) A generic pointer passed to the error handler, not used by this default error callback.
ErrorDesc (IN) The pointer to error descriptor.
Author:
Patrick Geoffray
Version:
1.0

Definition at line 526 of file vipl_priv.c.

References VIP_ERROR_DESCRIPTOR::ErrorCode, VIP_ERROR_DESCRIPTOR::OpCode, VIP_ERROR_DESCRIPTOR::ResourceCode, VIP_DEBUG, VIP_DEBUG_LABEL, VIP_ERROR_CATASTROPHIC, VIP_ERROR_COMP_PROT, VIP_ERROR_CONN_LOST, VIP_ERROR_POST_DESC, VIP_ERROR_RDMA_TRANSPORT, VIP_ERROR_RDMAR_PROT, VIP_ERROR_RDMAW_ABORT, VIP_ERROR_RDMAW_DATA, VIP_ERROR_RDMAW_PROT, VIP_ERROR_RECVQ_EMPTY, VIP_ERROR_VI_OVERRUN, VIP_STATUS_OP_RDMA_READ, VIP_STATUS_OP_RDMA_WRITE, VIP_STATUS_OP_RECEIVE, VIP_STATUS_OP_REMOTE_RDMA_WRITE, and VIP_STATUS_OP_SEND.

Referenced by VipErrorCallback(), and VipOpenNic().

void vip_generate_async_error VIP_NIC vip_nic_ptr,
VIP_VI vip_vi_ptr,
VIP_CQ vip_cq_ptr,
VIP_DESCRIPTOR vip_desc_ptr,
VIP_RESOURCE_CODE  resource_code,
VIP_ERROR_CODE  error_code,
VIP_UINT32  opcode
 

This function generates an asynchronous error by building an error descriptor from the various arguments and calling the error handler with it.

Parameters:
vip_nic_ptr (IN) The pointer to the NIC structure.
vip_vi_ptr (IN) The pointer to the VI structure.
vip_cq_ptr (IN) The pointer to the CQ structure, if any.
vip_desc_ptr (IN) The pointer to the descriptor in the VI queue.
resource_code (IN) The VI ressource code.
error_code (IN) The VI error code.
opcode (IN) The VI operation code.
See also:
vip_default_error_callback
Author:
Patrick Geoffray
Version:
1.0

Definition at line 654 of file vipl_priv.c.

References VIP_ERROR_DESCRIPTOR::CQHandle, VIP_ERROR_DESCRIPTOR::DescriptorPtr, VIP_NIC::error_callback, VIP_NIC::error_callback_context, VIP_ERROR_DESCRIPTOR::ErrorCode, VIP_GM::lock, VIP_NIC::lock, VIP_ERROR_DESCRIPTOR::NicHandle, VIP_ERROR_DESCRIPTOR::OpCode, VIP_ERROR_DESCRIPTOR::ResourceCode, VIP_ERROR_DESCRIPTOR::ViHandle, VIP_ASSERT, VIP_ASSERT_MUTEX_LOCKED, VIP_DEBUG, VIP_DEBUG_LABEL, and VIP_NIC::vip_gm_ptr.

Referenced by vip_handle_matching_message(), vip_handle_put_req(), vip_handle_report(), vip_notify_desc_completion(), vip_process_send_desc(), vip_resume_callback(), VipPostRecv(), and VipPostSend().

void vip_notify_desc_completion VIP_DESCRIPTOR vip_desc_ptr,
VIP_VI vip_vi_ptr,
VIP_BOOLEAN  recv_queue
 

This function tries to complete a descriptor in a VI queue, generate an entry in the corresponding completion queue if needed and wakes up any thread blocking on this descriptor.

Parameters:
vip_desc_ptr (IN) The pointer to the descriptor in the VI queue.
vip_vi_ptr (IN) The pointer to the VI structure.
recv_queue (IN) Flag indicating if the completed descriptor is in the receive queue.
Author:
Patrick Geoffray
Version:
1.0

Definition at line 709 of file vipl_priv.c.

References VIP_CQ_ENTRY::completed, VIP_CQ::count, VIP_DESCRIPTOR::CS, VIP_VI_QUEUE::current_desc, VIP_VI_QUEUE::current_mem, VIP_CQ::event, VIP_VI_QUEUE::event, VIP_CQ::event_count, VIP_VI_QUEUE::event_count, VIP_VI_QUEUE::first, VIP_VI::handle, VIP_PTAG::id, VIP_GM::lock, VIP_NIC::lock, VIP_CQ::next_completion, VIP_CQ::queue, VIP_CQ_ENTRY::recv_queue, VIP_VI::recv_queue, VIP_VI::send_queue, VIP_CONTROL_SEGMENT::Status, VIP_ASSERT, VIP_ASSERT_MUTEX_LOCKED, vip_check_memory_handle(), VIP_VI_QUEUE::vip_cq_ptr, VIP_DEBUG, VIP_DEBUG_LABEL, VIP_ERROR_COMP_PROT, VIP_ERROR_CONN_LOST, VIP_EVENT_SIGNAL, VIP_FALSE, vip_generate_async_error(), VIP_NIC::vip_gm_ptr, VIP_HANDLE::vip_nic_ptr, VIP_VI::vip_ptag_ptr, VIP_STATE_ERROR, VIP_STATUS_DONE, VIP_STATUS_OP_MASK, VIP_SUCCESS, VIP_TRUE, VIP_CQ_ENTRY::vip_vi_ptr, and vip_vi_transition_to_error_state().

Referenced by vip_handle_3way_done(), vip_handle_matching_message(), vip_handle_put_done(), vip_handle_report(), vip_process_send_desc(), vip_resume_callback(), vip_sent_callback(), and VipPostRecv().

void vip_vi_transition_to_error_state VIP_VI vip_vi_ptr,
VIP_BOOLEAN  send_conn_lost
 

This function changes the state of a VI to the Error state. It also flushes in error pending send or receive descriptors, flushes the completion queue entries if any and finally send a Connection Lost internal report to the remote side if needed.

Parameters:
vip_vi_ptr (IN) The pointer to the VI structure.
send_conn_lost (IN) Flag indicating if a Connection Lost internal report should be sent to the remote VI.
Author:
Patrick Geoffray
Version:
1.0

Definition at line 822 of file vipl_priv.c.

References VIP_PVOID64::Address, VIP_CQ_ENTRY::completed, VIP_CQ::count, VIP_VI_QUEUE::count_to_process, VIP_DESCRIPTOR::CS, VIP_VI_QUEUE::current_desc, VIP_VI_QUEUE::current_mem, VIP_CQ::event, VIP_VI_QUEUE::event, VIP_CQ::event_count, VIP_VI_QUEUE::event_count, VIP_VI_QUEUE::first, VIP_VI::handle, VIP_PTAG::id, VIP_VI_QUEUE::last, VIP_GM::lock, VIP_NIC::lock, VIP_CONTROL_SEGMENT::Next, VIP_CQ::next_completion, VIP_CONTROL_SEGMENT::NextHandle, VIP_CQ::queue, VIP_CQ_ENTRY::recv_queue, VIP_VI::recv_queue, VIP_VI::send_queue, VIP_VI::state, VIP_CONTROL_SEGMENT::Status, VIP_ASSERT, VIP_ASSERT_MUTEX_LOCKED, vip_check_memory_handle(), VIP_VI_QUEUE::vip_cq_ptr, VIP_DEBUG, VIP_DEBUG_LABEL, VIP_EVENT_SIGNAL, VIP_FALSE, VIP_NIC::vip_gm_ptr, vip_millisleep(), VIP_HANDLE::vip_nic_ptr, VIP_VI::vip_ptag_ptr, VIP_REPORT_CONN_LOST, vip_return_report(), VIP_STATE_ERROR, VIP_STATUS_DESC_FLUSHED_ERROR, VIP_STATUS_DONE, VIP_SUCCESS, VIP_TRUE, and VIP_CQ_ENTRY::vip_vi_ptr.

Referenced by vip_handle_matching_message(), vip_handle_put_req(), vip_handle_report(), vip_notify_desc_completion(), vip_process_send_desc(), vip_resume_callback(), VipDisconnect(), VipPostRecv(), and VipPostSend().

VIP_RETURN vip_check_memory_handle VIP_NIC vip_nic_ptr,
VIP_MEM_HANDLE  vip_mem_handle,
VIP_UINT64  range_start,
VIP_UINT64  range_length,
VIP_UINT32  vip_vi_ptag_id
 

This function changes the state of a VI to the Error state. It also flushes in error pending send or receive descriptors, flushes the completion queue entries if any and finally send a Connection Lost internal report to the remote side if needed.

Return values:
VIP_INVALID_PARAMETER At least one check has failed, the memory handle cannot validate the memory segment.
VIP_SUCESS The memory handle is valid for this memory segment.
Parameters:
vip_nic_ptr (IN) The pointer to the NIC structure.
vip_mem_handle (IN) The memory handle to check.
range_start (IN) The memory address of the beginning of the segment that should be covered by the memory handle.
range_length (IN) The length of the memory segment that should be covered by the memory handle.
vip_vi_ptag_id (IN) The Protection Tag of the parent VI.
Author:
Patrick Geoffray
Version:
1.0

Definition at line 997 of file vipl_priv.c.

References VIP_NIC::lock, VI_GM_MAX_REGISTER_REGIONS, VIP_ASSERT_MUTEX_LOCKED, VIP_DEBUG, VIP_DEBUG_LABEL, VIP_INVALID_MEM_HANDLE, VIP_INVALID_PARAMETER, VIP_INVALID_PTAG_HANDLE, VIP_NIC::vip_mem_handle_ptrs, and VIP_SUCCESS.

Referenced by vip_handle_matching_message(), vip_handle_put_req(), vip_notify_desc_completion(), vip_process_send_desc(), vip_vi_transition_to_error_state(), VipPostRecv(), and VipPostSend().

void vip_alive_alarm_callback void *  ptr  ) 
 

This function is the Heartbeat alarm callback. It is called after the heartbeat GM alarm is raised to send a new heartbeat, or delay the send if the previous heartbeat is not completed yet.

Parameters:
ptr (IN) The context passed to the alarm call, contains the pointer to the main GM structure.
Author:
Patrick Geoffray
Version:
1.0

Definition at line 1084 of file vipl_priv.c.

References VIP_GM::alive_alarm, VIP_GM::alive_buffer, VIP_GM::conn_mgr_gm_id, VIP_GM::gm_port, VIP_GM::lock, VIP_GM::magic, VIP_PACKET_ALIVE::net_srv_magic, VIP_PACKET_ALIVE::type, VI_GM_CONN_MGR_TTL, VI_GM_CTRL_GM_SIZE, VI_GM_PORT_CONN_MANAGER, vip_alive_alarm_callback(), VIP_ALIVE_PKT, vip_alive_sent_callback(), VIP_ASSERT, VIP_ASSERT_MUTEX_LOCKED, VIP_DEBUG, VIP_DEBUG_LABEL, VIP_HTON_UCHAR, VIP_HTON_UINT32, and VIP_NTOH_UINT32.

Referenced by vip_alive_alarm_callback(), and VipOpenNic().

void vip_alive_sent_callback struct gm_port *  gm_port,
void *  context,
gm_status_t  status
 

This function is the Heartbeat send completion callback. It prints an error if the connection manager is unreachable and signal to the pending alarm that the send is completed.

Parameters:
gm_port (IN) The GM port used to send the packet.
context (IN) The context passed to GM by the send call, contains the pointer to main GM structure.
status (IN) The GM status of the send operation.
Author:
Patrick Geoffray
Version:
1.0

Definition at line 1139 of file vipl_priv.c.

References VIP_GM::alive_buffer, VIP_GM::conn_mgr_gm_id, VIP_GM::lock, VIP_PACKET_ALIVE::net_srv_magic, VI_GM_PORT_CONN_MANAGER, vip_alive_sent_callback(), VIP_ASSERT_MUTEX_LOCKED, VIP_DEBUG, VIP_DEBUG_LABEL, VIP_HTON_UINT32, and VIP_NOTICE.

Referenced by vip_alive_alarm_callback(), and vip_alive_sent_callback().

void vip_remove_conn_waiting_list VIP_GM vip_gm_ptr,
VIP_CONN vip_conn_ptr
 

This function removes the specified connection from the waiting list on the server to prevent matching by an incoming connection request.

Parameters:
vip_gm_ptr (IN) The pointer to the main GM structure.
vip_conn_ptr (IN) The pointer to the connection handle.
Author:
Patrick Geoffray
Version:
1.0

Definition at line 1180 of file vipl_priv.c.

References VIP_CONN::handle, VIP_GM::head_waiting_conn_ptr, VIP_NIC::lock, VIP_GM::lock, VIP_CONN::next_waiting_conn_ptr, VIP_CONN::prev_waiting_conn_ptr, VIP_GM::tail_waiting_conn_ptr, VIP_ASSERT, VIP_ASSERT_MUTEX_LOCKED, VIP_DEBUG, VIP_DEBUG_LABEL, VIP_FALSE, VIP_HANDLE::vip_nic_ptr, VIP_TRUE, and VIP_CONN::waiting_list.

Referenced by vip_conn_peer_request_alarm_callback(), vip_handle_conn_accept(), vip_handle_conn_reject(), vip_handle_conn_req(), VipConnectPeerRequest(), VipConnectPeerWait(), VipConnectWait(), and VipDisconnect().

void vip_conn_peer_request_alarm_callback void *  ptr  ) 
 

This function is the Connection Peer alarm callback. It is called when the peer connection has reached the timeout and need to be completed, even if no incoming connection request has matched it.

Parameters:
ptr (IN) The context passed to the alarm call, contains the connection handle.
Author:
Patrick Geoffray
Version:
1.0

Definition at line 1230 of file vipl_priv.c.

References VIP_DEBUG, VIP_DEBUG_LABEL, VIP_EVENT_SIGNAL, VIP_INVALID_CONN_HANDLE, VIP_MUTEX_LOCK, VIP_MUTEX_UNLOCK, VIP_NOT_DONE, vip_remove_conn_waiting_list(), and VIP_TIMEOUT.

Referenced by VipConnectPeerRequest().

int vip_avl_compare_function const void *  a,
const void *  b,
void *  param
 

This function is used as the comparaison function for the AVL library. It compares two memory addresses and returns their relative order.

Return values:
-1 a is smaller than b.
0 a and b are equal.
1 a is larger than b.
Parameters:
a (IN) The first memory address to compare.
b (IN) The second memory address to compare.
param (IN) Unused parameter.
Author:
Patrick Geoffray
Version:
1.0

Definition at line 1276 of file vipl_priv.c.

void vip_avl_free_function void *  data,
void *  param
 

This function is used to free an entry in the AVL tree, using a lookaside list.

Parameters:
data (IN) The pointer to the entry to release.
param (IN) Unused parameter.
Author:
Patrick Geoffray
Version:
1.0

Definition at line 1309 of file vipl_priv.c.

VIP_UINT32 vip_avl_register_memory VIP_GM vip_gm_ptr,
VIP_UINTPTR  start,
VIP_UINTPTR  end
 

This function tries to lookup a specific memory range into the registration AVL tree. For each part of this memory range that is in the AVL tree, aka already registered, the reference count of the AVL entry is incremented. Otherwise, a new AVL entry is created and the corresponding memory segment is registered.

Returns:
The number of bytes successfully registered.
Parameters:
vip_gm_ptr (IN) The pointer to the main GM structure.
start (IN) The starting address of the memory segment to register.
end (IN) The ending address of the memory segment to register.
Author:
Patrick Geoffray
See also:
vip_avl_deregister_memory
Version:
1.0

Definition at line 1335 of file vipl_priv.c.

References VIP_AVL_RANGE::addr, VIP_AVL_RANGE::count, VIP_GM::gm_port, VIP_AVL_RANGE::length, VIP_GM::lock, VIP_GM::regmem_avl_lookaside, VIP_GM::regmem_avl_tree, VIP_ABORT, VIP_ASSERT, VIP_ASSERT_MUTEX_LOCKED, VIP_AVL_TREE_FIND, VIP_AVL_TREE_INSERT, VIP_DEBUG, VIP_DEBUG_GM, VIP_DEBUG_LABEL, VIP_ENTER_IOCTL, and VIP_EXIT_IOCTL.

Referenced by VipRegisterMem().

VIP_RETURN vip_avl_deregister_memory VIP_GM vip_gm_ptr,
VIP_UINTPTR  start,
VIP_UINTPTR  end
 

This function lookups a specific memory range into the registration AVL tree. For each part of this memory range with a reference count in the AVL tree greather than 1, the reference count is simply decremented. If the reference count of a segment becomes null, the segment is deregistered and the AVL entry is removed.

Return values:
VIP_ERROR_RESOURCE The GM deregister call failed.
VIP_SUCCESS Success.
Parameters:
vip_gm_ptr (IN) The pointer to the main GM structure.
start (IN) The starting address of the segment to deregister.
end (IN) The ending address of the memory segment to deregister.
Author:
Patrick Geoffray
See also:
vip_avl_register_memory
Version:
1.0

Definition at line 1553 of file vipl_priv.c.

References VIP_AVL_RANGE::addr, VIP_AVL_RANGE::count, VIP_GM::gm_port, VIP_AVL_RANGE::length, VIP_GM::lock, VIP_GM::regmem_avl_tree, VIP_ASSERT, VIP_ASSERT_MUTEX_LOCKED, VIP_AVL_TREE_DELETE, VIP_AVL_TREE_FIND, VIP_DEBUG, VIP_DEBUG_GM, VIP_DEBUG_LABEL, VIP_ENTER_IOCTL, VIP_ERROR_RESOURCE, VIP_EXIT_IOCTL, and VIP_SUCCESS.

Referenced by VipDeregisterMem(), and VipRegisterMem().


Variable Documentation

VIP_MUTEX_ATTR
 

Defined a mutex attribute, if supported by the local thread package.

Definition at line 30 of file vipl_priv.c.

VIP_MUTEX_T vip_glob_lock = PTHREAD_MUTEX_INITIALIZER
 

Global VI-GM lock. It is mainly used to protect the access to the global data (VIP_GM structures), when opening or destroying a VI NIC.

Definition at line 36 of file vipl_priv.c.

Referenced by VipCloseNic(), and VipOpenNic().

VIP_MUTEX_T vip_gm_host_name_lock = PTHREAD_MUTEX_INITIALIZER
 

GM host name lock. GM is not thread safe but can be easily used in a multithreaded environment. A lock is needed to protect GM functions manipulating the host name.

Definition at line 40 of file vipl_priv.c.

Referenced by VipConnectPeerRequest(), VipConnectRequest(), and VipNSGetHostByAddr().

struct gm_lookaside* vip_glob_nic_lookaside = NULL
 

The lookaside list used to manage the allocation of VI NIC structures.

Definition at line 47 of file vipl_priv.c.

Referenced by VipOpenNic().

VIP_GM* vip_glob_gm_ptrs[VI_GM_MAX_NICS] = { 0 }
 

Array of VIP_GM structures, one per Myrinet board.

Definition at line 50 of file vipl_priv.c.

Referenced by VipCloseNic(), and VipOpenNic().

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