[openib-general] Re: [PATCH][RFC] kDAPL: use linux native timers instead of own

James Lentini jlentini at netapp.com
Tue May 24 11:40:47 PDT 2005


Tom,

This looks very good. A few comments:

- Do we need to convert the timeout from milliseconds to jiffies? 
  
  DAT timeout values are in milliseconds and kernel timers are in 
  jiffies. I think we need to convert from milliseconds to jiffies 
  before setting up a timer.

- Is it safe to use del_timer()? 

  Currently, kDAPL assumes that any function may be called from an
  interrupt (hence the use of spin_lock_irqsave(), etc). This
  precludes us from using del_timer_sync(), but I think there are
  scenarios in which we could get into trouble by using del_timer().

  For example, suppose we are on an SMP machine and the timeout
  occurs. While dapl_ep_timeout() is running on one processor, the 
  kDAPL consumer calls dat_ep_free() on another processor. Now one 
  processor would free the DAPL_EP structure's memory while it was
  being used by dapl_ep_timeout() and its callees. Could this be 
  fixed by simply moving line 260 of dapl_ep_util.c to the end 
  of dapl_ep_timeout and updating dapl_ep_free to return if the 
  ep state is DAT_EP_STATE_ACTIVE_CONNECTION_PENDING? 

- Could we use cm timeouts?

  The timers are only used to implement 2 DAT API calls: 
  dat_ep_connect and dat_ep_dup_connect. Both use a timer to 
  implement the same feature (cancel connection attempts 
  after some period of time) and both eventually call 
  ib_send_cm_req().  ib_send_cm_req() allows the consumer to specify 
  timeouts. What happens when these timeouts expire? Could DAPL use 
  these instead of kernel timers? 

  I don't see an ib_cm_event_type that corresponds to a timeout. This 
  implies that the CM user's ib_cm_handler is not invoked when one of 
  these timeout values expires. If so kDAPL wouldn't be able to make
  use of them. Does anyone know how these work?

james

On Mon, 23 May 2005, Tom Duffy wrote:

