Skip to content

Commit

Permalink
fabtests: Split out ft_sync logic
Browse files Browse the repository at this point in the history
Split out the ft_sync logic into two separate functions: inband sync
(ft_sync_inband) and out-of-band sync (ft_sync_oob). The inband sync
supports the option to conditionally repost buffers after the sync.

The breaking out of the sync logic is needed to support
fi_rdm_pingpong/fi_rdm_tagged_pingpong with a no pre-posted RX buffer
option.

Signed-off-by: Ian Ziemba <ian.ziemba@hpe.com>
  • Loading branch information
iziemba authored and j-xiong committed Sep 24, 2024
1 parent 8e8a920 commit 77b3bdd
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 31 deletions.
87 changes: 56 additions & 31 deletions fabtests/common/shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -3012,49 +3012,74 @@ void eq_readerr(struct fid_eq *eq, const char *eq_str)
}
}

int ft_sync()
int ft_sync_oob(void)
{
char buf = 'a';
int ret;

if (opts.dst_addr) {
if (!(opts.options & FT_OPT_OOB_SYNC)) {
ret = ft_tx_msg(ep, remote_fi_addr, tx_buf, 1, &tx_ctx,
FI_DELIVERY_COMPLETE);
if (ret)
return ret;
ret = ft_sock_send(oob_sock, &buf, 1);
if (ret)
return ret;

ret = ft_rx(ep, 1);
} else {
ret = ft_sock_send(oob_sock, &buf, 1);
if (ret)
return ret;
ret = ft_sock_recv(oob_sock, &buf, 1);
if (ret)
return ret;
} else {
ret = ft_sock_recv(oob_sock, &buf, 1);
if (ret)
return ret;

ret = ft_sock_recv(oob_sock, &buf, 1);
if (ret)
return ret;
}
ret = ft_sock_send(oob_sock, &buf, 1);
if (ret)
return ret;
}

return FI_SUCCESS;
}

int ft_sync_inband(bool repost_rx)
{
int ret;

if (opts.dst_addr) {
ret = ft_tx_msg(ep, remote_fi_addr, tx_buf, 1, &tx_ctx,
FI_DELIVERY_COMPLETE);
if (ret)
return ret;

ret = ft_get_rx_comp(rx_seq);
if (ret)
return ret;
} else {
if (!(opts.options & FT_OPT_OOB_SYNC)) {
ret = ft_rx(ep, 1);
if (ret)
return ret;
ret = ft_get_rx_comp(rx_seq);
if (ret)
return ret;

ret = ft_tx_msg(ep, remote_fi_addr, tx_buf, 1, &tx_ctx,
FI_DELIVERY_COMPLETE);
if (ret)
return ret;
} else {
ret = ft_sock_recv(oob_sock, &buf, 1);
if (ret)
return ret;
ret = ft_tx_msg(ep, remote_fi_addr, tx_buf, 1, &tx_ctx,
FI_DELIVERY_COMPLETE);
if (ret)
return ret;
}

ret = ft_sock_send(oob_sock, &buf, 1);
if (ret)
return ret;
}
if (repost_rx) {
ret = ft_post_rx(ep, rx_size, &rx_ctx);
if (ret)
return ret;
}

return FI_SUCCESS;
}

int ft_sync()
{
int ret;

if (ft_check_opts(FT_OPT_OOB_SYNC))
ret = ft_sync_oob();
else
ret = ft_sync_inband(true);

return ret;
}

Expand Down
2 changes: 2 additions & 0 deletions fabtests/include/shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,8 @@ void *ft_get_aligned_addr(void *ptr, size_t alignment)

int ft_read_cq(struct fid_cq *cq, uint64_t *cur, uint64_t total,
int timeout, uint64_t tag);
int ft_sync_oob(void);
int ft_sync_inband(bool repost_rx);
int ft_sync(void);
int ft_sync_pair(int status);
int ft_fork_and_pair(void);
Expand Down

0 comments on commit 77b3bdd

Please sign in to comment.