From d3061c18e84c91a417f8832b1a7cc09b1d26d1ee Mon Sep 17 00:00:00 2001 From: Lukasz Dorau Date: Mon, 28 Feb 2022 15:25:53 +0100 Subject: [PATCH] rpma: simplify server_cmpl_process() Simplify the code of the server_cmpl_process() function. Signed-off-by: Lukasz Dorau --- engines/librpma_gpspm.c | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/engines/librpma_gpspm.c b/engines/librpma_gpspm.c index f00717a7..64962dda 100644 --- a/engines/librpma_gpspm.c +++ b/engines/librpma_gpspm.c @@ -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; } -- 2.25.1