/*
* 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_ia_util.c
*
* PURPOSE: Manage IA Info structure
*
* $Id: dapl_ia_util.c,v 1.29 2003/07/25 19:24:11 sjs2 Exp $
*/
#include "dapl.h"
#include "dapl_hca_util.h"
#include "dapl_ia_util.h"
#include "dapl_evd_util.h"
#include "dapl_adapter_util.h"
/* Internal prototype */
void dapli_ia_release_hca(
/*
* dapl_ia_alloc
*
* alloc and initialize an IA INFO struct
*
* Input:
* none
*
* Output:
* ia_ptr
*
* Returns:
* none
*
*/
DAPL_IA *
{
/* Allocate IA */
return (NULL);
}
/* zero the structure */
/*
* initialize the header
*/
/*
* initialize the body
*/
/*
* initialize the flags
*/
ia_ptr->dapl_flags = 0;
return (ia_ptr);
}
/*
* dapl_ia_abrupt_close
*
* Performs an abrupt close of the IA
*
* Input:
* ia_ptr
*
* Output:
* none
*
* Returns:
* status
*
*/
{
/*
* clear all the data structures associated with the IA.
* this must be done in order (rmr,rsp) before (ep lmr psp) before
* (pz evd)
*
* Note that in all the following we can leave the loop either
* when we run out of entries, or when we get back to the head
* if we end up skipping an entry.
*/
if (dat_status != DAT_SUCCESS) {
"ia_close(ABRUPT): rmr_free(%p) returns %x\n",
}
}
if (dat_status != DAT_SUCCESS) {
"ia_close(ABRUPT): rsp_free(%p) returns %x\n",
}
}
if (dat_status != DAT_SUCCESS) {
"ia_close(ABRUPT): ep_disconnect(%p) returns %x\n",
}
if (dat_status != DAT_SUCCESS) {
"ia_close(ABRUPT): ep_free(%p) returns %x\n",
}
}
if (dat_status != DAT_SUCCESS) {
"ia_close(ABRUPT): lmr_free(%p) returns %x\n",
}
}
if (dat_status != DAT_SUCCESS) {
"ia_close(ABRUPT): psp_free(%p) returns %x\n",
}
}
if (dat_status != DAT_SUCCESS) {
"ia_close(ABRUPT): pz_free(%p) returns %x\n",
}
}
/*
* EVDs are tricky; we want to release all except for the async
* EVD. That EVD needs to stick around until after we close the
* HCA, to accept any async events that occur. So we cycle through
* the list with dapl_llist_next_entry instead of dapl_llist_is_empty.
*/
/*
* Don't delete the EVD, but break any CNO
* connections.
*/
(void) dapl_evd_disable(evd_ptr);
(void) dapl_evd_modify_cno(evd_ptr,
} else {
/* it isn't the async EVD; delete it. */
if (dat_status != DAT_SUCCESS) {
"ia_close(ABRUPT): evd_free(%p) "
"returns %x\n",
}
}
}
if (dat_status != DAT_SUCCESS) {
"ia_close(ABRUPT): cno_free(%p) returns %x\n",
}
}
/*
* Free the async EVD, shutting down callbacks from the HCA.
*/
if (ia_ptr->async_error_evd &&
if (DAT_SUCCESS != dat_status) {
"ia_close(ABRUPT): evd_free(%p) returns %x\n",
}
}
/*
* Release our reference on the hca_handle. If we are the last
* one, close it
*/
return (DAT_SUCCESS); /* Abrupt close can't fail. */
}
/*
* dapl_ia_graceful_close
*
* Performs an graceful close of the IA
*
* Input:
* ia_ptr
*
* Output:
* none
*
* Returns:
* status
*
*/
{
goto bail;
}
/* if the async evd does not need to be cleaned up */
/* (ie. it was not created by dapl_ia_open) */
/* then the evd list should be empty */
goto bail;
}
} else {
/* else the async evd should be the only evd in */
/* the list. */
goto bail;
}
/* if the async evd is not the only element in the list */
goto bail;
}
/*
* If the async evd has a non-unary ref count (i.e. it's in
* use by someone besides us.
*/
goto bail;
}
}
/*
* We've validated the call; now we can start the teardown.
* Because we're in the IA close routine, we're safe from races with
* DAPL).
*/
/* Tear down the async EVD if needed, first shutting down callbacks. */
if (ia_ptr->async_error_evd &&
if (DAT_SUCCESS != cur_dat_status) {
}
if (DAT_SUCCESS != cur_dat_status) {
}
}
bail:
return (dat_status);
}
/*
* Release a reference on the HCA handle. If it is 0, close the
* handle. Manipulate under lock to prevent races with threads trying to
* open the HCA.
*/
void
{
if (hca_ptr->handle_ref_count == 0) {
/*
* Get rid of the cqd associated with the hca.
* Print out instead of status return as this routine
* shouldn't fail.
*/
if (dat_status != DAT_SUCCESS) {
"ERR: Cannot free CQD: err %x\n", dat_status);
}
}
}
/*
* dapls_ia_free
*
* free an IA INFO struct
*
* Input:
* ia_ptr
*
* Output:
* one
*
* Returns:
* none
*
*/
void
{
/*
* deinitialize the header
*/
/* reset magic to prevent reuse */
}
/*
* dapl_ia_link_ep
*
* Add an ep to the IA structure
*
* Input:
* ia_ptr
* ep_ptr
*
* Output:
* none
*
* Returns:
* none
*
*/
void
{
ep_ptr);
}
/*
* dapl_ia_unlink_ep
*
* Remove an ep from the ia info structure
*
* Input:
* ia_ptr
* ep_ptr
*
* Output:
* none
*
* Returns:
* none
*
*/
void
{
}
/*
* dapl_ia_link_lmr
*
* Add an lmr to the IA structure
*
* Input:
* ia_ptr
* lmr_ptr
*
* Output:
* none
*
* Returns:
* none
*
*/
void
{
lmr_ptr);
}
/*
* dapl_ia_unlink_lmr
*
* Remove an lmr from the ia info structure
*
* Input:
* ia_ptr
* lmr_ptr
*
* Output:
* none
*
* Returns:
* none
*
*/
void
{
}
/*
* dapl_ia_link_rmr
*
* Add an rmr to the IA structure
*
* Input:
* ia_ptr
* rmr_ptr
*
* Output:
* none
*
* Returns:
* none
*
*/
void
{
rmr_ptr);
}
/*
* dapl_ia_unlink_rmr
*
* Remove an rmr from the ia info structure
*
* Input:
* ia_ptr
* rmr_ptr
*
* Output:
* none
*
* Returns:
* none
*
*/
void
{
}
/*
* dapl_ia_link_pz
*
* Add an pz to the IA structure
*
* Input:
* ia_ptr
* pz_ptr
*
* Output:
* none
*
* Returns:
* none
*
*/
void
{
pz_ptr);
}
/*
* dapl_ia_unlink_pz
*
* Remove an pz from the ia info structure
*
* Input:
* ia_ptr
* pz_ptr
*
* Output:
* none
*
* Returns:
* none
*
*/
void
{
}
/*
* dapl_ia_link_evd
*
* Add an evd to the IA structure
*
* Input:
* ia_ptr
* evd_ptr
*
* Output:
* none
*
* Returns:
* none
*
*/
void
{
evd_ptr);
}
/*
* dapl_ia_unlink_evd
*
* Remove an evd from the ia info structure
*
* Input:
* ia_ptr
* evd_ptr
*
* Output:
* none
*
* Returns:
* none
*
*/
void
{
}
/*
* dapl_ia_link_cno
*
* Add an cno to the IA structure
*
* Input:
* ia_ptr
* cno_ptr
*
* Output:
* none
*
* Returns:
* none
*
*/
void
{
cno_ptr);
}
/*
* dapl_ia_unlink_cno
*
* Remove an cno from the ia info structure
*
* Input:
* ia_ptr
* cno_ptr
*
* Output:
* none
*
* Returns:
* none
*
*/
void
{
}
/*
* dapl_ia_link_psp
*
* Add an psp to the IA structure
*
* Input:
* ia_ptr
* sp_ptr
*
* Output:
* none
*
* Returns:
* none
*
*/
void
{
sp_ptr);
}
/*
* daps_ia_unlink_sp
*
* Remove an sp from the appropriate ia rsp or psp queue
*
* Input:
* ia_ptr
* sp_ptr
*
* Output:
* none
*
* Returns:
* none
*
*/
void
{
} else {
}
(void) dapl_llist_remove_entry(list_head,
}
/*
* dapls_ia_sp_search
*
* Find an RSP or PSP on the IA list with a matching conn_qual value
*
* Input:
* ia_ptr
* sp_ptr
*
* Output:
* none
*
* Returns:
* none
*
*/
DAPL_SP *
{
if (is_psp) {
} else {
}
break;
}
}
return (sp_ptr);
}
/*
* dapl_ia_link_rsp
*
* Add an rsp to the IA structure
*
* Input:
* ia_ptr
* sp_ptr
*
* Output:
* none
*
* Returns:
* none
*
*/
void
{
sp_ptr);
}
/*
* dapl_ia_link_srq
*
* Add an srq to the IA structure
*
* Input:
* ia_ptr
* srq_ptr
*
* Output:
* none
*
* Returns:
* none
*
*/
void
{
srq_ptr);
}
/*
* dapl_ia_unlink_srq
*
* Remove an srq from the ia info structure
*
* Input:
* ia_ptr
* srq_ptr
*
* Output:
* none
*
* Returns:
* none
*
*/
void
{
}
{
/* unaffiliated handler */
NULL,
if (dat_status != DAT_SUCCESS) {
"ib_set_un_async_error_eh failed %d\n",
goto bail;
}
/* affiliated cq handler */
NULL,
if (dat_status != DAT_SUCCESS) {
"ib_set_cq_async_error_eh failed %d\n",
goto bail;
}
/* affiliated qp handler */
NULL,
ia_ptr);
if (dat_status != DAT_SUCCESS) {
"ib_set_qp_async_error_eh failed %d\n",
goto bail;
}
bail:
return (dat_status);
}
{
/* unaffiliated handler */
NULL,
NULL);
if (dat_status != DAT_SUCCESS) {
"ib_set_un_async_error_eh failed %d\n",
goto bail;
}
/* affiliated cq handler */
NULL,
NULL);
if (dat_status != DAT_SUCCESS) {
"ib_set_cq_async_error_eh failed %d\n",
goto bail;
}
/* affiliated qp handler */
NULL,
NULL);
if (dat_status != DAT_SUCCESS) {
"ib_set_qp_async_error_eh failed %d\n",
goto bail;
}
bail:
return (dat_status);
}