[openib-general] [PATCH] [uDAPL] DAT 2.0 extensions with IB immed data and atomics examples

Arlin Davis arlin.r.davis at intel.com
Fri Feb 10 15:56:00 PST 2006


James,

 

Here is a patch with the IB rdma_write_with_immediate() back in as an extension along with the
atomics. Please review the various methods that I used to extend the return codes, memory
privileges, and DTO event processing.

 

Thanks,

 

-arlin

 

Signed-off by: Arlin Davis ardavis at ichips.intel.com

 

Index: test/dtest/makefile
===================================================================
--- test/dtest/makefile (revision 5366)
+++ test/dtest/makefile (working copy)
@@ -4,13 +4,18 @@ CFLAGS     = -O2 -g
 DAT_INC = ../../dat/include
 DAT_LIB = /usr/local/lib
 
-all: dtest
+all: dtest dtest_ext
 
 clean:
-     rm -f *.o;touch *.c;rm -f dtest
+     rm -f *.o;touch *.c;rm -f dtest dtest_ext
 
 dtest: ./dtest.c
      $(CC) $(CFLAGS) ./dtest.c -o dtest \
      -DDAPL_PROVIDER='"OpenIB-cma-ip"' \
      -I $(DAT_INC) -L $(DAT_LIB) -ldat
 
+dtest_ext: ./dtest_ext.c
+     $(CC) $(CFLAGS) ./dtest_ext.c -o dtest_ext \
+     -DDAPL_PROVIDER='"OpenIB-cma-ip"' \
+     -I $(DAT_INC) -L $(DAT_LIB) -ldat
+
Index: dapl/include/dapl.h
===================================================================
--- dapl/include/dapl.h (revision 5366)
+++ dapl/include/dapl.h (working copy)
@@ -1,25 +1,28 @@
 /*
- * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.
+ * 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
+ *    in the file LICENSE.txt in the root directory. The license is also
+ *    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
+ * 
+ * 2) under the terms of the "The BSD License" a copy of which is in the file
+ *    LICENSE2.txt in the root directory. The license is also 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
+ *    copy of which is in the file LICENSE3.txt in the root directory. The
+ *    license is also 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.
@@ -178,6 +181,11 @@ typedef enum dapl_qp_state
 
 #define DAT_ERROR(Type, SubType) ((DAT_RETURN)(DAT_CLASS_ERROR | Type | SubType))
 
+#ifdef DAT_EXTENSIONS
+#define DAT_ERROR_EXTENSION(Type, ExtType, SubType) \
+     ((DAT_RETURN)(DAT_CLASS_ERROR | Type | ExtType | SubType))
+#endif
+
 /*********************************************************************
  *                                                                   *
  * Typedefs                                                          *
@@ -563,6 +571,10 @@ typedef enum dapl_dto_type
     DAPL_DTO_TYPE_RECV,
     DAPL_DTO_TYPE_RDMA_WRITE,
     DAPL_DTO_TYPE_RDMA_READ,
+#ifdef DAT_EXTENSIONS
+    DAPL_DTO_TYPE_EXTENSION
+#endif
+
 } DAPL_DTO_TYPE;
 
 typedef enum dapl_cookie_type
@@ -570,6 +582,7 @@ typedef enum dapl_cookie_type
     DAPL_COOKIE_TYPE_NULL,
     DAPL_COOKIE_TYPE_DTO,
     DAPL_COOKIE_TYPE_RMR,
+
 } DAPL_COOKIE_TYPE;
 
 /* DAPL_DTO_COOKIE used as context for DTO WQEs */
@@ -578,6 +591,9 @@ struct dapl_dto_cookie
     DAPL_DTO_TYPE            type;
     DAT_DTO_COOKIE           cookie;
     DAT_COUNT                size; /* used for SEND and RDMA write */
+#ifdef DAT_EXTENSIONS
+    DAT_PVOID                extension;  /* extended DTO ops */
+#endif
 };
 
 /* DAPL_RMR_COOKIE used as context for bind WQEs */
@@ -1116,6 +1132,14 @@ extern DAT_RETURN dapl_srq_set_lw(
      IN      DAT_SRQ_HANDLE,         /* srq_handle           */
      IN      DAT_COUNT);             /* low_watermark        */
 
+#ifdef DAT_EXTENSIONS
+extern DAT_RETURN dapl_extensions(
+     IN      DAT_HANDLE,           /* dat_handle           */
+     IN    DAT_DTO_EXTENSION_OP,   /* extension operation  */
+     IN    va_list );        /* va_list args         */
+
+#endif
+
 /*
  * DAPL internal utility function prototpyes
  */
