4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.
27 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
28 * Use is subject to license terms.
33 * MODULE: dapl_rmr_free.c
35 * PURPOSE: Memory management
36 * Description: Interfaces in this file are completely described in
37 * the DAPL 1.1 API, Chapter 6, section 6
41 #include "dapl_rmr_util.h"
42 #include "dapl_adapter_util.h"
43 #include "dapl_ia_util.h"
48 * DAPL Requirements Version xxx, 6.6.4.2
50 * Destroy an instance of the Remote Memory Region
60 * DAT_INVALID_PARAMETER
63 dapl_rmr_free(IN DAT_RMR_HANDLE rmr_handle
)
66 DAT_RETURN dat_status
;
68 dat_status
= DAT_SUCCESS
;
70 if (DAPL_BAD_HANDLE(rmr_handle
, DAPL_MAGIC_RMR
)) {
71 dat_status
= DAT_ERROR(DAT_INVALID_HANDLE
,
72 DAT_INVALID_HANDLE_RMR
);
76 rmr
= (DAPL_RMR
*)rmr_handle
;
79 * If the user did not perform an unbind op, release
82 if (rmr
->param
.lmr_triplet
.virtual_address
!= 0) {
83 dapl_os_atomic_dec(&rmr
->lmr
->lmr_ref_count
);
84 rmr
->param
.lmr_triplet
.virtual_address
= 0;
87 dat_status
= dapls_ib_mw_free(rmr
);
89 if (dat_status
!= DAT_SUCCESS
) {
93 dapl_os_atomic_dec(&rmr
->pz
->pz_ref_count
);
95 dapl_rmr_dealloc(rmr
);