common: set atomic attributes based on provider/device capabilities
authorAmir Hanania <amir.hanania@intel.com>
Wed, 28 Sep 2016 21:41:56 +0000 (14:41 -0700)
committerArlin Davis <arlin.r.davis@intel.com>
Wed, 28 Sep 2016 21:41:56 +0000 (14:41 -0700)
DAT_IB_FETCH_AND_ADD and DAT_IB_CMP_AND_SWAP values in provider_specific_attr are always set to TRUE.
Set their value according to the device atomic capability.

Signed-off-by: Arlin Davis <arlin.r.davis@intel.com>
Signed-off-by: Amir Hanania <amir.hanania@intel.com>
dapl/openib_common/util.c

index 95c9a4e..5cd3885 100644 (file)
@@ -523,8 +523,17 @@ DAT_RETURN dapls_ib_query_hca(IN DAPL_HCA * hca_ptr,
                ia_attr->extension_version = DAT_IB_EXTENSION_VERSION;
                tp->na.ib_ext = "TRUE";
                tp->na.i_data = "TRUE";
-               tp->na.f_add  = "TRUE";
-               tp->na.c_swap = "TRUE";
+#ifdef _OPENIB_MCM_
+       if (MFO_EP(&hca_ptr->ib_trans.addr) && tp->self.node) {
+               tp->na.f_add  = "FALSE";
+               tp->na.c_swap = "FALSE";
+       }
+       else
+#endif
+       {
+               tp->na.f_add  = (dev_attr.atomic_cap == IBV_ATOMIC_NONE) ? "FALSE" : "TRUE";
+               tp->na.c_swap = (dev_attr.atomic_cap == IBV_ATOMIC_NONE) ? "FALSE" : "TRUE";
+       }
 #ifdef _OPENIB_MCM_
                if (!MXF_EP(&hca_ptr->ib_trans.addr))
 #endif