On Tue, 2005-05-24 at 17:53 -0400, James Lentini wrote: > I'd suggest starting with the memory subsystem. Do you want to do the > lmr files?
OK, here goes. Remember that you will need to svn delete dapl_lmr_free.c dapl_lmr_kcreate.c dapl_lmr_query.c \ dapl_lmr_sync_rdma_read.c dapl_lmr_sync_rdma_write.c dapl_lmr_util.c \ dapl_lmr_util.h svn add dapl_lmr.c Signed-off-by: Tom Duffy <[EMAIL PROTECTED]> dat-provider/Makefile | 7 dat-provider/dapl_lmr.c | 618 ++++++++++++++++++++++++++++++++ dat-provider/dapl_lmr_free.c | 119 ------ dat-provider/dapl_lmr_kcreate.c | 395 -------------------- dat-provider/dapl_lmr_query.c | 60 --- dat-provider/dapl_lmr_sync_rdma_read.c | 75 --- dat-provider/dapl_lmr_sync_rdma_write.c | 60 --- dat-provider/dapl_lmr_util.c | 85 ---- dat-provider/dapl_lmr_util.h | 45 -- dat-provider/dapl_openib_util.c | 1 patches/alt_dat_provider_makefile | 12 11 files changed, 621 insertions(+), 856 deletions(-) Index: linux-kernel-lmr/dat-provider/dapl_lmr_sync_rdma_read.c =================================================================== --- linux-kernel-lmr/dat-provider/dapl_lmr_sync_rdma_read.c (revision 2475) +++ linux-kernel-lmr/dat-provider/dapl_lmr_sync_rdma_read.c (working copy) @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved. - * - * This Software is licensed under one of the following licenses: - * - * 1) under the terms of the "Common Public License 1.0" a copy of which is - * available from the Open Source Initiative, see - * http://www.opensource.org/licenses/cpl.php. - * - * 2) under the terms of the "The BSD License" a copy of which is - * available from the Open Source Initiative, see - * http://www.opensource.org/licenses/bsd-license.php. - * - * 3) under the terms of the "GNU General Public License (GPL) Version 2" a - * copy of which is available from the Open Source Initiative, see - * http://www.opensource.org/licenses/gpl-license.php. - * - * Licensee has the right to choose one of the above licenses. - * - * Redistributions of source code must retain the above copyright - * notice and one of the license notices. - * - * Redistributions in binary form must reproduce both the above copyright - * notice, one of the license notices in the documentation - * and/or other materials provided with the distribution. - */ - -/* - * $Id$ - */ - -#include "dapl.h" -#include "dapl_ia_util.h" - -/* - * dat_lmr_sync_rdma_read - * - * Ensure a region of memory is consistent by locally flushing - * non-coherent cache - * - * Input: - * ia_handle - * local_segments Array of buffer segments - * num_segments Number of segments in local_segments - * - * Output: - * none - * - * Return Values: - * DAT_SUCCESS - * DAT_INVALID_HANDLE - * DAT_INVALID_PARAMETER - */ -u32 dapl_lmr_sync_rdma_read(DAT_IA_HANDLE ia_handle, - const struct dat_lmr_triplet *local_segments, - u64 num_segments) -{ - struct dapl_ia *ia_ptr; - u32 dat_status = DAT_SUCCESS; - - dapl_dbg_log(DAPL_DBG_TYPE_API, - "dat_lmr_sync_rdma_read (%p, %p, %ld)\n", - ia_handle, local_segments, num_segments); - - ia_ptr = (struct dapl_ia *)ia_handle; - - if (DAPL_BAD_HANDLE(ia_ptr, DAPL_MAGIC_IA)) { - dat_status = - DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA); - goto bail; - } - -bail: - return dat_status; -} Index: linux-kernel-lmr/dat-provider/dapl_lmr_util.c =================================================================== --- linux-kernel-lmr/dat-provider/dapl_lmr_util.c (revision 2475) +++ linux-kernel-lmr/dat-provider/dapl_lmr_util.c (working copy) @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved. - * - * This Software is licensed under one of the following licenses: - * - * 1) under the terms of the "Common Public License 1.0" a copy of which is - * available from the Open Source Initiative, see - * http://www.opensource.org/licenses/cpl.php. - * - * 2) under the terms of the "The BSD License" a copy of which is - * available from the Open Source Initiative, see - * http://www.opensource.org/licenses/bsd-license.php. - * - * 3) under the terms of the "GNU General Public License (GPL) Version 2" a - * copy of which is available from the Open Source Initiative, see - * http://www.opensource.org/licenses/gpl-license.php. - * - * Licensee has the right to choose one of the above licenses. - * - * Redistributions of source code must retain the above copyright - * notice and one of the license notices. - * - * Redistributions in binary form must reproduce both the above copyright - * notice, one of the license notices in the documentation - * and/or other materials provided with the distribution. - */ - -/* - * $Id$ - */ - -#include "dapl_lmr_util.h" -#include "dapl_ia_util.h" - -struct dapl_lmr *dapl_lmr_alloc(struct dapl_ia *ia, enum dat_mem_type mem_type, - DAT_REGION_DESCRIPTION region_desc, u64 length, - DAT_PZ_HANDLE pz_handle, - enum dat_mem_priv_flags mem_priv) -{ - struct dapl_lmr *lmr; - - /* Allocate LMR */ - lmr = kmalloc(sizeof *lmr, GFP_ATOMIC); - if (!lmr) - return NULL; - - /* zero the structure */ - memset(lmr, 0, sizeof *lmr); - - /* - * initialize the header - */ - lmr->header.provider = ia->header.provider; - lmr->header.magic = DAPL_MAGIC_LMR; - lmr->header.handle_type = DAT_HANDLE_TYPE_LMR; - lmr->header.owner_ia = ia; - lmr->header.user_context.as_64 = 0; - lmr->header.user_context.as_ptr = NULL; - dapl_llist_init_entry(&lmr->header.ia_list_entry); - dapl_ia_link_lmr(ia, lmr); - spin_lock_init(&lmr->header.lock); - - /* - * initialize the body - */ - lmr->param.ia_handle = (DAT_IA_HANDLE) ia; - lmr->param.mem_type = mem_type; - lmr->param.region_desc = region_desc; - lmr->param.length = length; - lmr->param.pz_handle = pz_handle; - lmr->param.mem_priv = mem_priv; - atomic_set(&lmr->lmr_ref_count, 0); - - return lmr; -} - -void dapl_lmr_dealloc(struct dapl_lmr *lmr) -{ - /* reset magic to prevent reuse */ - lmr->header.magic = DAPL_MAGIC_INVALID; - dapl_ia_unlink_lmr(lmr->header.owner_ia, lmr); - /* no need to destroy lmr->header.lock */ - - kfree(lmr); -} Index: linux-kernel-lmr/dat-provider/Makefile =================================================================== --- linux-kernel-lmr/dat-provider/Makefile (revision 2476) +++ linux-kernel-lmr/dat-provider/Makefile (working copy) @@ -22,7 +22,6 @@ PROVIDER_MODULES := \ dapl_evd_kquery \ dapl_evd_kcreate \ dapl_evd_modify_upcall \ - dapl_lmr_kcreate \ dapl_cookie \ dapl_cno_util \ dapl_cr_accept \ @@ -67,11 +66,7 @@ PROVIDER_MODULES := \ dapl_ia_query \ dapl_ia_util \ dapl_llist \ - dapl_lmr_free \ - dapl_lmr_query \ - dapl_lmr_sync_rdma_read \ - dapl_lmr_sync_rdma_write \ - dapl_lmr_util \ + dapl_lmr \ dapl_mr_util \ dapl_provider \ dapl_sp_util \ Index: linux-kernel-lmr/dat-provider/dapl_lmr_util.h =================================================================== --- linux-kernel-lmr/dat-provider/dapl_lmr_util.h (revision 2475) +++ linux-kernel-lmr/dat-provider/dapl_lmr_util.h (working copy) @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved. - * - * This Software is licensed under one of the following licenses: - * - * 1) under the terms of the "Common Public License 1.0" a copy of which is - * available from the Open Source Initiative, see - * http://www.opensource.org/licenses/cpl.php. - * - * 2) under the terms of the "The BSD License" a copy of which is - * available from the Open Source Initiative, see - * http://www.opensource.org/licenses/bsd-license.php. - * - * 3) under the terms of the "GNU General Public License (GPL) Version 2" a - * copy of which is available from the Open Source Initiative, see - * http://www.opensource.org/licenses/gpl-license.php. - * - * Licensee has the right to choose one of the above licenses. - * - * Redistributions of source code must retain the above copyright - * notice and one of the license notices. - * - * Redistributions in binary form must reproduce both the above copyright - * notice, one of the license notices in the documentation - * and/or other materials provided with the distribution. - */ - -/* - * $Id$ - */ - -#ifndef DAPL_LMR_UTIL_H -#define DAPL_LMR_UTIL_H - -#include "dapl_mr_util.h" - -extern struct dapl_lmr *dapl_lmr_alloc(struct dapl_ia *ia, - enum dat_mem_type mem_type, - DAT_REGION_DESCRIPTION region_desc, - u64 length, DAT_PZ_HANDLE pz_handle, - enum dat_mem_priv_flags mem_priv); - -extern void dapl_lmr_dealloc(struct dapl_lmr *lmr); - -#endif /* DAPL_LMR_UTIL_H */ Index: linux-kernel-lmr/dat-provider/dapl_lmr_query.c =================================================================== --- linux-kernel-lmr/dat-provider/dapl_lmr_query.c (revision 2475) +++ linux-kernel-lmr/dat-provider/dapl_lmr_query.c (working copy) @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved. - * - * This Software is licensed under one of the following licenses: - * - * 1) under the terms of the "Common Public License 1.0" a copy of which is - * available from the Open Source Initiative, see - * http://www.opensource.org/licenses/cpl.php. - * - * 2) under the terms of the "The BSD License" a copy of which is - * available from the Open Source Initiative, see - * http://www.opensource.org/licenses/bsd-license.php. - * - * 3) under the terms of the "GNU General Public License (GPL) Version 2" a - * copy of which is available from the Open Source Initiative, see - * http://www.opensource.org/licenses/gpl-license.php. - * - * Licensee has the right to choose one of the above licenses. - * - * Redistributions of source code must retain the above copyright - * notice and one of the license notices. - * - * Redistributions in binary form must reproduce both the above copyright - * notice, one of the license notices in the documentation - * and/or other materials provided with the distribution. - */ - -/* - * $Id$ - */ - -#include "dapl.h" - -u32 dapl_lmr_query(DAT_LMR_HANDLE lmr_handle, struct dat_lmr_param *lmr_param) -{ - struct dapl_lmr *lmr; - u32 dat_status; - - dapl_dbg_log(DAPL_DBG_TYPE_API, - "dapl_lmr_query (%p, %p)\n", - lmr_handle, lmr_param); - - if (DAPL_BAD_HANDLE(lmr_handle, DAPL_MAGIC_LMR)) { - dat_status = - DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_LMR); - goto bail; - } - if (NULL == lmr_param) { - dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3); - goto bail; - } - - dat_status = DAT_SUCCESS; - lmr = (struct dapl_lmr *)lmr_handle; - - memcpy(lmr_param, &lmr->param, sizeof *lmr_param); - -bail: - return dat_status; -} Index: linux-kernel-lmr/dat-provider/dapl_openib_util.c =================================================================== --- linux-kernel-lmr/dat-provider/dapl_openib_util.c (revision 2476) +++ linux-kernel-lmr/dat-provider/dapl_openib_util.c (working copy) @@ -37,7 +37,6 @@ #include "dapl_openib_util.h" #include "dapl_evd_util.h" #include "dapl_cr_util.h" -#include "dapl_lmr_util.h" #include "dapl_rmr_util.h" #include "dapl_cookie.h" #include "dapl_openib_cm.h" Index: linux-kernel-lmr/dat-provider/dapl_lmr.c =================================================================== --- linux-kernel-lmr/dat-provider/dapl_lmr.c (revision 0) +++ linux-kernel-lmr/dat-provider/dapl_lmr.c (revision 0) @@ -0,0 +1,618 @@ +/* + * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved. + * + * This Software is licensed under one of the following licenses: + * + * 1) under the terms of the "Common Public License 1.0" a copy of which is + * available from the Open Source Initiative, see + * http://www.opensource.org/licenses/cpl.php. + * + * 2) under the terms of the "The BSD License" a copy of which is + * available from the Open Source Initiative, see + * http://www.opensource.org/licenses/bsd-license.php. + * + * 3) under the terms of the "GNU General Public License (GPL) Version 2" a + * copy of which is available from the Open Source Initiative, see + * http://www.opensource.org/licenses/gpl-license.php. + * + * Licensee has the right to choose one of the above licenses. + * + * Redistributions of source code must retain the above copyright + * notice and one of the license notices. + * + * Redistributions in binary form must reproduce both the above copyright + * notice, one of the license notices in the documentation + * and/or other materials provided with the distribution. + */ + +/* + * $Id: dapl_lmr.c 2433 2005-05-21 04:11:03Z jlentini $ + */ + +#include "dapl_openib_util.h" +#include "dapl_ia_util.h" +#include "dapl_hash.h" + +static struct dapl_lmr *dapl_lmr_alloc(struct dapl_ia *ia, + enum dat_mem_type mem_type, + DAT_REGION_DESCRIPTION region_desc, + u64 length, DAT_PZ_HANDLE pz_handle, + enum dat_mem_priv_flags mem_priv) +{ + struct dapl_lmr *lmr; + + /* Allocate LMR */ + lmr = kmalloc(sizeof *lmr, GFP_ATOMIC); + if (!lmr) + return NULL; + + /* zero the structure */ + memset(lmr, 0, sizeof *lmr); + + /* + * initialize the header + */ + lmr->header.provider = ia->header.provider; + lmr->header.magic = DAPL_MAGIC_LMR; + lmr->header.handle_type = DAT_HANDLE_TYPE_LMR; + lmr->header.owner_ia = ia; + lmr->header.user_context.as_64 = 0; + lmr->header.user_context.as_ptr = NULL; + dapl_llist_init_entry(&lmr->header.ia_list_entry); + dapl_ia_link_lmr(ia, lmr); + spin_lock_init(&lmr->header.lock); + + /* + * initialize the body + */ + lmr->param.ia_handle = (DAT_IA_HANDLE) ia; + lmr->param.mem_type = mem_type; + lmr->param.region_desc = region_desc; + lmr->param.length = length; + lmr->param.pz_handle = pz_handle; + lmr->param.mem_priv = mem_priv; + atomic_set(&lmr->lmr_ref_count, 0); + + return lmr; +} + +static void dapl_lmr_dealloc(struct dapl_lmr *lmr) +{ + /* reset magic to prevent reuse */ + lmr->header.magic = DAPL_MAGIC_INVALID; + dapl_ia_unlink_lmr(lmr->header.owner_ia, lmr); + /* no need to destroy lmr->header.lock */ + + kfree(lmr); +} + +/* + * dapl_lmr_free + * + * Destroy an instance of the Local Memory Region + * + * Input: + * lmr_handle + * + * Output: + * + * Returns: + * DAT_SUCCESS + * DAT_INVALID_HANDLE + * DAT_INVALID_PARAMETER + * DAT_INVALID_STATE + */ + +u32 dapl_lmr_free(DAT_LMR_HANDLE lmr_handle) +{ + struct dapl_lmr *lmr; + u32 dat_status; + + dapl_dbg_log(DAPL_DBG_TYPE_API, "dapl_lmr_free (%p)\n", lmr_handle); + + if (DAPL_BAD_HANDLE(lmr_handle, DAPL_MAGIC_LMR)) { + dat_status = + DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_LMR); + goto bail; + } + + lmr = (struct dapl_lmr *)lmr_handle; + + switch (lmr->param.mem_type) { + case DAT_MEM_TYPE_PHYSICAL: + case DAT_MEM_TYPE_VIRTUAL: + case DAT_MEM_TYPE_LMR: + { + struct dapl_pz *pz; + + if (0 != atomic_read(&lmr->lmr_ref_count)) + return DAT_INVALID_STATE; + + dat_status = + dapl_hash_remove(lmr->header.owner_ia->hca_ptr-> + lmr_hash_table, + lmr->param.lmr_context, NULL); + if (dat_status != DAT_SUCCESS) + goto bail; + + dat_status = dapl_ib_mr_deregister(lmr); + + if (dat_status == DAT_SUCCESS) { + + pz = (struct dapl_pz *)lmr->param.pz_handle; + atomic_dec(&pz->pz_ref_count); + + dapl_lmr_dealloc(lmr); + } else + /* + * Deregister failed; put it back in the + * hash table. + */ + dapl_hash_insert(lmr->header.owner_ia-> + hca_ptr->lmr_hash_table, + lmr->param.lmr_context, lmr); + + break; + } + case DAT_MEM_TYPE_PLATFORM: + case DAT_MEM_TYPE_IA: + case DAT_MEM_TYPE_BYPASS: + return DAT_ERROR(DAT_NOT_IMPLEMENTED, 0); + default: + dat_status = + DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG1); + break; + } +bail: + return dat_status; +} + +static inline u32 dapl_lmr_create_virtual(struct dapl_ia *ia, void *virt_addr, + u64 length, struct dapl_pz *pz, + enum dat_mem_priv_flags privileges, + DAT_LMR_HANDLE *lmr_handle, + DAT_LMR_CONTEXT *lmr_context, + DAT_RMR_CONTEXT *rmr_context, + u64 *registered_length, + u64 *registered_address) +{ + struct dapl_lmr *lmr; + DAT_REGION_DESCRIPTION reg_desc; + u32 dat_status = DAT_SUCCESS; + + reg_desc.for_va = virt_addr; + + lmr = dapl_lmr_alloc(ia, + DAT_MEM_TYPE_VIRTUAL, + reg_desc, length, (DAT_PZ_HANDLE) pz, privileges); + + if (NULL == lmr) { + dat_status = + DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY); + goto bail; + } + + dat_status = dapl_ib_mr_register(ia, + lmr, virt_addr, length, privileges); + + if (DAT_SUCCESS != dat_status) { + dapl_lmr_dealloc(lmr); + goto bail; + } + + /* if the LMR context is already in the hash table */ + dat_status = dapl_hash_search(ia->hca_ptr->lmr_hash_table, + lmr->param.lmr_context, NULL); + if (dat_status == DAT_SUCCESS) { + (void)dapl_ib_mr_deregister(lmr); + dapl_lmr_dealloc(lmr); + + dat_status = + DAT_ERROR(DAT_INVALID_STATE, DAT_INVALID_STATE_LMR_IN_USE); + goto bail; + } + + dat_status = dapl_hash_insert(ia->hca_ptr->lmr_hash_table, + lmr->param.lmr_context, lmr); + if (dat_status != DAT_SUCCESS) { + (void)dapl_ib_mr_deregister(lmr); + dapl_lmr_dealloc(lmr); + + /* The value returned by dapl_hash_insert(.) is not */ + /* returned to the consumer because the spec. requires */ + /* that dat_lmr_create(.) return only certain values. */ + dat_status = + DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY); + goto bail; + } + + atomic_inc(&pz->pz_ref_count); + + if (lmr_handle) + *lmr_handle = (DAT_LMR_HANDLE) lmr; + if (lmr_context) + *lmr_context = (DAT_LMR_CONTEXT) lmr->param.lmr_context; + if (rmr_context) + *rmr_context = (DAT_LMR_CONTEXT) lmr->param.rmr_context; + if (registered_address) + *registered_address = (u64)(unsigned long) virt_addr; + if (registered_length) + *registered_length = length; + +bail: + return dat_status; + +} + +static inline u32 dapl_lmr_create_physical(struct dapl_ia *ia, + DAT_REGION_DESCRIPTION phys_addr, + u64 page_count, struct dapl_pz *pz, + enum dat_mem_priv_flags privileges, + DAT_LMR_HANDLE *lmr_handle, + DAT_LMR_CONTEXT *lmr_context, + DAT_RMR_CONTEXT *rmr_context, + u64 *registered_length, + u64 *registered_address) +{ + struct dapl_lmr *lmr; + u32 dat_status = DAT_SUCCESS; + u64 *array = phys_addr.for_array; + + lmr = dapl_lmr_alloc(ia, + DAT_MEM_TYPE_PHYSICAL, + phys_addr, + page_count, (DAT_PZ_HANDLE) pz, privileges); + + if (NULL == lmr) { + dat_status = + DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY); + goto bail; + } + + dat_status = dapl_ib_mr_register_physical(ia, lmr, phys_addr.for_array, + page_count, privileges); + + if (DAT_SUCCESS != dat_status) { + dapl_lmr_dealloc(lmr); + goto bail; + } + + /* if the LMR context is already in the hash table */ + dat_status = dapl_hash_search(ia->hca_ptr->lmr_hash_table, + lmr->param.lmr_context, NULL); + if (dat_status == DAT_SUCCESS) { + (void)dapl_ib_mr_deregister(lmr); + dapl_lmr_dealloc(lmr); + + dat_status = + DAT_ERROR(DAT_INVALID_STATE, DAT_INVALID_STATE_LMR_IN_USE); + goto bail; + } + + dat_status = dapl_hash_insert(ia->hca_ptr->lmr_hash_table, + lmr->param.lmr_context, lmr); + if (dat_status != DAT_SUCCESS) { + (void)dapl_ib_mr_deregister(lmr); + dapl_lmr_dealloc(lmr); + + /* The value returned by dapl_hash_insert(.) is not */ + /* returned to the consumer because the spec. requires */ + /* that dat_lmr_create(.) return only certain values. */ + dat_status = + DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY); + goto bail; + } + + atomic_inc(&pz->pz_ref_count); + + if (lmr_handle) + *lmr_handle = (DAT_LMR_HANDLE) lmr; + if (lmr_context) + *lmr_context = (DAT_LMR_CONTEXT) lmr->param.lmr_context; + if (rmr_context) + *rmr_context = (DAT_LMR_CONTEXT) lmr->param.rmr_context; + if (registered_address) + *registered_address = array[0]; + if (registered_length) + *registered_length = page_count * PAGE_SIZE; + +bail: + return dat_status; +} + +static inline u32 dapl_lmr_create_lmr(struct dapl_ia *ia, + struct dapl_lmr *original_lmr, + struct dapl_pz *pz, + enum dat_mem_priv_flags privileges, + DAT_LMR_HANDLE *lmr_handle, + DAT_LMR_CONTEXT *lmr_context, + DAT_RMR_CONTEXT *rmr_context, + u64 *registered_length, + u64 *registered_address) +{ + struct dapl_lmr *lmr; + DAT_REGION_DESCRIPTION reg_desc; + u32 dat_status; + + dat_status = dapl_hash_search(ia->hca_ptr->lmr_hash_table, + original_lmr->param.lmr_context, + (DAPL_HASH_DATA *) & lmr); + if (dat_status != DAT_SUCCESS) { + dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG2); + goto bail; + } + + reg_desc.for_lmr_handle = (DAT_LMR_HANDLE) original_lmr; + + lmr = dapl_lmr_alloc(ia, DAT_MEM_TYPE_LMR, reg_desc, 0, /* length is meaningless */ + (DAT_PZ_HANDLE) pz, privileges); + + if (NULL == lmr) { + dat_status = + DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY); + goto bail; + } +#if 0 + dat_status = dapl_ib_mr_register_shared(ia, lmr, privileges); +#endif + + if (DAT_SUCCESS != dat_status) { + dapl_lmr_dealloc(lmr); + goto bail; + } + + /* if the LMR context is already in the hash table */ + dat_status = dapl_hash_search(ia->hca_ptr->lmr_hash_table, + lmr->param.lmr_context, NULL); + if (dat_status == DAT_SUCCESS) { + dapl_ib_mr_deregister(lmr); + dapl_lmr_dealloc(lmr); + + dat_status = + DAT_ERROR(DAT_INVALID_STATE, DAT_INVALID_STATE_LMR_IN_USE); + goto bail; + } + + dat_status = dapl_hash_insert(ia->hca_ptr->lmr_hash_table, + lmr->param.lmr_context, lmr); + if (dat_status != DAT_SUCCESS) { + dapl_ib_mr_deregister(lmr); + dapl_lmr_dealloc(lmr); + + /* The value returned by dapl_hash_insert(.) is not */ + /* returned to the consumer because the spec. requires */ + /* that dat_lmr_create(.) return only certain values. */ + dat_status = + DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY); + goto bail; + } + + atomic_inc(&pz->pz_ref_count); + + if (lmr_handle) + *lmr_handle = (DAT_LMR_HANDLE) lmr; + if (lmr_context) + *lmr_context = (DAT_LMR_CONTEXT) lmr->param.lmr_context; + if (rmr_context) + *rmr_context = (DAT_LMR_CONTEXT) lmr->param.rmr_context; + if (registered_address) + *registered_address = (u64) (unsigned long) + original_lmr->param.region_desc.for_va; + if (registered_length) + *registered_length = original_lmr->param.length; +bail: + return dat_status; +} + +/* + * dapl_lmr_kcreate + * + * Register a memory region with an Interface Adaptor. + * + * Input: + * ia_handle + * mem_type + * region_description + * length + * pz_handle + * privileges + * optimization + * + * Output: + * lmr_handle + * lmr_context + * registered_length + * registered_address + * + * Returns: + * DAT_SUCCESS + * DAT_INSUFFICIENT_RESOURCES + * DAT_INVALID_PARAMETER + * DAT_INVALID_HANDLE + * DAT_INVALID_STATE + * DAT_MODEL_NOT_SUPPORTED + * + */ +u32 dapl_lmr_kcreate(DAT_IA_HANDLE ia_handle, enum dat_mem_type mem_type, + DAT_REGION_DESCRIPTION region_description, u64 length, + DAT_PZ_HANDLE pz_handle, + enum dat_mem_priv_flags privileges, + enum dat_mem_optimize_flags optimization, DAT_LMR_HANDLE *lmr_handle, + DAT_LMR_CONTEXT *lmr_context, DAT_RMR_CONTEXT *rmr_context, u64 *registered_length, u64 *registered_address) +{ + struct dapl_ia *ia; + struct dapl_pz *pz; + u32 dat_status; + + dapl_dbg_log(DAPL_DBG_TYPE_API, + "dapl_lmr_kcreate(ia:%p, mem_type:%x, ...)\n", + ia_handle, mem_type); + + if (DAPL_BAD_HANDLE(ia_handle, DAPL_MAGIC_IA)) { + dat_status = + DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA); + goto bail; + } + if (DAPL_BAD_HANDLE(pz_handle, DAPL_MAGIC_PZ)) { + dat_status = + DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PZ); + goto bail; + } + + ia = (struct dapl_ia *)ia_handle; + pz = (struct dapl_pz *)pz_handle; + + switch (mem_type) { + case DAT_MEM_TYPE_VIRTUAL: + dat_status = + DAT_ERROR(DAT_NOT_IMPLEMENTED, DAT_NO_SUBTYPE); + break; + /* + * dat_status = dapl_lmr_create_virtual ( + * ia, region_description.for_va, length, pz, privileges, + * lmr_handle, lmr_context, rmr_context, registered_length, + * registered_address); + * break; + */ + case DAT_MEM_TYPE_PHYSICAL: + dat_status = dapl_lmr_create_physical(ia, region_description, + length, pz, privileges, + lmr_handle, lmr_context, + rmr_context, + registered_length, + registered_address); + break; + case DAT_MEM_TYPE_LMR: + { + struct dapl_lmr *lmr; + + if (DAPL_BAD_HANDLE + (region_description.for_lmr_handle, + DAPL_MAGIC_LMR)) { + dat_status = + DAT_ERROR(DAT_INVALID_HANDLE, + DAT_INVALID_HANDLE_LMR); + goto bail; + } + + lmr = (struct dapl_lmr *)region_description.for_lmr_handle; + + dat_status = + dapl_lmr_create_lmr(ia, lmr, pz, privileges, + lmr_handle, lmr_context, + rmr_context, registered_length, + registered_address); + break; + } + case DAT_MEM_TYPE_PLATFORM: + case DAT_MEM_TYPE_IA: + case DAT_MEM_TYPE_BYPASS: + dat_status = + DAT_ERROR(DAT_NOT_IMPLEMENTED, DAT_NO_SUBTYPE); + break; + default: + dat_status = + DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG2); + break; + } + +bail: + return dat_status; +} + +u32 dapl_lmr_query(DAT_LMR_HANDLE lmr_handle, struct dat_lmr_param *lmr_param) +{ + struct dapl_lmr *lmr; + u32 dat_status; + + dapl_dbg_log(DAPL_DBG_TYPE_API, + "dapl_lmr_query (%p, %p)\n", + lmr_handle, lmr_param); + + if (DAPL_BAD_HANDLE(lmr_handle, DAPL_MAGIC_LMR)) { + dat_status = + DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_LMR); + goto bail; + } + if (NULL == lmr_param) { + dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3); + goto bail; + } + + dat_status = DAT_SUCCESS; + lmr = (struct dapl_lmr *)lmr_handle; + + memcpy(lmr_param, &lmr->param, sizeof *lmr_param); + +bail: + return dat_status; +} + +/* + * dat_lmr_sync_rdma_read + * + * Ensure a region of memory is consistent by locally flushing + * non-coherent cache + * + * Input: + * ia_handle + * local_segments Array of buffer segments + * num_segments Number of segments in local_segments + * + * Output: + * none + * + * Return Values: + * DAT_SUCCESS + * DAT_INVALID_HANDLE + * DAT_INVALID_PARAMETER + */ +u32 dapl_lmr_sync_rdma_read(DAT_IA_HANDLE ia_handle, + const struct dat_lmr_triplet *local_segments, + u64 num_segments) +{ + struct dapl_ia *ia_ptr; + u32 dat_status = DAT_SUCCESS; + + dapl_dbg_log(DAPL_DBG_TYPE_API, + "dat_lmr_sync_rdma_read (%p, %p, %ld)\n", + ia_handle, local_segments, num_segments); + + ia_ptr = (struct dapl_ia *)ia_handle; + + if (DAPL_BAD_HANDLE(ia_ptr, DAPL_MAGIC_IA)) { + dat_status = + DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA); + goto bail; + } + +bail: + return dat_status; +} + +/* + * Ensure a region of memory is consistent by locally flushing + * non-coherent cache + */ +u32 dapl_lmr_sync_rdma_write(DAT_IA_HANDLE ia_handle, + const struct dat_lmr_triplet *local_segments, + u64 num_segments) +{ + struct dapl_ia *ia_ptr; + u32 dat_status = DAT_SUCCESS; + + dapl_dbg_log(DAPL_DBG_TYPE_API, + "dat_lmr_sync_rdma_write (%p, %p, %ld)\n", + ia_handle, local_segments, num_segments); + + ia_ptr = (struct dapl_ia *)ia_handle; + + if (DAPL_BAD_HANDLE(ia_ptr, DAPL_MAGIC_IA)) { + dat_status = + DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA); + goto bail; + } + +bail: + return dat_status; +} Index: linux-kernel-lmr/dat-provider/dapl_lmr_free.c =================================================================== --- linux-kernel-lmr/dat-provider/dapl_lmr_free.c (revision 2475) +++ linux-kernel-lmr/dat-provider/dapl_lmr_free.c (working copy) @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved. - * - * This Software is licensed under one of the following licenses: - * - * 1) under the terms of the "Common Public License 1.0" a copy of which is - * available from the Open Source Initiative, see - * http://www.opensource.org/licenses/cpl.php. - * - * 2) under the terms of the "The BSD License" a copy of which is - * available from the Open Source Initiative, see - * http://www.opensource.org/licenses/bsd-license.php. - * - * 3) under the terms of the "GNU General Public License (GPL) Version 2" a - * copy of which is available from the Open Source Initiative, see - * http://www.opensource.org/licenses/gpl-license.php. - * - * Licensee has the right to choose one of the above licenses. - * - * Redistributions of source code must retain the above copyright - * notice and one of the license notices. - * - * Redistributions in binary form must reproduce both the above copyright - * notice, one of the license notices in the documentation - * and/or other materials provided with the distribution. - */ - -/* - * $Id$ - */ - -#include "dapl_lmr_util.h" -#include "dapl_openib_util.h" -#include "dapl_ia_util.h" - -/* - * dapl_lmr_free - * - * Destroy an instance of the Local Memory Region - * - * Input: - * lmr_handle - * - * Output: - * - * Returns: - * DAT_SUCCESS - * DAT_INVALID_HANDLE - * DAT_INVALID_PARAMETER - * DAT_INVALID_STATE - */ - -u32 dapl_lmr_free(DAT_LMR_HANDLE lmr_handle) -{ - struct dapl_lmr *lmr; - u32 dat_status; - - dapl_dbg_log(DAPL_DBG_TYPE_API, "dapl_lmr_free (%p)\n", lmr_handle); - - if (DAPL_BAD_HANDLE(lmr_handle, DAPL_MAGIC_LMR)) { - dat_status = - DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_LMR); - goto bail; - } - - lmr = (struct dapl_lmr *)lmr_handle; - - switch (lmr->param.mem_type) { - case DAT_MEM_TYPE_PHYSICAL: - case DAT_MEM_TYPE_VIRTUAL: - case DAT_MEM_TYPE_LMR: - { - struct dapl_pz *pz; - - if (0 != atomic_read(&lmr->lmr_ref_count)) - return DAT_INVALID_STATE; - - dat_status = - dapl_hash_remove(lmr->header.owner_ia->hca_ptr-> - lmr_hash_table, - lmr->param.lmr_context, NULL); - if (dat_status != DAT_SUCCESS) - goto bail; - - dat_status = dapl_ib_mr_deregister(lmr); - - if (dat_status == DAT_SUCCESS) { - - pz = (struct dapl_pz *)lmr->param.pz_handle; - atomic_dec(&pz->pz_ref_count); - - dapl_lmr_dealloc(lmr); - } else - /* - * Deregister failed; put it back in the - * hash table. - */ - dapl_hash_insert(lmr->header.owner_ia-> - hca_ptr->lmr_hash_table, - lmr->param.lmr_context, lmr); - - break; - } - case DAT_MEM_TYPE_PLATFORM: - case DAT_MEM_TYPE_IA: - case DAT_MEM_TYPE_BYPASS: - { - return DAT_ERROR(DAT_NOT_IMPLEMENTED, 0); - } - default: - { - dat_status = - DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG1); - break; - } - } -bail: - return dat_status; -} Index: linux-kernel-lmr/dat-provider/dapl_lmr_sync_rdma_write.c =================================================================== --- linux-kernel-lmr/dat-provider/dapl_lmr_sync_rdma_write.c (revision 2475) +++ linux-kernel-lmr/dat-provider/dapl_lmr_sync_rdma_write.c (working copy) @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved. - * - * This Software is licensed under one of the following licenses: - * - * 1) under the terms of the "Common Public License 1.0" a copy of which is - * available from the Open Source Initiative, see - * http://www.opensource.org/licenses/cpl.php. - * - * 2) under the terms of the "The BSD License" a copy of which is - * available from the Open Source Initiative, see - * http://www.opensource.org/licenses/bsd-license.php. - * - * 3) under the terms of the "GNU General Public License (GPL) Version 2" a - * copy of which is available from the Open Source Initiative, see - * http://www.opensource.org/licenses/gpl-license.php. - * - * Licensee has the right to choose one of the above licenses. - * - * Redistributions of source code must retain the above copyright - * notice and one of the license notices. - * - * Redistributions in binary form must reproduce both the above copyright - * notice, one of the license notices in the documentation - * and/or other materials provided with the distribution. - */ - -/* - * $Id$ - */ - -#include "dapl.h" -#include "dapl_ia_util.h" - -/* - * Ensure a region of memory is consistent by locally flushing - * non-coherent cache - */ -u32 dapl_lmr_sync_rdma_write(DAT_IA_HANDLE ia_handle, - const struct dat_lmr_triplet *local_segments, - u64 num_segments) -{ - struct dapl_ia *ia_ptr; - u32 dat_status = DAT_SUCCESS; - - dapl_dbg_log(DAPL_DBG_TYPE_API, - "dat_lmr_sync_rdma_write (%p, %p, %ld)\n", - ia_handle, local_segments, num_segments); - - ia_ptr = (struct dapl_ia *)ia_handle; - - if (DAPL_BAD_HANDLE(ia_ptr, DAPL_MAGIC_IA)) { - dat_status = - DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA); - goto bail; - } - -bail: - return dat_status; -} Index: linux-kernel-lmr/dat-provider/dapl_lmr_kcreate.c =================================================================== --- linux-kernel-lmr/dat-provider/dapl_lmr_kcreate.c (revision 2475) +++ linux-kernel-lmr/dat-provider/dapl_lmr_kcreate.c (working copy) @@ -1,395 +0,0 @@ -/* - * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved. - * - * This Software is licensed under one of the following licenses: - * - * 1) under the terms of the "Common Public License 1.0" a copy of which is - * available from the Open Source Initiative, see - * http://www.opensource.org/licenses/cpl.php. - * - * 2) under the terms of the "The BSD License" a copy of which is - * available from the Open Source Initiative, see - * http://www.opensource.org/licenses/bsd-license.php. - * - * 3) under the terms of the "GNU General Public License (GPL) Version 2" a - * copy of which is available from the Open Source Initiative, see - * http://www.opensource.org/licenses/gpl-license.php. - * - * Licensee has the right to choose one of the above licenses. - * - * Redistributions of source code must retain the above copyright - * notice and one of the license notices. - * - * Redistributions in binary form must reproduce both the above copyright - * notice, one of the license notices in the documentation - * and/or other materials provided with the distribution. - */ - -/* - * $Id$ - */ - -#include "dapl_lmr_util.h" -#include "dapl_openib_util.h" - -static inline u32 dapl_lmr_create_virtual(struct dapl_ia *ia, void *virt_addr, - u64 length, struct dapl_pz *pz, - enum dat_mem_priv_flags privileges, - DAT_LMR_HANDLE *lmr_handle, - DAT_LMR_CONTEXT *lmr_context, - DAT_RMR_CONTEXT *rmr_context, - u64 *registered_length, - u64 *registered_address) -{ - struct dapl_lmr *lmr; - DAT_REGION_DESCRIPTION reg_desc; - u32 dat_status = DAT_SUCCESS; - - reg_desc.for_va = virt_addr; - - lmr = dapl_lmr_alloc(ia, - DAT_MEM_TYPE_VIRTUAL, - reg_desc, length, (DAT_PZ_HANDLE) pz, privileges); - - if (NULL == lmr) { - dat_status = - DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY); - goto bail; - } - - dat_status = dapl_ib_mr_register(ia, - lmr, virt_addr, length, privileges); - - if (DAT_SUCCESS != dat_status) { - dapl_lmr_dealloc(lmr); - goto bail; - } - - /* if the LMR context is already in the hash table */ - dat_status = dapl_hash_search(ia->hca_ptr->lmr_hash_table, - lmr->param.lmr_context, NULL); - if (dat_status == DAT_SUCCESS) { - (void)dapl_ib_mr_deregister(lmr); - dapl_lmr_dealloc(lmr); - - dat_status = - DAT_ERROR(DAT_INVALID_STATE, DAT_INVALID_STATE_LMR_IN_USE); - goto bail; - } - - dat_status = dapl_hash_insert(ia->hca_ptr->lmr_hash_table, - lmr->param.lmr_context, lmr); - if (dat_status != DAT_SUCCESS) { - (void)dapl_ib_mr_deregister(lmr); - dapl_lmr_dealloc(lmr); - - /* The value returned by dapl_hash_insert(.) is not */ - /* returned to the consumer because the spec. requires */ - /* that dat_lmr_create(.) return only certain values. */ - dat_status = - DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY); - goto bail; - } - - atomic_inc(&pz->pz_ref_count); - - if (lmr_handle) - *lmr_handle = (DAT_LMR_HANDLE) lmr; - if (lmr_context) - *lmr_context = (DAT_LMR_CONTEXT) lmr->param.lmr_context; - if (rmr_context) - *rmr_context = (DAT_LMR_CONTEXT) lmr->param.rmr_context; - if (registered_address) - *registered_address = (u64)(unsigned long) virt_addr; - if (registered_length) - *registered_length = length; - -bail: - return dat_status; - -} - -static inline u32 dapl_lmr_create_physical(struct dapl_ia *ia, - DAT_REGION_DESCRIPTION phys_addr, - u64 page_count, struct dapl_pz *pz, - enum dat_mem_priv_flags privileges, - DAT_LMR_HANDLE *lmr_handle, - DAT_LMR_CONTEXT *lmr_context, - DAT_RMR_CONTEXT *rmr_context, - u64 *registered_length, - u64 *registered_address) -{ - struct dapl_lmr *lmr; - u32 dat_status = DAT_SUCCESS; - u64 *array = phys_addr.for_array; - - lmr = dapl_lmr_alloc(ia, - DAT_MEM_TYPE_PHYSICAL, - phys_addr, - page_count, (DAT_PZ_HANDLE) pz, privileges); - - if (NULL == lmr) { - dat_status = - DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY); - goto bail; - } - - dat_status = dapl_ib_mr_register_physical(ia, lmr, phys_addr.for_array, - page_count, privileges); - - if (DAT_SUCCESS != dat_status) { - dapl_lmr_dealloc(lmr); - goto bail; - } - - /* if the LMR context is already in the hash table */ - dat_status = dapl_hash_search(ia->hca_ptr->lmr_hash_table, - lmr->param.lmr_context, NULL); - if (dat_status == DAT_SUCCESS) { - (void)dapl_ib_mr_deregister(lmr); - dapl_lmr_dealloc(lmr); - - dat_status = - DAT_ERROR(DAT_INVALID_STATE, DAT_INVALID_STATE_LMR_IN_USE); - goto bail; - } - - dat_status = dapl_hash_insert(ia->hca_ptr->lmr_hash_table, - lmr->param.lmr_context, lmr); - if (dat_status != DAT_SUCCESS) { - (void)dapl_ib_mr_deregister(lmr); - dapl_lmr_dealloc(lmr); - - /* The value returned by dapl_hash_insert(.) is not */ - /* returned to the consumer because the spec. requires */ - /* that dat_lmr_create(.) return only certain values. */ - dat_status = - DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY); - goto bail; - } - - atomic_inc(&pz->pz_ref_count); - - if (lmr_handle) - *lmr_handle = (DAT_LMR_HANDLE) lmr; - if (lmr_context) - *lmr_context = (DAT_LMR_CONTEXT) lmr->param.lmr_context; - if (rmr_context) - *rmr_context = (DAT_LMR_CONTEXT) lmr->param.rmr_context; - if (registered_address) - *registered_address = array[0]; - if (registered_length) - *registered_length = page_count * PAGE_SIZE; - -bail: - return dat_status; -} - -static inline u32 dapl_lmr_create_lmr(struct dapl_ia *ia, - struct dapl_lmr *original_lmr, - struct dapl_pz *pz, - enum dat_mem_priv_flags privileges, - DAT_LMR_HANDLE *lmr_handle, - DAT_LMR_CONTEXT *lmr_context, - DAT_RMR_CONTEXT *rmr_context, - u64 *registered_length, - u64 *registered_address) -{ - struct dapl_lmr *lmr; - DAT_REGION_DESCRIPTION reg_desc; - u32 dat_status; - - dat_status = dapl_hash_search(ia->hca_ptr->lmr_hash_table, - original_lmr->param.lmr_context, - (DAPL_HASH_DATA *) & lmr); - if (dat_status != DAT_SUCCESS) { - dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG2); - goto bail; - } - - reg_desc.for_lmr_handle = (DAT_LMR_HANDLE) original_lmr; - - lmr = dapl_lmr_alloc(ia, DAT_MEM_TYPE_LMR, reg_desc, 0, /* length is meaningless */ - (DAT_PZ_HANDLE) pz, privileges); - - if (NULL == lmr) { - dat_status = - DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY); - goto bail; - } -#if 0 - dat_status = dapl_ib_mr_register_shared(ia, lmr, privileges); -#endif - - if (DAT_SUCCESS != dat_status) { - dapl_lmr_dealloc(lmr); - goto bail; - } - - /* if the LMR context is already in the hash table */ - dat_status = dapl_hash_search(ia->hca_ptr->lmr_hash_table, - lmr->param.lmr_context, NULL); - if (dat_status == DAT_SUCCESS) { - dapl_ib_mr_deregister(lmr); - dapl_lmr_dealloc(lmr); - - dat_status = - DAT_ERROR(DAT_INVALID_STATE, DAT_INVALID_STATE_LMR_IN_USE); - goto bail; - } - - dat_status = dapl_hash_insert(ia->hca_ptr->lmr_hash_table, - lmr->param.lmr_context, lmr); - if (dat_status != DAT_SUCCESS) { - dapl_ib_mr_deregister(lmr); - dapl_lmr_dealloc(lmr); - - /* The value returned by dapl_hash_insert(.) is not */ - /* returned to the consumer because the spec. requires */ - /* that dat_lmr_create(.) return only certain values. */ - dat_status = - DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY); - goto bail; - } - - atomic_inc(&pz->pz_ref_count); - - if (lmr_handle) - *lmr_handle = (DAT_LMR_HANDLE) lmr; - if (lmr_context) - *lmr_context = (DAT_LMR_CONTEXT) lmr->param.lmr_context; - if (rmr_context) - *rmr_context = (DAT_LMR_CONTEXT) lmr->param.rmr_context; - if (registered_address) - *registered_address = (u64) (unsigned long) - original_lmr->param.region_desc.for_va; - if (registered_length) - *registered_length = original_lmr->param.length; -bail: - return dat_status; -} - -/* - * dapl_lmr_kcreate - * - * Register a memory region with an Interface Adaptor. - * - * Input: - * ia_handle - * mem_type - * region_description - * length - * pz_handle - * privileges - * optimization - * - * Output: - * lmr_handle - * lmr_context - * registered_length - * registered_address - * - * Returns: - * DAT_SUCCESS - * DAT_INSUFFICIENT_RESOURCES - * DAT_INVALID_PARAMETER - * DAT_INVALID_HANDLE - * DAT_INVALID_STATE - * DAT_MODEL_NOT_SUPPORTED - * - */ -u32 dapl_lmr_kcreate(DAT_IA_HANDLE ia_handle, enum dat_mem_type mem_type, - DAT_REGION_DESCRIPTION region_description, u64 length, - DAT_PZ_HANDLE pz_handle, - enum dat_mem_priv_flags privileges, - enum dat_mem_optimize_flags optimization, DAT_LMR_HANDLE *lmr_handle, - DAT_LMR_CONTEXT *lmr_context, DAT_RMR_CONTEXT *rmr_context, u64 *registered_length, u64 *registered_address) -{ - struct dapl_ia *ia; - struct dapl_pz *pz; - u32 dat_status; - - dapl_dbg_log(DAPL_DBG_TYPE_API, - "dapl_lmr_kcreate(ia:%p, mem_type:%x, ...)\n", - ia_handle, mem_type); - - if (DAPL_BAD_HANDLE(ia_handle, DAPL_MAGIC_IA)) { - dat_status = - DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA); - goto bail; - } - if (DAPL_BAD_HANDLE(pz_handle, DAPL_MAGIC_PZ)) { - dat_status = - DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PZ); - goto bail; - } - - ia = (struct dapl_ia *)ia_handle; - pz = (struct dapl_pz *)pz_handle; - - switch (mem_type) { - case DAT_MEM_TYPE_VIRTUAL: - { - dat_status = - DAT_ERROR(DAT_NOT_IMPLEMENTED, DAT_NO_SUBTYPE); - break; - /* - dat_status = dapl_lmr_create_virtual ( - ia, region_description.for_va, length, pz, privileges, - lmr_handle, lmr_context, rmr_context, registered_length, - registered_address); - break; - */ - } - case DAT_MEM_TYPE_PHYSICAL: - { - dat_status = - dapl_lmr_create_physical(ia, region_description, - length, pz, privileges, - lmr_handle, lmr_context, - rmr_context, - registered_length, - registered_address); - break; - } - case DAT_MEM_TYPE_LMR: - { - struct dapl_lmr *lmr; - - if (DAPL_BAD_HANDLE - (region_description.for_lmr_handle, - DAPL_MAGIC_LMR)) { - dat_status = - DAT_ERROR(DAT_INVALID_HANDLE, - DAT_INVALID_HANDLE_LMR); - goto bail; - } - - lmr = (struct dapl_lmr *)region_description.for_lmr_handle; - - dat_status = - dapl_lmr_create_lmr(ia, lmr, pz, privileges, - lmr_handle, lmr_context, - rmr_context, registered_length, - registered_address); - break; - } - case DAT_MEM_TYPE_PLATFORM: - case DAT_MEM_TYPE_IA: - case DAT_MEM_TYPE_BYPASS: - { - dat_status = - DAT_ERROR(DAT_NOT_IMPLEMENTED, DAT_NO_SUBTYPE); - break; - } - default: - { - dat_status = - DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG2); - break; - } - } - -bail: - return dat_status; -} Index: linux-kernel-lmr/patches/alt_dat_provider_makefile =================================================================== --- linux-kernel-lmr/patches/alt_dat_provider_makefile (revision 2475) +++ linux-kernel-lmr/patches/alt_dat_provider_makefile (working copy) @@ -16,7 +16,6 @@ PROVIDER_MODULES := \ dapl_evd_kquery \ dapl_evd_kcreate \ dapl_evd_modify_upcall \ - dapl_lmr_kcreate \ dapl_cookie \ dapl_cno_util \ dapl_cr_accept \ @@ -61,11 +60,7 @@ PROVIDER_MODULES := \ dapl_ia_query \ dapl_ia_util \ dapl_llist \ - dapl_lmr_free \ - dapl_lmr_query \ - dapl_lmr_sync_rdma_read \ - dapl_lmr_sync_rdma_write \ - dapl_lmr_util \ + dapl_lmr \ dapl_mr_util \ dapl_provider \ dapl_sp_util \ @@ -73,10 +68,7 @@ PROVIDER_MODULES := \ dapl_psp_create_any \ dapl_psp_free \ dapl_psp_query \ - dapl_pz_create \ - dapl_pz_free \ - dapl_pz_query \ - dapl_pz_util \ + dapl_pz \ dapl_ring_buffer_util \ dapl_rmr_bind \ dapl_rmr_create \ _______________________________________________ openib-general mailing list [email protected] http://openib.org/mailman/listinfo/openib-general To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general