Index: dapl/include/dapl_debug.h
===================================================================
--- dapl/include/dapl_debug.h (revision 5366)
+++ dapl/include/dapl_debug.h (working copy)
@@ -112,7 +112,13 @@ extern void dapl_internal_dbg_log ( DAPL
 #define DCNT_EVD_DEQUEUE_NOT_FOUND 18
 #define DCNT_TIMER_SET             19
 #define DCNT_TIMER_CANCEL          20
+#ifdef DAT_EXTENSION
+#define DCNT_EXTENSION             21
+#define DCNT_NUM_COUNTERS          22
+#else
 #define DCNT_NUM_COUNTERS          21
+#endif
+
 #define DCNT_ALL_COUNTERS               DCNT_NUM_COUNTERS
 
 #if defined(DAPL_COUNTERS)
Index: dapl/udapl/Makefile
===================================================================
--- dapl/udapl/Makefile (revision 5366)
+++ dapl/udapl/Makefile (working copy)
@@ -80,6 +80,12 @@ ifdef OS_VENDOR
 CFLAGS += -D$(OS_VENDOR)
 endif
 
+# If an implementation supports immdiate data and extensions
+CFLAGS += -DDAT_EXTENSIONS 
+
+# If an implementation supports DAPL provider specific attributes
+CFLAGS += -DDAPL_PROVIDER_SPECIFIC_ATTR
+
 #
 # dummy provider
 #
@@ -283,6 +289,8 @@ LDFLAGS += -libverbs -lrdmacm
 LDFLAGS += -rpath /usr/local/lib -L /usr/local/lib
 PROVIDER_SRCS  = dapl_ib_util.c dapl_ib_cq.c dapl_ib_qp.c \
                  dapl_ib_cm.c dapl_ib_mem.c
+# implementation supports extensions
+PROVIDER_SRCS += dapl_ib_extensions.c
 endif
 
 UDAPL_SRCS =     dapl_init.c       \
Index: dapl/common/dapl_ia_query.c
===================================================================
--- dapl/common/dapl_ia_query.c     (revision 5366)
+++ dapl/common/dapl_ia_query.c     (working copy)
@@ -151,6 +151,7 @@ dapl_ia_query (
      provider_attr->dat_qos_supported      = DAT_QOS_BEST_EFFORT;
      provider_attr->completion_flags_supported = DAT_COMPLETION_DEFAULT_FLAG;
      provider_attr->is_thread_safe               = DAT_FALSE;
+
      /*
       * N.B. The second part of the following equation will evaluate
       *    to 0 unless IBHOSTS_NAMING is enabled.
@@ -167,6 +168,14 @@ dapl_ia_query (
 #if !defined(__KDAPL__)
      provider_attr->pz_support                 = DAT_PZ_UNIQUE;
 #endif /* !KDAPL */
+
+     /*
+     *  Query for provider specific attributes
+     */
+#ifdef DAPL_PROVIDER_SPECIFIC_ATTR
+     dapls_query_provider_specific_attr(provider_attr);
+#endif
+
      /*
       * Set up evd_stream_merging_supported options. Note there is
       * one bit per allowable combination, using the ordinal
Index: dapl/common/dapl_adapter_util.h
===================================================================
--- dapl/common/dapl_adapter_util.h (revision 5366)
+++ dapl/common/dapl_adapter_util.h (working copy)
@@ -256,6 +256,21 @@ dapls_ib_wait_object_wait (
      IN u_int32_t                  timeout);
 #endif
 
+#ifdef DAPL_PROVIDER_SPECIFIC_ATTR
+void 
+dapls_query_provider_specific_attr(
+     IN DAT_PROVIDER_ATTR          *provider_attr );
+#endif
+
+#ifdef DAT_EXTENSIONS
+void
+dapls_cqe_to_event_extension(
+     IN DAPL_EP              *ep_ptr,
+     IN DAPL_COOKIE                *cookie,
+     IN ib_work_completion_t       *cqe_ptr,
+     OUT DAT_EVENT                 *event_ptr);
+#endif
+
 /*
  * Values for provider DAT_NAMED_ATTR
  */
Index: dapl/common/dapl_provider.c
===================================================================
--- dapl/common/dapl_provider.c     (revision 5366)
+++ dapl/common/dapl_provider.c     (working copy)
@@ -221,7 +221,12 @@ DAT_PROVIDER g_dapl_provider_template =
     &dapl_srq_post_recv,
     &dapl_srq_query,
     &dapl_srq_resize,
-    &dapl_srq_set_lw
+    &dapl_srq_set_lw,
+
+#ifdef DAT_EXTENSIONS
+    /* dat-2.0 */
+    &dapl_extensions
+#endif
 
 };
 #endif /* __KDAPL__ */
Index: dapl/common/dapl_evd_util.c
===================================================================
--- dapl/common/dapl_evd_util.c     (revision 5366)
+++ dapl/common/dapl_evd_util.c     (working copy)
@@ -502,6 +502,21 @@ dapli_evd_eh_print_cqe (
 #ifdef DAPL_DBG
     static char *optable[] =
     {
+#ifdef OPENIB
+     /* different order for openib verbs */
+    "OP_RDMA_WRITE",
+     "OP_RDMA_WRITE_IMMED",
+     "OP_SEND",
+     "OP_SEND_IMMED",
+     "OP_RDMA_READ",
+     "OP_COMP_AND_SWAP",
+     "OP_FETCH_AND_ADD",
+     "OP_RECEIVE",
+     "OP_RECEIVE_IMMED",
+     "OP_RECEIVE_RDMA_IMMED",
+     "OP_BIND_MW",
+     "OP_INVALID",
+#else
      "OP_SEND",
      "OP_RDMA_READ",
      "OP_RDMA_WRITE",
@@ -509,6 +524,7 @@ dapli_evd_eh_print_cqe (
      "OP_FETCH_AND_ADD",
      "OP_RECEIVE",
      "OP_BIND_MW",
+#endif
      0
     };
 
@@ -1047,6 +1063,10 @@ dapli_evd_cqe_to_event (
          event_ptr->event_data.dto_completion_event_data.user_cookie =
            cookie->val.dto.cookie;
          event_ptr->event_data.dto_completion_event_data.status = dto_status;
+         
+         /* new operation field for DAT 2.0 */
+         event_ptr->event_data.dto_completion_event_data.operation = 
+                                   DAPL_GET_CQE_DTOS_OPTYPE(cqe_ptr);
 
 #ifdef DAPL_DBG
          if (dto_status == DAT_DTO_SUCCESS)
@@ -1055,15 +1075,20 @@ dapli_evd_cqe_to_event (
 
            ibtype = DAPL_GET_CQE_OPTYPE (cqe_ptr);
 
-           dapl_os_assert ((ibtype == OP_SEND &&
-                       cookie->val.dto.type == DAPL_DTO_TYPE_SEND)
-                       || (ibtype == OP_RECEIVE &&
-                           cookie->val.dto.type == DAPL_DTO_TYPE_RECV)
-                       || (ibtype == OP_RDMA_WRITE &&
-                           cookie->val.dto.type == DAPL_DTO_TYPE_RDMA_WRITE)
-                       || (ibtype == OP_RDMA_READ &&
-                           cookie->val.dto.type == DAPL_DTO_TYPE_RDMA_READ));
-           }
+#ifdef DAT_EXTENSIONS
+           if ((cookie->val.dto.type != DAPL_DTO_TYPE_EXTENSION) &&
+               (ibtype == OP_RECEIVE && 
+                 cookie->val.dto.type == DAPL_DTO_TYPE_RECV))
+#endif
+                 dapl_os_assert ((ibtype == OP_SEND &&
+                      cookie->val.dto.type == DAPL_DTO_TYPE_SEND)
+                        || (ibtype == OP_RECEIVE &&
+                      cookie->val.dto.type == DAPL_DTO_TYPE_RECV)
+                       || (ibtype == OP_RDMA_WRITE &&
+                      cookie->val.dto.type == DAPL_DTO_TYPE_RDMA_WRITE)
+                       || (ibtype == OP_RDMA_READ &&
+                      cookie->val.dto.type == DAPL_DTO_TYPE_RDMA_READ));
+         }
 #endif /* DAPL_DBG */
 
          if ( cookie->val.dto.type == DAPL_DTO_TYPE_SEND ||
@@ -1079,6 +1104,11 @@ dapli_evd_cqe_to_event (
                DAPL_GET_CQE_BYTESNUM (cqe_ptr);
          }
 
+#ifdef DAT_EXTENSIONS
+         if ( DAPL_GET_CQE_DTOS_OPTYPE(cqe_ptr) == DAT_EXTENSION )
+           dapls_cqe_to_event_extension(ep_ptr, cookie, cqe_ptr, event_ptr);
+#endif
+
          dapls_cookie_dealloc (buffer, cookie);
          break;
      }
@@ -1113,6 +1143,7 @@ dapli_evd_cqe_to_event (
          dapls_cookie_dealloc (&ep_ptr->req_buffer, cookie);
          break;
      }
+
      default:
      {
          dapl_os_assert (!"Invalid Operation type");
Index: dapl/common/dapl_debug.c
===================================================================
--- dapl/common/dapl_debug.c  (revision 5366)
+++ dapl/common/dapl_debug.c  (working copy)
@@ -86,6 +86,9 @@ char  *dapl_dbg_counter_names[] = {
      "dapl_evd_not_found",
      "dapls_timer_set",
      "dapls_timer_cancel",
+#ifdef DAT_EXTENSION
+     "dapls_extension",
+#endif
 };
 
 void dapl_dump_cntr( int cntr )
Index: dapl/openib_cma/dapl_ib_dto.h
===================================================================
--- dapl/openib_cma/dapl_ib_dto.h   (revision 5366)
+++ dapl/openib_cma/dapl_ib_dto.h   (working copy)
@@ -35,7 +35,7 @@
  *
  *   Description: 
  *
- *   The uDAPL openib provider - DTO operations and CQE macros 
+ *   The OpenIB uCMA provider - DTO operations and CQE macros 
  *
  ****************************************************************************
  *            Source Control System Information
@@ -119,7 +119,6 @@ dapls_ib_post_recv (
      return DAT_SUCCESS;
 }
 
-
 /*
  * dapls_ib_post_send
  *
@@ -191,7 +190,7 @@ dapls_ib_post_send (
 
      if (cookie != NULL) 
            cookie->val.dto.size = total_len;
-     
+
      if ((op_type == OP_RDMA_WRITE) || (op_type == OP_RDMA_READ)) {
            wr.wr.rdma.remote_addr = remote_iov->target_address;
            wr.wr.rdma.rkey = remote_iov->rmr_context;
@@ -200,6 +199,7 @@ dapls_ib_post_send (
                       wr.wr.rdma.rkey, wr.wr.rdma.remote_addr);
      }
 
+
      /* inline data for send or write ops */
      if ((total_len <= ibt_ptr->max_inline_send) && 
         ((op_type == OP_SEND) || (op_type == OP_RDMA_WRITE))) 
@@ -224,6 +224,178 @@ dapls_ib_post_send (
      return DAT_SUCCESS;
 }
 
+/* map Work Completions to DAPL WR operations */
+STATIC _INLINE_ DAT_DTOS dapls_cqe_dtos_opcode(ib_work_completion_t *cqe_p)
+{
+     switch (cqe_p->opcode) {
+
+     case IBV_WC_SEND:
+           return (DAT_SEND);
+     case IBV_WC_RDMA_READ:
+           return (DAT_RDMA_READ);
+     case IBV_WC_BIND_MW:
+           return (DAT_BIND_MW);
+#ifdef DAT_EXTENSIONS
+     case IBV_WC_RDMA_WRITE:
+           if (cqe_p->wc_flags & IBV_WC_WITH_IMM)
+                 return (DAT_EXTENSION);
+           else
+                 return (DAT_RDMA_WRITE);
+     case IBV_WC_COMP_SWAP:
+           return (DAT_EXTENSION);
+     case IBV_WC_FETCH_ADD:
+           return (DAT_EXTENSION);
+     case IBV_WC_RECV_RDMA_WITH_IMM:
+           return (DAT_EXTENSION);
+#else
+     case IBV_WC_RDMA_WRITE:
+           return (DAT_RDMA_WRITE);
+#endif
+     case IBV_WC_RECV:
+           return (DAT_RECEIVE);
+     default:
+           return (0xff);
+     }
+}
+#define DAPL_GET_CQE_DTOS_OPTYPE(cqe_p) dapls_cqe_dtos_opcode(cqe_p)
+
+
+#ifdef DAT_EXTENSIONS
+/*
+ * dapls_ib_post_ext_send
+ *
+ * Provider specific extended Post SEND function for atomics
+ *   OP_COMP_AND_SWAP and OP_FETCH_AND_ADD
+ */
+STATIC _INLINE_ DAT_RETURN 
+dapls_ib_post_ext_send (
+     IN  DAPL_EP             *ep_ptr,
+     IN  ib_send_op_type_t         op_type,
+     IN  DAPL_COOKIE               *cookie,
+     IN  DAT_COUNT                 segments,
+     IN  DAT_LMR_TRIPLET           *local_iov,
+     IN  const DAT_RMR_TRIPLET     *remote_iov,
+     IN  DAT_UINT32                immed_data,
+     IN  DAT_UINT64                compare_add,
+     IN  DAT_UINT64                swap,
+     IN  DAT_COMPLETION_FLAGS      completion_flags)
+{
+     dapl_dbg_log(DAPL_DBG_TYPE_EP,
+                " post_snd: ep %p op %d ck %p sgs",
+                "%d l_iov %p r_iov %p f %d\n",
+                ep_ptr, op_type, cookie, segments, local_iov, 
+                remote_iov, completion_flags);
+
+     ib_data_segment_t ds_array[DEFAULT_DS_ENTRIES];
+     ib_data_segment_t *ds_array_p;
+     struct ibv_send_wr wr;
+     struct ibv_send_wr *bad_wr;
+     DAT_COUNT i, total_len;
+     
+     dapl_dbg_log(DAPL_DBG_TYPE_EP,
+                " post_snd: ep %p cookie %p segs %d l_iov %p\n",
+                ep_ptr, cookie, segments, local_iov);
+
+     if(segments <= DEFAULT_DS_ENTRIES) 
+           ds_array_p = ds_array;
+     else
+           ds_array_p = 
+                 dapl_os_alloc(segments * sizeof(ib_data_segment_t));
+
+     if (NULL == ds_array_p)
+           return (DAT_INSUFFICIENT_RESOURCES);
+     
+     /* setup the work request */
+     wr.next = 0;
+     wr.opcode = op_type;
+     wr.num_sge = 0;
+     wr.send_flags = 0;
+     wr.wr_id = (uint64_t)(uintptr_t)cookie;
+     wr.sg_list = ds_array_p;
+     total_len = 0;
+
+     for (i = 0; i < segments; i++ ) {
+           if ( !local_iov[i].segment_length )
+                 continue;
+
+           ds_array_p->addr = (uint64_t) local_iov[i].virtual_address;
+           ds_array_p->length = local_iov[i].segment_length;
+           ds_array_p->lkey = local_iov[i].lmr_context;
+           
+           dapl_dbg_log(DAPL_DBG_TYPE_EP, 
+                      " post_snd: lkey 0x%x va %p len %d\n",
+                      ds_array_p->lkey, ds_array_p->addr, 
+                      ds_array_p->length );
+
+           total_len += ds_array_p->length;
+           wr.num_sge++;
+           ds_array_p++;
+     }
+
+     if (cookie != NULL) 
+           cookie->val.dto.size = total_len;
+
+     switch (op_type) {
+     case OP_RDMA_WRITE_IMMED:
+           /* OP_RDMA_WRITE)IMMED has direct IB wr_type mapping */
+           dapl_dbg_log(DAPL_DBG_TYPE_EP, 
+                      " post_ext: rkey 0x%x va %#016Lx immed=0x%x\n",
+                      remote_iov->rmr_context, 
+                      remote_iov->target_address, immed_data);
+
+           wr.imm_data = immed_data;
+           wr.wr.rdma.remote_addr = remote_iov->target_address;
+           wr.wr.rdma.rkey = remote_iov->rmr_context;
+           break;
+     case OP_COMP_AND_SWAP:
+           /* OP_COMP_AND_SWAP has direct IB wr_type mapping */
+           dapl_dbg_log(DAPL_DBG_TYPE_EP, 
+                      " post_ext: OP_COMP_AND_SWAP=%lx,"
+                      "%lx rkey 0x%x va %#016Lx\n",
+                      compare_add, swap, remote_iov->rmr_context,
+                      remote_iov->target_address);
+           
+           wr.wr.atomic.compare_add = compare_add;
+           wr.wr.atomic.swap = swap;
+           wr.wr.atomic.remote_addr = remote_iov->target_address;
+           wr.wr.atomic.rkey = remote_iov->rmr_context;
+           break;
+     case OP_FETCH_AND_ADD:
+           /* OP_FETCH_AND_ADD has direct IB wr_type mapping */
+           dapl_dbg_log(DAPL_DBG_TYPE_EP, 
+                      " post_ext: OP_FETCH_AND_ADD=%lx,"
+                      "%lx rkey 0x%x va %#016Lx\n",
+                      compare_add, remote_iov->rmr_context,
+                      remote_iov->target_address);
+
+           wr.wr.atomic.compare_add = compare_add;
+           wr.wr.atomic.remote_addr = remote_iov->target_address;
+           wr.wr.atomic.rkey = remote_iov->rmr_context;
+           break;
+     default:
+           break;
+     }
+
+     /* set completion flags in work request */
+     wr.send_flags |= (DAT_COMPLETION_SUPPRESS_FLAG & 
+                       completion_flags) ? 0 : IBV_SEND_SIGNALED;
+     wr.send_flags |= (DAT_COMPLETION_BARRIER_FENCE_FLAG & 
+                       completion_flags) ? IBV_SEND_FENCE : 0;
+     wr.send_flags |= (DAT_COMPLETION_SOLICITED_WAIT_FLAG & 
+                       completion_flags) ? IBV_SEND_SOLICITED : 0;
+
+     dapl_dbg_log(DAPL_DBG_TYPE_EP, 
+                " post_snd: op 0x%x flags 0x%x sglist %p, %d\n", 
+                wr.opcode, wr.send_flags, wr.sg_list, wr.num_sge);
+
+     if (ibv_post_send(ep_ptr->qp_handle->cm_id->qp, &wr, &bad_wr))
+           return( dapl_convert_errno(EFAULT,"ibv_recv") );
+     
+     dapl_dbg_log(DAPL_DBG_TYPE_EP," post_snd: returned\n");
+     return DAT_SUCCESS;
+}
+#endif
+
 STATIC _INLINE_ DAT_RETURN 
 dapls_ib_optional_prv_dat(
      IN  DAPL_CR       *cr_ptr,
@@ -233,13 +405,17 @@ dapls_ib_optional_prv_dat(
     return DAT_SUCCESS;
 }
 
+/* map Work Completions to DAPL WR operations */
 STATIC _INLINE_ int dapls_cqe_opcode(ib_work_completion_t *cqe_p)
 {
      switch (cqe_p->opcode) {
      case IBV_WC_SEND:
            return (OP_SEND);
      case IBV_WC_RDMA_WRITE:
-           return (OP_RDMA_WRITE);
+           if (cqe_p->wc_flags & IBV_WC_WITH_IMM)
+                 return (OP_RDMA_WRITE_IMMED);
+           else
+                 return (OP_RDMA_WRITE);
      case IBV_WC_RDMA_READ:
            return (OP_RDMA_READ);
      case IBV_WC_COMP_SWAP:
@@ -249,14 +425,18 @@ STATIC _INLINE_ int dapls_cqe_opcode(ib_
      case IBV_WC_BIND_MW:
            return (OP_BIND_MW);
      case IBV_WC_RECV:
-           return (OP_RECEIVE);
+           if (cqe_p->wc_flags & IBV_WC_WITH_IMM)
+                 return (OP_RECEIVE_IMMED);
+           else
+                 return (OP_RECEIVE);
      case IBV_WC_RECV_RDMA_WITH_IMM:
-           return (OP_RECEIVE_IMM);
+           return (OP_RECEIVE_RDMA_IMMED);
      default:
            return (OP_INVALID);
      }
 }
 
+
 #define DAPL_GET_CQE_OPTYPE(cqe_p) dapls_cqe_opcode(cqe_p)
 #define DAPL_GET_CQE_WRID(cqe_p) ((ib_work_completion_t*)cqe_p)->wr_id
 #define DAPL_GET_CQE_STATUS(cqe_p) ((ib_work_completion_t*)cqe_p)->status
Index: dapl/openib_cma/dapl_ib_util.c
===================================================================
--- dapl/openib_cma/dapl_ib_util.c  (revision 5366)
+++ dapl/openib_cma/dapl_ib_util.c  (working copy)
@@ -35,7 +35,7 @@
  *
  *   Description: 
  *
- *   The uDAPL openib provider - init, open, close, utilities, work thread
+ *   The OpenIB uCMA provider - init, open, close, utilities, work thread
  *
  ****************************************************************************
  *            Source Control System Information
@@ -64,7 +64,6 @@ static const char rcsid[] = "$Id:  $";
 #include <net/if.h>     /* for struct ifreq */
 #include <net/if_arp.h> /* for ARPHRD_INFINIBAND */
 
-
 int g_dapl_loopback_connection = 0;
 int g_ib_pipe[2];
 ib_thread_state_t g_ib_thread_state = 0;
@@ -121,11 +120,12 @@ static int getipaddr(char *name, char *a
      if (getaddrinfo(name, NULL, NULL, &res)) {
            /* retry using network device name */
            ret = getipaddr_netdev(name,addr,len);
-           if (ret)
+           if (ret) {
                  dapl_dbg_log(DAPL_DBG_TYPE_WARN, 
                       " getipaddr: invalid name, addr, or netdev(%s)\n",
                       name);
-           return ret;
+                 return ret;
+           }
      } else {
            if (len >= res->ai_addrlen)
                  memcpy(addr, res->ai_addr, res->ai_addrlen);
@@ -330,6 +330,13 @@ DAT_RETURN dapls_ib_close_hca(IN DAPL_HC
            hca_ptr->ib_hca_handle = IB_INVALID_HANDLE;
      }
 
+     dapl_os_lock(&g_hca_lock);
+     if (g_ib_thread_state != IB_THREAD_RUN) {
+           dapl_os_unlock(&g_hca_lock);
+           goto bail;
+     }
+     dapl_os_unlock(&g_hca_lock);
+
      /* 
       * Remove hca from async and CQ event processing list
       * Wakeup work thread to remove from polling list
@@ -342,10 +349,12 @@ DAT_RETURN dapls_ib_close_hca(IN DAPL_HC
            struct timespec   sleep, remain;
            sleep.tv_sec = 0;
            sleep.tv_nsec = 10000000; /* 10 ms */
+           write(g_ib_pipe[1], "w", sizeof "w");
            dapl_dbg_log(DAPL_DBG_TYPE_UTIL, 
                       " ib_thread_destroy: wait on hca %p destroy\n");
            nanosleep (&sleep, &remain);
      }
+bail:
      return (DAT_SUCCESS);
 }
   
@@ -727,7 +736,7 @@ void dapli_thread(void *arg) 
      int               ret,idx,fds;
      char              rbuf[2];
      
-     dapl_dbg_log (DAPL_DBG_TYPE_CM,
+     dapl_dbg_log (DAPL_DBG_TYPE_UTIL,
                  " ib_thread(%d,0x%x): ENTER: pipe %d ucma %d\n",
                  getpid(), g_ib_thread, g_ib_pipe[0], rdma_get_fd());
 
@@ -767,7 +776,7 @@ void dapli_thread(void *arg) 
                  ufds[idx].revents = 0;
                  uhca[idx] = hca;
 
-                 dapl_dbg_log(DAPL_DBG_TYPE_CM,
+                 dapl_dbg_log(DAPL_DBG_TYPE_UTIL,
                        " ib_thread(%d) poll_fd: hca[%d]=%p, async=%d"
                        " pipe=%d cm=%d cq=d\n",
                        getpid(), hca, ufds[idx-1].fd, 
@@ -783,14 +792,14 @@ void dapli_thread(void *arg) 
            dapl_os_unlock(&g_hca_lock);
                 ret = poll(ufds, fds, -1); 
            if (ret <= 0) {
-                 dapl_dbg_log(DAPL_DBG_TYPE_WARN,
+                 dapl_dbg_log(DAPL_DBG_TYPE_UTIL,
                             " ib_thread(%d): ERR %s poll\n",
                             getpid(),strerror(errno));
                  dapl_os_lock(&g_hca_lock);
                  continue;
            }
 
-           dapl_dbg_log(DAPL_DBG_TYPE_CM,
+           dapl_dbg_log(DAPL_DBG_TYPE_UTIL,
                  " ib_thread(%d) poll_event: "
                  " async=0x%x pipe=0x%x cm=0x%x cq=0x%x\n",
                  getpid(), ufds[idx-1].revents, ufds[0].revents, 
@@ -834,3 +843,61 @@ void dapli_thread(void *arg) 
      dapl_os_unlock(&g_hca_lock);  
 }
 
+#ifdef DAPL_PROVIDER_SPECIFIC_ATTR
+/*
+ * dapls_query_provider_specific_attr
+ *
+ * Input:
+ *   attr_ptr    Pointer provider attributes
+ *
+ * Output:
+ *   none
+ *
+ * Returns:
+ *   void
+ */
+DAT_NAMED_ATTR   ib_attrs[] = {
+ 
+#ifdef DAT_EXTENSIONS
+    {
+    DAT_EXTENSION_ATTR,
+    DAT_EXTENSION_ATTR_TRUE
+    },
+    {
+    DAT_EXTENSION_ATTR_VERSION,
+    DAT_EXTENSION_ATTR_VERSION_VALUE
+    },
+    {
+    DAT_EXTENSION_ATTR_FETCH_AND_ADD,
+    DAT_EXTENSION_ATTR_TRUE
+    },
+    {
+    DAT_EXTENSION_ATTR_CMP_AND_SWAP,
+    DAT_EXTENSION_ATTR_TRUE
+    },
+    {
+    DAT_EXTENSION_ATTR_IMMED_DATA,
+    DAT_EXTENSION_ATTR_TRUE
+    },
+#else
+     {
+    "DAT_EXTENSION_INTERFACE",
+    "FALSE"
+    },
+#endif
+};
+
+#define SPEC_ATTR_SIZE(x) ( sizeof(x)/sizeof(DAT_NAMED_ATTR) )
+
+/* 
+ * Query for all provider specific attributes and 
+ */
+void dapls_query_provider_specific_attr(
+     IN DAT_PROVIDER_ATTR    *attr_ptr )
+{
+     attr_ptr->num_provider_specific_attr = SPEC_ATTR_SIZE(ib_attrs);
+     attr_ptr->provider_specific_attr = ib_attrs;
+}
+
+#endif
+
Index: dapl/openib_cma/dapl_ib_mem.c
===================================================================
--- dapl/openib_cma/dapl_ib_mem.c   (revision 5366)
+++ dapl/openib_cma/dapl_ib_mem.c   (working copy)
@@ -25,9 +25,9 @@
 
 /**********************************************************************
  * 
- * MODULE: dapl_det_mem.c
+ * MODULE: dapl_ib_mem.c
  *
- * PURPOSE: Intel DET APIs: Memory windows, registration,
+ * PURPOSE: OpenIB uCMA provider Memory windows, registration,
  *           and protection domain 
  *
  * $Id: $
@@ -72,12 +72,12 @@ dapls_convert_privileges(IN DAT_MEM_PRIV
            access |= IBV_ACCESS_LOCAL_WRITE;
      if (DAT_MEM_PRIV_REMOTE_WRITE_FLAG & privileges)
            access |= IBV_ACCESS_REMOTE_WRITE;
-     if (DAT_MEM_PRIV_REMOTE_READ_FLAG & privileges)
-           access |= IBV_ACCESS_REMOTE_READ;
-     if (DAT_MEM_PRIV_REMOTE_READ_FLAG & privileges)
-           access |= IBV_ACCESS_REMOTE_READ;
-     if (DAT_MEM_PRIV_REMOTE_READ_FLAG & privileges)
+     if (DAT_MEM_PRIV_REMOTE_READ_FLAG & privileges) 
            access |= IBV_ACCESS_REMOTE_READ;
+#ifdef DAT_EXTENSIONS
+     if (DAT_MEM_PRIV_EXT_REMOTE_ATOMIC & privileges) 
+           access |= IBV_ACCESS_REMOTE_ATOMIC;
+#endif
 
      return access;
 }
Index: dapl/openib_cma/dapl_ib_qp.c
===================================================================
--- dapl/openib_cma/dapl_ib_qp.c    (revision 5366)
+++ dapl/openib_cma/dapl_ib_qp.c    (working copy)
@@ -25,9 +25,9 @@
 
 /**********************************************************************
  *
- * MODULE: dapl_det_qp.c
+ * MODULE: dapl_ib_qp.c
  *
- * PURPOSE: QP routines for access to DET Verbs
+ * PURPOSE: OpenIB uCMA QP routines 
  *
  * $Id: $
  **********************************************************************/
Index: dapl/openib_cma/dapl_ib_util.h
===================================================================
--- dapl/openib_cma/dapl_ib_util.h  (revision 5366)
+++ dapl/openib_cma/dapl_ib_util.h  (working copy)
@@ -35,7 +35,7 @@
  *
  *   Description: 
  *
- *   The uDAPL openib provider - definitions, prototypes,
+ *   The OpenIB uCMA provider - definitions, prototypes,
  *
  ****************************************************************************
  *            Source Control System Information
@@ -123,15 +123,16 @@ typedef struct ibv_comp_channel *ib_wait
 
 /* DTO OPs, ordered for DAPL ENUM definitions */
 #define OP_RDMA_WRITE           IBV_WR_RDMA_WRITE
-#define OP_RDMA_WRITE_IMM       IBV_WR_RDMA_WRITE_WITH_IMM
+#define OP_RDMA_WRITE_IMMED     IBV_WR_RDMA_WRITE_WITH_IMM
 #define OP_SEND                 IBV_WR_SEND
-#define OP_SEND_IMM             IBV_WR_SEND_WITH_IMM
+#define OP_SEND_IMMED           IBV_WR_SEND_WITH_IMM
 #define OP_RDMA_READ            IBV_WR_RDMA_READ
 #define OP_COMP_AND_SWAP        IBV_WR_ATOMIC_CMP_AND_SWP
 #define OP_FETCH_AND_ADD        IBV_WR_ATOMIC_FETCH_AND_ADD
-#define OP_RECEIVE              7   /* internal op */
-#define OP_RECEIVE_IMM       8   /* internel op */
-#define OP_BIND_MW              9   /* internal op */
+#define OP_RECEIVE              0x7   /* internal op */
+#define OP_RECEIVE_IMMED     0x8   /* internel op */
+#define OP_RECEIVE_RDMA_IMMED      0x9   /* internal op */
+#define OP_BIND_MW              0xa   /* internal op */
 #define OP_INVALID           0xff
 
 /* Definitions to map QP state */
@@ -295,7 +296,8 @@ dapl_convert_errno( IN int err, IN const
     if (!err)    return DAT_SUCCESS;
     
 #if DAPL_DBG
-    if ((err != EAGAIN) && (err != ETIME) && (err != ETIMEDOUT))
+    if ((err != EAGAIN) && (err != ETIME) && 
+     (err != ETIMEDOUT) && (err != EINTR))
      dapl_dbg_log (DAPL_DBG_TYPE_ERR," %s %s\n", str, strerror(err));
 #endif 
 
Index: dapl/openib_cma/dapl_ib_cq.c
===================================================================
--- dapl/openib_cma/dapl_ib_cq.c    (revision 5366)
+++ dapl/openib_cma/dapl_ib_cq.c    (working copy)
@@ -35,7 +35,7 @@
  *
  *   Description: 
  *
- *   The uDAPL openib provider - completion queue
+ *   The OpenIB uCMA provider - completion queue
  *
  ****************************************************************************
  *            Source Control System Information
@@ -498,7 +498,10 @@ dapls_ib_wait_object_wait(IN ib_wait_obj
      if (timeout != DAT_TIMEOUT_INFINITE)
            timeout_ms = timeout/1000;
 
-     status = poll(&cq_fd, 1, timeout_ms);
+     /* restart syscall */
+     while ((status = poll(&cq_fd, 1, timeout_ms)) == -1 )
+           if (errno == EINTR)
+                 continue;
 
      /* returned event */
      if (status > 0) {
@@ -511,6 +514,8 @@ dapls_ib_wait_object_wait(IN ib_wait_obj
      /* timeout */
      } else if (status == 0) 
            status = ETIMEDOUT;
+     else 
+           status = errno;
      
      dapl_dbg_log(DAPL_DBG_TYPE_UTIL, 
                 " cq_object_wait: RET evd %p ibv_cq %p ibv_ctx %p %s\n",
Index: dat/include/dat/udat.h
===================================================================
--- dat/include/dat/udat.h    (revision 5366)
+++ dat/include/dat/udat.h    (working copy)
@@ -1,31 +1,51 @@
 /*
- * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
+ * Copyright (c) 2002-2004, 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
- *    in the file LICENSE.txt in the root directory. The license is also
- *    available from the Open Source Initiative, see 
+ * This Software is licensed under both of the following two licenses:
+ *
+ * 1) under the terms of the "Common Public License 1.0". The license is also
+ *    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 in the file
- *    LICENSE2.txt in the root directory. The license is also available from
- *    the Open Source Initiative, see
+ *
+ * OR
+ *
+ * 2) under the terms of the "The BSD License". The license is also 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 in the file LICENSE3.txt in the root directory. The
- *    license is also 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.
- * 
+ *
+ * Licensee has the right to choose either one of the above two licenses.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * Redistributions of source code must retain both the above copyright
+ * notice and either one of the license notices.
+ *
  * Redistributions in binary form must reproduce both the above copyright
- * notice, one of the license notices in the documentation
+ * notice, either one of the license notices in the documentation
  * and/or other materials provided with the distribution.
+ *
+ * Neither the name of Network Appliance, Inc. nor the names of other DAT
+ * Collaborative contributors may be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
  */
 
 /****************************************************************
Index: dat/include/dat/dat_redirection.h
===================================================================
--- dat/include/dat/dat_redirection.h     (revision 5366)
+++ dat/include/dat/dat_redirection.h     (working copy)
@@ -59,10 +59,10 @@ typedef struct dat_provider DAT_PROVIDER
  * This would allow a good compiler to avoid indirection overhead when
  * making function calls.
  */
-
 #define DAT_HANDLE_TO_PROVIDER(handle) (*(DAT_PROVIDER **)(handle))
 #endif
 
+
 #define DAT_IA_QUERY(ia, evd, ia_msk, ia_ptr, p_msk, p_ptr) \
      (*DAT_HANDLE_TO_PROVIDER (ia)->ia_query_func) (\
                 (ia),               \
@@ -395,6 +395,14 @@ typedef struct dat_provider DAT_PROVIDER
            (lbuf),              \
            (cookie))
 
+#ifdef DAT_EXTENSIONS
+#define DAT_EXTENSION(handle, op, args) \
+     (*DAT_HANDLE_TO_PROVIDER (handle)->extension_func) (\
+           (handle), \
+           (op), \
+           (args))
+#endif
+
 /***************************************************************
  *
  * FUNCTION PROTOTYPES
@@ -720,4 +728,13 @@ typedef DAT_RETURN (*DAT_SRQ_POST_RECV_F
      IN      DAT_LMR_TRIPLET *,    /* local_iov            */
      IN      DAT_DTO_COOKIE );     /* user_cookie          */
 
+#ifdef DAT_EXTENSIONS
+#include <stdarg.h>
+typedef DAT_RETURN (*DAT_EXTENSION_FUNC) (
+     IN    DAT_HANDLE,       /* dat handle           */
+     IN    DAT_DTO_EXTENSION_OP,   /* extension operation  */
+        IN va_list );        /* va_list        */
+#endif
+
+
 #endif /* _DAT_REDIRECTION_H_ */
Index: dat/include/dat/dat_error.h
===================================================================
--- dat/include/dat/dat_error.h     (revision 5366)
+++ dat/include/dat/dat_error.h     (working copy)
@@ -1,31 +1,51 @@
 /*
- * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
+ * Copyright (c) 2002-2004, 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
- *    in the file LICENSE.txt in the root directory. The license is also
- *    available from the Open Source Initiative, see 
+ * This Software is licensed under both of the following two licenses:
+ *
+ * 1) under the terms of the "Common Public License 1.0". The license is also
+ *    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 in the file
- *    LICENSE2.txt in the root directory. The license is also available from
- *    the Open Source Initiative, see
+ *
+ * OR
+ *
+ * 2) under the terms of the "The BSD License". The license is also 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 in the file LICENSE3.txt in the root directory. The
- *    license is also 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.
- * 
+ *
+ * Licensee has the right to choose either one of the above two licenses.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * Redistributions of source code must retain both the above copyright
+ * notice and either one of the license notices.
+ *
  * Redistributions in binary form must reproduce both the above copyright
- * notice, one of the license notices in the documentation
+ * notice, either one of the license notices in the documentation
  * and/or other materials provided with the distribution.
+ *
+ * Neither the name of Network Appliance, Inc. nor the names of other DAT
+ * Collaborative contributors may be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
  */
 
 /***********************************************************
@@ -47,17 +67,15 @@
 
 /*
  *
- * All return codes are actually a 3-way tuple:
- *
- * type: DAT_RETURN_CLASS DAT_RETURN_TYPE DAT_RETURN_SUBTYPE
- * bits: 31-30            29-16           15-0
+ * All return codes are actually a 4-way tuple:
  *
- *    3                   2                   1
- *  1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | C | DAT_RETURN_TYPE           | DAT_RETURN_SUBTYPE            |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * type: CLASS    RETURN_TYPE   EXTENSION_SUBTYPE     SUBTYPE
+ * bits: 31-30    29-16         15-8                  7-0
  *
+ * +-------------------------------------------------------------------------+
+ * |3130 | 2928272625242322212019181716 | 15141312111009080 | 706054003020100|
+ * |CLAS | DAT_TYPE_STATUS              | EXTENSION_SUBTYPE | SUBTYPE        |
+ * +-------------------------------------------------------------------------+
  */
 
 /*
@@ -70,8 +88,13 @@
  * DAT Error bits
  */
 #define DAT_TYPE_MASK             0x3fff0000 /* mask for DAT_TYPE_STATUS bits */
-#define DAT_SUBTYPE_MASK          0x0000FFFF /* mask for DAT_SUBTYPE_STATUS bits */
+#define DAT_SUBTYPE_MASK          0x000000FF /* mask for DAT_SUBTYPE_STATUS bits */
 
+#ifdef DAT_EXTENSIONS
+/* Mask and macro for new extension subtype bits */
+#define DAT_EXTENSION_SUBTYPE_MASK    0x0000FF00 /* mask for DAT_EXTENSION_SUBTYPE_STATUS bits */
+#define DAT_GET_EXTENSION_SUBTYPE(status) ((DAT_UINT32)(status) & DAT_EXTENSION_SUBTYPE_MASK)
+#endif
 /*
  * Determining the success of an operation is best done with a macro;
  * each of these returns a boolean value.
Index: dat/include/dat/udat_redirection.h
===================================================================
--- dat/include/dat/udat_redirection.h    (revision 5366)
+++ dat/include/dat/udat_redirection.h    (working copy)
@@ -199,13 +199,12 @@ typedef DAT_RETURN (*DAT_EVD_SET_UNWAITA
 typedef DAT_RETURN (*DAT_EVD_CLEAR_UNWAITABLE_FUNC) (
      IN DAT_EVD_HANDLE);           /* evd_handle           */
 
-
 #include <dat/dat_redirection.h>
 
 struct dat_provider
 {
     const char *                        device_name;
-    DAT_PVOID                           extension;
+    DAT_PVOID                      extension;
 
     DAT_IA_OPEN_FUNC                    ia_open_func;
     DAT_IA_QUERY_FUNC                   ia_query_func;
@@ -294,6 +293,12 @@ struct dat_provider
     DAT_SRQ_QUERY_FUNC                  srq_query_func;
     DAT_SRQ_RESIZE_FUNC                 srq_resize_func;
     DAT_SRQ_SET_LW_FUNC                 srq_set_lw_func;
+
+#ifdef DAT_EXTENSIONS
+    /* udat-2.0 extensions */
+    DAT_EXTENSION_FUNC                  extension_func;
+#endif
+
 };
 
 #endif /* _UDAT_REDIRECTION_H_ */
Index: dat/include/dat/dat.h
===================================================================
--- dat/include/dat/dat.h     (revision 5366)
+++ dat/include/dat/dat.h     (working copy)
@@ -119,6 +119,23 @@ typedef DAT_HANDLE       DAT_RMR_HANDLE;
 typedef DAT_HANDLE       DAT_RSP_HANDLE;
 typedef DAT_HANDLE       DAT_SRQ_HANDLE;
 
+/* PROTOTYPE: immediate data and extensions */
+typedef enum dat_dtos
+{
+     DAT_SEND,
+     DAT_SEND_IMMED,
+     DAT_RDMA_WRITE,
+     DAT_RDMA_WRITE_IMMED,
+     DAT_RDMA_READ,
+     DAT_RECEIVE,
+     DAT_RECEIVE_INVALIDATE,
+     DAT_RECEIVE_RDMA_WRITE_IMMED,
+     DAT_BIND_MW,
+#ifdef DAT_EXTENSIONS
+     DAT_EXTENSION,
+#endif
+} DAT_DTOS;
+
 /* dat NULL handles */
 #define DAT_HANDLE_NULL ((DAT_HANDLE)NULL)
 
@@ -259,7 +276,6 @@ typedef struct dat_rmr_triplet
  */
 
 /* Memory privileges */
-
 typedef enum dat_mem_priv_flags
 {
     DAT_MEM_PRIV_NONE_FLAG           = 0x00,
@@ -267,7 +283,11 @@ typedef enum dat_mem_priv_flags
     DAT_MEM_PRIV_REMOTE_READ_FLAG    = 0x02,
     DAT_MEM_PRIV_LOCAL_WRITE_FLAG    = 0x10,
     DAT_MEM_PRIV_REMOTE_WRITE_FLAG   = 0x20,
-    DAT_MEM_PRIV_ALL_FLAG            = 0x33
+    DAT_MEM_PRIV_MW_BIND_FLAG        = 0x40,
+    DAT_MEM_PRIV_ALL_FLAG            = 0x73,
+#ifdef DAT_EXTENSIONS
+    DAT_MEM_PRIV_EXTENSION           = 0x1000
+#endif
 } DAT_MEM_PRIV_FLAGS;
 
 /* For backward compatibility with DAT-1.0, memory privileges values are
@@ -712,14 +732,23 @@ typedef enum dat_dto_completion_status
 
 /* Completion group structs (six total) */
 
-/* DTO completion event data */
+#ifdef DAT_EXTENSIONS
+#include <dat/dat_extensions.h>
+#endif
+
+/* DTO completion event data, 2.0 update */
 /* transfered_length is not defined if status is not DAT_SUCCESS */
 typedef struct dat_dto_completion_event_data
 {
     DAT_EP_HANDLE               ep_handle;
     DAT_DTO_COOKIE              user_cookie;
     DAT_DTO_COMPLETION_STATUS   status;
-    DAT_VLEN                    transfered_length;
+    DAT_VLEN                 transfered_length;
+    DAT_DTOS                 operation;
+    DAT_RMR_CONTEXT          rmr_context;
+#ifdef DAT_EXTENSIONS
+    DAT_DTO_EXTENSION_EVENT_DATA   extension;
+#endif
 } DAT_DTO_COMPLETION_EVENT_DATA;
 
     /* RMR bind  completion event data */
@@ -854,11 +883,11 @@ typedef enum dat_event_number
     DAT_ASYNC_ERROR_EP_BROKEN                    = 0x08003,
     DAT_ASYNC_ERROR_TIMED_OUT                    = 0x08004,
     DAT_ASYNC_ERROR_PROVIDER_INTERNAL_ERROR      = 0x08005,
-    DAT_SOFTWARE_EVENT                           = 0x10001
+    DAT_SOFTWARE_EVENT                           = 0x10001,
+
 } DAT_EVENT_NUMBER;
 
 /* Union for event Data */
-
 typedef union dat_event_data
 {
     DAT_DTO_COMPLETION_EVENT_DATA      dto_completion_event_data;
@@ -1222,6 +1251,13 @@ extern DAT_RETURN dat_srq_set_lw (
      IN      DAT_SRQ_HANDLE,         /* srq_handle           */
      IN      DAT_COUNT);             /* low_watermark        */
 
+#ifdef DAT_EXTENSIONS
+extern DAT_RETURN dat_extension(
+     IN    DAT_HANDLE,
+     IN      DAT_DTO_EXTENSION_OP,
+     IN    ... );
+#endif
+
 /*
  * DAT registry functions.
  *
Index: dat/common/dat_api.c
===================================================================
--- dat/common/dat_api.c      (revision 5366)
+++ dat/common/dat_api.c      (working copy)
@@ -2,27 +2,27 @@
  * 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
  *    in the file LICENSE.txt in the root directory. The license is also
- *    available from the Open Source Initiative, see
+ *    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 in the file
  *    LICENSE2.txt in the root directory. The license is also 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 in the file LICENSE3.txt in the root directory. The
  *    license is also 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.
@@ -35,7 +35,7 @@
  * PURPOSE: DAT Provider and Consumer registry functions.
  *       Also provide small integers for IA_HANDLES
  *
- * $Id: dat_api.c,v 1.10 2005/05/20 22:25:31 jlentini Exp $
+ * $Id: dat_api.c,v 1.5 2005/02/17 19:36:23 jlentini Exp $
  **********************************************************************/
 
 #include "dat_osd.h"
@@ -70,15 +70,16 @@ dats_handle_vector_init ( void )
 {
     DAT_RETURN         dat_status;
     int                i;
+    int                status;
 
     dat_status = DAT_SUCCESS;
 
     g_hv.handle_max   = DAT_HANDLE_ENTRY_STEP;
 
-    dat_status = dat_os_lock_init (&g_hv.handle_lock);
-    if ( DAT_SUCCESS != dat_status )
+    status = dat_os_lock_init (&g_hv.handle_lock);
+    if ( DAT_SUCCESS != status )
     {
-     return dat_status;
+     return status;
     }
 
     g_hv.handle_array = dat_os_alloc (sizeof(void *) * DAT_HANDLE_ENTRY_STEP);
@@ -88,7 +89,7 @@ dats_handle_vector_init ( void )
      goto bail;
     }
 
-    for (i = 0; i < g_hv.handle_max; i++)
+    for (i = g_hv.handle_max; i < g_hv.handle_max; i++)
     {
      g_hv.handle_array[i] = NULL;
     }
@@ -112,11 +113,7 @@ dats_set_ia_handle (
     void      **h;
 
     dat_os_lock (&g_hv.handle_lock);
-
-    /*
-     * Don't give out handle zero since that is DAT_HANDLE_NULL!
-     */
-    for (i = 1; i < g_hv.handle_max; i++)
+    for (i = 0; i < g_hv.handle_max; i++)
     {
      if (g_hv.handle_array[i] == NULL)
      {
@@ -1142,6 +1139,39 @@ DAT_RETURN dat_srq_set_lw(
                     low_watermark);
 }
 
+#ifdef DAT_EXTENSIONS
+DAT_RETURN dat_extension(
+     IN    DAT_HANDLE        handle,
+     IN      DAT_DTO_EXTENSION_OP  ext_op,
+     IN    ... ) 
+     
+{
+     DAT_RETURN status;
+     va_list args;
+
+     if (handle == NULL)
+     {
+     return DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_EP);
+     }
+
+     /* verify provider extension support */
+     if (!dat_extensions)
+     {
+     return DAT_ERROR(DAT_NOT_IMPLEMENTED, 0);
+     }
+
+     va_start(args, ext_op);
+
+     status = DAT_EXTENSION(handle, 
+                     ext_op,
+                     args);
+     va_end(args);
+
+     return status;
+}
+#endif 
+
+
 /*
  * Local variables:
  *  c-indent-level: 4
Index: dat/udat/Makefile
===================================================================
--- dat/udat/Makefile   (revision 5366)
+++ dat/udat/Makefile   (working copy)
@@ -112,6 +112,12 @@ CFLAGS32 = -m32
 endif
 
 #
+# Prototype 2.0 DAT extensions  
+#
+CFLAGS += -DDAT_EXTENSIONS
+
+
+#
 # LD definitions
 #
 
Index: dat/udat/udat.c
===================================================================
--- dat/udat/udat.c     (revision 5366)
+++ dat/udat/udat.c     (working copy)
@@ -2,27 +2,27 @@
  * 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
  *    in the file LICENSE.txt in the root directory. The license is also
- *    available from the Open Source Initiative, see
+ *    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 in the file
  *    LICENSE2.txt in the root directory. The license is also 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 in the file LICENSE3.txt in the root directory. The 
+ * 
+ * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
+ *    copy of which is in the file LICENSE3.txt in the root directory. The
  *    license is also 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.
@@ -34,7 +34,7 @@
  *
  * PURPOSE: DAT Provider and Consumer registry functions.
  *
- * $Id: udat.c,v 1.22 2005/03/24 05:58:35 jlentini Exp $
+ * $Id: udat.c,v 1.20 2005/02/11 20:17:05 jlentini Exp $
  **********************************************************************/
 
 #include <dat/udat.h>
@@ -66,6 +66,10 @@ udat_check_state ( void );
  *                                                                   *
  *********************************************************************/
 
+/*
+ *  Use a global to get an unresolved when run with pre-extension library
+ */
+int dat_extensions = 0;
 
 /*
  *
@@ -226,17 +230,48 @@ dat_ia_openv (
      return dat_status;
     }
 
-    dat_status = (*ia_open_func) (name,
-                         async_event_qlen,
-                         async_event_handle,
-                         ia_handle);
+    dat_status =  (*ia_open_func) (name,
+                          async_event_qlen,
+                          async_event_handle,
+                          ia_handle);
+
+    /*
+     *  See if provider supports extensions
+     */
     if (dat_status == DAT_SUCCESS)
     {
+     DAT_PROVIDER_ATTR p_attr;
+     int               i;
+
      return_handle = dats_set_ia_handle (*ia_handle);
      if (return_handle >= 0)
      {
          *ia_handle = (DAT_IA_HANDLE)return_handle;
-     }
+     } 
+
+    if ( dat_ia_query( *ia_handle,
+                    NULL,
+                    0,
+                    NULL,
+                    DAT_PROVIDER_FIELD_PROVIDER_SPECIFIC_ATTR,
+                    &p_attr ) == DAT_SUCCESS )
+    {
+         for ( i = 0; i < p_attr.num_provider_specific_attr; i++ )
+         {
+           if ( (strcmp( p_attr.provider_specific_attr[i].name,  
+                             "DAT_EXTENSION_INTERFACE" ) == 0) &&
+                (strcmp( p_attr.provider_specific_attr[i].value, 
+                             "TRUE" ) == 0) )
+           {
+                 dat_os_dbg_print(DAT_OS_DBG_TYPE_CONSUMER_API,
+                             "DAT Registry: dat_ia_open () "
+                             "DAPL Extension Interface supported!\n");
+
+                 dat_extensions = 1;
+                 break;
+           }
+         }
+    }
     }
 
     return dat_status;
 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20060210/62200041/attachment.html>


More information about the general mailing list