[openib-general] [PATCHv2][RFC] kDAPL: use cm timers instead of own
Tom Duffy
tduffy at sun.com
Thu May 26 19:41:08 PDT 2005
On Tue, 2005-05-24 at 15:00 -0400, James Lentini wrote:
> Tom, are you willing to rework the patch to use the CM timeout values?
So, here is the strategy I am taking. Please let me know if it is
wrong.
When dapl_ep_connect() is called, I save off the timeout value into the
dapl_ep struct. Then, when we get ready to call ib_send_cm_req(), I
stuff the timeout value (after munging it into IB's strange format) into
the conn params remote_cm_response_timeout.
If the connection fails to complete within the timeout,
dapl_cm_active_cb_handler() is called with IB_CM_REQ_ERROR which in turn
calls dapl_evd_connection_callback() which does the same thing that
dapl_ep_timeout() used to do -- tear down the connection.
Here is a patch that implements this, *untested*, please take a look.
Signed-off-by: Tom Duffy <tduffy at sun.com>
Index: linux-kernel-timer/test/dapltest/test/dapl_performance_util.c
===================================================================
--- linux-kernel-timer/test/dapltest/test/dapl_performance_util.c (revision 2498)
+++ linux-kernel-timer/test/dapltest/test/dapl_performance_util.c (working copy)
@@ -538,7 +538,7 @@ DT_performance_wait (
pre_ts = DT_Mdep_GetTimeStamp ();
ret = DT_Tdep_evd_wait ( evd_handle,
- DAT_TIMEOUT_INFINITE,
+ MAX_SCHEDULE_TIMEOUT,
&event);
post_ts = DT_Mdep_GetTimeStamp ();
Index: linux-kernel-timer/test/dapltest/test/dapl_performance_client.c
===================================================================
--- linux-kernel-timer/test/dapltest/test/dapl_performance_client.c (revision 2498)
+++ linux-kernel-timer/test/dapltest/test/dapl_performance_client.c (working copy)
@@ -105,7 +105,7 @@ retry:
ret = dat_ep_connect (test_ptr->ep_context.ep_handle,
test_ptr->remote_ia_addr,
test_ptr->ep_context.port,
- DAT_TIMEOUT_INFINITE,
+ MAX_SCHEDULE_TIMEOUT,
0,
(void *) 0, /* no private data */
test_ptr->cmd->qos,
Index: linux-kernel-timer/test/dapltest/test/dapl_server.c
===================================================================
--- linux-kernel-timer/test/dapltest/test/dapl_server.c (revision 2498)
+++ linux-kernel-timer/test/dapltest/test/dapl_server.c (working copy)
@@ -584,7 +584,7 @@ DT_cs_Server (Params_t * params_ptr)
DT_Mdep_wait_object_wait (
&pt_ptr->synch_wait_object,
- DAT_TIMEOUT_INFINITE);
+ MAX_SCHEDULE_TIMEOUT);
/* Send the Server_Info */
DT_Tdep_PT_Debug (1,(phead,"%s: Send Server_Info\n", module));
Index: linux-kernel-timer/test/dapltest/test/dapl_transaction_test.c
===================================================================
--- linux-kernel-timer/test/dapltest/test/dapl_transaction_test.c (revision 2498)
+++ linux-kernel-timer/test/dapltest/test/dapl_transaction_test.c (working copy)
@@ -714,7 +714,7 @@ retry:
ret = dat_ep_connect (test_ptr->ep_context[i].ep_handle,
test_ptr->remote_ia_addr,
test_ptr->ep_context[i].ia_port,
- DAT_TIMEOUT_INFINITE,
+ MAX_SCHEDULE_TIMEOUT,
strlen (private_data_str), private_data_str,
pt_ptr->Params.ReliabilityLevel,
DAT_CONNECT_DEFAULT_FLAG);
Index: linux-kernel-timer/test/dapltest/test/dapl_test_util.c
===================================================================
--- linux-kernel-timer/test/dapltest/test/dapl_test_util.c (revision 2498)
+++ linux-kernel-timer/test/dapltest/test/dapl_test_util.c (working copy)
@@ -261,7 +261,7 @@ DT_cr_event_wait ( DT_Tdep_Print_Head *p
u32 ret;
struct dat_event event;
- ret = DT_Tdep_evd_wait (evd_handle, DAT_TIMEOUT_INFINITE, &event);
+ ret = DT_Tdep_evd_wait (evd_handle, MAX_SCHEDULE_TIMEOUT, &event);
if (ret != DAT_SUCCESS)
{
DT_Tdep_PT_Printf (phead, "Test Error: dapl_event_wait (CR) failed: %s\n",
@@ -316,7 +316,7 @@ DT_conn_event_wait (DT_Tdep_Print_Head *
u32 ret;
struct dat_event event;
- ret = DT_Tdep_evd_wait (evd_handle, DAT_TIMEOUT_INFINITE, &event);
+ ret = DT_Tdep_evd_wait (evd_handle, MAX_SCHEDULE_TIMEOUT, &event);
if (ret != DAT_SUCCESS)
{
DT_Tdep_PT_Printf (phead, "Test Error: dapl_event_wait (CONN) failed: %s\n",
@@ -369,7 +369,7 @@ DT_disco_event_wait ( DT_Tdep_Print_Head
u32 ret;
struct dat_event event;
- ret = DT_Tdep_evd_wait (evd_handle, DAT_TIMEOUT_INFINITE, &event);
+ ret = DT_Tdep_evd_wait (evd_handle, MAX_SCHEDULE_TIMEOUT, &event);
if (ret != DAT_SUCCESS)
{
DT_Tdep_PT_Printf (phead, "Test Error: dapl_event_wait (DISCONN) failed: %s\n",
@@ -492,7 +492,7 @@ DT_dto_event_wait (DT_Tdep_Print_Head *p
u32 ret;
struct dat_event event;
- ret = DT_Tdep_evd_wait (evd_handle, DAT_TIMEOUT_INFINITE, &event);
+ ret = DT_Tdep_evd_wait (evd_handle, MAX_SCHEDULE_TIMEOUT, &event);
if (ret != DAT_SUCCESS)
{
DT_Tdep_PT_Printf (phead, "Test Error: dapl_event_wait (DTO) failed: %s\n",
@@ -536,7 +536,7 @@ DT_rmr_event_wait (DT_Tdep_Print_Head *p
u32 ret;
struct dat_event event;
- ret = DT_Tdep_evd_wait (evd_handle, DAT_TIMEOUT_INFINITE, &event);
+ ret = DT_Tdep_evd_wait (evd_handle, MAX_SCHEDULE_TIMEOUT, &event);
if (ret != DAT_SUCCESS)
{
DT_Tdep_PT_Printf (phead, "Test Error: dapl_event_wait (RMR) failed: %s\n",
Index: linux-kernel-timer/test/dapltest/test/dapl_client.c
===================================================================
--- linux-kernel-timer/test/dapltest/test/dapl_client.c (revision 2498)
+++ linux-kernel-timer/test/dapltest/test/dapl_client.c (working copy)
@@ -256,7 +256,7 @@ retry:
ret = dat_ep_connect (ep_handle,
server_netaddr,
SERVER_PORT_NUMBER,
- DAT_TIMEOUT_INFINITE,
+ MAX_SCHEDULE_TIMEOUT,
0, (void *) 0, /* no private data */
params_ptr->ReliabilityLevel,
DAT_CONNECT_DEFAULT_FLAG);
Index: linux-kernel-timer/test/dapltest/include/dapl_tdep.h
===================================================================
--- linux-kernel-timer/test/dapltest/include/dapl_tdep.h (revision 2498)
+++ linux-kernel-timer/test/dapltest/include/dapl_tdep.h (working copy)
@@ -56,7 +56,7 @@ DT_Tdep_evd_free (DAT_EVD_HANDLE evd_ha
u32
DT_Tdep_evd_wait (DAT_EVD_HANDLE evd_handle,
- DAT_TIMEOUT timeout,
+ unsigned long timeout,
struct dat_event *event);
u32
DT_Tdep_evd_dequeue (DAT_EVD_HANDLE evd_handle,
Index: linux-kernel-timer/test/dapltest/include/dapl_proto.h
===================================================================
--- linux-kernel-timer/test/dapltest/include/dapl_proto.h (revision 2498)
+++ linux-kernel-timer/test/dapltest/include/dapl_proto.h (working copy)
@@ -189,7 +189,7 @@ void DT_Mdep_Thread_EXIT ( void * thr
int DT_Mdep_wait_object_init ( DT_WAIT_OBJECT *wait_obj);
int DT_Mdep_wait_object_wait (
DT_WAIT_OBJECT *wait_obj,
- int timeout_val);
+ unsigned long timeout_val);
int DT_Mdep_wait_object_wakeup ( DT_WAIT_OBJECT *wait_obj);
int DT_Mdep_wait_object_destroy ( DT_WAIT_OBJECT *wait_obj);
Index: linux-kernel-timer/test/dapltest/include/dapl_transaction_test.h
===================================================================
--- linux-kernel-timer/test/dapltest/include/dapl_transaction_test.h (revision 2498)
+++ linux-kernel-timer/test/dapltest/include/dapl_transaction_test.h (working copy)
@@ -79,7 +79,7 @@ typedef struct
Transaction_Cmd_t *cmd;
struct sockaddr * remote_ia_addr;
DAT_CONN_QUAL base_port;
- DAT_TIMEOUT time_out;
+ unsigned long time_out;
int evd_length;
Thread *thread;
Index: linux-kernel-timer/test/dapltest/mdep/linux/dapl_mdep_user.c
===================================================================
--- linux-kernel-timer/test/dapltest/mdep/linux/dapl_mdep_user.c (revision 2498)
+++ linux-kernel-timer/test/dapltest/mdep/linux/dapl_mdep_user.c (working copy)
@@ -459,7 +459,7 @@ DT_Mdep_wait_object_init (
int
DT_Mdep_wait_object_wait (
DT_WAIT_OBJECT *wait_obj,
- int timeout_val)
+ unsigned long timeout_val)
{
int dat_status;
int pthread_status;
Index: linux-kernel-timer/test/dapltest/mdep/linux/dapl_mdep_kernel.c
===================================================================
--- linux-kernel-timer/test/dapltest/mdep/linux/dapl_mdep_kernel.c (revision 2498)
+++ linux-kernel-timer/test/dapltest/mdep/linux/dapl_mdep_kernel.c (working copy)
@@ -313,13 +313,13 @@ DT_Mdep_wait_object_init (
int
DT_Mdep_wait_object_wait (
DT_WAIT_OBJECT *wait_obj,
- int timeout_val)
+ unsigned long timeout_val)
{
int expire;
int dat_status;
dat_status = DAT_SUCCESS;
- if ( DAT_TIMEOUT_INFINITE == timeout_val)
+ if ( MAX_SCHEDULE_TIMEOUT == timeout_val)
{
interruptible_sleep_on (wait_obj);
}
Index: linux-kernel-timer/test/dapltest/kdapl/kdapl_tdep_evd.c
===================================================================
--- linux-kernel-timer/test/dapltest/kdapl/kdapl_tdep_evd.c (revision 2498)
+++ linux-kernel-timer/test/dapltest/kdapl/kdapl_tdep_evd.c (working copy)
@@ -214,7 +214,7 @@ DT_Tdep_evd_dequeue (DAT_EVD_HANDLE evd_
u32
DT_Tdep_evd_wait (DAT_EVD_HANDLE evd_handle,
- DAT_TIMEOUT timeout,
+ unsigned long timeout,
struct dat_event *dat_event)
{
u32 dat_status;
@@ -240,7 +240,7 @@ DT_Tdep_evd_wait (DAT_EVD_HANDLE evd_han
return dat_status;
}
/* wait for an event */
- if (timeout == DAT_TIMEOUT_INFINITE)
+ if (timeout == MAX_SCHEDULE_TIMEOUT)
{
rc = wait_event_interruptible (evd_ptr->wait_object,
evd_ptr->event_next != NULL);
Index: linux-kernel-timer/dat-provider/dapl_ep_connect.c
===================================================================
--- linux-kernel-timer/dat-provider/dapl_ep_connect.c (revision 2498)
+++ linux-kernel-timer/dat-provider/dapl_ep_connect.c (working copy)
@@ -35,7 +35,6 @@
#include "dapl_ep_util.h"
#include "dapl_openib_util.h"
#include "dapl_evd_util.h"
-#include "dapl_timer_util.h"
/*
* Request a connection be established between the local Endpoint
@@ -44,7 +43,7 @@
*/
u32 dapl_ep_connect(DAT_EP_HANDLE ep_handle,
struct sockaddr *remote_ia_address,
- DAT_CONN_QUAL remote_conn_qual, DAT_TIMEOUT timeout,
+ DAT_CONN_QUAL remote_conn_qual, unsigned long timeout,
int private_data_size, const void *private_data,
enum dat_qos qos, enum dat_connect_flags connect_flags)
{
@@ -277,23 +276,13 @@ u32 dapl_ep_connect(DAT_EP_HANDLE ep_han
spin_lock_irqsave(&ep_ptr->header.lock, ep_ptr->header.flags);
if (ep_ptr->param.ep_state ==
DAT_EP_STATE_ACTIVE_CONNECTION_PENDING
- && timeout != DAT_TIMEOUT_INFINITE) {
- ep_ptr->cxn_timer = kmalloc(sizeof *ep_ptr->cxn_timer,
- GFP_ATOMIC);
- if (!ep_ptr->cxn_timer) {
- dat_status = DAT_ERROR(DAT_INSUFFICIENT_RESOURCES,
- DAT_RESOURCE_MEMORY);
- goto bail;
- }
-
- dapl_timer_set(ep_ptr->cxn_timer,
- dapl_ep_timeout, ep_ptr, timeout);
- }
+ && timeout != MAX_SCHEDULE_TIMEOUT)
+ ep_ptr->timeout = timeout;
spin_unlock_irqrestore(&ep_ptr->header.lock,
ep_ptr->header.flags);
}
- bail:
+bail:
dapl_dbg_log(DAPL_DBG_TYPE_RTN | DAPL_DBG_TYPE_CM,
"dapl_ep_connect () returns 0x%x\n", dat_status);
Index: linux-kernel-timer/dat-provider/dapl_module.c
===================================================================
--- linux-kernel-timer/dat-provider/dapl_module.c (revision 2498)
+++ linux-kernel-timer/dat-provider/dapl_module.c (working copy)
@@ -36,7 +36,6 @@
#include "dapl_mr_util.h"
#include "dapl_util.h"
#include "dapl_openib_util.h"
-#include "dapl_timer_util.h"
MODULE_LICENSE("Dual BSD/GPL");
MODULE_DESCRIPTION("DAT Provider for InfiniBand");
@@ -57,8 +56,6 @@ static int __init dapl_init(void)
dapl_dbg_log(DAPL_DBG_TYPE_UTIL, "provider started\n");
- dapl_timer_init();
-
dat_status = dapl_provider_list_create();
if (DAT_SUCCESS != dat_status) {
dapl_dbg_log(DAPL_DBG_TYPE_ERR,
Index: linux-kernel-timer/dat-provider/dapl_evd_connection_callb.c
===================================================================
--- linux-kernel-timer/dat-provider/dapl_evd_connection_callb.c (revision 2498)
+++ linux-kernel-timer/dat-provider/dapl_evd_connection_callb.c (working copy)
@@ -32,7 +32,6 @@
#include "dapl.h"
#include "dapl_evd_util.h"
#include "dapl_ep_util.h"
-#include "dapl_timer_util.h"
/*
* dapl_evd_connection_callback
@@ -87,15 +86,6 @@ void dapl_evd_connection_callback(struct
*/
spin_lock_irqsave(&ep_ptr->header.lock, ep_ptr->header.flags);
- /*
- * If a connection timer has been set up on this EP, cancel it now
- */
- if (ep_ptr->cxn_timer != NULL) {
- dapl_timer_cancel(ep_ptr->cxn_timer);
- kfree(ep_ptr->cxn_timer);
- ep_ptr->cxn_timer = NULL;
- }
-
switch (event) {
case DAT_CONNECTION_EVENT_ESTABLISHED:
{
Index: linux-kernel-timer/dat-provider/dapl_ep_free.c
===================================================================
--- linux-kernel-timer/dat-provider/dapl_ep_free.c (revision 2498)
+++ linux-kernel-timer/dat-provider/dapl_ep_free.c (working copy)
@@ -34,7 +34,6 @@
#include "dapl_ep_util.h"
#include "dapl_openib_util.h"
#include "dapl_ring_buffer_util.h"
-#include "dapl_timer_util.h"
/*
* dapl_ep_free
@@ -107,12 +106,6 @@ u32 dapl_ep_free(DAT_EP_HANDLE ep_handle
*/
spin_lock_irqsave(&ep_ptr->header.lock, ep_ptr->header.flags);
- if (ep_ptr->cxn_timer != NULL) {
- dapl_timer_cancel(ep_ptr->cxn_timer);
- kfree(ep_ptr->cxn_timer);
- ep_ptr->cxn_timer = NULL;
- }
-
/* Remove the EP from the IA */
dapl_ia_unlink_ep(ia_ptr, ep_ptr);
Index: linux-kernel-timer/dat-provider/dapl_openib_cm.c
===================================================================
--- linux-kernel-timer/dat-provider/dapl_openib_cm.c (revision 2498)
+++ linux-kernel-timer/dat-provider/dapl_openib_cm.c (working copy)
@@ -288,6 +288,26 @@ static int dapl_cm_passive_cb_handler(st
return ret;
}
+/*
+ * approximately transforms miliseconds to 4.096us*2^x
+ * 63(+8) is max return
+ */
+static inline u8 dapl_convert_ms_to_kookyib(unsigned long ms) {
+ unsigned long converged = 2;
+ u8 i;
+
+ if (2 > ms)
+ return 8;
+
+ for (i = 1; i < 64; i++) {
+ if (converged >= ms)
+ break;
+ converged = 2*converged;
+ }
+
+ return i+8;
+}
+
static void dapl_path_comp_handler(u64 req_id, void *context, int rec_num)
{
struct dapl_cm_id *conn = context;
@@ -321,6 +341,10 @@ static void dapl_path_comp_handler(u64 r
if (conn->dapl_path.mtu > IB_MTU_1024)
conn->dapl_path.mtu = IB_MTU_1024;
+ if (conn->ep && conn->ep->timeout != 0)
+ conn->param.remote_cm_response_timeout =
+ dapl_convert_ms_to_kookyib(conn->ep->timeout);
+
conn->param.primary_path = &conn->dapl_path;
conn->param.alternate_path = NULL;
Index: linux-kernel-timer/dat-provider/dapl_timer_util.c
===================================================================
--- linux-kernel-timer/dat-provider/dapl_timer_util.c (revision 2498)
+++ linux-kernel-timer/dat-provider/dapl_timer_util.c (working copy)
@@ -1,313 +0,0 @@
-/*
- * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
- *
- * This Software is licensed under one of the following licenses:
- *
- * 1) under the terms of the "Common Public License 1.0" a copy of which is
- * available from the Open Source Initiative, see
- * http://www.opensource.org/licenses/cpl.php.
- *
- * 2) under the terms of the "The BSD License" a copy of which is
- * available from the Open Source Initiative, see
- * http://www.opensource.org/licenses/bsd-license.php.
- *
- * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
- * copy of which is available from the Open Source Initiative, see
- * http://www.opensource.org/licenses/gpl-license.php.
- *
- * Licensee has the right to choose one of the above licenses.
- *
- * Redistributions of source code must retain the above copyright
- * notice and one of the license notices.
- *
- * Redistributions in binary form must reproduce both the above copyright
- * notice, one of the license notices in the documentation
- * and/or other materials provided with the distribution.
- */
-
-/*
- * Routines to add and cancel timer records. A timer record
- * is put on the global timer queue. If the timer thread is
- * not running, start it. The timer thread will sleep
- * until a timer event or until a process wakes it up
- * to notice a new timer is available; we use a DAPL_WAIT_OBJ
- * for synchronization.
- *
- * If a timer is cancelled, it is simlpy removed from the
- * queue. The timer may wakeup and notice there is no timer
- * record to awaken at this time, so it will reset for the
- * next entry. When there are no timer records to manage,
- * the timer thread just sleeps until awakened.
- *
- * This file also contains the timer handler thread,
- * embodied in dapl_timer_thread().
- *
- * $Id$
- */
-
-#include "dapl.h"
-#include "dapl_timer_util.h"
-
-struct dapl_timer_head {
- struct dapl_llist_entry *timer_list_head;
- spinlock_t lock;
- unsigned long flags;
- DAPL_OS_WAIT_OBJECT wait_object;
- int thread_id;
-};
-
-static struct dapl_timer_head g_dapl_timer_head;
-
-static int dapl_timer_thread(void *arg);
-
-void dapl_timer_init(void)
-{
- /*
- * Set up the timer thread elements. The timer thread isn't
- * started until it is actually needed
- */
- g_dapl_timer_head.timer_list_head = NULL;
- spin_lock_init(&g_dapl_timer_head.lock);
- dapl_os_wait_object_init(&g_dapl_timer_head.wait_object);
- g_dapl_timer_head.thread_id = -1;
-}
-
-/*
- * dapl_timer_set
- *
- * Set a timer. The timer will invoke the specified function
- * after a number of useconds expires.
- *
- * Input:
- * timer User provided timer structure
- * func Function to invoke when timer expires
- * data Argument passed to func()
- * expires microseconds until timer fires
- *
- * Returns:
- * no return value
- *
- */
-u32 dapl_timer_set(struct dapl_timer_entry *timer, void (*func) (void *),
- void *data, DAPL_OS_TIMEVAL expires)
-{
- struct dapl_timer_entry *list_ptr;
- DAPL_OS_TIMEVAL cur_time;
- boolean_t wakeup_tmo_thread;
-
- /*
- * Start the timer thread the first time we need a timer
- */
- if ( -1 == g_dapl_timer_head.thread_id ) {
- g_dapl_timer_head.thread_id =
- kernel_thread(dapl_timer_thread, &g_dapl_timer_head, 0);
- }
-
- dapl_llist_init_entry(&timer->list_entry);
- wakeup_tmo_thread = FALSE;
- dapl_os_get_time(&cur_time);
- timer->expires = cur_time + expires; /* calculate future time */
- timer->function = func;
- timer->data = data;
-
- /*
- * Put the element on the queue: sorted by wakeup time, eariliest
- * first.
- */
- spin_lock_irqsave(&g_dapl_timer_head.lock, g_dapl_timer_head.flags);
- /*
- * Deal with 3 cases due to our list structure:
- * 1) list is empty: become the list head
- * 2) New timer is sooner than list head: become the list head
- * 3) otherwise, sort the timer into the list, no need to wake
- * the timer thread up
- */
- if (dapl_llist_is_empty(&g_dapl_timer_head.timer_list_head)) {
- /* Case 1: add entry to head of list */
- dapl_llist_add_head(&g_dapl_timer_head.timer_list_head,
- (struct dapl_llist_entry *)
- &timer->list_entry,
- timer);
- wakeup_tmo_thread = TRUE;
- } else {
- list_ptr = (struct dapl_timer_entry *)
- dapl_llist_peek_head(&g_dapl_timer_head.timer_list_head);
-
- if (timer->expires < list_ptr->expires) {
- /* Case 2: add entry to head of list */
- dapl_llist_add_head(&g_dapl_timer_head.timer_list_head,
- (struct dapl_llist_entry *)
- &timer->list_entry, timer);
- wakeup_tmo_thread = TRUE;
- } else {
- /* Case 3: figure out where entry goes in sorted list */
- list_ptr =
- dapl_llist_next_entry(&g_dapl_timer_head.
- timer_list_head,
- (struct dapl_llist_entry *)
- &list_ptr->list_entry);
-
- while (list_ptr != NULL) {
- if (timer->expires < list_ptr->expires) {
- dapl_llist_add_entry(&g_dapl_timer_head.
- timer_list_head,
- (struct dapl_llist_entry *)
- &list_ptr->list_entry,
- (struct dapl_llist_entry *)
- &timer->list_entry,
- timer);
- break;
-
- }
- list_ptr =
- dapl_llist_next_entry(&g_dapl_timer_head.
- timer_list_head,
- (struct dapl_llist_entry *)
- &list_ptr->list_entry);
- }
- if (list_ptr == NULL) {
- /* entry goes to the end of the list */
- dapl_llist_add_tail(&g_dapl_timer_head.
- timer_list_head,
- (struct dapl_llist_entry *)
- &timer->list_entry, timer);
- }
- }
-
- }
- spin_unlock_irqrestore(&g_dapl_timer_head.lock,
- g_dapl_timer_head.flags);
-
- if (wakeup_tmo_thread == TRUE) {
- dapl_os_wait_object_wakeup(&g_dapl_timer_head.wait_object);
- }
-
- return DAT_SUCCESS;
-}
-
-/*
- * dapl_timer_cancel
- *
- * Cancel a timer. Simply deletes the timer with no function invocations
- *
- * Input:
- * timer User provided timer structure
- *
- * Returns:
- * no return value
- */
-void dapl_timer_cancel(struct dapl_timer_entry *timer)
-{
- spin_lock_irqsave(&g_dapl_timer_head.lock, g_dapl_timer_head.flags);
- /*
- * make sure the entry has not been removed by another thread
- */
- if (!dapl_llist_is_empty(&g_dapl_timer_head.timer_list_head) &&
- timer->list_entry.list_head == &g_dapl_timer_head.timer_list_head) {
- dapl_llist_remove_entry(&g_dapl_timer_head.timer_list_head,
- (struct dapl_llist_entry *)
- &timer->list_entry);
- }
- /*
- * If this was the first entry on the queue we could awaken the
- * thread and have it reset the list; but it will just wake up
- * and find that the timer entry has been removed, then go back
- * to sleep, so don't bother.
- */
- spin_unlock_irqrestore(&g_dapl_timer_head.lock,
- g_dapl_timer_head.flags);
-}
-
-/*
- * dapl_timer_thread
- *
- * Core worker thread dealing with all timers. Basic algorithm:
- * - Sleep until work shows up
- * - Take first element of sorted timer list and wake
- * invoke the callback if expired
- * - Sleep for the timeout period if not expired
- *
- * Input:
- * timer_head Timer head structure to manage timer lists
- *
- * Returns:
- * int
- */
-int dapl_timer_thread(void *arg)
-{
- struct dapl_timer_entry *list_ptr;
- DAPL_OS_TIMEVAL cur_time;
- struct dapl_timer_head *timer_head;
- u32 dat_status;
-
- timer_head = arg;
-
- for (;;) {
- if (dapl_llist_is_empty(&timer_head->timer_list_head)) {
- dat_status =
- dapl_os_wait_object_wait(&timer_head->wait_object,
- DAT_TIMEOUT_INFINITE);
- }
-
- /*
- * Lock policy:
- * While this thread is accessing the timer list, it holds the
- * lock. Otherwise, it doesn't.
- */
- spin_lock_irqsave(&timer_head->lock, timer_head->flags);
- while (!dapl_llist_is_empty(&timer_head->timer_list_head)) {
- list_ptr = (struct dapl_timer_entry *)
- dapl_llist_peek_head(&g_dapl_timer_head.
- timer_list_head);
- dapl_os_get_time(&cur_time);
-
- if (list_ptr->expires <= cur_time) {
- /*
- * Remove the entry from the list. Sort out how much
- * time we need to sleep for the next one
- */
- list_ptr =
- dapl_llist_remove_head(&timer_head->
- timer_list_head);
- spin_unlock_irqrestore(&timer_head->lock,
- timer_head->flags);
-
- /*
- * Invoke the user callback
- */
- list_ptr->function(list_ptr->data);
- /* timer structure was allocated by caller, we don't
- * free it here.
- */
-
- /* reacquire the lock */
- spin_lock_irqsave(&timer_head->lock,
- timer_head->flags);
- } else {
- spin_unlock_irqrestore(&timer_head->lock,
- timer_head->flags);
- dat_status =
- dapl_os_wait_object_wait(&timer_head->
- wait_object,
- (DAT_TIMEOUT)
- (list_ptr->
- expires -
- cur_time));
- spin_lock_irqsave(&timer_head->lock,
- timer_head->flags);
- }
- }
- /*
- * release the lock before going back to the top to sleep
- */
- spin_unlock_irqrestore(&timer_head->lock, timer_head->flags);
-
- if (dat_status == DAT_INTERNAL_ERROR) {
- /*
- * XXX What do we do here?
- */
- }
- } /* for (;;) */
-
- return 0;
-}
Index: linux-kernel-timer/dat-provider/dapl_timer_util.h
===================================================================
--- linux-kernel-timer/dat-provider/dapl_timer_util.h (revision 2498)
+++ linux-kernel-timer/dat-provider/dapl_timer_util.h (working copy)
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
- *
- * This Software is licensed under one of the following licenses:
- *
- * 1) under the terms of the "Common Public License 1.0" a copy of which is
- * available from the Open Source Initiative, see
- * http://www.opensource.org/licenses/cpl.php.
- *
- * 2) under the terms of the "The BSD License" a copy of which is
- * available from the Open Source Initiative, see
- * http://www.opensource.org/licenses/bsd-license.php.
- *
- * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
- * copy of which is available from the Open Source Initiative, see
- * http://www.opensource.org/licenses/gpl-license.php.
- *
- * Licensee has the right to choose one of the above licenses.
- *
- * Redistributions of source code must retain the above copyright
- * notice and one of the license notices.
- *
- * Redistributions in binary form must reproduce both the above copyright
- * notice, one of the license notices in the documentation
- * and/or other materials provided with the distribution.
- */
-
-/*
- * $Id$
- */
-
-#ifndef DAPL_TIMER_UTIL_H
-#define DAPL_TIMER_UTIL_H
-
-void dapl_timer_init(void);
-
-u32 dapl_timer_set(struct dapl_timer_entry *timer, void (*func) (void *),
- void *data, DAPL_OS_TIMEVAL expires);
-
-void dapl_timer_cancel(struct dapl_timer_entry *timer);
-
-#endif /* DAPL_TIMER_UTIL_H */
Index: linux-kernel-timer/dat-provider/dapl_ep_util.c
===================================================================
--- linux-kernel-timer/dat-provider/dapl_ep_util.c (revision 2498)
+++ linux-kernel-timer/dat-provider/dapl_ep_util.c (working copy)
@@ -168,9 +168,6 @@ void dapl_ep_dealloc(struct dapl_ep *ep_
if (ep_ptr->send_iov)
kfree(ep_ptr->send_iov);
- if (ep_ptr->cxn_timer)
- kfree(ep_ptr->cxn_timer);
-
kfree(ep_ptr);
}
@@ -242,32 +239,6 @@ bail:
}
/*
- * dapl_ep_timeout
- *
- * If this routine is invoked before a connection occurs, generate an
- * event
- */
-void dapl_ep_timeout(void *arg)
-{
- struct dapl_ep *ep_ptr;
-
- dapl_dbg_log(DAPL_DBG_TYPE_CM, "--> dapl_ep_timeout! ep %lx\n", arg);
-
- ep_ptr = (struct dapl_ep *)arg;
-
- /* reset the EP state */
- ep_ptr->param.ep_state = DAT_EP_STATE_DISCONNECTED;
-
- /* Clean up the EP and put the underlying QP into the ERROR state. */
- dapl_ib_disconnect_clean(ep_ptr, TRUE);
-
- (void)dapl_evd_post_connection_event((struct dapl_evd *)ep_ptr->param.
- connect_evd_handle,
- DAT_CONNECTION_EVENT_TIMED_OUT,
- (DAT_HANDLE) ep_ptr, 0, NULL);
-}
-
-/*
* dapl_ep_state_subtype
*
* Return the INVALID_STATE connection subtype associated with an
Index: linux-kernel-timer/dat-provider/dapl_ep_util.h
===================================================================
--- linux-kernel-timer/dat-provider/dapl_ep_util.h (revision 2498)
+++ linux-kernel-timer/dat-provider/dapl_ep_util.h (working copy)
@@ -52,8 +52,6 @@ extern u32 dapl_ep_post_send_req(DAT_EP_
DAPL_DTO_TYPE dto_type,
enum ib_wr_opcode op_type);
-void dapl_ep_timeout(void *arg);
-
enum dat_return_subtype dapl_ep_state_subtype(struct dapl_ep *ep_ptr);
#endif /* DAPL_EP_UTIL_H */
Index: linux-kernel-timer/dat-provider/dapl_util.c
===================================================================
--- linux-kernel-timer/dat-provider/dapl_util.c (revision 2498)
+++ linux-kernel-timer/dat-provider/dapl_util.c (working copy)
@@ -33,104 +33,6 @@
#include "dapl_module.h"
#include "dapl_util.h"
-/*
- * dapl_os_get_time
- *
- * Return 64 bit value of current time in microseconds.
- *
- * Input:
- * loc User location to place current time
- *
- * Returns:
- * DAT_SUCCESS
- */
-
-u32 dapl_os_get_time(DAPL_OS_TIMEVAL *loc)
-{
- struct timeval tv;
-
- do_gettimeofday(&tv);
- *loc = ((u64) (tv.tv_sec) * 1000000L) + (u64) tv.tv_usec;
-
- return DAT_SUCCESS;
-}
-
-/*
- * Wait object routines
- */
-
-/*
- * dapl_os_wait_object_init
- *
- * Initialize a wait object
- *
- * Input:
- * wait_obj
- *
- * Returns:
- * DAT_SUCCESS
- * DAT_INTERNAL_ERROR
- */
-u32 dapl_os_wait_object_init(DAPL_OS_WAIT_OBJECT *wait_obj)
-{
- init_waitqueue_head(&wait_obj->wait_queue);
-
- return DAT_SUCCESS;
-}
-
-/* Wait on the supplied wait object, up to the specified time_out.
- * A timeout of DAT_TIMEOUT_INFINITE will wait indefinitely.
- * Timeout should be specified in micro seconds.
- *
- * Functional returns:
- * DAT_SUCCESS -- another thread invoked dapl_os_wait object_wakeup
- * DAT_INVALID_STATE -- someone else is already waiting in this wait
- * object.
- * only one waiter is allowed at a time.
- * DAT_ABORT -- another thread invoked dapl_os_wait_object_destroy
- * DAT_TIMEOUT -- the specified time limit was reached.
- */
-
-u32 dapl_os_wait_object_wait(DAPL_OS_WAIT_OBJECT *wait_obj,
- DAT_TIMEOUT timeout_val)
-{
- u32 dat_status = DAT_SUCCESS;
-
- if (DAT_TIMEOUT_INFINITE == timeout_val) {
- interruptible_sleep_on(&wait_obj->wait_queue);
- } else {
- int expire;
-
- expire = timeout_val * HZ / 1000000;
-
- while (expire) {
- current->state = TASK_INTERRUPTIBLE;
- expire = schedule_timeout(expire);
- }
- dat_status = DAT_ERROR(DAT_TIMEOUT_EXPIRED, 0);
- }
- return dat_status;
-}
-
-/*
- * dapl_os_wait_object_wakeup
- *
- * Wakeup a thread waiting on a wait object
- *
- * Input:
- * wait_obj
- *
- * Returns:
- * DAT_SUCCESS
- * DAT_INTERNAL_ERROR
- */
-u32 dapl_os_wait_object_wakeup(DAPL_OS_WAIT_OBJECT *wait_obj)
-{
- wake_up_interruptible(&wait_obj->wait_queue);
-
- return DAT_SUCCESS;
-}
-
#ifdef DAPL_DBG
void dapl_dbg_log(DAPL_DBG_TYPE type, const char *fmt, ...)
Index: linux-kernel-timer/dat-provider/dapl_util.h
===================================================================
--- linux-kernel-timer/dat-provider/dapl_util.h (revision 2498)
+++ linux-kernel-timer/dat-provider/dapl_util.h (working copy)
@@ -107,24 +107,6 @@ static inline int dapl_os_atomic_assign(
*/
/*
- * The wait object invariant: Presuming a call to dapl_os_wait_object_wait
- * occurs at some point, there will be at least one wakeup after each call
- * to dapl_os_wait_object_signal. I.e. Signals are not ignored, though
- * they may be coallesced.
- */
-typedef struct dapl_os_wait_object {
- wait_queue_head_t wait_queue;
-} DAPL_OS_WAIT_OBJECT;
-
-/* function prototypes */
-u32 dapl_os_wait_object_init(DAPL_OS_WAIT_OBJECT *wait_obj);
-
-u32 dapl_os_wait_object_wait(DAPL_OS_WAIT_OBJECT *wait_obj,
- DAT_TIMEOUT timeout_val);
-
-u32 dapl_os_wait_object_wakeup(DAPL_OS_WAIT_OBJECT *wait_obj);
-
-/*
* Memory Functions
*/
@@ -154,15 +136,6 @@ static inline char *dapl_os_strdup(const
}
/*
- * Timer Functions
- */
-
-typedef u64 DAPL_OS_TIMEVAL;
-
-/* timer function prototype */
-u32 dapl_os_get_time(DAPL_OS_TIMEVAL *);
-
-/*
* *printf format helper. We use the C string constant concatenation
* ability to define 64 bit formats, which unfortunatly are non standard
* in the C compiler world.
Index: linux-kernel-timer/dat-provider/dapl_ep_dup_connect.c
===================================================================
--- linux-kernel-timer/dat-provider/dapl_ep_dup_connect.c (revision 2498)
+++ linux-kernel-timer/dat-provider/dapl_ep_dup_connect.c (working copy)
@@ -32,7 +32,6 @@
#include "dapl.h"
#include "dapl_ep_util.h"
#include "dapl_openib_util.h"
-#include "dapl_timer_util.h"
/*
* dapl_ep_dup_connect
@@ -63,7 +62,7 @@
* DAT_MODEL_NOT_SUPPORTED
*/
u32 dapl_ep_dup_connect(DAT_EP_HANDLE ep_handle, DAT_EP_HANDLE ep_dup_handle,
- DAT_TIMEOUT timeout, int private_data_size,
+ unsigned long timeout, int private_data_size,
const void *private_data, enum dat_qos qos)
{
struct dapl_ep *ep_dup_ptr;
@@ -114,6 +113,6 @@ u32 dapl_ep_dup_connect(DAT_EP_HANDLE ep
private_data_size,
private_data,
qos, DAT_CONNECT_DEFAULT_FLAG);
- bail:
+bail:
return dat_status;
}
Index: linux-kernel-timer/dat-provider/dapl.h
===================================================================
--- linux-kernel-timer/dat-provider/dapl.h (revision 2498)
+++ linux-kernel-timer/dat-provider/dapl.h (working copy)
@@ -236,14 +236,6 @@ struct dapl_evd {
struct dapl_cno *cno_ptr;
};
-/* DAPL timer entry, used to queue timeouts */
-struct dapl_timer_entry {
- struct dapl_llist_entry list_entry; /* link entry on ia struct */
- DAPL_OS_TIMEVAL expires;
- void (*function) (void *);
- void *data;
-};
-
/* struct dapl_ep maps to DAT_EP_HANDLE */
struct dapl_ep {
struct dapl_header header;
@@ -264,8 +256,7 @@ struct dapl_ep {
/* For passive connections we maintain a back pointer to the CR */
void *cr_ptr;
- /* pointer to connection timer, if set */
- struct dapl_timer_entry *cxn_timer;
+ unsigned long timeout;
/* private data container */
char private_data[DAPL_MAX_PRIVATE_DATA_SIZE];
@@ -498,14 +489,15 @@ extern u32 dapl_ep_modify(DAT_EP_HANDLE
extern u32 dapl_ep_connect(DAT_EP_HANDLE ep_handle,
struct sockaddr *remote_ia_address,
DAT_CONN_QUAL remote_conn_qual,
- DAT_TIMEOUT timeout,
+ unsigned long timeout,
int private_data_size,
const void *private_data,
enum dat_qos quality_of_service,
enum dat_connect_flags connect_flags);
extern u32 dapl_ep_dup_connect(DAT_EP_HANDLE ep_handle,
- DAT_EP_HANDLE ep_dup_handle, DAT_TIMEOUT timeout,
+ DAT_EP_HANDLE ep_dup_handle,
+ unsigned long timeout,
int private_data_size,
const void *private_data,
enum dat_qos quality_of_service);
Index: linux-kernel-timer/patches/alt_dat_provider_makefile
===================================================================
--- linux-kernel-timer/patches/alt_dat_provider_makefile (revision 2498)
+++ linux-kernel-timer/patches/alt_dat_provider_makefile (working copy)
@@ -83,7 +83,6 @@ PROVIDER_MODULES := \
dapl_srq_resize \
dapl_srq_set_lw \
dapl_srq_util \
- dapl_timer_util \
dapl_util
PROVIDER_OBJS := $(foreach s, $(PROVIDER_MODULES), $(s).o)
@@ -109,4 +108,4 @@ default:
endif
clean:
- rm -f *.o *.ko
+ rm -rf *.o *.ko .*.cmd *.mod.* .tmp_versions .*.d .*.o.tmp cscope.out
Index: linux-kernel-timer/dat/dat.h
===================================================================
--- linux-kernel-timer/dat/dat.h (revision 2498)
+++ linux-kernel-timer/dat/dat.h (working copy)
@@ -383,11 +383,6 @@ enum dat_completion_flags {
DAT_COMPLETION_BARRIER_FENCE_FLAG = 0x08,
};
-typedef u32 DAT_TIMEOUT; /* microseconds */
-
-/* timeout = infinity */
-#define DAT_TIMEOUT_INFINITE ((DAT_TIMEOUT) ~0)
-
/* dat handles */
typedef void *DAT_HANDLE;
typedef DAT_HANDLE DAT_CR_HANDLE;
@@ -1139,12 +1134,12 @@ typedef u32 (*DAT_EP_MODIFY_FUNC)(DAT_EP
const struct dat_ep_param *);
typedef u32 (*DAT_EP_CONNECT_FUNC)(DAT_EP_HANDLE, struct sockaddr *,
- DAT_CONN_QUAL, DAT_TIMEOUT, int,
+ DAT_CONN_QUAL, unsigned long timeout, int,
const void *, enum dat_qos,
enum dat_connect_flags);
typedef u32 (*DAT_EP_DUP_CONNECT_FUNC)(DAT_EP_HANDLE, DAT_EP_HANDLE,
- DAT_TIMEOUT, int, const void *,
+ unsigned long timeout, int, const void *,
enum dat_qos);
typedef u32 (*DAT_EP_DISCONNECT_FUNC)(DAT_EP_HANDLE, enum dat_close_flags);
@@ -1493,7 +1488,7 @@ static inline u32 dat_evd_resize(DAT_EVD
}
static inline u32 dat_ep_connect(DAT_EP_HANDLE ep, struct sockaddr *ia_addr,
- DAT_CONN_QUAL conn_qual, DAT_TIMEOUT timeout,
+ DAT_CONN_QUAL conn_qual, unsigned long timeout,
int private_data_size,
const void *private_data, enum dat_qos qos,
enum dat_connect_flags flags)
@@ -1533,7 +1528,8 @@ static inline u32 dat_ep_disconnect(DAT_
}
static inline u32 dat_ep_dup_connect(DAT_EP_HANDLE ep, DAT_EP_HANDLE dup_ep,
- DAT_TIMEOUT timeout, int private_data_size,
+ unsigned long timeout,
+ int private_data_size,
const void *private_data, enum dat_qos qos)
{
return DAT_CALL_PROVIDER_FUNC(ep_dup_connect_func, ep, dup_ep, timeout,
More information about the general
mailing list