rpma: simplify server_cmpl_process()
authorLukasz Dorau <lukasz.dorau@intel.com>
Mon, 28 Feb 2022 14:25:53 +0000 (15:25 +0100)
committerLukasz Dorau <lukasz.dorau@intel.com>
Tue, 6 Sep 2022 11:08:41 +0000 (13:08 +0200)
Simplify the code of the server_cmpl_process() function.

Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
engines/librpma_gpspm.c

index f00717a731c43298f270bb6aa7f0908221c9b161..64962dda4c7088f994180e8193017e324731f535 100644 (file)
@@ -685,29 +685,25 @@ 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 == 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;
+               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;
                }
-       } else if (ret != 0) {
+       } else if (ret) {
                librpma_td_verror(td, ret, "rpma_cq_get_wc");
                goto err_terminate;
        }