/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
*
* MODULE: dapl_lmr_create.c
*
* PURPOSE: Memory management
* Description: Interfaces in this file are completely described in
* the DAPL 1.1 API, Chapter 6, section 6
*
*/
#include <dapl_lmr_util.h>
#include <dapl_adapter_util.h>
#include <libdevinfo.h>
/*
* Function Prototypes
*/
static DAT_RETURN
static DAT_RETURN
/*
* Function Definitions
*/
static DAT_RETURN
{
goto bail;
}
if (shm_cookie == NULL) {
length, privileges);
} else {
}
if (DAT_SUCCESS != dat_status) {
goto bail;
}
/* if the LMR context is already in the hash table */
if (dat_status == DAT_SUCCESS) {
(void) dapls_ib_mr_deregister(lmr);
goto bail;
}
if (dat_status != DAT_SUCCESS) {
(void) dapls_ib_mr_deregister(lmr);
/*
* The value returned by dapls_hash_insert(.) is not
* returned to the consumer because the spec. requires
* that dat_lmr_create(.) return only certain values.
*/
goto bail;
}
if (NULL != lmr_handle) {
}
if (NULL != lmr_context) {
}
if (NULL != rmr_context) {
}
if (NULL != registered_length) {
}
if (NULL != registered_address) {
}
bail:
return (dat_status);
}
static DAT_RETURN
{
"dapl_lmr_create_lmr (%p, %p, %p, %x, %p, %p, %p, %p)\n",
ia,
pz, privileges,
(DAPL_HASH_DATA *) & lmr);
if (dat_status != DAT_SUCCESS) {
goto bail;
}
goto bail;
}
if (DAT_SUCCESS != dat_status) {
goto bail;
}
/* if the LMR context is already in the hash table */
if (dat_status == DAT_SUCCESS) {
(void) dapls_ib_mr_deregister(lmr);
goto bail;
}
if (dat_status != DAT_SUCCESS) {
(void) dapls_ib_mr_deregister(lmr);
/*
* The value returned by dapls_hash_insert(.) is not
* returned to the consumer because the spec. requires
* that dat_lmr_create(.) return only certain values.
*/
goto bail;
}
if (NULL != lmr_handle) {
}
if (NULL != lmr_context) {
}
if (NULL != rmr_context) {
}
if (NULL != registered_length) {
}
if (NULL != registered_address) {
}
bail:
return (dat_status);
}
/*
* dapl_lmr_create
*
* DAPL Requirements Version xxx, 6.6.3.1
*
* Register a memory region with an Interface Adaptor.
*
* Input:
* ia_handle
* mem_type
* region_description
* length
* pz_handle
* privileges
*
* Output:
* lmr_handle
* lmr_context
* registered_length
* registered_address
*
* Returns:
* DAT_SUCCESS
* DAT_INSUFFICIENT_RESOURCES
* DAT_INVALID_PARAMETER
* DAT_INVALID_STATE
* DAT_MODEL_NOT_SUPPORTED
*
*/
{
return (DAT_INVALID_HANDLE);
}
if (length == 0) {
}
/* Always ignore this bit as it is passed in */
/*
* If at open time we determined that RO should not be used,
* note it here.
*/
switch (mem_type) {
case DAT_MEM_TYPE_SO_VIRTUAL:
/* FALLTHROUGH */
case DAT_MEM_TYPE_VIRTUAL:
/* NOTREACHED */
case DAT_MEM_TYPE_LMR: {
if (DAPL_BAD_HANDLE
return (DAT_INVALID_HANDLE);
}
/* NOTREACHED */
}
return (dapl_lmr_create_virtual(ia,
/* NOTREACHED */
default:
return (DAT_INVALID_PARAMETER);
}
}