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

vipquerymem.c

Go to the documentation of this file.
00001 /********************************************************
00002  * Myricom VI-GM  networking software and documentation *
00003  * Copyright (c) 2001 by Myricom, Inc.                  *
00004  * All rights reserved.                                 *
00005  * See the file `COPYING' for copyright notice.         *
00006  ********************************************************/
00007 
00013 #include "vipl_priv.h"
00014 
00015 
00038 VIP_ENTRY_POINT VIP_RETURN
00039 VipQueryMem (VIP_NIC_HANDLE NicHandle,
00040              VIP_PVOID Address,
00041              VIP_MEM_HANDLE MemHandle, VIP_MEM_ATTRIBUTES * MemAttribs)
00042 {
00043   VIP_NIC *vip_nic_ptr;
00044   VIP_MEM *vip_mem_ptr;
00045   VIP_DEBUG_LABEL (("VipQueryMem"));
00046 
00047 
00048   if (Address == NULL)
00049     {
00050       VIP_DEBUG (("Address is null"));
00051       return VIP_INVALID_PARAMETER;
00052     }
00053 
00054   if ((MemHandle == 0) || (MemHandle > VI_GM_MAX_REGISTER_REGIONS))
00055     {
00056       VIP_DEBUG (("MemHandle is invalid"));
00057       return VIP_INVALID_PARAMETER;
00058     }
00059 
00060   if (MemAttribs == NULL)
00061     {
00062       VIP_DEBUG (("MemAttribs is null"));
00063       return VIP_INVALID_PARAMETER;
00064     }
00065 
00066   /* check nic handle */
00067   vip_nic_ptr = (VIP_NIC *) NicHandle;
00068   if (VIP_INVALID_NIC_HANDLE (vip_nic_ptr))
00069     {
00070       VIP_DEBUG (("Invalid NIC handle"));
00071       return VIP_INVALID_PARAMETER;
00072     }
00073   VIP_MUTEX_LOCK (&(vip_nic_ptr->lock));
00074 
00075   /* check regmem handle */
00076   vip_mem_ptr = (VIP_MEM *) (vip_nic_ptr->vip_mem_handle_ptrs[MemHandle]);
00077   if (VIP_INVALID_MEM_HANDLE (vip_mem_ptr))
00078     {
00079       VIP_DEBUG (("Invalid MEM handle"));
00080       VIP_MUTEX_UNLOCK (&(vip_nic_ptr->lock));
00081       return VIP_INVALID_PARAMETER;
00082     }
00083 
00084   /* check consistency */
00085   if (vip_mem_ptr->address != Address)
00086     {
00087       VIP_DEBUG (("Inconsistent virtual address"));
00088       VIP_MUTEX_UNLOCK (&(vip_nic_ptr->lock));
00089       return VIP_INVALID_PARAMETER;
00090     }
00091 
00092   MemAttribs->Ptag = vip_mem_ptr->vip_ptag_ptr;
00093   MemAttribs->EnableRdmaWrite = vip_mem_ptr->rdma_write;
00094   MemAttribs->EnableRdmaRead = ((VI_GM_ENABLE_RDMAREAD == VIP_TRUE)
00095                                 ? VIP_TRUE : VIP_FALSE);
00096 
00097   VIP_DEBUG (("Success"));
00098   VIP_MUTEX_UNLOCK (&(vip_nic_ptr->lock));
00099   return VIP_SUCCESS;
00100 }
VI-GM-1.3 by Myricom © 1997-2006. Documentation generated on 20 May 2006 by doxygen 1.4.4.