tduffy> This patch removes the kDAPL timer implementation and uses the Linux
tduffy> native timer class.  Please look over and comment.
tduffy> 
tduffy> Signed-off-by: Tom Duffy <tduffy at sun.com>
tduffy> 
tduffy> Index: linux-kernel-timer/test/dapltest/test/dapl_performance_util.c
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/test/dapltest/test/dapl_performance_util.c	(revision 2457)
tduffy> +++ linux-kernel-timer/test/dapltest/test/dapl_performance_util.c	(working copy)
tduffy> @@ -538,7 +538,7 @@ DT_performance_wait (
tduffy>      pre_ts = DT_Mdep_GetTimeStamp ();
tduffy>  
tduffy>      ret = DT_Tdep_evd_wait ( evd_handle,
tduffy> -			DAT_TIMEOUT_INFINITE,
tduffy> +			MAX_SCHEDULE_TIMEOUT,
tduffy>  			&event);
tduffy>  
tduffy>      post_ts = DT_Mdep_GetTimeStamp ();
tduffy> Index: linux-kernel-timer/test/dapltest/test/dapl_performance_client.c
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/test/dapltest/test/dapl_performance_client.c	(revision 2457)
tduffy> +++ linux-kernel-timer/test/dapltest/test/dapl_performance_client.c	(working copy)
tduffy> @@ -105,7 +105,7 @@ retry:
tduffy>      ret = dat_ep_connect (test_ptr->ep_context.ep_handle,
tduffy>  			 test_ptr->remote_ia_addr,
tduffy>  			 test_ptr->ep_context.port,
tduffy> -			 DAT_TIMEOUT_INFINITE,
tduffy> +			 MAX_SCHEDULE_TIMEOUT,
tduffy>  			 0,
tduffy>  			 (void *) 0,	  /* no private data */
tduffy>  			 test_ptr->cmd->qos,
tduffy> Index: linux-kernel-timer/test/dapltest/test/dapl_server.c
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/test/dapltest/test/dapl_server.c	(revision 2457)
tduffy> +++ linux-kernel-timer/test/dapltest/test/dapl_server.c	(working copy)
tduffy> @@ -584,7 +584,7 @@ DT_cs_Server (Params_t * params_ptr)
tduffy>  
tduffy>  	DT_Mdep_wait_object_wait (
tduffy>  		&pt_ptr->synch_wait_object,
tduffy> -		DAT_TIMEOUT_INFINITE);
tduffy> +		MAX_SCHEDULE_TIMEOUT);
tduffy>  
tduffy>  	/* Send the Server_Info */
tduffy>  	DT_Tdep_PT_Debug (1,(phead,"%s: Send Server_Info\n", module));
tduffy> Index: linux-kernel-timer/test/dapltest/test/dapl_transaction_test.c
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/test/dapltest/test/dapl_transaction_test.c	(revision 2457)
tduffy> +++ linux-kernel-timer/test/dapltest/test/dapl_transaction_test.c	(working copy)
tduffy> @@ -714,7 +714,7 @@ retry:
tduffy>  	    ret = dat_ep_connect (test_ptr->ep_context[i].ep_handle,
tduffy>  				 test_ptr->remote_ia_addr,
tduffy>  				 test_ptr->ep_context[i].ia_port,
tduffy> -				 DAT_TIMEOUT_INFINITE,
tduffy> +				 MAX_SCHEDULE_TIMEOUT,
tduffy>  				  strlen (private_data_str), private_data_str,
tduffy>  				 pt_ptr->Params.ReliabilityLevel,
tduffy>  				 DAT_CONNECT_DEFAULT_FLAG);
tduffy> Index: linux-kernel-timer/test/dapltest/test/dapl_test_util.c
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/test/dapltest/test/dapl_test_util.c	(revision 2457)
tduffy> +++ linux-kernel-timer/test/dapltest/test/dapl_test_util.c	(working copy)
tduffy> @@ -261,7 +261,7 @@ DT_cr_event_wait ( DT_Tdep_Print_Head *p
tduffy>  	u32      ret;
tduffy>  	struct dat_event       event;
tduffy>  
tduffy> -	ret = DT_Tdep_evd_wait (evd_handle, DAT_TIMEOUT_INFINITE, &event);
tduffy> +	ret = DT_Tdep_evd_wait (evd_handle, MAX_SCHEDULE_TIMEOUT, &event);
tduffy>  	if (ret != DAT_SUCCESS)
tduffy>  	{
tduffy>  	    DT_Tdep_PT_Printf (phead, "Test Error: dapl_event_wait (CR) failed: %s\n",
tduffy> @@ -316,7 +316,7 @@ DT_conn_event_wait (DT_Tdep_Print_Head *
tduffy>  	u32      ret;
tduffy>  	struct dat_event       event;
tduffy>  
tduffy> -	ret = DT_Tdep_evd_wait (evd_handle, DAT_TIMEOUT_INFINITE, &event);
tduffy> +	ret = DT_Tdep_evd_wait (evd_handle, MAX_SCHEDULE_TIMEOUT, &event);
tduffy>  	if (ret != DAT_SUCCESS)
tduffy>  	{
tduffy>  	    DT_Tdep_PT_Printf (phead, "Test Error: dapl_event_wait (CONN) failed: %s\n",
tduffy> @@ -369,7 +369,7 @@ DT_disco_event_wait ( DT_Tdep_Print_Head
tduffy>  	u32      ret;
tduffy>  	struct dat_event       event;
tduffy>  
tduffy> -	ret = DT_Tdep_evd_wait (evd_handle, DAT_TIMEOUT_INFINITE, &event);
tduffy> +	ret = DT_Tdep_evd_wait (evd_handle, MAX_SCHEDULE_TIMEOUT, &event);
tduffy>  	if (ret != DAT_SUCCESS)
tduffy>  	{
tduffy>  	    DT_Tdep_PT_Printf (phead, "Test Error: dapl_event_wait (DISCONN) failed: %s\n",
tduffy> @@ -492,7 +492,7 @@ DT_dto_event_wait (DT_Tdep_Print_Head *p
tduffy>  	u32      ret;
tduffy>  	struct dat_event       event;
tduffy>  
tduffy> -	ret = DT_Tdep_evd_wait (evd_handle, DAT_TIMEOUT_INFINITE, &event);
tduffy> +	ret = DT_Tdep_evd_wait (evd_handle, MAX_SCHEDULE_TIMEOUT, &event);
tduffy>  	if (ret != DAT_SUCCESS)
tduffy>  	{
tduffy>  	    DT_Tdep_PT_Printf (phead, "Test Error: dapl_event_wait (DTO) failed: %s\n",
tduffy> @@ -536,7 +536,7 @@ DT_rmr_event_wait (DT_Tdep_Print_Head *p
tduffy>  	u32      ret;
tduffy>  	struct dat_event       event;
tduffy>  
tduffy> -	ret = DT_Tdep_evd_wait (evd_handle, DAT_TIMEOUT_INFINITE, &event);
tduffy> +	ret = DT_Tdep_evd_wait (evd_handle, MAX_SCHEDULE_TIMEOUT, &event);
tduffy>  	if (ret != DAT_SUCCESS)
tduffy>  	{
tduffy>  	    DT_Tdep_PT_Printf (phead, "Test Error: dapl_event_wait (RMR) failed: %s\n",
tduffy> Index: linux-kernel-timer/test/dapltest/test/dapl_client.c
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/test/dapltest/test/dapl_client.c	(revision 2457)
tduffy> +++ linux-kernel-timer/test/dapltest/test/dapl_client.c	(working copy)
tduffy> @@ -256,7 +256,7 @@ retry:
tduffy>      ret = dat_ep_connect (ep_handle,
tduffy>  			 server_netaddr,
tduffy>  			 SERVER_PORT_NUMBER,
tduffy> -			 DAT_TIMEOUT_INFINITE,
tduffy> +			 MAX_SCHEDULE_TIMEOUT,
tduffy>  			 0, (void *) 0,  /* no private data */
tduffy>  			 params_ptr->ReliabilityLevel,
tduffy>  			 DAT_CONNECT_DEFAULT_FLAG);
tduffy> Index: linux-kernel-timer/test/dapltest/include/dapl_tdep.h
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/test/dapltest/include/dapl_tdep.h	(revision 2457)
tduffy> +++ linux-kernel-timer/test/dapltest/include/dapl_tdep.h	(working copy)
tduffy> @@ -56,7 +56,7 @@ DT_Tdep_evd_free (DAT_EVD_HANDLE 	evd_ha
tduffy>  
tduffy>  u32
tduffy>  DT_Tdep_evd_wait (DAT_EVD_HANDLE 	evd_handle,
tduffy> -		  DAT_TIMEOUT   	timeout,
tduffy> +		  unsigned long   	timeout,
tduffy>  		  struct dat_event    	*event);
tduffy>  u32
tduffy>  DT_Tdep_evd_dequeue (DAT_EVD_HANDLE	evd_handle,
tduffy> Index: linux-kernel-timer/test/dapltest/include/dapl_proto.h
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/test/dapltest/include/dapl_proto.h	(revision 2457)
tduffy> +++ linux-kernel-timer/test/dapltest/include/dapl_proto.h	(working copy)
tduffy> @@ -189,7 +189,7 @@ void 			DT_Mdep_Thread_EXIT ( void * thr
tduffy>  int				DT_Mdep_wait_object_init ( DT_WAIT_OBJECT *wait_obj);
tduffy>  int 			DT_Mdep_wait_object_wait (
tduffy>  						    DT_WAIT_OBJECT *wait_obj,
tduffy> -						     int timeout_val);
tduffy> +						     unsigned long timeout_val);
tduffy>  int 			DT_Mdep_wait_object_wakeup ( DT_WAIT_OBJECT *wait_obj);
tduffy>  int 			DT_Mdep_wait_object_destroy ( DT_WAIT_OBJECT *wait_obj);
tduffy>  
tduffy> Index: linux-kernel-timer/test/dapltest/include/dapl_transaction_test.h
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/test/dapltest/include/dapl_transaction_test.h	(revision 2457)
tduffy> +++ linux-kernel-timer/test/dapltest/include/dapl_transaction_test.h	(working copy)
tduffy> @@ -79,7 +79,7 @@ typedef struct
tduffy>      Transaction_Cmd_t       *cmd;
tduffy>      struct sockaddr *     remote_ia_addr;
tduffy>      DAT_CONN_QUAL           base_port;
tduffy> -    DAT_TIMEOUT             time_out;
tduffy> +    unsigned long             time_out;
tduffy>      int               evd_length;
tduffy>      Thread                  *thread;
tduffy>  
tduffy> Index: linux-kernel-timer/test/dapltest/mdep/linux/dapl_mdep_user.c
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/test/dapltest/mdep/linux/dapl_mdep_user.c	(revision 2457)
tduffy> +++ linux-kernel-timer/test/dapltest/mdep/linux/dapl_mdep_user.c	(working copy)
tduffy> @@ -459,7 +459,7 @@ DT_Mdep_wait_object_init (
tduffy>  int
tduffy>  DT_Mdep_wait_object_wait (
tduffy>  	DT_WAIT_OBJECT *wait_obj,
tduffy> -	 int timeout_val)
tduffy> +	 unsigned long timeout_val)
tduffy>  {
tduffy>      int 		dat_status;
tduffy>      int 		pthread_status;
tduffy> Index: linux-kernel-timer/test/dapltest/mdep/linux/dapl_mdep_kernel.c
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/test/dapltest/mdep/linux/dapl_mdep_kernel.c	(revision 2457)
tduffy> +++ linux-kernel-timer/test/dapltest/mdep/linux/dapl_mdep_kernel.c	(working copy)
tduffy> @@ -313,13 +313,13 @@ DT_Mdep_wait_object_init (
tduffy>  int
tduffy>  DT_Mdep_wait_object_wait (
tduffy>  	DT_WAIT_OBJECT *wait_obj,
tduffy> -	 int timeout_val)
tduffy> +	 unsigned long timeout_val)
tduffy>  {
tduffy>      int     expire;
tduffy>      int 	dat_status;
tduffy>  
tduffy>      dat_status = DAT_SUCCESS;
tduffy> -    if ( DAT_TIMEOUT_INFINITE == timeout_val)
tduffy> +    if ( MAX_SCHEDULE_TIMEOUT == timeout_val)
tduffy>      {
tduffy>  	interruptible_sleep_on (wait_obj);
tduffy>      }
tduffy> Index: linux-kernel-timer/test/dapltest/kdapl/kdapl_tdep_evd.c
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/test/dapltest/kdapl/kdapl_tdep_evd.c	(revision 2457)
tduffy> +++ linux-kernel-timer/test/dapltest/kdapl/kdapl_tdep_evd.c	(working copy)
tduffy> @@ -214,7 +214,7 @@ DT_Tdep_evd_dequeue (DAT_EVD_HANDLE evd_
tduffy>  
tduffy>  u32
tduffy>  DT_Tdep_evd_wait (DAT_EVD_HANDLE evd_handle,
tduffy> -		  DAT_TIMEOUT   timeout,
tduffy> +		  unsigned long   timeout,
tduffy>  		  struct dat_event      *dat_event)
tduffy>  {
tduffy>      u32  dat_status;
tduffy> @@ -240,7 +240,7 @@ DT_Tdep_evd_wait (DAT_EVD_HANDLE evd_han
tduffy>  	return dat_status;
tduffy>      }
tduffy>      /* wait for an event */
tduffy> -    if (timeout == DAT_TIMEOUT_INFINITE) 
tduffy> +    if (timeout == MAX_SCHEDULE_TIMEOUT) 
tduffy>      {
tduffy>  	rc = wait_event_interruptible (evd_ptr->wait_object, 
tduffy>  				       evd_ptr->event_next != NULL);
tduffy> Index: linux-kernel-timer/dat-provider/dapl_ep_connect.c
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/dat-provider/dapl_ep_connect.c	(revision 2457)
tduffy> +++ linux-kernel-timer/dat-provider/dapl_ep_connect.c	(working copy)
tduffy> @@ -35,7 +35,6 @@
tduffy>  #include "dapl_ep_util.h"
tduffy>  #include "dapl_openib_util.h"
tduffy>  #include "dapl_evd_util.h"
tduffy> -#include "dapl_timer_util.h"
tduffy>  
tduffy>  /*
tduffy>   * Request a connection be established between the local Endpoint
tduffy> @@ -44,7 +43,7 @@
tduffy>   */
tduffy>  u32 dapl_ep_connect(DAT_EP_HANDLE ep_handle,
tduffy>  		    struct sockaddr *remote_ia_address,
tduffy> -		    DAT_CONN_QUAL remote_conn_qual, DAT_TIMEOUT timeout,
tduffy> +		    DAT_CONN_QUAL remote_conn_qual, unsigned long timeout,
tduffy>  		    int private_data_size, const void *private_data,
tduffy>  		    enum dat_qos qos, enum dat_connect_flags connect_flags)
tduffy>  {
tduffy> @@ -278,23 +277,17 @@ u32 dapl_ep_connect(DAT_EP_HANDLE ep_han
tduffy>  		spin_lock_irqsave(&ep_ptr->header.lock, ep_ptr->header.flags);
tduffy>  		if (ep_ptr->param.ep_state == 
tduffy>  			DAT_EP_STATE_ACTIVE_CONNECTION_PENDING
tduffy> -		    && timeout != DAT_TIMEOUT_INFINITE) {
tduffy> -			ep_ptr->cxn_timer = kmalloc(sizeof *ep_ptr->cxn_timer,
tduffy> -						    GFP_ATOMIC);
tduffy> -			if (!ep_ptr->cxn_timer) {
tduffy> -				dat_status = DAT_ERROR(DAT_INSUFFICIENT_RESOURCES,
tduffy> -						       DAT_RESOURCE_MEMORY);
tduffy> -				goto bail;
tduffy> -			}
tduffy> -
tduffy> -			dapl_timer_set(ep_ptr->cxn_timer,
tduffy> -				       dapl_ep_timeout, ep_ptr, timeout);
tduffy> +		    && timeout != MAX_SCHEDULE_TIMEOUT) {
tduffy> +			ep_ptr->cxn_timer.expires = jiffies + timeout;
tduffy> +			ep_ptr->cxn_timer.data = (unsigned long)ep_ptr;
tduffy> +			ep_ptr->cxn_timer.function = dapl_ep_timeout;
tduffy> +			add_timer(&ep_ptr->cxn_timer);
tduffy>  		}
tduffy>  		spin_unlock_irqrestore(&ep_ptr->header.lock, 
tduffy>  				       ep_ptr->header.flags);
tduffy>  	}
tduffy>  
tduffy> -      bail:
tduffy> +bail:
tduffy>  	dapl_dbg_log(DAPL_DBG_TYPE_RTN | DAPL_DBG_TYPE_CM,
tduffy>  		     "dapl_ep_connect () returns 0x%x\n", dat_status);
tduffy>  
tduffy> Index: linux-kernel-timer/dat-provider/dapl_module.c
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/dat-provider/dapl_module.c	(revision 2457)
tduffy> +++ linux-kernel-timer/dat-provider/dapl_module.c	(working copy)
tduffy> @@ -36,7 +36,6 @@
tduffy>  #include "dapl_mr_util.h"
tduffy>  #include "dapl_util.h"
tduffy>  #include "dapl_openib_util.h"
tduffy> -#include "dapl_timer_util.h"
tduffy>  
tduffy>  MODULE_LICENSE("Dual BSD/GPL");
tduffy>  MODULE_DESCRIPTION("DAT Provider for InfiniBand");
tduffy> @@ -57,8 +56,6 @@ static int __init dapl_init(void)
tduffy>  
tduffy>  	dapl_dbg_log(DAPL_DBG_TYPE_UTIL, "provider started\n");
tduffy>  
tduffy> -	dapl_timer_init();
tduffy> -
tduffy>  	dat_status = dapl_provider_list_create();
tduffy>  	if (DAT_SUCCESS != dat_status) {
tduffy>  		dapl_dbg_log(DAPL_DBG_TYPE_ERR,
tduffy> Index: linux-kernel-timer/dat-provider/dapl_evd_connection_callb.c
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/dat-provider/dapl_evd_connection_callb.c	(revision 2457)
tduffy> +++ linux-kernel-timer/dat-provider/dapl_evd_connection_callb.c	(working copy)
tduffy> @@ -32,7 +32,6 @@
tduffy>  #include "dapl.h"
tduffy>  #include "dapl_evd_util.h"
tduffy>  #include "dapl_ep_util.h"
tduffy> -#include "dapl_timer_util.h"
tduffy>  
tduffy>  /*
tduffy>   * dapl_evd_connection_callback
tduffy> @@ -90,11 +89,7 @@ void dapl_evd_connection_callback(struct
tduffy>  	/*
tduffy>  	 * If a connection timer has been set up on this EP, cancel it now
tduffy>  	 */
tduffy> -	if (ep_ptr->cxn_timer != NULL) {
tduffy> -		dapl_timer_cancel(ep_ptr->cxn_timer);
tduffy> -		kfree(ep_ptr->cxn_timer);
tduffy> -		ep_ptr->cxn_timer = NULL;
tduffy> -	}
tduffy> +	del_timer(&ep_ptr->cxn_timer);
tduffy>  
tduffy>  	switch (event) {
tduffy>  	case DAT_CONNECTION_EVENT_ESTABLISHED:
tduffy> Index: linux-kernel-timer/dat-provider/Makefile
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/dat-provider/Makefile	(revision 2457)
tduffy> +++ linux-kernel-timer/dat-provider/Makefile	(working copy)
tduffy> @@ -101,7 +101,6 @@ PROVIDER_MODULES := \
tduffy>          dapl_srq_resize               	\
tduffy>          dapl_srq_set_lw               	\
tduffy>          dapl_srq_util                 	\
tduffy> -        dapl_timer_util 		\
tduffy>  	dapl_util
tduffy>  
tduffy>  PROVIDER_OBJS := $(foreach s, $(PROVIDER_MODULES), $(s).o)
tduffy> Index: linux-kernel-timer/dat-provider/dapl_ep_free.c
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/dat-provider/dapl_ep_free.c	(revision 2457)
tduffy> +++ linux-kernel-timer/dat-provider/dapl_ep_free.c	(working copy)
tduffy> @@ -34,7 +34,6 @@
tduffy>  #include "dapl_ep_util.h"
tduffy>  #include "dapl_openib_util.h"
tduffy>  #include "dapl_ring_buffer_util.h"
tduffy> -#include "dapl_timer_util.h"
tduffy>  
tduffy>  /*
tduffy>   * dapl_ep_free
tduffy> @@ -107,11 +106,7 @@ u32 dapl_ep_free(DAT_EP_HANDLE ep_handle
tduffy>  	 */
tduffy>  	spin_lock_irqsave(&ep_ptr->header.lock, ep_ptr->header.flags);
tduffy>  
tduffy> -	if (ep_ptr->cxn_timer != NULL) {
tduffy> -		dapl_timer_cancel(ep_ptr->cxn_timer);
tduffy> -		kfree(ep_ptr->cxn_timer);
tduffy> -		ep_ptr->cxn_timer = NULL;
tduffy> -	}
tduffy> +	del_timer(&ep_ptr->cxn_timer);
tduffy>  
tduffy>  	/* Remove the EP from the IA */
tduffy>  	dapl_ia_unlink_ep(ia_ptr, ep_ptr);
tduffy> Index: linux-kernel-timer/dat-provider/dapl_timer_util.c
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/dat-provider/dapl_timer_util.c	(revision 2457)
tduffy> +++ linux-kernel-timer/dat-provider/dapl_timer_util.c	(working copy)
tduffy> @@ -1,313 +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> - * Routines to add and cancel timer records. A timer record
tduffy> - * is put on the global timer queue. If the timer thread is
tduffy> - * not running, start it. The timer thread will sleep
tduffy> - * until a timer event or until a process wakes it up
tduffy> - * to notice a new timer is available; we use a DAPL_WAIT_OBJ
tduffy> - * for synchronization.
tduffy> - *
tduffy> - * If a timer is cancelled, it is simlpy removed from the
tduffy> - * queue. The timer may wakeup and notice there is no timer
tduffy> - * record to awaken at this time, so it will reset for the
tduffy> - * next entry. When there are no timer records to manage,
tduffy> - * the timer thread just sleeps until awakened.
tduffy> - *
tduffy> - * This file also contains the timer handler thread,
tduffy> - * embodied in dapl_timer_thread().
tduffy> - *
tduffy> - * $Id$
tduffy> - */
tduffy> -
tduffy> -#include "dapl.h"
tduffy> -#include "dapl_timer_util.h"
tduffy> -
tduffy> -struct dapl_timer_head {
tduffy> -	struct dapl_llist_entry *timer_list_head;
tduffy> -	spinlock_t lock;
tduffy> -	unsigned long flags;
tduffy> -	DAPL_OS_WAIT_OBJECT wait_object;
tduffy> -	int thread_id;
tduffy> -};
tduffy> -
tduffy> -static struct dapl_timer_head g_dapl_timer_head;
tduffy> -
tduffy> -static int dapl_timer_thread(void *arg);
tduffy> -
tduffy> -void dapl_timer_init(void)
tduffy> -{
tduffy> -	/*
tduffy> -	 * Set up the timer thread elements. The timer thread isn't
tduffy> -	 * started until it is actually needed
tduffy> -	 */
tduffy> -	g_dapl_timer_head.timer_list_head = NULL;
tduffy> -	spin_lock_init(&g_dapl_timer_head.lock);
tduffy> -	dapl_os_wait_object_init(&g_dapl_timer_head.wait_object);
tduffy> -	g_dapl_timer_head.thread_id = -1;
tduffy> -}
tduffy> -
tduffy> -/*
tduffy> - * dapl_timer_set
tduffy> - *
tduffy> - * Set a timer. The timer will invoke the specified function
tduffy> - * after a number of useconds expires.
tduffy> - *
tduffy> - * Input:
tduffy> - *      timer    User provided timer structure
tduffy> - *      func     Function to invoke when timer expires
tduffy> - *      data     Argument passed to func()
tduffy> - *      expires  microseconds until timer fires
tduffy> - *
tduffy> - * Returns:
tduffy> - *	no return value
tduffy> - *
tduffy> - */
tduffy> -u32 dapl_timer_set(struct dapl_timer_entry *timer, void (*func) (void *),
tduffy> -		   void *data, DAPL_OS_TIMEVAL expires)
tduffy> -{
tduffy> -	struct dapl_timer_entry *list_ptr;
tduffy> -	DAPL_OS_TIMEVAL cur_time;
tduffy> -	boolean_t wakeup_tmo_thread;
tduffy> -
tduffy> -	/*
tduffy> -	 * Start the timer thread the first time we need a timer
tduffy> -	 */
tduffy> -	if ( -1 == g_dapl_timer_head.thread_id ) {
tduffy> -		g_dapl_timer_head.thread_id = 
tduffy> -			kernel_thread(dapl_timer_thread, &g_dapl_timer_head, 0);
tduffy> -	}
tduffy> -
tduffy> -	dapl_llist_init_entry(&timer->list_entry);
tduffy> -	wakeup_tmo_thread = FALSE;
tduffy> -	dapl_os_get_time(&cur_time);
tduffy> -	timer->expires = cur_time + expires;	/* calculate future time */
tduffy> -	timer->function = func;
tduffy> -	timer->data = data;
tduffy> -
tduffy> -	/*
tduffy> -	 * Put the element on the queue: sorted by wakeup time, eariliest
tduffy> -	 * first.
tduffy> -	 */
tduffy> -	spin_lock_irqsave(&g_dapl_timer_head.lock, g_dapl_timer_head.flags);
tduffy> -	/*
tduffy> -	 * Deal with 3 cases due to our list structure:
tduffy> -	 * 1) list is empty: become the list head
tduffy> -	 * 2) New timer is sooner than list head: become the list head
tduffy> -	 * 3) otherwise, sort the timer into the list, no need to wake
tduffy> -	 *    the timer thread up
tduffy> -	 */
tduffy> -	if (dapl_llist_is_empty(&g_dapl_timer_head.timer_list_head)) {
tduffy> -		/* Case 1: add entry to head of list */
tduffy> -		dapl_llist_add_head(&g_dapl_timer_head.timer_list_head,
tduffy> -				    (struct dapl_llist_entry *)
tduffy> -					&timer->list_entry,
tduffy> -				    timer);
tduffy> -		wakeup_tmo_thread = TRUE;
tduffy> -	} else {
tduffy> -		list_ptr = (struct dapl_timer_entry *)
tduffy> -		    dapl_llist_peek_head(&g_dapl_timer_head.timer_list_head);
tduffy> -
tduffy> -		if (timer->expires < list_ptr->expires) {
tduffy> -			/* Case 2: add entry to head of list */
tduffy> -			dapl_llist_add_head(&g_dapl_timer_head.timer_list_head,
tduffy> -					    (struct dapl_llist_entry *)
tduffy> -						&timer->list_entry, timer);
tduffy> -			wakeup_tmo_thread = TRUE;
tduffy> -		} else {
tduffy> -			/* Case 3: figure out where entry goes in sorted list */
tduffy> -			list_ptr =
tduffy> -			    dapl_llist_next_entry(&g_dapl_timer_head.
tduffy> -						  timer_list_head,
tduffy> -						  (struct dapl_llist_entry *)
tduffy> -							&list_ptr->list_entry);
tduffy> -
tduffy> -			while (list_ptr != NULL) {
tduffy> -				if (timer->expires < list_ptr->expires) {
tduffy> -					dapl_llist_add_entry(&g_dapl_timer_head.
tduffy> -							     timer_list_head,
tduffy> -							     (struct dapl_llist_entry *)
tduffy> -								&list_ptr->list_entry,
tduffy> -							     (struct dapl_llist_entry *)
tduffy> -								&timer->list_entry,
tduffy> -							     timer);
tduffy> -					break;
tduffy> -
tduffy> -				}
tduffy> -				list_ptr =
tduffy> -				    dapl_llist_next_entry(&g_dapl_timer_head.
tduffy> -							  timer_list_head,
tduffy> -							  (struct dapl_llist_entry *)
tduffy> -							  &list_ptr->list_entry);
tduffy> -			}
tduffy> -			if (list_ptr == NULL) {
tduffy> -				/* entry goes to the end of the list */
tduffy> -				dapl_llist_add_tail(&g_dapl_timer_head.
tduffy> -						    timer_list_head,
tduffy> -						    (struct dapl_llist_entry *)
tduffy> -						    &timer->list_entry, timer);
tduffy> -			}
tduffy> -		}
tduffy> -
tduffy> -	}
tduffy> -	spin_unlock_irqrestore(&g_dapl_timer_head.lock, 
tduffy> -			       g_dapl_timer_head.flags);
tduffy> -
tduffy> -	if (wakeup_tmo_thread == TRUE) {
tduffy> -		dapl_os_wait_object_wakeup(&g_dapl_timer_head.wait_object);
tduffy> -	}
tduffy> -
tduffy> -	return DAT_SUCCESS;
tduffy> -}
tduffy> -
tduffy> -/*
tduffy> - * dapl_timer_cancel
tduffy> - *
tduffy> - * Cancel a timer. Simply deletes the timer with no function invocations
tduffy> - *
tduffy> - * Input:
tduffy> - *      timer    User provided timer structure
tduffy> - *
tduffy> - * Returns:
tduffy> - *	no return value
tduffy> - */
tduffy> -void dapl_timer_cancel(struct dapl_timer_entry *timer)
tduffy> -{
tduffy> -	spin_lock_irqsave(&g_dapl_timer_head.lock, g_dapl_timer_head.flags);
tduffy> -	/*
tduffy> -	 * make sure the entry has not been removed by another thread
tduffy> -	 */
tduffy> -	if (!dapl_llist_is_empty(&g_dapl_timer_head.timer_list_head) &&
tduffy> -	    timer->list_entry.list_head == &g_dapl_timer_head.timer_list_head) {
tduffy> -		dapl_llist_remove_entry(&g_dapl_timer_head.timer_list_head,
tduffy> -					(struct dapl_llist_entry *)
tduffy> -						&timer->list_entry);
tduffy> -	}
tduffy> -	/*
tduffy> -	 * If this was the first entry on the queue we could awaken the
tduffy> -	 * thread and have it reset the list; but it will just wake up
tduffy> -	 * and find that the timer entry has been removed, then go back
tduffy> -	 * to sleep, so don't bother.
tduffy> -	 */
tduffy> -	spin_unlock_irqrestore(&g_dapl_timer_head.lock, 
tduffy> -			       g_dapl_timer_head.flags);
tduffy> -}
tduffy> -
tduffy> -/*
tduffy> - * dapl_timer_thread
tduffy> - *
tduffy> - * Core worker thread dealing with all timers. Basic algorithm:
tduffy> - *	- Sleep until work shows up
tduffy> - *	- Take first element of sorted timer list and wake
tduffy> - *	  invoke the callback if expired
tduffy> - *	- Sleep for the timeout period if not expired
tduffy> - *
tduffy> - * Input:
tduffy> - *      timer_head    Timer head structure to manage timer lists
tduffy> - *
tduffy> - * Returns:
tduffy> - *	int
tduffy> - */
tduffy> -int dapl_timer_thread(void *arg)
tduffy> -{
tduffy> -	struct dapl_timer_entry *list_ptr;
tduffy> -	DAPL_OS_TIMEVAL cur_time;
tduffy> -	struct dapl_timer_head *timer_head;
tduffy> -	u32 dat_status;
tduffy> -
tduffy> -	timer_head = arg;
tduffy> -
tduffy> -	for (;;) {
tduffy> -		if (dapl_llist_is_empty(&timer_head->timer_list_head)) {
tduffy> -			dat_status =
tduffy> -			    dapl_os_wait_object_wait(&timer_head->wait_object,
tduffy> -						     DAT_TIMEOUT_INFINITE);
tduffy> -		}
tduffy> -
tduffy> -		/*
tduffy> -		 * Lock policy:
tduffy> -		 * While this thread is accessing the timer list, it holds the
tduffy> -		 * lock.  Otherwise, it doesn't.
tduffy> -		 */
tduffy> -		spin_lock_irqsave(&timer_head->lock, timer_head->flags);
tduffy> -		while (!dapl_llist_is_empty(&timer_head->timer_list_head)) {
tduffy> -			list_ptr = (struct dapl_timer_entry *)
tduffy> -			    dapl_llist_peek_head(&g_dapl_timer_head.
tduffy> -						 timer_list_head);
tduffy> -			dapl_os_get_time(&cur_time);
tduffy> -
tduffy> -			if (list_ptr->expires <= cur_time) {
tduffy> -				/*
tduffy> -				 * Remove the entry from the list. Sort out how much
tduffy> -				 * time we need to sleep for the next one
tduffy> -				 */
tduffy> -				list_ptr =
tduffy> -				    dapl_llist_remove_head(&timer_head->
tduffy> -							   timer_list_head);
tduffy> -				spin_unlock_irqrestore(&timer_head->lock, 
tduffy> -						       timer_head->flags);
tduffy> -
tduffy> -				/*
tduffy> -				 * Invoke the user callback
tduffy> -				 */
tduffy> -				list_ptr->function(list_ptr->data);
tduffy> -				/* timer structure was allocated by caller, we don't
tduffy> -				 * free it here.
tduffy> -				 */
tduffy> -
tduffy> -				/* reacquire the lock */
tduffy> -				spin_lock_irqsave(&timer_head->lock, 
tduffy> -					          timer_head->flags);
tduffy> -			} else {
tduffy> -				spin_unlock_irqrestore(&timer_head->lock, 
tduffy> -						       timer_head->flags);
tduffy> -				dat_status =
tduffy> -				    dapl_os_wait_object_wait(&timer_head->
tduffy> -							     wait_object,
tduffy> -							     (DAT_TIMEOUT)
tduffy> -							     (list_ptr->
tduffy> -							      expires -
tduffy> -							      cur_time));
tduffy> -				spin_lock_irqsave(&timer_head->lock, 
tduffy> -						  timer_head->flags);
tduffy> -			}
tduffy> -		}
tduffy> -		/*
tduffy> -		 * release the lock before going back to the top to sleep
tduffy> -		 */
tduffy> -		spin_unlock_irqrestore(&timer_head->lock, timer_head->flags);
tduffy> -
tduffy> -		if (dat_status == DAT_INTERNAL_ERROR) {
tduffy> -			/*
tduffy> -			 * XXX What do we do here?
tduffy> -			 */
tduffy> -		}
tduffy> -	} /* for (;;) */
tduffy> -
tduffy> -	return 0;
tduffy> -}
tduffy> Index: linux-kernel-timer/dat-provider/dapl_timer_util.h
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/dat-provider/dapl_timer_util.h	(revision 2457)
tduffy> +++ linux-kernel-timer/dat-provider/dapl_timer_util.h	(working copy)
tduffy> @@ -1,42 +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> -#ifndef DAPL_TIMER_UTIL_H
tduffy> -#define DAPL_TIMER_UTIL_H
tduffy> -
tduffy> -void dapl_timer_init(void);
tduffy> -
tduffy> -u32 dapl_timer_set(struct dapl_timer_entry *timer, void (*func) (void *),
tduffy> -		   void *data, DAPL_OS_TIMEVAL expires);
tduffy> -
tduffy> -void dapl_timer_cancel(struct dapl_timer_entry *timer);
tduffy> -
tduffy> -#endif /*  DAPL_TIMER_UTIL_H */
tduffy> Index: linux-kernel-timer/dat-provider/dapl_ep_util.c
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/dat-provider/dapl_ep_util.c	(revision 2457)
tduffy> +++ linux-kernel-timer/dat-provider/dapl_ep_util.c	(working copy)
tduffy> @@ -75,6 +75,7 @@ struct dapl_ep *dapl_ep_alloc(struct dap
tduffy>  
tduffy>  	dapl_llist_init_entry(&ep_ptr->header.ia_list_entry);
tduffy>  	spin_lock_init(&ep_ptr->header.lock);
tduffy> +	init_timer(&ep_ptr->cxn_timer);
tduffy>  
tduffy>  	/*
tduffy>  	 * Initialize the body
tduffy> @@ -169,8 +170,7 @@ void dapl_ep_dealloc(struct dapl_ep *ep_
tduffy>  	if (ep_ptr->send_iov)
tduffy>  		kfree(ep_ptr->send_iov);
tduffy>  
tduffy> -	if (ep_ptr->cxn_timer)
tduffy> -		kfree(ep_ptr->cxn_timer);
tduffy> +	del_timer(&ep_ptr->cxn_timer);
tduffy>  
tduffy>  	kfree(ep_ptr);
tduffy>  }
tduffy> @@ -248,7 +248,7 @@ bail:
tduffy>   * If this routine is invoked before a connection occurs, generate an
tduffy>   * event
tduffy>   */
tduffy> -void dapl_ep_timeout(void *arg)
tduffy> +void dapl_ep_timeout(unsigned long arg)
tduffy>  {
tduffy>  	struct dapl_ep *ep_ptr;
tduffy>  
tduffy> Index: linux-kernel-timer/dat-provider/dapl_ep_util.h
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/dat-provider/dapl_ep_util.h	(revision 2457)
tduffy> +++ linux-kernel-timer/dat-provider/dapl_ep_util.h	(working copy)
tduffy> @@ -52,7 +52,7 @@ extern u32 dapl_ep_post_send_req(DAT_EP_
tduffy>  				 DAPL_DTO_TYPE dto_type,
tduffy>  				 enum ib_wr_opcode op_type);
tduffy>  
tduffy> -void dapl_ep_timeout(void *arg);
tduffy> +void dapl_ep_timeout(unsigned long arg);
tduffy>  
tduffy>  enum dat_return_subtype dapl_ep_state_subtype(struct dapl_ep *ep_ptr);
tduffy>  
tduffy> Index: linux-kernel-timer/dat-provider/dapl_util.c
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/dat-provider/dapl_util.c	(revision 2457)
tduffy> +++ linux-kernel-timer/dat-provider/dapl_util.c	(working copy)
tduffy> @@ -33,104 +33,6 @@
tduffy>  #include "dapl_module.h"
tduffy>  #include "dapl_util.h"
tduffy>  
tduffy> -/*
tduffy> - * dapl_os_get_time
tduffy> - *
tduffy> - * Return 64 bit value of current time in microseconds.
tduffy> - *
tduffy> - * Input:
tduffy> - *      loc       User location to place current time
tduffy> - *
tduffy> - * Returns:
tduffy> - *	DAT_SUCCESS
tduffy> - */
tduffy> -
tduffy> -u32 dapl_os_get_time(DAPL_OS_TIMEVAL *loc)
tduffy> -{
tduffy> -	struct timeval tv;
tduffy> -
tduffy> -	do_gettimeofday(&tv);
tduffy> -	*loc = ((u64) (tv.tv_sec) * 1000000L) + (u64) tv.tv_usec;
tduffy> -
tduffy> -	return DAT_SUCCESS;
tduffy> -}
tduffy> -
tduffy> -/*
tduffy> - * Wait object routines
tduffy> - */
tduffy> -
tduffy> -/*
tduffy> - * dapl_os_wait_object_init
tduffy> - *
tduffy> - * Initialize a wait object
tduffy> - *
tduffy> - * Input:
tduffy> - *	wait_obj
tduffy> - *
tduffy> - * Returns:
tduffy> - *	DAT_SUCCESS
tduffy> - *	DAT_INTERNAL_ERROR
tduffy> - */
tduffy> -u32 dapl_os_wait_object_init(DAPL_OS_WAIT_OBJECT *wait_obj)
tduffy> -{
tduffy> -	init_waitqueue_head(&wait_obj->wait_queue);
tduffy> -
tduffy> -	return DAT_SUCCESS;
tduffy> -}
tduffy> -
tduffy> -/* Wait on the supplied wait object, up to the specified time_out.
tduffy> - * A timeout of DAT_TIMEOUT_INFINITE will wait indefinitely.
tduffy> - * Timeout should be specified in micro seconds.
tduffy> - *
tduffy> - * Functional returns:
tduffy> - *	DAT_SUCCESS -- another thread invoked dapl_os_wait object_wakeup
tduffy> - * 	DAT_INVALID_STATE -- someone else is already waiting in this wait
tduffy> - * 	object.
tduffy> - *			     only one waiter is allowed at a time.
tduffy> - *	DAT_ABORT -- another thread invoked dapl_os_wait_object_destroy
tduffy> - *	DAT_TIMEOUT -- the specified time limit was reached.
tduffy> - */
tduffy> -
tduffy> -u32 dapl_os_wait_object_wait(DAPL_OS_WAIT_OBJECT *wait_obj,
tduffy> -			     DAT_TIMEOUT timeout_val)
tduffy> -{
tduffy> -	u32 dat_status = DAT_SUCCESS;
tduffy> -
tduffy> -	if (DAT_TIMEOUT_INFINITE == timeout_val) {
tduffy> -		interruptible_sleep_on(&wait_obj->wait_queue);
tduffy> -	} else {
tduffy> -		int expire;
tduffy> -
tduffy> -		expire = timeout_val * HZ / 1000000;
tduffy> -
tduffy> -		while (expire) {
tduffy> -			current->state = TASK_INTERRUPTIBLE;
tduffy> -			expire = schedule_timeout(expire);
tduffy> -		}
tduffy> -		dat_status = DAT_ERROR(DAT_TIMEOUT_EXPIRED, 0);
tduffy> -	}
tduffy> -	return dat_status;
tduffy> -}
tduffy> -
tduffy> -/*
tduffy> - * dapl_os_wait_object_wakeup
tduffy> - *
tduffy> - * Wakeup a thread waiting on a wait object
tduffy> - *
tduffy> - * Input:
tduffy> - *      wait_obj
tduffy> - *
tduffy> - * Returns:
tduffy> - *	DAT_SUCCESS
tduffy> - *	DAT_INTERNAL_ERROR
tduffy> - */
tduffy> -u32 dapl_os_wait_object_wakeup(DAPL_OS_WAIT_OBJECT *wait_obj)
tduffy> -{
tduffy> -	wake_up_interruptible(&wait_obj->wait_queue);
tduffy> -
tduffy> -	return DAT_SUCCESS;
tduffy> -}
tduffy> -
tduffy>  #ifdef DAPL_DBG
tduffy>  
tduffy>  void dapl_dbg_log(DAPL_DBG_TYPE type, const char *fmt, ...)
tduffy> Index: linux-kernel-timer/dat-provider/dapl_util.h
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/dat-provider/dapl_util.h	(revision 2457)
tduffy> +++ linux-kernel-timer/dat-provider/dapl_util.h	(working copy)
tduffy> @@ -107,24 +107,6 @@ static inline int dapl_os_atomic_assign(
tduffy>   */
tduffy>  
tduffy>  /*
tduffy> - * The wait object invariant: Presuming a call to dapl_os_wait_object_wait
tduffy> - * occurs at some point, there will be at least one wakeup after each call
tduffy> - * to dapl_os_wait_object_signal.  I.e. Signals are not ignored, though
tduffy> - * they may be coallesced.
tduffy> - */
tduffy> -typedef struct dapl_os_wait_object {
tduffy> -	wait_queue_head_t wait_queue;
tduffy> -} DAPL_OS_WAIT_OBJECT;
tduffy> -
tduffy> -/* function prototypes */
tduffy> -u32 dapl_os_wait_object_init(DAPL_OS_WAIT_OBJECT *wait_obj);
tduffy> -
tduffy> -u32 dapl_os_wait_object_wait(DAPL_OS_WAIT_OBJECT *wait_obj,
tduffy> -			     DAT_TIMEOUT timeout_val);
tduffy> -
tduffy> -u32 dapl_os_wait_object_wakeup(DAPL_OS_WAIT_OBJECT *wait_obj);
tduffy> -
tduffy> -/*
tduffy>   * Memory Functions
tduffy>   */
tduffy>  
tduffy> @@ -154,15 +136,6 @@ static inline char *dapl_os_strdup(const
tduffy>  }
tduffy>  
tduffy>  /*
tduffy> - * Timer Functions
tduffy> - */
tduffy> -
tduffy> -typedef u64 DAPL_OS_TIMEVAL;
tduffy> -
tduffy> -/* timer function prototype */
tduffy> -u32 dapl_os_get_time(DAPL_OS_TIMEVAL *);
tduffy> -
tduffy> -/*
tduffy>   * *printf format helper. We use the C string constant concatenation
tduffy>   * ability to define 64 bit formats, which unfortunatly are non standard
tduffy>   * in the C compiler world. 
tduffy> Index: linux-kernel-timer/dat-provider/dapl_ep_dup_connect.c
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/dat-provider/dapl_ep_dup_connect.c	(revision 2457)
tduffy> +++ linux-kernel-timer/dat-provider/dapl_ep_dup_connect.c	(working copy)
tduffy> @@ -32,7 +32,6 @@
tduffy>  #include "dapl.h"
tduffy>  #include "dapl_ep_util.h"
tduffy>  #include "dapl_openib_util.h"
tduffy> -#include "dapl_timer_util.h"
tduffy>  
tduffy>  /*
tduffy>   * dapl_ep_dup_connect
tduffy> @@ -63,7 +62,7 @@
tduffy>   *	DAT_MODEL_NOT_SUPPORTED
tduffy>   */
tduffy>  u32 dapl_ep_dup_connect(DAT_EP_HANDLE ep_handle, DAT_EP_HANDLE ep_dup_handle,
tduffy> -			DAT_TIMEOUT timeout, int private_data_size,
tduffy> +			unsigned long timeout, int private_data_size,
tduffy>  			const void *private_data, enum dat_qos qos)
tduffy>  {
tduffy>  	struct dapl_ep *ep_dup_ptr;
tduffy> @@ -114,6 +113,6 @@ u32 dapl_ep_dup_connect(DAT_EP_HANDLE ep
tduffy>  				     private_data_size,
tduffy>  				     private_data,
tduffy>  				     qos, DAT_CONNECT_DEFAULT_FLAG);
tduffy> -      bail:
tduffy> +bail:
tduffy>  	return dat_status;
tduffy>  }
tduffy> Index: linux-kernel-timer/dat-provider/dapl.h
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/dat-provider/dapl.h	(revision 2457)
tduffy> +++ linux-kernel-timer/dat-provider/dapl.h	(working copy)
tduffy> @@ -237,14 +237,6 @@ struct dapl_evd {
tduffy>  	struct dapl_cno		*cno_ptr;
tduffy>  };
tduffy>  
tduffy> -/* DAPL timer entry, used to queue timeouts */
tduffy> -struct dapl_timer_entry {
tduffy> -	struct dapl_llist_entry list_entry;	/* link entry on ia struct */
tduffy> -	DAPL_OS_TIMEVAL expires;
tduffy> -	void (*function) (void *);
tduffy> -	void *data;
tduffy> -};
tduffy> -
tduffy>  /* struct dapl_ep maps to DAT_EP_HANDLE */
tduffy>  struct dapl_ep {
tduffy>  	struct dapl_header header;
tduffy> @@ -266,8 +258,8 @@ struct dapl_ep {
tduffy>  	/* For passive connections we maintain a back pointer to the CR */
tduffy>  	void *cr_ptr;
tduffy>  
tduffy> -	/* pointer to connection timer, if set */
tduffy> -	struct dapl_timer_entry *cxn_timer;
tduffy> +	/* connection timer */
tduffy> +	struct timer_list cxn_timer;
tduffy>  
tduffy>  	/* private data container */
tduffy>  	char private_data[DAPL_MAX_PRIVATE_DATA_SIZE];
tduffy> @@ -500,14 +492,15 @@ extern u32 dapl_ep_modify(DAT_EP_HANDLE 
tduffy>  extern u32 dapl_ep_connect(DAT_EP_HANDLE ep_handle,
tduffy>  			   struct sockaddr *remote_ia_address,
tduffy>  			   DAT_CONN_QUAL remote_conn_qual,
tduffy> -			   DAT_TIMEOUT timeout,
tduffy> +			   unsigned long timeout,
tduffy>  			   int private_data_size,
tduffy>  			   const void *private_data,
tduffy>  			   enum dat_qos quality_of_service,
tduffy>  			   enum dat_connect_flags connect_flags);
tduffy>  
tduffy>  extern u32 dapl_ep_dup_connect(DAT_EP_HANDLE ep_handle,
tduffy> -			       DAT_EP_HANDLE ep_dup_handle, DAT_TIMEOUT timeout,
tduffy> +			       DAT_EP_HANDLE ep_dup_handle,
tduffy> +			       unsigned long timeout,
tduffy>  			       int private_data_size,
tduffy>  			       const void *private_data,
tduffy>  			       enum dat_qos quality_of_service);
tduffy> Index: linux-kernel-timer/patches/alt_dat_provider_makefile
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/patches/alt_dat_provider_makefile	(revision 2457)
tduffy> +++ linux-kernel-timer/patches/alt_dat_provider_makefile	(working copy)
tduffy> @@ -95,7 +95,6 @@ PROVIDER_MODULES := \
tduffy>          dapl_srq_resize               	\
tduffy>          dapl_srq_set_lw               	\
tduffy>          dapl_srq_util                 	\
tduffy> -        dapl_timer_util 		\
tduffy>  	dapl_util
tduffy>  
tduffy>  PROVIDER_OBJS := $(foreach s, $(PROVIDER_MODULES), $(s).o)
tduffy> @@ -103,7 +102,7 @@ PROVIDER_OBJS := $(foreach s, $(PROVIDER
tduffy>  KDAPL_DEBUG = 1
tduffy>  ifeq (1,$(KDAPL_DEBUG))
tduffy>    EXTRA_CFLAGS += -O0 -g
tduffy> -  EXTRA_CFLAGS += -DDAPL_DBG # -DDAPL_DBG_IO_TRC
tduffy> +  EXTRA_CFLAGS += -DDAPL_DBG
tduffy>  endif
tduffy>  
tduffy>  EXTRA_CFLAGS += -DDAPL_ATS -Idrivers/infiniband/include -I$(obj)/../dat -I$(obj)/../patches/
tduffy> @@ -121,4 +120,4 @@ default:
tduffy>  endif
tduffy>  
tduffy>  clean:
tduffy> -	rm -f *.o *.ko
tduffy> +	rm -rf *.o *.ko .*.cmd *.mod.* .tmp_versions .*.d .*.o.tmp cscope.out
tduffy> Index: linux-kernel-timer/dat/dat.h
tduffy> ===================================================================
tduffy> --- linux-kernel-timer/dat/dat.h	(revision 2457)
tduffy> +++ linux-kernel-timer/dat/dat.h	(working copy)
tduffy> @@ -383,11 +383,6 @@ enum dat_completion_flags {
tduffy>  	DAT_COMPLETION_BARRIER_FENCE_FLAG = 0x08,
tduffy>  };
tduffy>  
tduffy> -typedef u32 DAT_TIMEOUT;	/* microseconds */
tduffy> -
tduffy> -/* timeout = infinity */
tduffy> -#define DAT_TIMEOUT_INFINITE    ((DAT_TIMEOUT) ~0)
tduffy> -
tduffy>  /* dat handles */
tduffy>  typedef void *DAT_HANDLE;
tduffy>  typedef DAT_HANDLE DAT_CR_HANDLE;
tduffy> @@ -1139,12 +1134,12 @@ typedef u32 (*DAT_EP_MODIFY_FUNC)(DAT_EP
tduffy>  				  const struct dat_ep_param *);
tduffy>  
tduffy>  typedef u32 (*DAT_EP_CONNECT_FUNC)(DAT_EP_HANDLE, struct sockaddr *,
tduffy> -				   DAT_CONN_QUAL, DAT_TIMEOUT, int,
tduffy> +				   DAT_CONN_QUAL, unsigned long timeout, int,
tduffy>  				   const void *, enum dat_qos,
tduffy>  				   enum dat_connect_flags);
tduffy>  
tduffy>  typedef u32 (*DAT_EP_DUP_CONNECT_FUNC)(DAT_EP_HANDLE, DAT_EP_HANDLE,
tduffy> -				       DAT_TIMEOUT, int, const void *,
tduffy> +				       unsigned long timeout, int, const void *,
tduffy>  				       enum dat_qos);
tduffy>  
tduffy>  typedef u32 (*DAT_EP_DISCONNECT_FUNC)(DAT_EP_HANDLE, enum dat_close_flags);
tduffy> @@ -1493,7 +1488,7 @@ static inline u32 dat_evd_resize(DAT_EVD
tduffy>  }
tduffy>  
tduffy>  static inline u32 dat_ep_connect(DAT_EP_HANDLE ep, struct sockaddr *ia_addr,
tduffy> -				 DAT_CONN_QUAL conn_qual, DAT_TIMEOUT timeout,
tduffy> +				 DAT_CONN_QUAL conn_qual, unsigned long timeout,
tduffy>  				 int private_data_size,
tduffy>  				 const void *private_data, enum dat_qos qos,
tduffy>  				 enum dat_connect_flags flags)
tduffy> @@ -1533,7 +1528,8 @@ static inline u32 dat_ep_disconnect(DAT_
tduffy>  }
tduffy>  
tduffy>  static inline u32 dat_ep_dup_connect(DAT_EP_HANDLE ep, DAT_EP_HANDLE dup_ep,
tduffy> -				     DAT_TIMEOUT timeout, int private_data_size,
tduffy> +				     unsigned long timeout,
tduffy> +				     int private_data_size,
tduffy>  				     const void *private_data, enum dat_qos qos)
tduffy>  {
tduffy>          return DAT_CALL_PROVIDER_FUNC(ep_dup_connect_func, ep, dup_ep, timeout, 
tduffy> 



More information about the general mailing list