Revert "rpma: simplify server_cmpl_process()"
authorTomasz Gromadzki <tomasz.gromadzki@intel.com>
Thu, 29 Aug 2024 11:47:36 +0000 (13:47 +0200)
committerTomasz Gromadzki <tomasz.gromadzki@intel.com>
Thu, 29 Aug 2024 11:47:36 +0000 (13:47 +0200)
This reverts commit d3061c18e84c91a417f8832b1a7cc09b1d26d1ee.

engines/librpma_gpspm.c

index 70116d0d6ece5d3d2adf6b5bb93081bc787662ca..e751e302e8588583a70aca43a1ee86f28e44d585 100644 (file)
@@ -700,25 +700,29 @@ static int server_cmpl_process(struct thread_data *td)
 
        ret = rpma_cq_get_wc(csd->cq, 1, wc, NULL);
        if (ret == RPMA_E_NO_COMPLETION) {
-               if (o->busy_wait_polling)
-                       return 0; /* lack of completion is not an error */
-
-               ret = rpma_cq_wait(csd->cq);
-               if (ret == RPMA_E_NO_COMPLETION)
-                       return 0; /* lack of completion is not an error */
-               if (ret) {
-                       librpma_td_verror(td, ret, "rpma_cq_wait");
-                       goto err_terminate;
-               }
-
-               ret = rpma_cq_get_wc(csd->cq, 1, wc, NULL);
-               if (ret == RPMA_E_NO_COMPLETION)
-                       return 0; /* lack of completion is not an error */
-               if (ret) {
-                       librpma_td_verror(td, ret, "rpma_cq_get_wc");
-                       goto err_terminate;
+               if (o->busy_wait_polling == 0) {
+                       ret = rpma_cq_wait(csd->cq);
+                       if (ret == RPMA_E_NO_COMPLETION) {
+                               /* lack of completion is not an error */
+                               return 0;
+                       } else if (ret != 0) {
+                               librpma_td_verror(td, ret, "rpma_cq_wait");
+                               goto err_terminate;
+                       }
+
+                       ret = rpma_cq_get_wc(csd->cq, 1, wc, NULL);
+                       if (ret == RPMA_E_NO_COMPLETION) {
+                               /* lack of completion is not an error */
+                               return 0;
+                       } else if (ret != 0) {
+                               librpma_td_verror(td, ret, "rpma_cq_get_wc");
+                               goto err_terminate;
+                       }
+               } else {
+                       /* lack of completion is not an error */
+                       return 0;
                }
-       } else if (ret) {
+       } else if (ret != 0) {
                librpma_td_verror(td, ret, "rpma_cq_get_wc");
                goto err_terminate;
        }