Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Commit

Permalink
rpma: additional parameter to be able extend functionality
Browse files Browse the repository at this point in the history
pmem#1743 will be implemented later.
This PR intorduce only the flag to be able to mergee all new examples
with target API.
  • Loading branch information
grom72 committed Jun 29, 2022
1 parent 81ceb2b commit 796e7cc
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion examples/06s-multiple-connections/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ client_handle_completion(struct custom_event *ce)
struct rpma_cq *cq = NULL;

/* wait for the completion to be ready */
int ret = rpma_conn_wait(clnt->conn, &cq, NULL);
int ret = rpma_conn_wait(clnt->conn, 0, &cq, NULL);
if (ret) {
/* no completion is ready - continue */
if (ret == RPMA_E_NO_COMPLETION)
Expand Down
2 changes: 1 addition & 1 deletion examples/common/common-conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ wait_and_validate_completion(struct rpma_conn *conn, enum ibv_wc_opcode expected
struct rpma_cq *cq = NULL;
int ret;

if ((ret = rpma_conn_wait(conn, &cq, NULL)))
if ((ret = rpma_conn_wait(conn, 0, &cq, NULL)))
return ret;
if ((ret = rpma_cq_get_wc(cq, 1, wc, NULL)))
return ret;
Expand Down
4 changes: 3 additions & 1 deletion src/conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,11 @@ rpma_conn_next_event(struct rpma_conn *conn, enum rpma_conn_event *event)
* channel from CQ or RCQ, ack it and return a CQ that caused the event
* in the cq argument and a boolean value saying if it is RCQ or not
* in the is_rcq argument (if is_rcq is not NULL)
* flags parameter is added to ensure backward compatibility in the future when
* https://github.com/pmem/rpma/issues/1743 will be implemented
*/
int
rpma_conn_wait(struct rpma_conn *conn, struct rpma_cq **cq, bool *is_rcq)
rpma_conn_wait(struct rpma_conn *conn, int flags, struct rpma_cq **cq, bool *is_rcq)
{
RPMA_DEBUG_TRACE;
RPMA_FAULT_INJECTION(RPMA_E_NO_COMPLETION, {});
Expand Down
4 changes: 2 additions & 2 deletions src/include/librpma.h
Original file line number Diff line number Diff line change
Expand Up @@ -2143,7 +2143,7 @@ int rpma_conn_get_compl_fd(const struct rpma_conn *conn, int *fd);
*
* struct rpma_conn;
* struct rpma_cq
* int rpma_conn_wait(struct rpma_conn *conn, struct rpma_cq **cq, bool *is_rcq)
* int rpma_conn_wait(struct rpma_conn *conn, int flags, struct rpma_cq **cq, bool *is_rcq)
*
* DESCRIPTION
* rpma_conn_wait() waits for a completion event on the shared completion
Expand All @@ -2169,7 +2169,7 @@ int rpma_conn_get_compl_fd(const struct rpma_conn *conn, int *fd);
* SEE ALSO
* rpma_conn_req_new(3), librpma(7) and https://pmem.io/rpma/
*/
int rpma_conn_wait(struct rpma_conn *conn, struct rpma_cq **cq, bool *is_rcq);
int rpma_conn_wait(struct rpma_conn *conn, int flags, struct rpma_cq **cq, bool *is_rcq);

/** 3
* rpma_conn_req_recv - initiate the receive operation
Expand Down
16 changes: 8 additions & 8 deletions tests/unit/conn/conn-wait.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ wait__conn_NULL(void **unused)
/* run test */
struct rpma_cq *cq = NULL;
bool is_rcq;
int ret = rpma_conn_wait(NULL, &cq, &is_rcq);
int ret = rpma_conn_wait(NULL, 0, &cq, &is_rcq);

/* verify the results */
assert_int_equal(ret, RPMA_E_INVAL);
Expand All @@ -37,7 +37,7 @@ wait__cq_NULL(void **unused)
{
/* run test */
bool is_rcq;
int ret = rpma_conn_wait(MOCK_CONN, NULL, &is_rcq);
int ret = rpma_conn_wait(MOCK_CONN, 0, NULL, &is_rcq);

/* verify the results */
assert_int_equal(ret, RPMA_E_INVAL);
Expand All @@ -54,7 +54,7 @@ wait__channel_not_shared(void **cstate_ptr)
/* run test */
struct rpma_cq *cq = NULL;
bool is_rcq;
int ret = rpma_conn_wait(cstate->conn, &cq, &is_rcq);
int ret = rpma_conn_wait(cstate->conn, 0, &cq, &is_rcq);

/* verify the results */
assert_int_equal(ret, RPMA_E_NOT_SHARED_CHNL);
Expand All @@ -76,7 +76,7 @@ wait__get_cq_event_ERRNO(void **cstate_ptr)
/* run test */
struct rpma_cq *cq = NULL;
bool is_rcq;
int ret = rpma_conn_wait(cstate->conn, &cq, &is_rcq);
int ret = rpma_conn_wait(cstate->conn, 0, &cq, &is_rcq);

/* verify the results */
assert_int_equal(ret, RPMA_E_NO_COMPLETION);
Expand All @@ -103,7 +103,7 @@ wait__get_cq_event_UNKNOWN(void **cstate_ptr)
/* run test */
struct rpma_cq *cq = NULL;
bool is_rcq;
int ret = rpma_conn_wait(cstate->conn, &cq, &is_rcq);
int ret = rpma_conn_wait(cstate->conn, 0, &cq, &is_rcq);

/* verify the results */
assert_int_equal(ret, RPMA_E_UNKNOWN);
Expand Down Expand Up @@ -131,7 +131,7 @@ wait__req_notify_cq_ERRNO(void **cstate_ptr)
/* run test */
struct rpma_cq *cq = NULL;
bool is_rcq;
int ret = rpma_conn_wait(cstate->conn, &cq, &is_rcq);
int ret = rpma_conn_wait(cstate->conn, 0, &cq, &is_rcq);

/* verify the results */
assert_int_equal(ret, RPMA_E_PROVIDER);
Expand Down Expand Up @@ -161,7 +161,7 @@ wait__success_is_rcq_NULL(void **cstate_ptr)

/* run test */
struct rpma_cq *cq = NULL;
int ret = rpma_conn_wait(cstate->conn, &cq, NULL);
int ret = rpma_conn_wait(cstate->conn, 0, &cq, NULL);
/* verify the results */
assert_int_equal(ret, MOCK_OK);
assert_ptr_equal(cq, MOCK_RPMA_RCQ);
Expand Down Expand Up @@ -190,7 +190,7 @@ wait__success(void **cstate_ptr)
/* run test */
struct rpma_cq *cq = NULL;
bool is_rcq;
int ret = rpma_conn_wait(cstate->conn, &cq, &is_rcq);
int ret = rpma_conn_wait(cstate->conn, 0, &cq, &is_rcq);

/* verify the results */
assert_int_equal(ret, MOCK_OK);
Expand Down

0 comments on commit 796e7cc

Please sign in to comment.