[openib-general] Re: [PATCH 1/3] kDAPL: consolidate dapl_srq*.c into one file

James Lentini jlentini at netapp.com
Fri May 27 08:17:27 PDT 2005


Actually, "[PATCH 2/3] kDAPL: consolidate dapl_rsp*.c into one file" 
was committed in  revision 2501.

On Fri, 27 May 2005, James Lentini wrote:

>
> Committed in revision 2501.
>
> On Thu, 26 May 2005, Tom Duffy wrote:
>
> tduffy> Signed-off-by: Tom Duffy <tduffy at sun.com>
> tduffy>
> tduffy> Index: linux-kernel-srq/dat-provider/dapl_srq.c
> tduffy> ===================================================================
> tduffy> --- linux-kernel-srq/dat-provider/dapl_srq.c	(revision 0)
> tduffy> +++ linux-kernel-srq/dat-provider/dapl_srq.c	(revision 0)
> tduffy> @@ -0,0 +1,500 @@
> tduffy> +/*
> tduffy> + * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
> tduffy> + *
> tduffy> + * This Software is licensed under one of the following licenses:
> tduffy> + *
> tduffy> + * 1) under the terms of the "Common Public License 1.0" a copy of which is
> tduffy> + *    available from the Open Source Initiative, see
> tduffy> + *    http://www.opensource.org/licenses/cpl.php.
> tduffy> + *
> tduffy> + * 2) under the terms of the "The BSD License" a copy of which is
> tduffy> + *    available from the Open Source Initiative, see
> tduffy> + *    http://www.opensource.org/licenses/bsd-license.php.
> tduffy> + *
> tduffy> + * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
> tduffy> + *    copy of which is available from the Open Source Initiative, see
> tduffy> + *    http://www.opensource.org/licenses/gpl-license.php.
> tduffy> + *
> tduffy> + * Licensee has the right to choose one of the above licenses.
> tduffy> + *
> tduffy> + * Redistributions of source code must retain the above copyright
> tduffy> + * notice and one of the license notices.
> tduffy> + *
> tduffy> + * Redistributions in binary form must reproduce both the above copyright
> tduffy> + * notice, one of the license notices in the documentation
> tduffy> + * and/or other materials provided with the distribution.
> tduffy> + */
> tduffy> +
> tduffy> +/*
> tduffy> + * $Id$
> tduffy> + */
> tduffy> +
> tduffy> +#include "dapl.h"
> tduffy> +#include "dapl_ia_util.h"
> tduffy> +#include "dapl_openib_util.h"
> tduffy> +#include "dapl_cookie.h"
> tduffy> +
> tduffy> +/*
> tduffy> + * dapl_srq_dealloc
> tduffy> + *
> tduffy> + * Free the passed in SRQ structure.
> tduffy> + *
> tduffy> + * Input:
> tduffy> + * 	SRQ pointer
> tduffy> + *
> tduffy> + * Output:
> tduffy> + * 	none
> tduffy> + *
> tduffy> + * Returns:
> tduffy> + * 	none
> tduffy> + *
> tduffy> + */
> tduffy> +static void dapl_srq_dealloc(struct dapl_srq *srq_ptr)
> tduffy> +{
> tduffy> +	dapl_os_assert(srq_ptr->header.magic == DAPL_MAGIC_SRQ);
> tduffy> +
> tduffy> +	/* reset magic to prevent reuse */
> tduffy> +	srq_ptr->header.magic = DAPL_MAGIC_INVALID;
> tduffy> +	dapl_ia_unlink_srq(srq_ptr->header.owner_ia, srq_ptr);
> tduffy> +	dapl_cb_free(&srq_ptr->recv_buffer);
> tduffy> +	/* no need to destroy srq_ptr->header.lock */
> tduffy> +
> tduffy> +	kfree(srq_ptr);
> tduffy> +}
> tduffy> +
> tduffy> +/*
> tduffy> + * dapl_srq_alloc
> tduffy> + *
> tduffy> + * alloc and initialize an SRQ struct
> tduffy> + *
> tduffy> + * Input:
> tduffy> + * 	IA INFO struct ptr
> tduffy> + *	SRQ ATTR ptr
> tduffy> + *
> tduffy> + * Output:
> tduffy> + * 	none
> tduffy> + *
> tduffy> + * Returns:
> tduffy> + * 	pointer to srq
> tduffy> + *
> tduffy> + */
> tduffy> +static struct dapl_srq *dapl_srq_alloc(struct dapl_ia *ia_ptr,
> tduffy> +				       const struct dat_srq_attr *srq_attr)
> tduffy> +{
> tduffy> +	struct dapl_srq *srq_ptr;
> tduffy> +
> tduffy> +	/* Allocate SRQ */
> tduffy> +	srq_ptr = kmalloc(sizeof *srq_ptr, GFP_ATOMIC);
> tduffy> +	if (!srq_ptr)
> tduffy> +		goto bail;
> tduffy> +
> tduffy> +	/* zero the structure */
> tduffy> +	memset(srq_ptr, 0, sizeof *srq_ptr);
> tduffy> +
> tduffy> +	/*
> tduffy> +	 * initialize the header
> tduffy> +	 */
> tduffy> +	srq_ptr->header.provider = ia_ptr->header.provider;
> tduffy> +	srq_ptr->header.magic = DAPL_MAGIC_SRQ;
> tduffy> +	srq_ptr->header.handle_type = DAT_HANDLE_TYPE_SRQ;
> tduffy> +	srq_ptr->header.owner_ia = ia_ptr;
> tduffy> +	srq_ptr->header.user_context.as_64 = 0;
> tduffy> +	srq_ptr->header.user_context.as_ptr = NULL;
> tduffy> +	atomic_set(&srq_ptr->srq_ref_count, 0);
> tduffy> +
> tduffy> +	dapl_llist_init_entry(&srq_ptr->header.ia_list_entry);
> tduffy> +	spin_lock_init(&srq_ptr->header.lock);
> tduffy> +
> tduffy> +	/*
> tduffy> +	 * Initialize the body.
> tduffy> +	 * XXX Assume srq_attrs is required
> tduffy> +	 */
> tduffy> +	srq_ptr->param.max_recv_dtos = srq_attr->max_recv_dtos;
> tduffy> +	srq_ptr->param.max_recv_iov = srq_attr->max_recv_iov;
> tduffy> +	srq_ptr->param.low_watermark = srq_attr->low_watermark;
> tduffy> +
> tduffy> +	/* Get a cookie buffer to track outstanding recvs */
> tduffy> +	if (DAT_SUCCESS != dapl_cb_create(&srq_ptr->recv_buffer,
> tduffy> +					 (struct dapl_ep *)srq_ptr,
> tduffy> +					  srq_ptr->param.max_recv_dtos)) {
> tduffy> +		dapl_srq_dealloc(srq_ptr);
> tduffy> +		srq_ptr = NULL;
> tduffy> +		goto bail;
> tduffy> +	}
> tduffy> +
> tduffy> +bail:
> tduffy> +	return srq_ptr;
> tduffy> +}
> tduffy> +
> tduffy> +/*
> tduffy> + * dapl_srq_create
> tduffy> + *
> tduffy> + * Create an instance of a Shared Receive Queue that is provided to the
> tduffy> + * consumer at srq_handle.
> tduffy> + *
> tduffy> + * Input:
> tduffy> + *	ia_handle
> tduffy> + *	pz_handle
> tduffy> + *	srq_attr
> tduffy> + *
> tduffy> + * Output:
> tduffy> + *	srq_handle
> tduffy> + *
> tduffy> + * Returns:
> tduffy> + *	DAT_SUCCESS
> tduffy> + *	DAT_INSUFFICIENT_RESOURCES
> tduffy> + *	DAT_INVALID_HANDLE
> tduffy> + *	DAT_INVALID_PARAMETER
> tduffy> + *	?DAT_INVALID_ATTRIBUTE??
> tduffy> + *	DAT_MODEL_NOT_SUPPORTED
> tduffy> + */
> tduffy> +u32 dapl_srq_create(DAT_IA_HANDLE ia_handle, DAT_PZ_HANDLE pz_handle,
> tduffy> +		    struct dat_srq_attr *srq_attr, DAT_SRQ_HANDLE *srq_handle)
> tduffy> +{
> tduffy> +	struct dapl_ia *ia_ptr;
> tduffy> +	struct dapl_srq *srq_ptr;
> tduffy> +	u32 status = DAT_SUCCESS;
> tduffy> +
> tduffy> +	dapl_dbg_log(DAPL_DBG_TYPE_API,
> tduffy> +		     "dapl_srq_create (%p, %p, %p, %p)\n",
> tduffy> +		     ia_handle, pz_handle, srq_attr, srq_handle);
> tduffy> +
> tduffy> +	ia_ptr = (struct dapl_ia *)ia_handle;
> tduffy> +
> tduffy> +	/*
> tduffy> +	 * Verify parameters
> tduffy> +	 */
> tduffy> +	if (DAPL_BAD_HANDLE(ia_ptr, DAPL_MAGIC_IA)) {
> tduffy> +		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);
> tduffy> +		goto bail;
> tduffy> +	}
> tduffy> +
> tduffy> +	/*
> tduffy> +	 * Verify non-required parameters.
> tduffy> +	 * N.B. Assumption: any parameter that can be
> tduffy> +	 *      modified by dat_ep_modify() is not strictly
> tduffy> +	 *      required when the EP is created
> tduffy> +	 */
> tduffy> +	if (pz_handle != NULL && DAPL_BAD_HANDLE(pz_handle, DAPL_MAGIC_PZ)) {
> tduffy> +		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PZ);
> tduffy> +		goto bail;
> tduffy> +	}
> tduffy> +
> tduffy> +	if (srq_handle == NULL) {
> tduffy> +		status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG4);
> tduffy> +		goto bail;
> tduffy> +	}
> tduffy> +	if ((unsigned long)srq_attr & 3) {
> tduffy> +		status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);
> tduffy> +		goto bail;
> tduffy> +	}
> tduffy> +
> tduffy> +	/* Allocate SRQ */
> tduffy> +	srq_ptr = dapl_srq_alloc(ia_ptr, srq_attr);
> tduffy> +	if (srq_ptr == NULL) {
> tduffy> +		status = DAT_ERROR(DAT_INSUFFICIENT_RESOURCES,
> tduffy> +				   DAT_RESOURCE_MEMORY);
> tduffy> +		goto bail;
> tduffy> +	}
> tduffy> +
> tduffy> +	srq_ptr->param.ia_handle = (DAT_IA_HANDLE) ia_ptr;
> tduffy> +	srq_ptr->param.srq_state = DAT_SRQ_STATE_OPERATIONAL;
> tduffy> +	srq_ptr->param.pz_handle = pz_handle;
> tduffy> +
> tduffy> +	/*
> tduffy> +	 * XXX Allocate provider resource here!!!
> tduffy> +	 */
> tduffy> +	/* XXX */ status = DAT_ERROR(DAT_NOT_IMPLEMENTED, DAT_NO_SUBTYPE);
> tduffy> +	/* XXX */ dapl_srq_dealloc(srq_ptr);
> tduffy> +	/* XXX */ goto bail;
> tduffy> +
> tduffy> +	/* Link it onto the IA */
> tduffy> +	dapl_ia_link_srq(ia_ptr, srq_ptr);
> tduffy> +
> tduffy> +	*srq_handle = srq_ptr;
> tduffy> +
> tduffy> +bail:
> tduffy> +	return status;
> tduffy> +}
> tduffy> +
> tduffy> +/*
> tduffy> + * dapl_srq_free
> tduffy> + *
> tduffy> + * Destroy an instance of an SRQ
> tduffy> + *
> tduffy> + * Input:
> tduffy> + *	srq_handle
> tduffy> + *
> tduffy> + * Output:
> tduffy> + *	none
> tduffy> + *
> tduffy> + * Returns:
> tduffy> + *	DAT_SUCCESS
> tduffy> + *	DAT_INVALID_PARAMETER
> tduffy> + *	DAT_INVALID_STATE
> tduffy> + */
> tduffy> +u32 dapl_srq_free(DAT_SRQ_HANDLE srq_handle)
> tduffy> +{
> tduffy> +	struct dapl_srq *srq_ptr;
> tduffy> +	struct dapl_ia *ia_ptr;
> tduffy> +	struct dat_srq_param *param;
> tduffy> +	u32 status = DAT_SUCCESS;
> tduffy> +
> tduffy> +	dapl_dbg_log(DAPL_DBG_TYPE_API, "dapl_srq_free (%p)\n", srq_handle);
> tduffy> +
> tduffy> +	srq_ptr = (struct dapl_srq *)srq_handle;
> tduffy> +	param = &srq_ptr->param;
> tduffy> +
> tduffy> +	/*
> tduffy> +	 * Verify parameter & state
> tduffy> +	 */
> tduffy> +	if (DAPL_BAD_HANDLE(srq_ptr, DAPL_MAGIC_SRQ)) {
> tduffy> +		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ);
> tduffy> +		goto bail;
> tduffy> +	}
> tduffy> +
> tduffy> +	if (atomic_read(&srq_ptr->srq_ref_count) != 0) {
> tduffy> +		/*
> tduffy> +		 * The DAPL 1.2 spec says to return DAT_SRQ_IN_USE, which does
> tduffy> +		 * not exist. Have filed the following as an eratta.
> tduffy> +		 */
> tduffy> +		status = DAT_ERROR(DAT_INVALID_STATE,
> tduffy> +				   DAT_INVALID_STATE_SRQ_IN_USE);
> tduffy> +		goto bail;
> tduffy> +	}
> tduffy> +
> tduffy> +	ia_ptr = srq_ptr->header.owner_ia;
> tduffy> +
> tduffy> +	/*
> tduffy> +	 * Do verification of parameters and the state change atomically.
> tduffy> +	 */
> tduffy> +	spin_lock_irqsave(&srq_ptr->header.lock, srq_ptr->header.flags);
> tduffy> +
> tduffy> +	/* Remove the SRQ from the IA */
> tduffy> +	dapl_ia_unlink_srq(ia_ptr, srq_ptr);
> tduffy> +
> tduffy> +	spin_unlock_irqrestore(&srq_ptr->header.lock, srq_ptr->header.flags);
> tduffy> +
> tduffy> +	/*
> tduffy> +	 * Finish tearing everything down.
> tduffy> +	 */
> tduffy> +
> tduffy> +	/*
> tduffy> +	 * Take care of the transport resource
> tduffy> +	 */
> tduffy> +
> tduffy> +	/* XXX Put provider code here!!! */
> tduffy> +
> tduffy> +	/* Free the resource */
> tduffy> +	dapl_srq_dealloc(srq_ptr);
> tduffy> +
> tduffy> +bail:
> tduffy> +	return status;
> tduffy> +
> tduffy> +}
> tduffy> +
> tduffy> +/*
> tduffy> + * dapl_srq_post_recv
> tduffy> + *
> tduffy> + * Post a receive buffer that can be used by any incoming
> tduffy> + * message by any connected EP using the SRQ. Request to receive data
> tduffy> + * over a connection of any ep handle into local_iov
> tduffy> + *
> tduffy> + * Input:
> tduffy> + * 	srq_handle
> tduffy> + * 	num_segments
> tduffy> + * 	local_iov
> tduffy> + * 	user_cookie
> tduffy> + *
> tduffy> + * Output:
> tduffy> + * 	None.
> tduffy> + *
> tduffy> + * Returns:
> tduffy> + * 	DAT_SUCCESS
> tduffy> + * 	DAT_INSUFFICIENT_RESOURCES
> tduffy> + * 	DAT_INVALID_PARAMETER
> tduffy> + * 	DAT_INVALID_HANDLE
> tduffy> + * 	DAT_INVALID_STATE
> tduffy> + * 	DAT_PROTECTION_VIOLATION
> tduffy> + * 	DAT_PROVILEGES_VIOLATION
> tduffy> + */
> tduffy> +u32 dapl_srq_post_recv(DAT_SRQ_HANDLE srq_handle, int num_segments,
> tduffy> +		       struct dat_lmr_triplet *local_iov,
> tduffy> +		       DAT_DTO_COOKIE user_cookie)
> tduffy> +{
> tduffy> +	struct dapl_srq *srq_ptr;
> tduffy> +	struct dapl_cookie *cookie;
> tduffy> +	u32 status;
> tduffy> +
> tduffy> +	dapl_dbg_log(DAPL_DBG_TYPE_API,
> tduffy> +		     "dapl_srq_post_recv (%p, %d, %p, %P)\n",
> tduffy> +		     srq_handle, num_segments, local_iov, user_cookie.as_64);
> tduffy> +
> tduffy> +	if (DAPL_BAD_HANDLE(srq_handle, DAPL_MAGIC_SRQ)) {
> tduffy> +		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ);
> tduffy> +		goto bail;
> tduffy> +	}
> tduffy> +
> tduffy> +	srq_ptr = (struct dapl_srq *)srq_handle;
> tduffy> +
> tduffy> +	/*
> tduffy> +	 * Synchronization ok since this buffer is only used for receive
> tduffy> +	 * requests, which aren't allowed to race with each other. The
> tduffy> +	 * app must syncronize access to the SRQ.
> tduffy> +	 */
> tduffy> +	status = dapl_dto_cookie_alloc(&srq_ptr->recv_buffer,
> tduffy> +				       DAPL_DTO_TYPE_RECV,
> tduffy> +				       user_cookie, &cookie);
> tduffy> +	if (DAT_SUCCESS != status)
> tduffy> +		goto bail;
> tduffy> +
> tduffy> +	/*
> tduffy> +	 * Take reference before posting to avoid race conditions with
> tduffy> +	 * completions
> tduffy> +	 */
> tduffy> +	atomic_inc(&srq_ptr->recv_count);
> tduffy> +
> tduffy> +	/*
> tduffy> +	 * Invoke provider specific routine to post DTO
> tduffy> +	 */
> tduffy> +	/* XXX Put code here XXX */
> tduffy> +	/* XXX */ status = DAT_ERROR(DAT_NOT_IMPLEMENTED, DAT_NO_SUBTYPE);
> tduffy> +
> tduffy> +	if (status != DAT_SUCCESS) {
> tduffy> +		atomic_dec(&srq_ptr->recv_count);
> tduffy> +		dapl_cookie_dealloc(&srq_ptr->recv_buffer, cookie);
> tduffy> +	}
> tduffy> +
> tduffy> +bail:
> tduffy> +	return status;
> tduffy> +}
> tduffy> +
> tduffy> +u32 dapl_srq_query(DAT_SRQ_HANDLE srq_handle, struct dat_srq_param *srq_param)
> tduffy> +{
> tduffy> +	struct dapl_srq *srq_ptr;
> tduffy> +	u32 status = DAT_SUCCESS;
> tduffy> +
> tduffy> +	dapl_dbg_log(DAPL_DBG_TYPE_API,
> tduffy> +		     "dapl_srq_query (%p, %x, %p)\n",
> tduffy> +		     srq_handle, srq_param);
> tduffy> +
> tduffy> +	if (DAPL_BAD_HANDLE(srq_handle, DAPL_MAGIC_SRQ)) {
> tduffy> +		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ);
> tduffy> +		goto bail;
> tduffy> +	}
> tduffy> +	if (srq_param == NULL) {
> tduffy> +		status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);
> tduffy> +		goto bail;
> tduffy> +	}
> tduffy> +
> tduffy> +	srq_ptr = (struct dapl_srq *)srq_handle;
> tduffy> +
> tduffy> +	/*
> tduffy> +	 * XXX Need to calculate available_dto_count and outstanding_dto_count
> tduffy> +	 */
> tduffy> +	srq_ptr->param.available_dto_count = DAT_VALUE_UNKNOWN;
> tduffy> +	srq_ptr->param.outstanding_dto_count = DAT_VALUE_UNKNOWN;
> tduffy> +
> tduffy> +	*srq_param = srq_ptr->param;
> tduffy> +
> tduffy> +bail:
> tduffy> +	return status;
> tduffy> +}
> tduffy> +
> tduffy> +/*
> tduffy> + * dapl_srq_resize
> tduffy> + *
> tduffy> + * Modify the size fo the event queue of a Shared Recieve Queue
> tduffy> + *
> tduffy> + * Input:
> tduffy> + * 	srq_handle
> tduffy> + * 	srq_max_recv_dto
> tduffy> + *
> tduffy> + * Output:
> tduffy> + * 	none
> tduffy> + *
> tduffy> + * Returns:
> tduffy> + * 	DAT_SUCCESS
> tduffy> + * 	DAT_INVALID_HANDLE
> tduffy> + * 	DAT_INVALID_PARAMETER
> tduffy> + * 	DAT_INSUFFICIENT_RESOURCES
> tduffy> + * 	DAT_INVALID_STATE
> tduffy> + */
> tduffy> +
> tduffy> +u32 dapl_srq_resize(DAT_SRQ_HANDLE srq_handle, int srq_max_recv_dto)
> tduffy> +{
> tduffy> +	struct dapl_ia *ia_ptr;
> tduffy> +	struct dapl_srq *srq_ptr;
> tduffy> +	u32 status = DAT_SUCCESS;
> tduffy> +
> tduffy> +	dapl_dbg_log(DAPL_DBG_TYPE_API, "dapl_srq_resize (%p, %d)\n",
> tduffy> +		     srq_handle, srq_max_recv_dto);
> tduffy> +
> tduffy> +	if (DAPL_BAD_HANDLE(srq_handle, DAPL_MAGIC_SRQ)) {
> tduffy> +		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ);
> tduffy> +		goto bail;
> tduffy> +	}
> tduffy> +
> tduffy> +	srq_ptr = (struct dapl_srq *)srq_handle;
> tduffy> +	ia_ptr = srq_ptr->header.owner_ia;
> tduffy> +
> tduffy> +	/*
> tduffy> +	 * Check for nonsense requests per the spec
> tduffy> +	 */
> tduffy> +	if (srq_max_recv_dto <= srq_ptr->param.low_watermark) {
> tduffy> +		status = DAT_ERROR(DAT_INVALID_STATE, DAT_NO_SUBTYPE);
> tduffy> +		goto bail;
> tduffy> +	}
> tduffy> +
> tduffy> +	/* XXX Put implementation here XXX */
> tduffy> +
> tduffy> +	/* XXX */ status = DAT_ERROR(DAT_NOT_IMPLEMENTED, DAT_NO_SUBTYPE);
> tduffy> +
> tduffy> +bail:
> tduffy> +	return status;
> tduffy> +}
> tduffy> +
> tduffy> +/*
> tduffy> + * dapl_srq_set_lw
> tduffy> + *
> tduffy> + * DAPL Requirements Version 1.2, 6.5.4
> tduffy> + *
> tduffy> + * Set the low water mark for an SRQ and arm the SRQ to generate an
> tduffy> + * event if it is reached.
> tduffy> + *
> tduffy> + * Input:
> tduffy> + * 	srq_handle
> tduffy> + * 	srq_max_recv_dto
> tduffy> + *
> tduffy> + * Output:
> tduffy> + * 	none
> tduffy> + *
> tduffy> + * Returns:
> tduffy> + * 	DAT_SUCCESS
> tduffy> + * 	DAT_INVALID_HANDLE
> tduffy> + * 	DAT_INVALID_PARAMETER
> tduffy> + * 	DAT_MODEL_NOT_SUPPORTED
> tduffy> + */
> tduffy> +
> tduffy> +u32 dapl_srq_set_lw(DAT_SRQ_HANDLE srq_handle, int low_watermark)
> tduffy> +{
> tduffy> +	struct dapl_srq *srq_ptr;
> tduffy> +	u32 status = DAT_SUCCESS;
> tduffy> +
> tduffy> +	dapl_dbg_log(DAPL_DBG_TYPE_API, "dapl_srq_set_lw (%p, %d)\n",
> tduffy> +		     srq_handle, low_watermark);
> tduffy> +
> tduffy> +	if (DAPL_BAD_HANDLE(srq_handle, DAPL_MAGIC_SRQ)) {
> tduffy> +		status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ);
> tduffy> +		goto bail;
> tduffy> +	}
> tduffy> +
> tduffy> +	srq_ptr = (struct dapl_srq *)srq_handle;
> tduffy> +
> tduffy> +	/* XXX Put implementation here XXX */
> tduffy> +
> tduffy> +	/* XXX */ status = DAT_ERROR(DAT_NOT_IMPLEMENTED, DAT_NO_SUBTYPE);
> tduffy> +
> tduffy> +bail:
> tduffy> +	return status;
> tduffy> +}
> tduffy> Index: linux-kernel-srq/dat-provider/dapl_srq_resize.c
> tduffy> ===================================================================
> tduffy> --- linux-kernel-srq/dat-provider/dapl_srq_resize.c	(revision 2489)
> tduffy> +++ linux-kernel-srq/dat-provider/dapl_srq_resize.c	(working copy)
> tduffy> @@ -1,88 +0,0 @@
> tduffy> -/*
> tduffy> - * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
> tduffy> - *
> tduffy> - * This Software is licensed under one of the following licenses:
> tduffy> - *
> tduffy> - * 1) under the terms of the "Common Public License 1.0" a copy of which is
> tduffy> - *    available from the Open Source Initiative, see
> tduffy> - *    http://www.opensource.org/licenses/cpl.php.
> tduffy> - *
> tduffy> - * 2) under the terms of the "The BSD License" a copy of which is
> tduffy> - *    available from the Open Source Initiative, see
> tduffy> - *    http://www.opensource.org/licenses/bsd-license.php.
> tduffy> - *
> tduffy> - * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
> tduffy> - *    copy of which is available from the Open Source Initiative, see
> tduffy> - *    http://www.opensource.org/licenses/gpl-license.php.
> tduffy> - *
> tduffy> - * Licensee has the right to choose one of the above licenses.
> tduffy> - *
> tduffy> - * Redistributions of source code must retain the above copyright
> tduffy> - * notice and one of the license notices.
> tduffy> - *
> tduffy> - * Redistributions in binary form must reproduce both the above copyright
> tduffy> - * notice, one of the license notices in the documentation
> tduffy> - * and/or other materials provided with the distribution.
> tduffy> - */
> tduffy> -
> tduffy> -/*
> tduffy> - * $Id$
> tduffy> - */
> tduffy> -
> tduffy> -#include "dapl.h"
> tduffy> -#include "dapl_srq_util.h"
> tduffy> -#include "dapl_openib_util.h"
> tduffy> -
> tduffy> -/*
> tduffy> - * dapl_srq_resize
> tduffy> - *
> tduffy> - * Modify the size fo the event queue of a Shared Recieve Queue
> tduffy> - *
> tduffy> - * Input:
> tduffy> - * 	srq_handle
> tduffy> - * 	srq_max_recv_dto
> tduffy> - *
> tduffy> - * Output:
> tduffy> - * 	none
> tduffy> - *
> tduffy> - * Returns:
> tduffy> - * 	DAT_SUCCESS
> tduffy> - * 	DAT_INVALID_HANDLE
> tduffy> - * 	DAT_INVALID_PARAMETER
> tduffy> - * 	DAT_INSUFFICIENT_RESOURCES
> tduffy> - * 	DAT_INVALID_STATE
> tduffy> - */
> tduffy> -
> tduffy> -u32 dapl_srq_resize(DAT_SRQ_HANDLE srq_handle, int srq_max_recv_dto)
> tduffy> -{
> tduffy> -	struct dapl_ia *ia_ptr;
> tduffy> -	struct dapl_srq *srq_ptr;
> tduffy> -	u32 dat_status = DAT_SUCCESS;
> tduffy> -
> tduffy> -	dapl_dbg_log(DAPL_DBG_TYPE_API, "dapl_srq_resize (%p, %d)\n",
> tduffy> -		     srq_handle, srq_max_recv_dto);
> tduffy> -
> tduffy> -	if (DAPL_BAD_HANDLE(srq_handle, DAPL_MAGIC_SRQ)) {
> tduffy> -		dat_status =
> tduffy> -		    DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ);
> tduffy> -		goto bail;
> tduffy> -	}
> tduffy> -
> tduffy> -	srq_ptr = (struct dapl_srq *)srq_handle;
> tduffy> -	ia_ptr = srq_ptr->header.owner_ia;
> tduffy> -
> tduffy> -	/*
> tduffy> -	 * Check for nonsense requests per the spec
> tduffy> -	 */
> tduffy> -	if (srq_max_recv_dto <= srq_ptr->param.low_watermark) {
> tduffy> -		dat_status = DAT_ERROR(DAT_INVALID_STATE, DAT_NO_SUBTYPE);
> tduffy> -		goto bail;
> tduffy> -	}
> tduffy> -
> tduffy> -	/* XXX Put implementation here XXX */
> tduffy> -
> tduffy> -	/* XXX */ dat_status = DAT_ERROR(DAT_NOT_IMPLEMENTED, DAT_NO_SUBTYPE);
> tduffy> -
> tduffy> -      bail:
> tduffy> -	return dat_status;
> tduffy> -}
> tduffy> Index: linux-kernel-srq/dat-provider/dapl_srq_create.c
> tduffy> ===================================================================
> tduffy> --- linux-kernel-srq/dat-provider/dapl_srq_create.c	(revision 2489)
> tduffy> +++ linux-kernel-srq/dat-provider/dapl_srq_create.c	(working copy)
> tduffy> @@ -1,128 +0,0 @@
> tduffy> -/*
> tduffy> - * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
> tduffy> - *
> tduffy> - * This Software is licensed under one of the following licenses:
> tduffy> - *
> tduffy> - * 1) under the terms of the "Common Public License 1.0" a copy of which is
> tduffy> - *    available from the Open Source Initiative, see
> tduffy> - *    http://www.opensource.org/licenses/cpl.php.
> tduffy> - *
> tduffy> - * 2) under the terms of the "The BSD License" a copy of which is
> tduffy> - *    available from the Open Source Initiative, see
> tduffy> - *    http://www.opensource.org/licenses/bsd-license.php.
> tduffy> - *
> tduffy> - * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
> tduffy> - *    copy of which is available from the Open Source Initiative, see
> tduffy> - *    http://www.opensource.org/licenses/gpl-license.php.
> tduffy> - *
> tduffy> - * Licensee has the right to choose one of the above licenses.
> tduffy> - *
> tduffy> - * Redistributions of source code must retain the above copyright
> tduffy> - * notice and one of the license notices.
> tduffy> - *
> tduffy> - * Redistributions in binary form must reproduce both the above copyright
> tduffy> - * notice, one of the license notices in the documentation
> tduffy> - * and/or other materials provided with the distribution.
> tduffy> - */
> tduffy> -
> tduffy> -/*
> tduffy> - * $Id$
> tduffy> - */
> tduffy> -
> tduffy> -#include "dapl.h"
> tduffy> -#include "dapl_ia_util.h"
> tduffy> -#include "dapl_srq_util.h"
> tduffy> -#include "dapl_openib_util.h"
> tduffy> -
> tduffy> -/*
> tduffy> - * dapl_srq_create
> tduffy> - *
> tduffy> - * Create an instance of a Shared Receive Queue that is provided to the
> tduffy> - * consumer at srq_handle.
> tduffy> - *
> tduffy> - * Input:
> tduffy> - *	ia_handle
> tduffy> - *	pz_handle
> tduffy> - *	srq_attr
> tduffy> - *
> tduffy> - * Output:
> tduffy> - *	srq_handle
> tduffy> - *
> tduffy> - * Returns:
> tduffy> - *	DAT_SUCCESS
> tduffy> - *	DAT_INSUFFICIENT_RESOURCES
> tduffy> - *	DAT_INVALID_HANDLE
> tduffy> - *	DAT_INVALID_PARAMETER
> tduffy> - *	?DAT_INVALID_ATTRIBUTE??
> tduffy> - *	DAT_MODEL_NOT_SUPPORTED
> tduffy> - */
> tduffy> -u32 dapl_srq_create(DAT_IA_HANDLE ia_handle, DAT_PZ_HANDLE pz_handle,
> tduffy> -		    struct dat_srq_attr *srq_attr, DAT_SRQ_HANDLE *srq_handle)
> tduffy> -{
> tduffy> -	struct dapl_ia *ia_ptr;
> tduffy> -	struct dapl_srq *srq_ptr;
> tduffy> -	u32 dat_status = DAT_SUCCESS;
> tduffy> -
> tduffy> -	dapl_dbg_log(DAPL_DBG_TYPE_API,
> tduffy> -		     "dapl_srq_create (%p, %p, %p, %p)\n",
> tduffy> -		     ia_handle, pz_handle, srq_attr, srq_handle);
> tduffy> -
> tduffy> -	ia_ptr = (struct dapl_ia *)ia_handle;
> tduffy> -
> tduffy> -	/*
> tduffy> -	 * Verify parameters
> tduffy> -	 */
> tduffy> -	if (DAPL_BAD_HANDLE(ia_ptr, DAPL_MAGIC_IA)) {
> tduffy> -		dat_status =
> tduffy> -		    DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);
> tduffy> -		goto bail;
> tduffy> -	}
> tduffy> -
> tduffy> -	/*
> tduffy> -	 * Verify non-required parameters.
> tduffy> -	 * N.B. Assumption: any parameter that can be
> tduffy> -	 *      modified by dat_ep_modify() is not strictly
> tduffy> -	 *      required when the EP is created
> tduffy> -	 */
> tduffy> -	if (pz_handle != NULL && DAPL_BAD_HANDLE(pz_handle, DAPL_MAGIC_PZ)) {
> tduffy> -		dat_status =
> tduffy> -		    DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_PZ);
> tduffy> -		goto bail;
> tduffy> -	}
> tduffy> -
> tduffy> -	if (srq_handle == NULL) {
> tduffy> -		dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG4);
> tduffy> -		goto bail;
> tduffy> -	}
> tduffy> -	if ((unsigned long)srq_attr & 3) {
> tduffy> -		dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);
> tduffy> -		goto bail;
> tduffy> -	}
> tduffy> -
> tduffy> -	/* Allocate SRQ */
> tduffy> -	srq_ptr = dapl_srq_alloc(ia_ptr, srq_attr);
> tduffy> -	if (srq_ptr == NULL) {
> tduffy> -		dat_status =
> tduffy> -		    DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);
> tduffy> -		goto bail;
> tduffy> -	}
> tduffy> -
> tduffy> -	srq_ptr->param.ia_handle = (DAT_IA_HANDLE) ia_ptr;
> tduffy> -	srq_ptr->param.srq_state = DAT_SRQ_STATE_OPERATIONAL;
> tduffy> -	srq_ptr->param.pz_handle = pz_handle;
> tduffy> -
> tduffy> -	/*
> tduffy> -	 * XXX Allocate provider resource here!!!
> tduffy> -	 */
> tduffy> -	/* XXX */ dat_status = DAT_ERROR(DAT_NOT_IMPLEMENTED, DAT_NO_SUBTYPE);
> tduffy> -	/* XXX */ dapl_srq_dealloc(srq_ptr);
> tduffy> -	/* XXX */ goto bail;
> tduffy> -
> tduffy> -	/* Link it onto the IA */
> tduffy> -	dapl_ia_link_srq(ia_ptr, srq_ptr);
> tduffy> -
> tduffy> -	*srq_handle = srq_ptr;
> tduffy> -
> tduffy> -      bail:
> tduffy> -	return dat_status;
> tduffy> -}
> tduffy> Index: linux-kernel-srq/dat-provider/dapl_srq_query.c
> tduffy> ===================================================================
> tduffy> --- linux-kernel-srq/dat-provider/dapl_srq_query.c	(revision 2489)
> tduffy> +++ linux-kernel-srq/dat-provider/dapl_srq_query.c	(working copy)
> tduffy> @@ -1,65 +0,0 @@
> tduffy> -/*
> tduffy> - * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
> tduffy> - *
> tduffy> - * This Software is licensed under one of the following licenses:
> tduffy> - *
> tduffy> - * 1) under the terms of the "Common Public License 1.0" a copy of which is
> tduffy> - *    available from the Open Source Initiative, see
> tduffy> - *    http://www.opensource.org/licenses/cpl.php.
> tduffy> - *
> tduffy> - * 2) under the terms of the "The BSD License" a copy of which is
> tduffy> - *    available from the Open Source Initiative, see
> tduffy> - *    http://www.opensource.org/licenses/bsd-license.php.
> tduffy> - *
> tduffy> - * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
> tduffy> - *    copy of which is available from the Open Source Initiative, see
> tduffy> - *    http://www.opensource.org/licenses/gpl-license.php.
> tduffy> - *
> tduffy> - * Licensee has the right to choose one of the above licenses.
> tduffy> - *
> tduffy> - * Redistributions of source code must retain the above copyright
> tduffy> - * notice and one of the license notices.
> tduffy> - *
> tduffy> - * Redistributions in binary form must reproduce both the above copyright
> tduffy> - * notice, one of the license notices in the documentation
> tduffy> - * and/or other materials provided with the distribution.
> tduffy> - */
> tduffy> -
> tduffy> -/*
> tduffy> - * $Id$
> tduffy> - */
> tduffy> -
> tduffy> -#include "dapl.h"
> tduffy> -
> tduffy> -u32 dapl_srq_query(DAT_SRQ_HANDLE srq_handle, struct dat_srq_param *srq_param)
> tduffy> -{
> tduffy> -	struct dapl_srq *srq_ptr;
> tduffy> -	u32 dat_status = DAT_SUCCESS;
> tduffy> -
> tduffy> -	dapl_dbg_log(DAPL_DBG_TYPE_API,
> tduffy> -		     "dapl_srq_query (%p, %x, %p)\n",
> tduffy> -		     srq_handle, srq_param);
> tduffy> -
> tduffy> -	if (DAPL_BAD_HANDLE(srq_handle, DAPL_MAGIC_SRQ)) {
> tduffy> -		dat_status =
> tduffy> -		    DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ);
> tduffy> -		goto bail;
> tduffy> -	}
> tduffy> -	if (srq_param == NULL) {
> tduffy> -		dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);
> tduffy> -		goto bail;
> tduffy> -	}
> tduffy> -
> tduffy> -	srq_ptr = (struct dapl_srq *)srq_handle;
> tduffy> -
> tduffy> -	/*
> tduffy> -	 * XXX Need to calculate available_dto_count and outstanding_dto_count
> tduffy> -	 */
> tduffy> -	srq_ptr->param.available_dto_count = DAT_VALUE_UNKNOWN;
> tduffy> -	srq_ptr->param.outstanding_dto_count = DAT_VALUE_UNKNOWN;
> tduffy> -
> tduffy> -	*srq_param = srq_ptr->param;
> tduffy> -
> tduffy> -      bail:
> tduffy> -	return dat_status;
> tduffy> -}
> tduffy> Index: linux-kernel-srq/dat-provider/Makefile
> tduffy> ===================================================================
> tduffy> --- linux-kernel-srq/dat-provider/Makefile	(revision 2489)
> tduffy> +++ linux-kernel-srq/dat-provider/Makefile	(working copy)
> tduffy> @@ -82,13 +82,7 @@ PROVIDER_MODULES := \
> tduffy>          dapl_rsp_query                	\
> tduffy>          dapl_set_consumer_context     	\
> tduffy>          dapl_sp_util                  	\
> tduffy> -        dapl_srq_create               	\
> tduffy> -        dapl_srq_free                 	\
> tduffy> -        dapl_srq_post_recv            	\
> tduffy> -        dapl_srq_query                	\
> tduffy> -        dapl_srq_resize               	\
> tduffy> -        dapl_srq_set_lw               	\
> tduffy> -        dapl_srq_util                 	\
> tduffy> +        dapl_srq                 	\
> tduffy>          dapl_timer_util 		\
> tduffy>  	dapl_util
> tduffy>
> tduffy> Index: linux-kernel-srq/dat-provider/dapl_srq_util.c
> tduffy> ===================================================================
> tduffy> --- linux-kernel-srq/dat-provider/dapl_srq_util.c	(revision 2489)
> tduffy> +++ linux-kernel-srq/dat-provider/dapl_srq_util.c	(working copy)
> tduffy> @@ -1,126 +0,0 @@
> tduffy> -/*
> tduffy> - * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
> tduffy> - *
> tduffy> - * This Software is licensed under one of the following licenses:
> tduffy> - *
> tduffy> - * 1) under the terms of the "Common Public License 1.0" a copy of which is
> tduffy> - *    available from the Open Source Initiative, see
> tduffy> - *    http://www.opensource.org/licenses/cpl.php.
> tduffy> - *
> tduffy> - * 2) under the terms of the "The BSD License" a copy of which is
> tduffy> - *    available from the Open Source Initiative, see
> tduffy> - *    http://www.opensource.org/licenses/bsd-license.php.
> tduffy> - *
> tduffy> - * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
> tduffy> - *    copy of which is available from the Open Source Initiative, see
> tduffy> - *    http://www.opensource.org/licenses/gpl-license.php.
> tduffy> - *
> tduffy> - * Licensee has the right to choose one of the above licenses.
> tduffy> - *
> tduffy> - * Redistributions of source code must retain the above copyright
> tduffy> - * notice and one of the license notices.
> tduffy> - *
> tduffy> - * Redistributions in binary form must reproduce both the above copyright
> tduffy> - * notice, one of the license notices in the documentation
> tduffy> - * and/or other materials provided with the distribution.
> tduffy> - */
> tduffy> -
> tduffy> -/*
> tduffy> - * $Id$
> tduffy> - */
> tduffy> -
> tduffy> -#include "dapl_srq_util.h"
> tduffy> -#include "dapl_ia_util.h"
> tduffy> -#include "dapl_cookie.h"
> tduffy> -
> tduffy> -/*
> tduffy> - * dapl_srq_alloc
> tduffy> - *
> tduffy> - * alloc and initialize an SRQ struct
> tduffy> - *
> tduffy> - * Input:
> tduffy> - * 	IA INFO struct ptr
> tduffy> - *	SRQ ATTR ptr
> tduffy> - *
> tduffy> - * Output:
> tduffy> - * 	none
> tduffy> - *
> tduffy> - * Returns:
> tduffy> - * 	pointer to srq
> tduffy> - *
> tduffy> - */
> tduffy> -struct dapl_srq *dapl_srq_alloc(struct dapl_ia *ia_ptr,
> tduffy> -				const struct dat_srq_attr *srq_attr)
> tduffy> -{
> tduffy> -	struct dapl_srq *srq_ptr;
> tduffy> -
> tduffy> -	/* Allocate SRQ */
> tduffy> -	srq_ptr = kmalloc(sizeof *srq_ptr, GFP_ATOMIC);
> tduffy> -	if (!srq_ptr)
> tduffy> -		goto bail;
> tduffy> -
> tduffy> -	/* zero the structure */
> tduffy> -	memset(srq_ptr, 0, sizeof *srq_ptr);
> tduffy> -
> tduffy> -	/*
> tduffy> -	 * initialize the header
> tduffy> -	 */
> tduffy> -	srq_ptr->header.provider = ia_ptr->header.provider;
> tduffy> -	srq_ptr->header.magic = DAPL_MAGIC_SRQ;
> tduffy> -	srq_ptr->header.handle_type = DAT_HANDLE_TYPE_SRQ;
> tduffy> -	srq_ptr->header.owner_ia = ia_ptr;
> tduffy> -	srq_ptr->header.user_context.as_64 = 0;
> tduffy> -	srq_ptr->header.user_context.as_ptr = NULL;
> tduffy> -	atomic_set(&srq_ptr->srq_ref_count, 0);
> tduffy> -
> tduffy> -	dapl_llist_init_entry(&srq_ptr->header.ia_list_entry);
> tduffy> -	spin_lock_init(&srq_ptr->header.lock);
> tduffy> -
> tduffy> -	/*
> tduffy> -	 * Initialize the body.
> tduffy> -	 * XXX Assume srq_attrs is required
> tduffy> -	 */
> tduffy> -	srq_ptr->param.max_recv_dtos = srq_attr->max_recv_dtos;
> tduffy> -	srq_ptr->param.max_recv_iov = srq_attr->max_recv_iov;
> tduffy> -	srq_ptr->param.low_watermark = srq_attr->low_watermark;
> tduffy> -
> tduffy> -	/* Get a cookie buffer to track outstanding recvs */
> tduffy> -	if (DAT_SUCCESS != dapl_cb_create(&srq_ptr->recv_buffer,
> tduffy> -					 (struct dapl_ep *)srq_ptr,
> tduffy> -					  srq_ptr->param.max_recv_dtos)) {
> tduffy> -		dapl_srq_dealloc(srq_ptr);
> tduffy> -		srq_ptr = NULL;
> tduffy> -		goto bail;
> tduffy> -	}
> tduffy> -
> tduffy> -bail:
> tduffy> -	return srq_ptr;
> tduffy> -}
> tduffy> -
> tduffy> -/*
> tduffy> - * dapl_srq_dealloc
> tduffy> - *
> tduffy> - * Free the passed in SRQ structure.
> tduffy> - *
> tduffy> - * Input:
> tduffy> - * 	SRQ pointer
> tduffy> - *
> tduffy> - * Output:
> tduffy> - * 	none
> tduffy> - *
> tduffy> - * Returns:
> tduffy> - * 	none
> tduffy> - *
> tduffy> - */
> tduffy> -void dapl_srq_dealloc(struct dapl_srq *srq_ptr)
> tduffy> -{
> tduffy> -	dapl_os_assert(srq_ptr->header.magic == DAPL_MAGIC_SRQ);
> tduffy> -
> tduffy> -	/* reset magic to prevent reuse */
> tduffy> -	srq_ptr->header.magic = DAPL_MAGIC_INVALID;
> tduffy> -	dapl_ia_unlink_srq(srq_ptr->header.owner_ia, srq_ptr);
> tduffy> -	dapl_cb_free(&srq_ptr->recv_buffer);
> tduffy> -	/* no need to destroy srq_ptr->header.lock */
> tduffy> -
> tduffy> -	kfree(srq_ptr);
> tduffy> -}
> tduffy> Index: linux-kernel-srq/dat-provider/dapl_srq_util.h
> tduffy> ===================================================================
> tduffy> --- linux-kernel-srq/dat-provider/dapl_srq_util.h	(revision 2489)
> tduffy> +++ linux-kernel-srq/dat-provider/dapl_srq_util.h	(working copy)
> tduffy> @@ -1,47 +0,0 @@
> tduffy> -/*
> tduffy> - * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
> tduffy> - *
> tduffy> - * This Software is licensed under one of the following licenses:
> tduffy> - *
> tduffy> - * 1) under the terms of the "Common Public License 1.0" a copy of which is
> tduffy> - *    available from the Open Source Initiative, see
> tduffy> - *    http://www.opensource.org/licenses/cpl.php.
> tduffy> - *
> tduffy> - * 2) under the terms of the "The BSD License" a copy of which is
> tduffy> - *    available from the Open Source Initiative, see
> tduffy> - *    http://www.opensource.org/licenses/bsd-license.php.
> tduffy> - *
> tduffy> - * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
> tduffy> - *    copy of which is available from the Open Source Initiative, see
> tduffy> - *    http://www.opensource.org/licenses/gpl-license.php.
> tduffy> - *
> tduffy> - * Licensee has the right to choose one of the above licenses.
> tduffy> - *
> tduffy> - * Redistributions of source code must retain the above copyright
> tduffy> - * notice and one of the license notices.
> tduffy> - *
> tduffy> - * Redistributions in binary form must reproduce both the above copyright
> tduffy> - * notice, one of the license notices in the documentation
> tduffy> - * and/or other materials provided with the distribution.
> tduffy> - */
> tduffy> -
> tduffy> -/**********************************************************************
> tduffy> - *
> tduffy> - * HEADER: dapl_srq_util.h
> tduffy> - *
> tduffy> - * PURPOSE: Utility defs & routines for the SRQ data structure
> tduffy> - *
> tduffy> - * $Id$
> tduffy> - **********************************************************************/
> tduffy> -
> tduffy> -#ifndef DAPL_SRQ_UTIL_H
> tduffy> -#define DAPL_SRQ_UTIL_H
> tduffy> -
> tduffy> -#include "dapl.h"
> tduffy> -
> tduffy> -extern struct dapl_srq *dapl_srq_alloc(struct dapl_ia *ia,
> tduffy> -				       const struct dat_srq_attr *srq_attr);
> tduffy> -
> tduffy> -extern void dapl_srq_dealloc(struct dapl_srq *srq_ptr);
> tduffy> -
> tduffy> -#endif /* DAPL_SRQ_UTIL_H */
> tduffy> Index: linux-kernel-srq/dat-provider/dapl_srq_set_lw.c
> tduffy> ===================================================================
> tduffy> --- linux-kernel-srq/dat-provider/dapl_srq_set_lw.c	(revision 2489)
> tduffy> +++ linux-kernel-srq/dat-provider/dapl_srq_set_lw.c	(working copy)
> tduffy> @@ -1,80 +0,0 @@
> tduffy> -/*
> tduffy> - * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
> tduffy> - *
> tduffy> - * This Software is licensed under one of the following licenses:
> tduffy> - *
> tduffy> - * 1) under the terms of the "Common Public License 1.0" a copy of which is
> tduffy> - *    available from the Open Source Initiative, see
> tduffy> - *    http://www.opensource.org/licenses/cpl.php.
> tduffy> - *
> tduffy> - * 2) under the terms of the "The BSD License" a copy of which is
> tduffy> - *    available from the Open Source Initiative, see
> tduffy> - *    http://www.opensource.org/licenses/bsd-license.php.
> tduffy> - *
> tduffy> - * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
> tduffy> - *    copy of which is available from the Open Source Initiative, see
> tduffy> - *    http://www.opensource.org/licenses/gpl-license.php.
> tduffy> - *
> tduffy> - * Licensee has the right to choose one of the above licenses.
> tduffy> - *
> tduffy> - * Redistributions of source code must retain the above copyright
> tduffy> - * notice and one of the license notices.
> tduffy> - *
> tduffy> - * Redistributions in binary form must reproduce both the above copyright
> tduffy> - * notice, one of the license notices in the documentation
> tduffy> - * and/or other materials provided with the distribution.
> tduffy> - */
> tduffy> -
> tduffy> -/*
> tduffy> - * $Id$
> tduffy> - */
> tduffy> -
> tduffy> -#include "dapl.h"
> tduffy> -#include "dapl_srq_util.h"
> tduffy> -#include "dapl_openib_util.h"
> tduffy> -
> tduffy> -/*
> tduffy> - * dapl_srq_set_lw
> tduffy> - *
> tduffy> - * DAPL Requirements Version 1.2, 6.5.4
> tduffy> - *
> tduffy> - * Set the low water mark for an SRQ and arm the SRQ to generate an
> tduffy> - * event if it is reached.
> tduffy> - *
> tduffy> - * Input:
> tduffy> - * 	srq_handle
> tduffy> - * 	srq_max_recv_dto
> tduffy> - *
> tduffy> - * Output:
> tduffy> - * 	none
> tduffy> - *
> tduffy> - * Returns:
> tduffy> - * 	DAT_SUCCESS
> tduffy> - * 	DAT_INVALID_HANDLE
> tduffy> - * 	DAT_INVALID_PARAMETER
> tduffy> - * 	DAT_MODEL_NOT_SUPPORTED
> tduffy> - */
> tduffy> -
> tduffy> -u32 dapl_srq_set_lw(DAT_SRQ_HANDLE srq_handle, int low_watermark)
> tduffy> -{
> tduffy> -	struct dapl_srq *srq_ptr;
> tduffy> -	u32 dat_status = DAT_SUCCESS;
> tduffy> -
> tduffy> -	dapl_dbg_log(DAPL_DBG_TYPE_API, "dapl_srq_set_lw (%p, %d)\n",
> tduffy> -		     srq_handle, low_watermark);
> tduffy> -
> tduffy> -	if (DAPL_BAD_HANDLE(srq_handle, DAPL_MAGIC_SRQ)) {
> tduffy> -		dat_status =
> tduffy> -		    DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ);
> tduffy> -		goto bail;
> tduffy> -	}
> tduffy> -
> tduffy> -	srq_ptr = (struct dapl_srq *)srq_handle;
> tduffy> -
> tduffy> -	/* XXX Put implementation here XXX */
> tduffy> -
> tduffy> -	/* XXX */ dat_status = DAT_ERROR(DAT_NOT_IMPLEMENTED, DAT_NO_SUBTYPE);
> tduffy> -
> tduffy> -      bail:
> tduffy> -	return dat_status;
> tduffy> -}
> tduffy> Index: linux-kernel-srq/dat-provider/dapl_srq_post_recv.c
> tduffy> ===================================================================
> tduffy> --- linux-kernel-srq/dat-provider/dapl_srq_post_recv.c	(revision 2489)
> tduffy> +++ linux-kernel-srq/dat-provider/dapl_srq_post_recv.c	(working copy)
> tduffy> @@ -1,112 +0,0 @@
> tduffy> -/*
> tduffy> - * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
> tduffy> - *
> tduffy> - * This Software is licensed under one of the following licenses:
> tduffy> - *
> tduffy> - * 1) under the terms of the "Common Public License 1.0" a copy of which is
> tduffy> - *    available from the Open Source Initiative, see
> tduffy> - *    http://www.opensource.org/licenses/cpl.php.
> tduffy> - *
> tduffy> - * 2) under the terms of the "The BSD License" a copy of which is
> tduffy> - *    available from the Open Source Initiative, see
> tduffy> - *    http://www.opensource.org/licenses/bsd-license.php.
> tduffy> - *
> tduffy> - * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
> tduffy> - *    copy of which is available from the Open Source Initiative, see
> tduffy> - *    http://www.opensource.org/licenses/gpl-license.php.
> tduffy> - *
> tduffy> - * Licensee has the right to choose one of the above licenses.
> tduffy> - *
> tduffy> - * Redistributions of source code must retain the above copyright
> tduffy> - * notice and one of the license notices.
> tduffy> - *
> tduffy> - * Redistributions in binary form must reproduce both the above copyright
> tduffy> - * notice, one of the license notices in the documentation
> tduffy> - * and/or other materials provided with the distribution.
> tduffy> - */
> tduffy> -
> tduffy> -/*
> tduffy> - * $Id$
> tduffy> - */
> tduffy> -
> tduffy> -#include "dapl.h"
> tduffy> -#include "dapl_cookie.h"
> tduffy> -#include "dapl_openib_util.h"
> tduffy> -
> tduffy> -/*
> tduffy> - * dapl_srq_post_recv
> tduffy> - *
> tduffy> - * Post a receive buffer that can be used by any incoming
> tduffy> - * message by any connected EP using the SRQ. Request to receive data
> tduffy> - * over a connection of any ep handle into local_iov
> tduffy> - *
> tduffy> - * Input:
> tduffy> - * 	srq_handle
> tduffy> - * 	num_segments
> tduffy> - * 	local_iov
> tduffy> - * 	user_cookie
> tduffy> - *
> tduffy> - * Output:
> tduffy> - * 	None.
> tduffy> - *
> tduffy> - * Returns:
> tduffy> - * 	DAT_SUCCESS
> tduffy> - * 	DAT_INSUFFICIENT_RESOURCES
> tduffy> - * 	DAT_INVALID_PARAMETER
> tduffy> - * 	DAT_INVALID_HANDLE
> tduffy> - * 	DAT_INVALID_STATE
> tduffy> - * 	DAT_PROTECTION_VIOLATION
> tduffy> - * 	DAT_PROVILEGES_VIOLATION
> tduffy> - */
> tduffy> -u32 dapl_srq_post_recv(DAT_SRQ_HANDLE srq_handle, int num_segments,
> tduffy> -		       struct dat_lmr_triplet *local_iov,
> tduffy> -		       DAT_DTO_COOKIE user_cookie)
> tduffy> -{
> tduffy> -	struct dapl_srq *srq_ptr;
> tduffy> -	struct dapl_cookie *cookie;
> tduffy> -	u32 dat_status;
> tduffy> -
> tduffy> -	dapl_dbg_log(DAPL_DBG_TYPE_API,
> tduffy> -		     "dapl_srq_post_recv (%p, %d, %p, %P)\n",
> tduffy> -		     srq_handle, num_segments, local_iov, user_cookie.as_64);
> tduffy> -
> tduffy> -	if (DAPL_BAD_HANDLE(srq_handle, DAPL_MAGIC_SRQ)) {
> tduffy> -		dat_status =
> tduffy> -		    DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ);
> tduffy> -		goto bail;
> tduffy> -	}
> tduffy> -
> tduffy> -	srq_ptr = (struct dapl_srq *)srq_handle;
> tduffy> -
> tduffy> -	/*
> tduffy> -	 * Synchronization ok since this buffer is only used for receive
> tduffy> -	 * requests, which aren't allowed to race with each other. The
> tduffy> -	 * app must syncronize access to the SRQ.
> tduffy> -	 */
> tduffy> -	dat_status = dapl_dto_cookie_alloc(&srq_ptr->recv_buffer,
> tduffy> -					   DAPL_DTO_TYPE_RECV,
> tduffy> -					   user_cookie, &cookie);
> tduffy> -	if (DAT_SUCCESS != dat_status) {
> tduffy> -		goto bail;
> tduffy> -	}
> tduffy> -
> tduffy> -	/*
> tduffy> -	 * Take reference before posting to avoid race conditions with
> tduffy> -	 * completions
> tduffy> -	 */
> tduffy> -	atomic_inc(&srq_ptr->recv_count);
> tduffy> -
> tduffy> -	/*
> tduffy> -	 * Invoke provider specific routine to post DTO
> tduffy> -	 */
> tduffy> -	/* XXX Put code here XXX */
> tduffy> -	/* XXX */ dat_status = DAT_ERROR(DAT_NOT_IMPLEMENTED, DAT_NO_SUBTYPE);
> tduffy> -
> tduffy> -	if (dat_status != DAT_SUCCESS) {
> tduffy> -		atomic_dec(&srq_ptr->recv_count);
> tduffy> -		dapl_cookie_dealloc(&srq_ptr->recv_buffer, cookie);
> tduffy> -	}
> tduffy> -
> tduffy> -      bail:
> tduffy> -	return dat_status;
> tduffy> -}
> tduffy> Index: linux-kernel-srq/dat-provider/dapl_srq_free.c
> tduffy> ===================================================================
> tduffy> --- linux-kernel-srq/dat-provider/dapl_srq_free.c	(revision 2489)
> tduffy> +++ linux-kernel-srq/dat-provider/dapl_srq_free.c	(working copy)
> tduffy> @@ -1,112 +0,0 @@
> tduffy> -/*
> tduffy> - * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
> tduffy> - *
> tduffy> - * This Software is licensed under one of the following licenses:
> tduffy> - *
> tduffy> - * 1) under the terms of the "Common Public License 1.0" a copy of which is
> tduffy> - *    available from the Open Source Initiative, see
> tduffy> - *    http://www.opensource.org/licenses/cpl.php.
> tduffy> - *
> tduffy> - * 2) under the terms of the "The BSD License" a copy of which is
> tduffy> - *    available from the Open Source Initiative, see
> tduffy> - *    http://www.opensource.org/licenses/bsd-license.php.
> tduffy> - *
> tduffy> - * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
> tduffy> - *    copy of which is available from the Open Source Initiative, see
> tduffy> - *    http://www.opensource.org/licenses/gpl-license.php.
> tduffy> - *
> tduffy> - * Licensee has the right to choose one of the above licenses.
> tduffy> - *
> tduffy> - * Redistributions of source code must retain the above copyright
> tduffy> - * notice and one of the license notices.
> tduffy> - *
> tduffy> - * Redistributions in binary form must reproduce both the above copyright
> tduffy> - * notice, one of the license notices in the documentation
> tduffy> - * and/or other materials provided with the distribution.
> tduffy> - */
> tduffy> -
> tduffy> -/*
> tduffy> - * $Id$
> tduffy> - */
> tduffy> -
> tduffy> -#include "dapl.h"
> tduffy> -#include "dapl_ia_util.h"
> tduffy> -#include "dapl_srq_util.h"
> tduffy> -#include "dapl_openib_util.h"
> tduffy> -
> tduffy> -/*
> tduffy> - * dapl_srq_free
> tduffy> - *
> tduffy> - * Destroy an instance of an SRQ
> tduffy> - *
> tduffy> - * Input:
> tduffy> - *	srq_handle
> tduffy> - *
> tduffy> - * Output:
> tduffy> - *	none
> tduffy> - *
> tduffy> - * Returns:
> tduffy> - *	DAT_SUCCESS
> tduffy> - *	DAT_INVALID_PARAMETER
> tduffy> - *	DAT_INVALID_STATE
> tduffy> - */
> tduffy> -u32 dapl_srq_free(DAT_SRQ_HANDLE srq_handle)
> tduffy> -{
> tduffy> -	struct dapl_srq *srq_ptr;
> tduffy> -	struct dapl_ia *ia_ptr;
> tduffy> -	struct dat_srq_param *param;
> tduffy> -	u32 dat_status = DAT_SUCCESS;
> tduffy> -
> tduffy> -	dapl_dbg_log(DAPL_DBG_TYPE_API, "dapl_srq_free (%p)\n", srq_handle);
> tduffy> -
> tduffy> -	srq_ptr = (struct dapl_srq *)srq_handle;
> tduffy> -	param = &srq_ptr->param;
> tduffy> -
> tduffy> -	/*
> tduffy> -	 * Verify parameter & state
> tduffy> -	 */
> tduffy> -	if (DAPL_BAD_HANDLE(srq_ptr, DAPL_MAGIC_SRQ)) {
> tduffy> -		dat_status =
> tduffy> -		    DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_SRQ);
> tduffy> -		goto bail;
> tduffy> -	}
> tduffy> -
> tduffy> -	if (atomic_read(&srq_ptr->srq_ref_count) != 0) {
> tduffy> -		/*
> tduffy> -		 * The DAPL 1.2 spec says to return DAT_SRQ_IN_USE, which does
> tduffy> -		 * not exist. Have filed the following as an eratta.
> tduffy> -		 */
> tduffy> -		dat_status =
> tduffy> -		    DAT_ERROR(DAT_INVALID_STATE, DAT_INVALID_STATE_SRQ_IN_USE);
> tduffy> -		goto bail;
> tduffy> -	}
> tduffy> -
> tduffy> -	ia_ptr = srq_ptr->header.owner_ia;
> tduffy> -
> tduffy> -	/*
> tduffy> -	 * Do verification of parameters and the state change atomically.
> tduffy> -	 */
> tduffy> -	spin_lock_irqsave(&srq_ptr->header.lock, srq_ptr->header.flags);
> tduffy> -
> tduffy> -	/* Remove the SRQ from the IA */
> tduffy> -	dapl_ia_unlink_srq(ia_ptr, srq_ptr);
> tduffy> -
> tduffy> -	spin_unlock_irqrestore(&srq_ptr->header.lock, srq_ptr->header.flags);
> tduffy> -
> tduffy> -	/*
> tduffy> -	 * Finish tearing everything down.
> tduffy> -	 */
> tduffy> -
> tduffy> -	/*
> tduffy> -	 * Take care of the transport resource
> tduffy> -	 */
> tduffy> -
> tduffy> -	/* XXX Put provider code here!!! */
> tduffy> -
> tduffy> -	/* Free the resource */
> tduffy> -	dapl_srq_dealloc(srq_ptr);
> tduffy> -
> tduffy> -      bail:
> tduffy> -	return dat_status;
> tduffy> -
> tduffy> -}
> tduffy> Index: linux-kernel-srq/patches/alt_dat_provider_makefile
> tduffy> ===================================================================
> tduffy> --- linux-kernel-srq/patches/alt_dat_provider_makefile	(revision 2489)
> tduffy> +++ linux-kernel-srq/patches/alt_dat_provider_makefile	(working copy)
> tduffy> @@ -76,13 +76,7 @@ PROVIDER_MODULES := \
> tduffy>          dapl_rsp_query                	\
> tduffy>          dapl_set_consumer_context     	\
> tduffy>          dapl_sp_util                  	\
> tduffy> -        dapl_srq_create               	\
> tduffy> -        dapl_srq_free                 	\
> tduffy> -        dapl_srq_post_recv            	\
> tduffy> -        dapl_srq_query                	\
> tduffy> -        dapl_srq_resize               	\
> tduffy> -        dapl_srq_set_lw               	\
> tduffy> -        dapl_srq_util                 	\
> tduffy> +        dapl_srq                 	\
> tduffy>          dapl_timer_util 		\
> tduffy>  	dapl_util
> tduffy>
> tduffy>
>



More information about the general mailing list