Signed-off-by: Tom Duffy <[EMAIL PROTECTED]> diff -Nurp -X /home/tduffy/dontdiff linux-kernel-rsp/dat-provider/dapl_psp.c linux-kernel-psp/dat-provider/dapl_psp.c --- linux-kernel-rsp/dat-provider/dapl_psp.c 1969-12-31 16:00:00.000000000 -0800 +++ linux-kernel-psp/dat-provider/dapl_psp.c 2005-05-25 15:11:42.274000000 -0700 @@ -0,0 +1,446 @@ +/* + * 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_psp_create_any.c 2462 2005-05-24 02:28:24Z jlentini $ + */ + +#include "dapl.h" +#include "dapl_sp_util.h" +#include "dapl_ia_util.h" +#include "dapl_openib_util.h" + +/* + * dapl_psp_create_any + * + * Create a persistent Public Service Point that can recieve multiple + * requests for connections and generate multiple connection request + * instances that wil be delivered to the specified Event Dispatcher + * in a notification event. Differs from dapl_psp_create() in that + * the conn_qual is selected by the implementation and returned to + * the user. + * + * Input: + * ia_handle + * evd_handle + * psp_flags + * + * Output: + * conn_qual + * psp_handle + * + * Returns: + * DAT_SUCCESS + * DAT_INSUFFICIENT_RESOURCES + * DAT_INVALID_HANDLE + * DAT_INVALID_PARAMETER + * DAT_CONN_QUAL_IN_USE + * DAT_MODEL_NOT_SUPPORTED + */ +u32 dapl_psp_create_any(DAT_IA_HANDLE ia_handle, DAT_CONN_QUAL *conn_qual, + DAT_EVD_HANDLE evd_handle, enum dat_psp_flags psp_flags, + DAT_PSP_HANDLE *psp_handle) +{ + static DAT_CONN_QUAL hint_conn_qual = 1000; /* seed value */ + struct dapl_ia *ia_ptr; + struct dapl_sp *sp_ptr; + struct dapl_evd *evd_ptr; + u32 status = DAT_SUCCESS; + int i; + + ia_ptr = (struct dapl_ia *)ia_handle; + + if (DAPL_BAD_HANDLE(ia_ptr, DAPL_MAGIC_IA)) { + status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA); + goto bail; + } + if (DAPL_BAD_HANDLE(evd_handle, DAPL_MAGIC_EVD)) { + status = + DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EVD_CR); + goto bail; + } + + if (psp_handle == NULL) { + status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG5); + goto bail; + } + if (conn_qual == NULL) { + status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG2); + goto bail; + } + + evd_ptr = (struct dapl_evd *)evd_handle; + if (!(evd_ptr->evd_flags & DAT_EVD_CR_FLAG)) { + status = DAT_ERROR(DAT_INVALID_HANDLE, + DAT_INVALID_HANDLE_EVD_CR); + goto bail; + } + + if (psp_flags != DAT_PSP_CONSUMER_FLAG && + psp_flags != DAT_PSP_PROVIDER_FLAG) { + status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG4); + goto bail; + } + + /* Allocate PSP */ + sp_ptr = dapl_sp_alloc(ia_ptr, TRUE); + if (sp_ptr == NULL) { + status = DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, + DAT_RESOURCE_MEMORY); + goto bail; + } + + /* + * Fill out the args for a PSP + */ + sp_ptr->ia_handle = ia_handle; + sp_ptr->evd_handle = evd_handle; + sp_ptr->psp_flags = psp_flags; + sp_ptr->ep_handle = NULL; + + /* + * Take a reference on the EVD handle + */ + atomic_inc(&evd_ptr->evd_ref_count); + + /* Link it onto the IA */ + dapl_ia_link_psp(ia_ptr, sp_ptr); + + /* + * Set up a listener for a connection. Connections can arrive + * even before this call returns! + */ + sp_ptr->state = DAPL_SP_STATE_PSP_LISTENING; + sp_ptr->listening = TRUE; + + /* + * If we have a big number of tries and we still haven't + * found a service_ID we can use, bail out with an error, + * something is wrong! + */ + for (i = 0, sp_ptr->conn_qual = hint_conn_qual; i < 100000; i++) { + status = dapl_ib_setup_conn_listener(ia_ptr, sp_ptr); + if (DAT_SUCCESS == status) + break; + else + sp_ptr->conn_qual++; + } + hint_conn_qual = sp_ptr->conn_qual + 1; + + if (status != DAT_SUCCESS) { + atomic_dec(&evd_ptr->evd_ref_count); + sp_ptr->evd_handle = NULL; + dapl_ia_unlink_sp(ia_ptr, sp_ptr); + dapl_sp_dealloc(sp_ptr); + + dapl_dbg_log(DAPL_DBG_TYPE_ERR, + "dapl_psp_create cannot set up conn listener: %x\n", + status); + + goto bail; + } + + /* + * Return handle to the user + */ + *conn_qual = sp_ptr->conn_qual; + *psp_handle = (DAT_PSP_HANDLE) sp_ptr; + +bail: + return status; +} + +/* + * dapl_psp_create + * + * Create a persistent Public Service Point that can recieve multiple + * requests for connections and generate multiple connection request + * instances that wil be delivered to the specified Event Dispatcher + * in a notification event. + * + * Input: + * ia_handle + * conn_qual + * evd_handle + * psp_flags + * + * Output: + * psp_handle + * + * Returns: + * DAT_SUCCESS + * DAT_INSUFFICIENT_RESOURCES + * DAT_INVALID_PARAMETER + * DAT_CONN_QUAL_IN_USE + * DAT_MODEL_NOT_SUPPORTED + */ +u32 dapl_psp_create(DAT_IA_HANDLE ia_handle, DAT_CONN_QUAL conn_qual, + DAT_EVD_HANDLE evd_handle, enum dat_psp_flags psp_flags, + DAT_PSP_HANDLE *psp_handle) +{ + struct dapl_ia *ia_ptr; + struct dapl_sp *sp_ptr; + struct dapl_evd *evd_ptr; + boolean_t sp_found; + u32 status = DAT_SUCCESS; + + ia_ptr = (struct dapl_ia *)ia_handle; + + if (DAPL_BAD_HANDLE(ia_ptr, DAPL_MAGIC_IA)) { + status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA); + goto bail; + } + if (DAPL_BAD_HANDLE(evd_handle, DAPL_MAGIC_EVD)) { + status = DAT_ERROR(DAT_INVALID_HANDLE, + DAT_INVALID_HANDLE_EVD_CR); + goto bail; + } + + if (psp_handle == NULL) { + status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG5); + goto bail; + } + + evd_ptr = (struct dapl_evd *)evd_handle; + if (!(evd_ptr->evd_flags & DAT_EVD_CR_FLAG)) { + status = DAT_ERROR(DAT_INVALID_HANDLE, + DAT_INVALID_HANDLE_EVD_CR); + goto bail; + } + + if (psp_flags != DAT_PSP_CONSUMER_FLAG && + psp_flags != DAT_PSP_PROVIDER_FLAG) { + status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG4); + goto bail; + } + + /* + * See if we have a quiescent listener to use for this PSP, else + * create one and set it listening + */ + sp_ptr = dapl_ia_sp_search(ia_ptr, conn_qual, TRUE); + sp_found = TRUE; + if (sp_ptr == NULL) { + /* Allocate PSP */ + sp_found = FALSE; + sp_ptr = dapl_sp_alloc(ia_ptr, TRUE); + if (sp_ptr == NULL) { + status = DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, + DAT_RESOURCE_MEMORY); + goto bail; + } + } else if (sp_ptr->listening == TRUE) { + status = DAT_ERROR(DAT_CONN_QUAL_IN_USE, 0); + goto bail; + } + + /* + * Fill out the args for a PSP + */ + sp_ptr->ia_handle = ia_handle; + sp_ptr->conn_qual = conn_qual; + sp_ptr->evd_handle = evd_handle; + sp_ptr->psp_flags = psp_flags; + sp_ptr->ep_handle = NULL; + + /* + * Take a reference on the EVD handle + */ + atomic_inc(&evd_ptr->evd_ref_count); + + /* + * Set up a listener for a connection. Connections can arrive + * even before this call returns! + */ + sp_ptr->state = DAPL_SP_STATE_PSP_LISTENING; + sp_ptr->listening = TRUE; + + /* + * If this is a new sp we need to add it to the IA queue, and set up + * a conn_listener. + */ + if (sp_found == FALSE) { + /* + * Link it onto the IA before enabling it to receive conn + * requests + */ + dapl_ia_link_psp(ia_ptr, sp_ptr); + + status = dapl_ib_setup_conn_listener(ia_ptr, sp_ptr); + + if (status != DAT_SUCCESS) { + /* + * Have a problem setting up the connection, something + * wrong! Decrements the EVD refcount & release it. + */ + atomic_dec(&evd_ptr->evd_ref_count); + sp_ptr->evd_handle = NULL; + dapl_ia_unlink_sp(ia_ptr, sp_ptr); + dapl_sp_dealloc(sp_ptr); + + dapl_dbg_log(DAPL_DBG_TYPE_CM, "dapl_psp_create " + "setup_conn_listener failed: %x\n", + status); + + goto bail; + } + } + + /* + * Return handle to the user + */ + *psp_handle = (DAT_PSP_HANDLE) sp_ptr; + +bail: + return status; +} + +/* + * dapl_psp_free + * + * Destroy a specific instance of a Service Point. + * + * Input: + * psp_handle + * + * Output: + * none + * + * Returns: + * DAT_SUCCESS + * DAT_INVALID_PARAMETER + */ +u32 dapl_psp_free(DAT_PSP_HANDLE psp_handle) +{ + struct dapl_ia *ia_ptr; + struct dapl_sp *sp_ptr; + DAPL_SP_STATE save_state; + u32 status = DAT_SUCCESS; + + sp_ptr = (struct dapl_sp *)psp_handle; + /* + * Verify handle + */ + dapl_dbg_log(DAPL_DBG_TYPE_CM, ">>> dapl_psp_free %p\n", psp_handle); + + if (DAPL_BAD_HANDLE(sp_ptr, DAPL_MAGIC_PSP)) { + status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PSP); + goto bail; + } + + /* ia_ptr = (struct dapl_ia *)sp_ptr->header.owner_ia; */ + ia_ptr = sp_ptr->header.owner_ia; + /* + * Remove the connection listener if it has been established + * and there are no current connections in progress. + * If we defer removing the sp it becomes something of a zombie + * container until the last connection is disconnected, after + * which it will be cleaned up. + */ + spin_lock_irqsave(&sp_ptr->header.lock, sp_ptr->header.flags); + + sp_ptr->listening = FALSE; + + /* + * Release reference on EVD. If an error was encountered in a previous + * free the evd_handle will be NULL + */ + if (sp_ptr->evd_handle) { + atomic_dec(&((struct dapl_evd *)sp_ptr->evd_handle)-> + evd_ref_count); + sp_ptr->evd_handle = NULL; + } + + /* + * Release the base resource if there are no outstanding + * connections; else the last disconnect on this PSP will free it + * up. The PSP is used to contain CR records for each connection, + * which contain information necessary to disconnect. + */ + dapl_dbg_log(DAPL_DBG_TYPE_CM, + ">>> dapl_psp_free: state %d cr_list_count %d\n", + sp_ptr->state, sp_ptr->cr_list_count); + if ((sp_ptr->state == DAPL_SP_STATE_PSP_LISTENING || + sp_ptr->state == DAPL_SP_STATE_PSP_PENDING) && + sp_ptr->cr_list_count == 0) { + save_state = sp_ptr->state; + sp_ptr->state = DAPL_SP_STATE_FREE; + spin_unlock_irqrestore(&sp_ptr->header.lock, + sp_ptr->header.flags); + + status = dapl_ib_remove_conn_listener(ia_ptr, sp_ptr); + if (status != DAT_SUCCESS) { + /* revert to entry state on error */ + sp_ptr->state = save_state; + goto bail; + } + dapl_ia_unlink_sp(ia_ptr, sp_ptr); + dapl_sp_dealloc(sp_ptr); + } else { + /* + * The PSP is now in the pending state, where it will sit until + * the last connection terminates or the app uses the same + * ServiceID again, which will reactivate it. + */ + sp_ptr->state = DAPL_SP_STATE_PSP_PENDING; + spin_unlock_irqrestore(&sp_ptr->header.lock, sp_ptr->header.flags); + dapl_dbg_log(DAPL_DBG_TYPE_CM, + ">>> dapl_psp_free: PSP PENDING\n"); + } + +bail: + return status; +} + +u32 dapl_psp_query(DAT_PSP_HANDLE psp_handle, struct dat_psp_param *psp_param) +{ + struct dapl_sp *sp_ptr; + u32 status; + + if (DAPL_BAD_HANDLE(psp_handle, DAPL_MAGIC_PSP) || + ((struct dapl_sp *)psp_handle)->listening != TRUE) { + status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PSP); + goto bail; + } + + if (NULL == psp_param) { + status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3); + goto bail; + } + + sp_ptr = (struct dapl_sp *)psp_handle; + + psp_param->ia_handle = sp_ptr->ia_handle; + psp_param->conn_qual = sp_ptr->conn_qual; + psp_param->evd_handle = sp_ptr->evd_handle; + psp_param->psp_flags = sp_ptr->psp_flags; + + status = DAT_SUCCESS; + +bail: + return status; +} diff -Nurp -X /home/tduffy/dontdiff linux-kernel-rsp/dat-provider/dapl_psp_create_any.c linux-kernel-psp/dat-provider/dapl_psp_create_any.c --- linux-kernel-rsp/dat-provider/dapl_psp_create_any.c 2005-05-23 22:21:46.111018000 -0700 +++ linux-kernel-psp/dat-provider/dapl_psp_create_any.c 1969-12-31 16:00:00.000000000 -0800 @@ -1,177 +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: dapl_psp_create_any.c 2462 2005-05-24 02:28:24Z jlentini $ - */ - -#include "dapl.h" -#include "dapl_sp_util.h" -#include "dapl_ia_util.h" -#include "dapl_openib_util.h" - -/* - * dapl_psp_create_any - * - * Create a persistent Public Service Point that can recieve multiple - * requests for connections and generate multiple connection request - * instances that wil be delivered to the specified Event Dispatcher - * in a notification event. Differs from dapl_psp_create() in that - * the conn_qual is selected by the implementation and returned to - * the user. - * - * Input: - * ia_handle - * evd_handle - * psp_flags - * - * Output: - * conn_qual - * psp_handle - * - * Returns: - * DAT_SUCCESS - * DAT_INSUFFICIENT_RESOURCES - * DAT_INVALID_HANDLE - * DAT_INVALID_PARAMETER - * DAT_CONN_QUAL_IN_USE - * DAT_MODEL_NOT_SUPPORTED - */ -u32 dapl_psp_create_any(DAT_IA_HANDLE ia_handle, DAT_CONN_QUAL *conn_qual, - DAT_EVD_HANDLE evd_handle, enum dat_psp_flags psp_flags, - DAT_PSP_HANDLE *psp_handle) -{ - static DAT_CONN_QUAL hint_conn_qual = 1000; /* seed value */ - struct dapl_ia *ia_ptr; - struct dapl_sp *sp_ptr; - struct dapl_evd *evd_ptr; - u32 status = DAT_SUCCESS; - int i; - - ia_ptr = (struct dapl_ia *)ia_handle; - - if (DAPL_BAD_HANDLE(ia_ptr, DAPL_MAGIC_IA)) { - status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA); - goto bail; - } - if (DAPL_BAD_HANDLE(evd_handle, DAPL_MAGIC_EVD)) { - status = - DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EVD_CR); - goto bail; - } - - if (psp_handle == NULL) { - status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG5); - goto bail; - } - if (conn_qual == NULL) { - status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG2); - goto bail; - } - - evd_ptr = (struct dapl_evd *)evd_handle; - if (!(evd_ptr->evd_flags & DAT_EVD_CR_FLAG)) { - status = - DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EVD_CR); - goto bail; - } - - if (psp_flags != DAT_PSP_CONSUMER_FLAG && - psp_flags != DAT_PSP_PROVIDER_FLAG) { - status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG4); - goto bail; - } - - /* Allocate PSP */ - sp_ptr = dapl_sp_alloc(ia_ptr, TRUE); - if (sp_ptr == NULL) { - status = - DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY); - goto bail; - } - - /* - * Fill out the args for a PSP - */ - sp_ptr->ia_handle = ia_handle; - sp_ptr->evd_handle = evd_handle; - sp_ptr->psp_flags = psp_flags; - sp_ptr->ep_handle = NULL; - - /* - * Take a reference on the EVD handle - */ - atomic_inc(&evd_ptr->evd_ref_count); - - /* Link it onto the IA */ - dapl_ia_link_psp(ia_ptr, sp_ptr); - - /* - * Set up a listener for a connection. Connections can arrive - * even before this call returns! - */ - sp_ptr->state = DAPL_SP_STATE_PSP_LISTENING; - sp_ptr->listening = TRUE; - - /* - * If we have a big number of tries and we still haven't - * found a service_ID we can use, bail out with an error, - * something is wrong! - */ - for (i = 0, sp_ptr->conn_qual = hint_conn_qual; i < 100000; i++) { - - status = dapl_ib_setup_conn_listener(ia_ptr, sp_ptr); - - if (DAT_SUCCESS == status) - break; - else - sp_ptr->conn_qual++; - } - hint_conn_qual = sp_ptr->conn_qual + 1; - - if (status != DAT_SUCCESS) { - atomic_dec(&evd_ptr->evd_ref_count); - sp_ptr->evd_handle = NULL; - dapl_ia_unlink_sp(ia_ptr, sp_ptr); - dapl_sp_dealloc(sp_ptr); - - dapl_dbg_log(DAPL_DBG_TYPE_ERR, - "dapl_psp_create cannot set up conn listener: %x\n", - status); - - goto bail; - } - - /* - * Return handle to the user - */ - *conn_qual = sp_ptr->conn_qual; - *psp_handle = (DAT_PSP_HANDLE) sp_ptr; - - bail: - return status; -} diff -Nurp -X /home/tduffy/dontdiff linux-kernel-rsp/dat-provider/dapl_psp_create.c linux-kernel-psp/dat-provider/dapl_psp_create.c --- linux-kernel-rsp/dat-provider/dapl_psp_create.c 2005-05-23 22:21:46.086003000 -0700 +++ linux-kernel-psp/dat-provider/dapl_psp_create.c 1969-12-31 16:00:00.000000000 -0800 @@ -1,181 +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: dapl_psp_create.c 2462 2005-05-24 02:28:24Z jlentini $ - */ - -#include "dapl.h" -#include "dapl_sp_util.h" -#include "dapl_ia_util.h" -#include "dapl_openib_util.h" - -/* - * dapl_psp_create - * - * Create a persistent Public Service Point that can recieve multiple - * requests for connections and generate multiple connection request - * instances that wil be delivered to the specified Event Dispatcher - * in a notification event. - * - * Input: - * ia_handle - * conn_qual - * evd_handle - * psp_flags - * - * Output: - * psp_handle - * - * Returns: - * DAT_SUCCESS - * DAT_INSUFFICIENT_RESOURCES - * DAT_INVALID_PARAMETER - * DAT_CONN_QUAL_IN_USE - * DAT_MODEL_NOT_SUPPORTED - */ -u32 dapl_psp_create(DAT_IA_HANDLE ia_handle, DAT_CONN_QUAL conn_qual, - DAT_EVD_HANDLE evd_handle, enum dat_psp_flags psp_flags, - DAT_PSP_HANDLE *psp_handle) -{ - struct dapl_ia *ia_ptr; - struct dapl_sp *sp_ptr; - struct dapl_evd *evd_ptr; - boolean_t sp_found; - u32 dat_status = DAT_SUCCESS; - - 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; - } - if (DAPL_BAD_HANDLE(evd_handle, DAPL_MAGIC_EVD)) { - dat_status = - DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EVD_CR); - goto bail; - } - - if (psp_handle == NULL) { - dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG5); - goto bail; - } - - evd_ptr = (struct dapl_evd *)evd_handle; - if (!(evd_ptr->evd_flags & DAT_EVD_CR_FLAG)) { - dat_status = - DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EVD_CR); - goto bail; - } - - if (psp_flags != DAT_PSP_CONSUMER_FLAG && - psp_flags != DAT_PSP_PROVIDER_FLAG) { - dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG4); - goto bail; - } - - /* - * See if we have a quiescent listener to use for this PSP, else - * create one and set it listening - */ - sp_ptr = dapl_ia_sp_search(ia_ptr, conn_qual, TRUE); - sp_found = TRUE; - if (sp_ptr == NULL) { - /* Allocate PSP */ - sp_found = FALSE; - sp_ptr = dapl_sp_alloc(ia_ptr, TRUE); - if (sp_ptr == NULL) { - dat_status = - DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, - DAT_RESOURCE_MEMORY); - goto bail; - } - } else if (sp_ptr->listening == TRUE) { - dat_status = DAT_ERROR(DAT_CONN_QUAL_IN_USE, 0); - goto bail; - } - - /* - * Fill out the args for a PSP - */ - sp_ptr->ia_handle = ia_handle; - sp_ptr->conn_qual = conn_qual; - sp_ptr->evd_handle = evd_handle; - sp_ptr->psp_flags = psp_flags; - sp_ptr->ep_handle = NULL; - - /* - * Take a reference on the EVD handle - */ - atomic_inc(&evd_ptr->evd_ref_count); - - /* - * Set up a listener for a connection. Connections can arrive - * even before this call returns! - */ - sp_ptr->state = DAPL_SP_STATE_PSP_LISTENING; - sp_ptr->listening = TRUE; - - /* - * If this is a new sp we need to add it to the IA queue, and set up - * a conn_listener. - */ - if (sp_found == FALSE) { - /* Link it onto the IA before enabling it to receive conn - * requests - */ - dapl_ia_link_psp(ia_ptr, sp_ptr); - - dat_status = dapl_ib_setup_conn_listener(ia_ptr, sp_ptr); - - if (dat_status != DAT_SUCCESS) { - /* - * Have a problem setting up the connection, something - * wrong! Decrements the EVD refcount & release it. - */ - atomic_dec(&evd_ptr->evd_ref_count); - sp_ptr->evd_handle = NULL; - dapl_ia_unlink_sp(ia_ptr, sp_ptr); - dapl_sp_dealloc(sp_ptr); - - dapl_dbg_log(DAPL_DBG_TYPE_CM, "dapl_psp_create " - "setup_conn_listener failed: %x\n", - dat_status); - - goto bail; - } - } - - /* - * Return handle to the user - */ - *psp_handle = (DAT_PSP_HANDLE) sp_ptr; - - bail: - return dat_status; -} diff -Nurp -X /home/tduffy/dontdiff linux-kernel-rsp/dat-provider/dapl_psp_free.c linux-kernel-psp/dat-provider/dapl_psp_free.c --- linux-kernel-rsp/dat-provider/dapl_psp_free.c 2005-05-20 22:55:17.285001000 -0700 +++ linux-kernel-psp/dat-provider/dapl_psp_free.c 1969-12-31 16:00:00.000000000 -0800 @@ -1,131 +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: dapl_psp_free.c 2433 2005-05-21 04:11:03Z jlentini $ - */ - -#include "dapl.h" -#include "dapl_sp_util.h" -#include "dapl_ia_util.h" -#include "dapl_openib_util.h" - -/* - * dapl_psp_free - * - * Destroy a specific instance of a Service Point. - * - * Input: - * psp_handle - * - * Output: - * none - * - * Returns: - * DAT_SUCCESS - * DAT_INVALID_PARAMETER - */ -u32 dapl_psp_free(DAT_PSP_HANDLE psp_handle) -{ - struct dapl_ia *ia_ptr; - struct dapl_sp *sp_ptr; - DAPL_SP_STATE save_state; - u32 dat_status = DAT_SUCCESS; - - sp_ptr = (struct dapl_sp *)psp_handle; - /* - * Verify handle - */ - dapl_dbg_log(DAPL_DBG_TYPE_CM, ">>> dapl_psp_free %p\n", psp_handle); - - if (DAPL_BAD_HANDLE(sp_ptr, DAPL_MAGIC_PSP)) { - dat_status = - DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PSP); - goto bail; - } - - /* ia_ptr = (struct dapl_ia *)sp_ptr->header.owner_ia; */ - ia_ptr = sp_ptr->header.owner_ia; - /* - * Remove the connection listener if it has been established - * and there are no current connections in progress. - * If we defer removing the sp it becomes something of a zombie - * container until the last connection is disconnected, after - * which it will be cleaned up. - */ - spin_lock_irqsave(&sp_ptr->header.lock, sp_ptr->header.flags); - - sp_ptr->listening = FALSE; - - /* Release reference on EVD. If an error was encountered in a previous - * free the evd_handle will be NULL - */ - if (sp_ptr->evd_handle) { - atomic_dec(&((struct dapl_evd *)sp_ptr->evd_handle)-> - evd_ref_count); - sp_ptr->evd_handle = NULL; - } - - /* - * Release the base resource if there are no outstanding - * connections; else the last disconnect on this PSP will free it - * up. The PSP is used to contain CR records for each connection, - * which contain information necessary to disconnect. - */ - dapl_dbg_log(DAPL_DBG_TYPE_CM, - ">>> dapl_psp_free: state %d cr_list_count %d\n", - sp_ptr->state, sp_ptr->cr_list_count); - if ((sp_ptr->state == DAPL_SP_STATE_PSP_LISTENING || - sp_ptr->state == DAPL_SP_STATE_PSP_PENDING) && - sp_ptr->cr_list_count == 0) { - save_state = sp_ptr->state; - sp_ptr->state = DAPL_SP_STATE_FREE; - spin_unlock_irqrestore(&sp_ptr->header.lock, - sp_ptr->header.flags); - - dat_status = dapl_ib_remove_conn_listener(ia_ptr, sp_ptr); - if (dat_status != DAT_SUCCESS) { - /* revert to entry state on error */ - sp_ptr->state = save_state; - goto bail; - } - dapl_ia_unlink_sp(ia_ptr, sp_ptr); - dapl_sp_dealloc(sp_ptr); - } else { - /* The PSP is now in the pending state, where it will sit until - * the last connection terminates or the app uses the same - * ServiceID again, which will reactivate it. - */ - sp_ptr->state = DAPL_SP_STATE_PSP_PENDING; - spin_unlock_irqrestore(&sp_ptr->header.lock, sp_ptr->header.flags); - dapl_dbg_log(DAPL_DBG_TYPE_CM, - ">>> dapl_psp_free: PSP PENDING\n"); - } - - bail: - return dat_status; -} diff -Nurp -X /home/tduffy/dontdiff linux-kernel-rsp/dat-provider/dapl_psp_query.c linux-kernel-psp/dat-provider/dapl_psp_query.c --- linux-kernel-rsp/dat-provider/dapl_psp_query.c 2005-05-20 22:55:18.853022000 -0700 +++ linux-kernel-psp/dat-provider/dapl_psp_query.c 1969-12-31 16:00:00.000000000 -0800 @@ -1,62 +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: dapl_psp_query.c 2433 2005-05-21 04:11:03Z jlentini $ - */ - -#include "dapl.h" - -u32 dapl_psp_query(DAT_PSP_HANDLE psp_handle, struct dat_psp_param *psp_param) -{ - struct dapl_sp *sp_ptr; - u32 status; - - if (DAPL_BAD_HANDLE(psp_handle, DAPL_MAGIC_PSP) || - ((struct dapl_sp *)psp_handle)->listening != TRUE) { - status = - DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PSP); - goto bail; - } - - if (NULL == psp_param) { - status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3); - goto bail; - } - - sp_ptr = (struct dapl_sp *)psp_handle; - - psp_param->ia_handle = sp_ptr->ia_handle; - psp_param->conn_qual = sp_ptr->conn_qual; - psp_param->evd_handle = sp_ptr->evd_handle; - psp_param->psp_flags = sp_ptr->psp_flags; - - status = DAT_SUCCESS; - -bail: - return status; -} diff -Nurp -X /home/tduffy/dontdiff linux-kernel-rsp/dat-provider/Makefile linux-kernel-psp/dat-provider/Makefile --- linux-kernel-rsp/dat-provider/Makefile 2005-05-25 15:01:00.683014000 -0700 +++ linux-kernel-psp/dat-provider/Makefile 2005-05-25 15:12:34.054000000 -0700 @@ -70,10 +70,7 @@ PROVIDER_MODULES := \ dapl_mr_util \ dapl_provider \ dapl_sp_util \ - dapl_psp_create \ - dapl_psp_create_any \ - dapl_psp_free \ - dapl_psp_query \ + dapl_psp \ dapl_pz \ dapl_ring_buffer_util \ dapl_rmr \ diff -Nurp -X /home/tduffy/dontdiff linux-kernel-rsp/patches/alt_dat_provider_makefile linux-kernel-psp/patches/alt_dat_provider_makefile --- linux-kernel-rsp/patches/alt_dat_provider_makefile 2005-05-25 14:53:43.453015000 -0700 +++ linux-kernel-psp/patches/alt_dat_provider_makefile 2005-05-25 15:05:08.065003000 -0700 @@ -64,10 +64,7 @@ PROVIDER_MODULES := \ dapl_mr_util \ dapl_provider \ dapl_sp_util \ - dapl_psp_create \ - dapl_psp_create_any \ - dapl_psp_free \ - dapl_psp_query \ + dapl_psp \ dapl_pz \ dapl_ring_buffer_util \ dapl_rmr \
_______________________________________________ openib-general mailing list openib-general@openib.org http://openib.org/mailman/listinfo/openib-general To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general