From 77b3bddd0325e3b6e2babaf69173a15225fd9277 Mon Sep 17 00:00:00 2001 From: Ian Ziemba Date: Thu, 19 Sep 2024 11:54:39 -0500 Subject: [PATCH] fabtests: Split out ft_sync logic 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 --- fabtests/common/shared.c | 87 +++++++++++++++++++++++++-------------- fabtests/include/shared.h | 2 + 2 files changed, 58 insertions(+), 31 deletions(-) diff --git a/fabtests/common/shared.c b/fabtests/common/shared.c index 11b7a638fa2..2d4387ba4df 100644 --- a/fabtests/common/shared.c +++ b/fabtests/common/shared.c @@ -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; } diff --git a/fabtests/include/shared.h b/fabtests/include/shared.h index 4bed8cb572b..80fd5538fe4 100644 --- a/fabtests/include/shared.h +++ b/fabtests/include/shared.h @@ -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);