dtestx: check device capabilities and do atomic tests only if supported by HW
authorAmir Hanania <amir.hanania@intel.com>
Wed, 28 Sep 2016 21:44:18 +0000 (14:44 -0700)
committerArlin Davis <arlin.r.davis@intel.com>
Wed, 28 Sep 2016 21:44:18 +0000 (14:44 -0700)
Signed-off-by: Arlin Davis <arlin.r.davis@intel.com>
Signed-off-by: Amir Hanania <amir.hanania@intel.com>
test/dtest/dtestx.c

index 085da6b..c041a57 100755 (executable)
@@ -179,6 +179,8 @@ static int eps = 1;
 static int verbose = 0;
 static int counters = 0;
 static int counters_ok = 0;
+static int fetch_and_add_cap = 0;
+static int cmp_and_swap_cap = 0;
 static int query_only = 0;
 static int ucm = 0;
 static DAT_SOCK_ADDR6 remote;
@@ -1328,6 +1330,11 @@ static int do_cmp_swap()
        DAT_IB_EXTENSION_EVENT_DATA *ext_event =
            (DAT_IB_EXTENSION_EVENT_DATA *) & event.event_extension_data[0];
 
+       if (!cmp_and_swap_cap) {
+               printf("\nSkipping CMP and SWAP as it is not supported by HW\n");
+               return 0;
+       }
+
        printf("\nDoing CMP and SWAP\n");
 
        /* RMR info already swapped back to host order in connect_ep */
@@ -1425,6 +1432,11 @@ static int do_fetch_add()
        DAT_IB_EXTENSION_EVENT_DATA *ext_event =
            (DAT_IB_EXTENSION_EVENT_DATA *) & event.event_extension_data[0];
 
+       if (!fetch_and_add_cap) {
+               printf("\nSkipping FETCH and ADD as it is not supported by HW\n");
+               return 0;
+       }
+
        printf("\nDoing FETCH and ADD\n");
 
        /* RMR info already swapped back to host order in connect_ep */
@@ -1655,6 +1667,12 @@ int main(int argc, char **argv)
                          i, prov_attrs.provider_specific_attr[i].name,
                          prov_attrs.provider_specific_attr[i].value);
 
+               if (!strcmp(prov_attrs.provider_specific_attr[i].name, "DAT_IB_CMP_AND_SWAP"))
+                       cmp_and_swap_cap = !(strcmp(prov_attrs.provider_specific_attr[i].value, "TRUE"));
+
+               if (!strcmp(prov_attrs.provider_specific_attr[i].name, "DAT_IB_FETCH_AND_ADD"))
+                       fetch_and_add_cap = !(strcmp(prov_attrs.provider_specific_attr[i].value, "TRUE"));
+
                rc = strcmp(prov_attrs.provider_specific_attr[i].name,
                                "DAT_COUNTERS");
                if (!rc)