Skip to content

Commit

Permalink
UCP/RNDV: Fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrygx committed Dec 8, 2021
1 parent 2f82417 commit c6ecd5c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/ucp/core/ucp_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ void ucp_request_handle_send_error(ucp_request_t *req, ucs_status_t status)
}
} else {
if (req->flags & UCP_REQUEST_FLAG_SEND_RNDV) {
ucp_rndv_complete_send(req, UCS_ERR_CANCELED, "rndv_flush");
ucp_rndv_req_add_to_cancel_list(req, status);
} else {
ucp_request_complete_send(req, status);
}
Expand Down
29 changes: 13 additions & 16 deletions src/ucp/tag/rndv.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,12 @@ size_t ucp_tag_rndv_rts_pack(void *dest, void *arg)
return sizeof(*rndv_rts_hdr) + packed_rkey_size;
}

static void ucp_rndv_req_cancel(ucp_request_t *sreq, ucs_status_t status)
void ucp_rndv_req_add_to_cancel_list(ucp_request_t *sreq, ucs_status_t status)
{
if (sreq->flags & UCP_REQUEST_FLAG_CANCELED) {
return; /* already cancelled */
}

sreq->status = status;
sreq->flags |= UCP_REQUEST_FLAG_CANCELED;
ucs_list_add_tail(&sreq->send.ep->worker->rndv_reqs_list,
Expand Down Expand Up @@ -243,7 +247,7 @@ UCS_PROFILE_FUNC(ucs_status_t, ucp_proto_progress_rndv_rts, (self),
return UCS_ERR_NO_RESOURCE;
} else {
ucs_assert(UCS_STATUS_IS_ERR(status));
ucp_rndv_req_cancel(sreq, status);
ucp_rndv_complete_send(sreq, status, "rts_cancel");
return UCS_OK;
}
}
Expand Down Expand Up @@ -273,12 +277,12 @@ UCS_PROFILE_FUNC(ucs_status_t, ucp_proto_progress_rndv_cancel, (self),
UCP_AM_ID_RNDV_RTS, ucp_memcpy_pack, &ctx, 0);
if (packed_len == UCS_ERR_NO_RESOURCE) {
return UCS_ERR_NO_RESOURCE;
} else {
status = (packed_len >= 0) ? UCS_ERR_CANCELED :
(ucs_status_t)packed_len;
ucp_rndv_req_cancel(sreq, status);
return UCS_OK;
}

status = (packed_len >= 0) ? UCS_ERR_CANCELED : (ucs_status_t)packed_len;
ucp_rndv_req_add_to_cancel_list(sreq, status);

return UCS_OK;
}

static size_t ucp_tag_rndv_rtr_pack(void *dest, void *arg)
Expand Down Expand Up @@ -409,15 +413,8 @@ ucs_status_t ucp_tag_send_start_rndv(ucp_request_t *sreq)

void ucp_tag_rndv_cancel(ucp_request_t *sreq)
{
if (!(sreq->send.ep->flags & UCP_EP_FLAG_REMOTE_CONNECTED)) {
if (sreq->flags & UCP_REQUEST_FLAG_RNDV_RTS_SENT) {
ucp_rndv_req_cancel(sreq, UCS_ERR_CANCELED);
}
} else {
sreq->send.uct.func = ucp_proto_progress_rndv_cancel;
if (sreq->flags & UCP_REQUEST_FLAG_RNDV_RTS_SENT) {
ucp_request_send(sreq, 0);
}
if (sreq->flags & UCP_REQUEST_FLAG_RNDV_RTS_SENT) {
ucp_rndv_req_add_to_cancel_list(sreq, UCS_ERR_CANCELED);
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/ucp/tag/rndv.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ ucs_status_t ucp_rndv_process_rts(void *arg, void *data, size_t length,

size_t ucp_tag_rndv_rts_pack(void *dest, void *arg);

void ucp_rndv_req_add_to_cancel_list(ucp_request_t *sreq, ucs_status_t status);

ucs_status_t ucp_tag_rndv_reg_send_buffer(ucp_request_t *sreq);

void ucp_ep_complete_rndv_reqs(ucp_ep_h ep);
Expand Down

0 comments on commit c6ecd5c

Please sign in to comment.