Skip to content

Commit

Permalink
prov/shm: Make progress errors ints instead of unit64
Browse files Browse the repository at this point in the history
Make progress errors ints to match the fi_cq_err_entry
struct's err type. This error needs to be positive so
the paths have been checked and they all return negative
errors. The err sign is flipped when calling write_err_comp
to keep it positive like the API expects.

Signed-off-by: Zach Dworkin <[email protected]>
  • Loading branch information
zachdworkin committed Aug 23, 2024
1 parent 71b39cd commit df919ba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion prov/shm/src/smr.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ typedef ssize_t (*smr_proto_func)(struct smr_ep *ep, struct smr_region *peer_smr
extern smr_proto_func smr_proto_ops[smr_src_max];

int smr_write_err_comp(struct util_cq *cq, void *context,
uint64_t flags, uint64_t tag, uint64_t err);
uint64_t flags, uint64_t tag, int err);
int smr_complete_tx(struct smr_ep *ep, void *context, uint32_t op,
uint64_t flags);
int smr_complete_rx(struct smr_ep *ep, void *context, uint32_t op,
Expand Down
2 changes: 1 addition & 1 deletion prov/shm/src/smr_comp.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ int smr_complete_tx(struct smr_ep *ep, void *context, uint32_t op,
}

int smr_write_err_comp(struct util_cq *cq, void *context,
uint64_t flags, uint64_t tag, uint64_t err)
uint64_t flags, uint64_t tag, int err)
{
struct fi_cq_err_entry err_entry;

Expand Down
12 changes: 6 additions & 6 deletions prov/shm/src/smr_progress.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ static int smr_progress_iov(struct smr_cmd *cmd, struct iovec *iov,
//Status must be set last (signals peer: op done, valid resp entry)
resp->status = -ret;

return -ret;
return ret;
}

static int smr_mmap_peer_copy(struct smr_ep *ep, struct smr_cmd *cmd,
Expand Down Expand Up @@ -585,7 +585,7 @@ static struct smr_pend_entry *smr_progress_ipc(struct smr_cmd *cmd,
else if (hmem_copy_ret != cmd->msg.hdr.size)
*err = -FI_ETRUNC;
else
*err = ret;
*err = FI_SUCCESS;

*total_len = hmem_copy_ret;

Expand Down Expand Up @@ -719,7 +719,7 @@ static int smr_start_common(struct smr_ep *ep, struct smr_cmd *cmd,
uint64_t comp_flags;
void *comp_buf;
int ret;
uint64_t err = 0;
int err = 0;

switch (cmd->msg.hdr.op_src) {
case smr_src_inline:
Expand Down Expand Up @@ -752,7 +752,7 @@ static int smr_start_common(struct smr_ep *ep, struct smr_cmd *cmd,
pend = smr_progress_ipc(cmd, rx_entry,
(struct ofi_mr **) rx_entry->desc,
rx_entry->iov, rx_entry->count,
&total_len, ep, (int*)&err);
&total_len, ep, &err);
break;
default:
FI_WARN(&smr_prov, FI_LOG_EP_CTRL,
Expand All @@ -770,7 +770,7 @@ static int smr_start_common(struct smr_ep *ep, struct smr_cmd *cmd,
ret = smr_write_err_comp(ep->util_ep.rx_cq,
rx_entry->context,
comp_flags, rx_entry->tag,
err);
-err);
} else {
ret = smr_complete_rx(ep, rx_entry->context, cmd->msg.hdr.op,
comp_flags, total_len, comp_buf,
Expand Down Expand Up @@ -1105,7 +1105,7 @@ static int smr_progress_cmd_rma(struct smr_ep *ep, struct smr_cmd *cmd,
"error processing rma op\n");
ret = smr_write_err_comp(ep->util_ep.rx_cq, NULL,
smr_rx_cq_flags(cmd->msg.hdr.op, 0,
cmd->msg.hdr.op_flags), 0, err);
cmd->msg.hdr.op_flags), 0, -err);
} else {
ret = smr_complete_rx(ep, (void *) cmd->msg.hdr.msg_id,
cmd->msg.hdr.op, smr_rx_cq_flags(cmd->msg.hdr.op,
Expand Down

0 comments on commit df919ba

Please sign in to comment.