From 5717b22241518ed00ecb9b211bc875c3f3fca961 Mon Sep 17 00:00:00 2001 From: yosefe Date: Sun, 8 Mar 2015 18:21:03 +0200 Subject: [PATCH] UCT/API/TEST: Support holding the descriptor from active message callback. --- src/ucs/datastruct/mpool.c | 21 +++++------ src/ucs/datastruct/mpool.h | 5 +++ src/uct/api/tl.h | 2 ++ src/uct/api/uct.h | 5 +++ src/uct/api/uct_def.h | 5 +++ src/uct/ib/base/ib_iface.c | 15 ++++++-- src/uct/ib/base/ib_iface.h | 20 ++++++++++- src/uct/ib/rc/rc_iface.h | 5 +-- src/uct/ib/rc/rc_mlx5_iface.c | 21 +++++++++-- src/uct/ib/rc/rc_verbs_iface.c | 9 ++--- src/uct/tl/tl_base.h | 2 +- test/gtest/uct/test_amo.cc | 4 +-- test/gtest/uct/test_p2p_am.cc | 62 +++++++++++++++++++++++++++++---- test/gtest/uct/test_p2p_err.cc | 3 ++ test/gtest/uct/test_p2p_rma.cc | 3 ++ test/gtest/uct/test_pd.cc | 2 +- test/gtest/uct/test_uct_perf.cc | 2 +- test/gtest/uct/uct_p2p_test.cc | 12 +++++-- test/gtest/uct/uct_p2p_test.h | 3 ++ test/gtest/uct/uct_test.cc | 6 ++-- test/gtest/uct/uct_test.h | 2 +- 21 files changed, 168 insertions(+), 41 deletions(-) diff --git a/src/ucs/datastruct/mpool.c b/src/ucs/datastruct/mpool.c index bea1edc4d3d..10c1990b93d 100644 --- a/src/ucs/datastruct/mpool.c +++ b/src/ucs/datastruct/mpool.c @@ -137,17 +137,10 @@ ucs_mpool_create(const char *name, size_t elem_size, size_t align_offset, return UCS_OK; } -static void __mpool_destroy(ucs_mpool_h mp, unsigned check_inuse) +static void __mpool_destroy(ucs_mpool_h mp) { ucs_mpool_chunk_t *chunk; - /* Sanity check - all elements should be put back to the mpool */ - if (check_inuse) { - ucs_assertv(mp->num_elems_inuse == 0, - "destroying memory pool %s with %u used elements", mp->name, - mp->num_elems_inuse); - } - while (!ucs_queue_is_empty(&mp->chunks)) { chunk = ucs_queue_pull_elem_non_empty(&mp->chunks, ucs_mpool_chunk_t, queue); mp->chunk_free_cb(mp->mp_context, chunk); @@ -161,12 +154,20 @@ static void __mpool_destroy(ucs_mpool_h mp, unsigned check_inuse) void ucs_mpool_destroy(ucs_mpool_h mp) { - __mpool_destroy(mp, 1); + ucs_mpool_check_empty(mp); + __mpool_destroy(mp); } void ucs_mpool_destroy_unchecked(ucs_mpool_h mp) { - __mpool_destroy(mp, 0); + __mpool_destroy(mp); +} + +void ucs_mpool_check_empty(ucs_mpool_h mp) +{ + ucs_assertv(mp->num_elems_inuse == 0, + "destroying memory pool %s with %u used elements", mp->name, + mp->num_elems_inuse); } void *ucs_mpool_get(ucs_mpool_h mp) diff --git a/src/ucs/datastruct/mpool.h b/src/ucs/datastruct/mpool.h index b9c3bcb4033..6964182d2fc 100644 --- a/src/ucs/datastruct/mpool.h +++ b/src/ucs/datastruct/mpool.h @@ -84,6 +84,11 @@ ucs_mpool_create(const char *name, size_t elem_size, size_t align_offset, void ucs_mpool_destroy(ucs_mpool_h mp); void ucs_mpool_destroy_unchecked(ucs_mpool_h mp); +/** + * Check that memory pool is empty. Also called from ucs_mpool_destroy(). + */ +void ucs_mpool_check_empty(ucs_mpool_h mp); + /** * Get an element from the memory pool. */ diff --git a/src/uct/api/tl.h b/src/uct/api/tl.h index 6901c60190f..cb46a53ad7f 100644 --- a/src/uct/api/tl.h +++ b/src/uct/api/tl.h @@ -32,6 +32,8 @@ typedef struct uct_iface_ops { void (*iface_close)(uct_iface_h iface); + void (*iface_release_desc)(uct_iface_h iface, void *desc); + ucs_status_t (*ep_create)(uct_iface_h iface, uct_ep_h *ep_p); void (*ep_destroy)(uct_ep_h ep); diff --git a/src/uct/api/uct.h b/src/uct/api/uct.h index d3421cc29cc..f442305cdd5 100644 --- a/src/uct/api/uct.h +++ b/src/uct/api/uct.h @@ -555,6 +555,11 @@ UCT_INLINE_API void uct_iface_close(uct_iface_h iface) iface->ops.iface_close(iface); } +UCT_INLINE_API void uct_iface_release_desc(uct_iface_h iface, void *desc) +{ + iface->ops.iface_release_desc(iface, desc); +} + UCT_INLINE_API ucs_status_t uct_ep_create(uct_iface_h iface, uct_ep_h *ep_p) { return iface->ops.ep_create(iface, ep_p); diff --git a/src/uct/api/uct_def.h b/src/uct/api/uct_def.h index fbea8dd6372..11e8cc09d3c 100644 --- a/src/uct/api/uct_def.h +++ b/src/uct/api/uct_def.h @@ -47,6 +47,11 @@ typedef void (*uct_rkey_release_func_t)(uct_context_h context, uct_rkey_t rkey); /** * Callback to process incoming active message * + * When the callback is called, `desc' does not necessarily contain the payload. + * In this case, `data' would not point inside `desc', and user may want copy the + * payload from `data' to `desc' before returning UCT_INPROGRESS (it's guaranteed + * `desc' has enough room to hold the payload). + * * @param [in] arg User-defined argument. * @param [in] data Points to the received data. * @param [in] length Length of data. diff --git a/src/uct/ib/base/ib_iface.c b/src/uct/ib/base/ib_iface.c index 12044528689..5be2e941485 100644 --- a/src/uct/ib/base/ib_iface.c +++ b/src/uct/ib/base/ib_iface.c @@ -167,6 +167,15 @@ ucs_status_t uct_ib_iface_recv_mpool_create(uct_ib_iface_t *iface, mp_p); } +void uct_ib_iface_release_desc(uct_iface_t *tl_iface, void *desc) +{ + uct_ib_iface_t *iface = ucs_derived_of(tl_iface, uct_ib_iface_t); + void *ib_desc; + + ib_desc = desc - iface->config.rx_headroom_offset; + ucs_mpool_put(ib_desc); +} + /** * @param rx_headroom Headroom requested by the user. * @param rx_priv_len Length of transport private data to reserve (0 if unused) @@ -196,10 +205,10 @@ static UCS_CLASS_INIT_FUNC(uct_ib_iface_t, uct_iface_ops_t *ops, self->gid_index = config->gid_index; self->sl = config->sl; self->path_bits_count = config->lid_path_bits.count; - self->config.rx_headroom = rx_headroom; self->config.rx_payload_offset = sizeof(uct_ib_iface_recv_desc_t) + ucs_max(rx_headroom, rx_priv_len + rx_hdr_len); self->config.rx_hdr_offset = self->config.rx_payload_offset - rx_hdr_len; + self->config.rx_headroom_offset= self->config.rx_payload_offset - rx_headroom; self->config.seg_size = config->super.max_bcopy; if (self->path_bits_count == 0) { @@ -254,8 +263,8 @@ static UCS_CLASS_INIT_FUNC(uct_ib_iface_t, uct_iface_ops_t *ops, goto err_destroy_recv_cq; } - ucs_debug("created uct_ib_iface_t rx_headroom %d payload_ofs %d hdr_ofs %d data_sz %d", - self->config.rx_headroom, self->config.rx_payload_offset, + ucs_debug("created uct_ib_iface_t headroom_ofs %d payload_ofs %d hdr_ofs %d data_sz %d", + self->config.rx_headroom_offset, self->config.rx_payload_offset, self->config.rx_hdr_offset, self->config.seg_size); return UCS_OK; diff --git a/src/uct/ib/base/ib_iface.h b/src/uct/ib/base/ib_iface.h index a3a4f859a9c..7145d055c1a 100644 --- a/src/uct/ib/base/ib_iface.h +++ b/src/uct/ib/base/ib_iface.h @@ -49,9 +49,9 @@ typedef struct uct_ib_iface { /* TODO comp_channel */ struct { - unsigned rx_headroom; /* user-requested headroom */ unsigned rx_payload_offset; /* offset from desc to payload */ unsigned rx_hdr_offset; /* offset from desc to network header */ + unsigned rx_headroom_offset; /* offset from desc to user headroom */ unsigned seg_size; } config; @@ -100,6 +100,9 @@ typedef struct uct_ib_iface_config { * * (1) * + * + * | + * * am_callback * | * +------+----------+-----------+---------+ @@ -143,6 +146,8 @@ ucs_status_t uct_ib_iface_recv_mpool_create(uct_ib_iface_t *iface, uct_ib_iface_config_t *config, const char *name, ucs_mpool_h *mp_p); +void uct_ib_iface_release_desc(uct_iface_t *tl_iface, void *desc); + static inline uct_ib_device_t * uct_ib_iface_device(uct_ib_iface_t *iface) { return ucs_derived_of(iface->super.super.pd, uct_ib_device_t); @@ -174,4 +179,17 @@ int uct_ib_iface_prepare_rx_wrs(uct_ib_iface_t *iface, ucs_mpool_h rx_mp, uct_ib_recv_wr_t *wrs, unsigned n); +static inline void uct_ib_iface_desc_received(uct_ib_iface_t *iface, + uct_ib_iface_recv_desc_t *desc, + unsigned byte_len, int has_data) +{ + if (has_data) { + /* Memory has valid data */ + VALGRIND_MAKE_MEM_DEFINED((void*)desc + iface->config.rx_hdr_offset, byte_len); + } else { + /* Data is invalid, but memory is addressable */ + VALGRIND_MAKE_MEM_UNDEFINED((void*)desc + iface->config.rx_hdr_offset, byte_len); + } +} + #endif diff --git a/src/uct/ib/rc/rc_iface.h b/src/uct/ib/rc/rc_iface.h index 3f4bbfbb110..18a2b0855af 100644 --- a/src/uct/ib/rc/rc_iface.h +++ b/src/uct/ib/rc/rc_iface.h @@ -159,8 +159,9 @@ static UCS_F_ALWAYS_INLINE ucs_status_t uct_rc_iface_invoke_am(uct_rc_iface_t *iface, uct_rc_hdr_t *hdr, unsigned length, uct_ib_iface_recv_desc_t *desc) { - return uct_iface_invoke_am(&iface->super.super, hdr->am_id, hdr + 1, - length - sizeof(*hdr), desc); + return uct_iface_invoke_am(&iface->super.super, + hdr->am_id, hdr + 1, length - sizeof(*hdr), + (void*)desc + iface->super.config.rx_headroom_offset); } #endif diff --git a/src/uct/ib/rc/rc_mlx5_iface.c b/src/uct/ib/rc/rc_mlx5_iface.c index 4fc616f386f..a9dbf026962 100644 --- a/src/uct/ib/rc/rc_mlx5_iface.c +++ b/src/uct/ib/rc/rc_mlx5_iface.c @@ -156,6 +156,8 @@ static inline void uct_rc_mlx5_iface_poll_rx(uct_rc_mlx5_iface_t *iface) desc = ucs_queue_pull_elem_non_empty(&iface->rx.desc_q, uct_rc_mlx5_recv_desc_t, queue); byte_len = ntohl(cqe->byte_cnt); + uct_ib_iface_desc_received(&iface->super.super, &desc->super, byte_len, + !(cqe->op_own & (MLX5_INLINE_SCATTER_32|MLX5_INLINE_SCATTER_64))); /* Get a pointer to AM header (after which comes the payload) * Support cases of inline scatter by pointing directly to CQE. @@ -165,10 +167,9 @@ static inline void uct_rc_mlx5_iface_poll_rx(uct_rc_mlx5_iface_t *iface) UCS_STATS_UPDATE_COUNTER(iface->stats, UCT_RC_MLX5_IFACE_STAT_RX_INL_32, 1); } else if (cqe->op_own & MLX5_INLINE_SCATTER_64) { hdr = (uct_rc_hdr_t*)(cqe - 1); - UCS_STATS_UPDATE_COUNTER(iface->stats, UCT_RC_MLX5_IFACE_STAT_RX_INL_64, 1); + UCS_STATS_UPDATE_COUNTER(iface->stats, UCT_RC_MLX5_IFACE_STAT_RX_INL_64, 1) } else { hdr = uct_ib_iface_recv_desc_hdr(&iface->super.super, &desc->super); - VALGRIND_MAKE_MEM_DEFINED(hdr, byte_len); } uct_ib_mlx5_log_rx(IBV_QPT_RC, cqe, hdr, uct_rc_ep_am_packet_dump); @@ -188,6 +189,18 @@ static inline void uct_rc_mlx5_iface_poll_rx(uct_rc_mlx5_iface_t *iface) ++iface->super.rx.available; } +static void uct_rc_mlx5_iface_free_rx_descs(uct_rc_mlx5_iface_t *iface) +{ + uct_rc_mlx5_recv_desc_t *desc; + + while (!ucs_queue_is_empty(&iface->rx.desc_q)) { + desc = ucs_queue_pull_elem_non_empty(&iface->rx.desc_q, + uct_rc_mlx5_recv_desc_t, queue); + ucs_mpool_put(desc); + } + ucs_mpool_check_empty(iface->super.rx.mp); +} + static void uct_rc_mlx5_iface_progress(void *arg) { uct_rc_mlx5_iface_t *iface = arg; @@ -334,6 +347,7 @@ static UCS_CLASS_CLEANUP_FUNC(uct_rc_mlx5_iface_t) uct_context_h context = uct_ib_iface_device(&self->super.super)->super.context; ucs_notifier_chain_remove(&context->progress_chain, uct_rc_mlx5_iface_progress, self); + uct_rc_mlx5_iface_free_rx_descs(self); UCS_STATS_NODE_FREE(self->stats); ucs_mpool_destroy(self->tx.atomic_desc_mp); } @@ -345,9 +359,10 @@ static UCS_CLASS_DEFINE_NEW_FUNC(uct_rc_mlx5_iface_t, uct_iface_t, uct_context_h static UCS_CLASS_DEFINE_DELETE_FUNC(uct_rc_mlx5_iface_t, uct_iface_t); uct_iface_ops_t uct_rc_mlx5_iface_ops = { - .iface_close = UCS_CLASS_DELETE_FUNC_NAME(uct_rc_mlx5_iface_t), .iface_get_address = uct_rc_iface_get_address, .iface_flush = uct_rc_iface_flush, + .iface_close = UCS_CLASS_DELETE_FUNC_NAME(uct_rc_mlx5_iface_t), + .iface_release_desc = uct_ib_iface_release_desc, .ep_get_address = uct_rc_ep_get_address, .ep_connect_to_iface = NULL, .ep_connect_to_ep = uct_rc_ep_connect_to_ep, diff --git a/src/uct/ib/rc/rc_verbs_iface.c b/src/uct/ib/rc/rc_verbs_iface.c index 2a0419682d0..39e2a71d092 100644 --- a/src/uct/ib/rc/rc_verbs_iface.c +++ b/src/uct/ib/rc/rc_verbs_iface.c @@ -130,9 +130,9 @@ static inline ucs_status_t uct_rc_verbs_iface_poll_rx(uct_rc_verbs_iface_t *ifac UCS_STATS_UPDATE_COUNTER(iface->super.stats, UCT_RC_IFACE_STAT_RX_COMPLETION, 1); desc = (void*)wc[i].wr_id; - hdr = uct_ib_iface_recv_desc_hdr(&iface->super.super, desc); - VALGRIND_MAKE_MEM_DEFINED(hdr, wc[i].byte_len); + uct_ib_iface_desc_received(&iface->super.super, desc, wc[i].byte_len, 1); + hdr = uct_ib_iface_recv_desc_hdr(&iface->super.super, desc); uct_ib_log_recv_completion(IBV_QPT_RC, &wc[i], hdr, uct_rc_ep_am_packet_dump); status = uct_rc_iface_invoke_am(&iface->super, hdr, wc[i].byte_len, desc); @@ -329,13 +329,14 @@ static UCS_CLASS_DEFINE_DELETE_FUNC(uct_rc_verbs_iface_t, uct_iface_t); uct_iface_ops_t uct_rc_verbs_iface_ops = { - .iface_close = UCS_CLASS_DELETE_FUNC_NAME(uct_rc_verbs_iface_t), + .iface_query = uct_rc_verbs_iface_query, .iface_get_address = uct_rc_iface_get_address, .iface_flush = uct_rc_iface_flush, + .iface_close = UCS_CLASS_DELETE_FUNC_NAME(uct_rc_verbs_iface_t), + .iface_release_desc = uct_ib_iface_release_desc, .ep_get_address = uct_rc_ep_get_address, .ep_connect_to_iface = NULL, .ep_connect_to_ep = uct_rc_ep_connect_to_ep, - .iface_query = uct_rc_verbs_iface_query, .ep_am_short = uct_rc_verbs_ep_am_short, .ep_am_bcopy = uct_rc_verbs_ep_am_bcopy, .ep_am_zcopy = uct_rc_verbs_ep_am_zcopy, diff --git a/src/uct/tl/tl_base.h b/src/uct/tl/tl_base.h index 07f231abc25..eb795720c7c 100644 --- a/src/uct/tl/tl_base.h +++ b/src/uct/tl/tl_base.h @@ -82,7 +82,7 @@ struct uct_tl_ops { */ typedef struct uct_am_handler { uct_am_callback_t cb; - void *arg; + void *arg; } uct_am_handler_t; diff --git a/test/gtest/uct/test_amo.cc b/test/gtest/uct/test_amo.cc index 08a8d2db45f..5a64f10a662 100644 --- a/test/gtest/uct/test_amo.cc +++ b/test/gtest/uct/test_amo.cc @@ -19,12 +19,12 @@ void uct_amo_test::init() { srand48(rand()); - entity *receiver = new entity(GetParam()); + entity *receiver = new entity(GetParam(), 0); m_entities.push_back(receiver); for (unsigned i = 0; i < num_senders(); ++i) { receiver->add_ep(); - entity *sender = new entity(GetParam()); + entity *sender = new entity(GetParam(), 0); m_entities.push_back(sender); sender->add_ep(); sender->connect(0, *receiver, i); diff --git a/test/gtest/uct/test_p2p_am.cc b/test/gtest/uct/test_p2p_am.cc index 40d4f381ce8..50100e2dfeb 100644 --- a/test/gtest/uct/test_p2p_am.cc +++ b/test/gtest/uct/test_p2p_am.cc @@ -14,8 +14,18 @@ class uct_p2p_am_test : public uct_p2p_test { static const uint8_t AM_ID = 11; static const uint64_t SEED1 = 0xa1a1a1a1a1a1a1a1ul; static const uint64_t SEED2 = 0xa2a2a2a2a2a2a2a2ul; - - uct_p2p_am_test() : m_am_count(0) { + static const uint64_t MAGIC = 0xdeadbeef12345678ul; + + typedef struct { + uint64_t magic; + unsigned length; + /* data follows */ + } receive_desc_t; + + uct_p2p_am_test() : + uct_p2p_test(sizeof(receive_desc_t)), + m_keep_data(false), + m_am_count(0) { } virtual void init() { @@ -25,13 +35,33 @@ class uct_p2p_am_test : public uct_p2p_test { static ucs_status_t am_handler(void *arg, void *data, size_t length, void *desc) { uct_p2p_am_test *self = reinterpret_cast(arg); - self->am_handler(data, length); - return UCS_OK; /* TODO test keeping data */ + return self->am_handler(data, length, desc); } - void am_handler(void *data, size_t length) { - mapped_buffer::pattern_check(data, length, SEED1); + ucs_status_t am_handler(void *data, size_t length, void *desc) { ++m_am_count; + if (m_keep_data) { + receive_desc_t *my_desc = (receive_desc_t *)desc; + my_desc->magic = MAGIC; + my_desc->length = length; + if (data != my_desc + 1) { + memcpy(my_desc + 1, data, length); + } + m_backlog.push_back(my_desc); + return UCS_INPROGRESS; + } + mapped_buffer::pattern_check(data, length, SEED1); + return UCS_OK; + } + + void check_backlog() { + while (!m_backlog.empty()) { + receive_desc_t *my_desc = m_backlog.back(); + m_backlog.pop_back(); + EXPECT_EQ(uint64_t(MAGIC), my_desc->magic); + mapped_buffer::pattern_check(my_desc + 1, my_desc->length, SEED1); + uct_iface_release_desc(receiver().iface(), (void*)my_desc); + } } static void am_pack(void *dest, void *arg, size_t length) { @@ -84,10 +114,18 @@ class uct_p2p_am_test : public uct_p2p_test { status = uct_set_am_handler(receiver().iface(), AM_ID, NULL, NULL); ASSERT_UCS_OK(status); + + check_backlog(); + } + + void set_keep_data(bool keep) { + m_keep_data = keep; } private: - unsigned m_am_count; + bool m_keep_data; + unsigned m_am_count; + std::vector m_backlog; }; @@ -107,6 +145,16 @@ UCS_TEST_P(uct_p2p_am_test, am_bcopy) { DIRECTION_SEND_TO_RECV); } +UCS_TEST_P(uct_p2p_am_test, am_bcopy_keep_data) { + check_caps(UCT_IFACE_FLAG_AM_BCOPY); + set_keep_data(true); + test_xfer_multi(static_cast(&uct_p2p_am_test::am_bcopy), + 0ul, + sender().iface_attr().cap.am.max_bcopy, + DIRECTION_SEND_TO_RECV); +} + + UCS_TEST_P(uct_p2p_am_test, am_zcopy) { check_caps(UCT_IFACE_FLAG_AM_ZCOPY); test_xfer_multi(static_cast(&uct_p2p_am_test::am_zcopy), diff --git a/test/gtest/uct/test_p2p_err.cc b/test/gtest/uct/test_p2p_err.cc index c68e1446b99..edc7ec71f46 100644 --- a/test/gtest/uct/test_p2p_err.cc +++ b/test/gtest/uct/test_p2p_err.cc @@ -19,6 +19,9 @@ class uct_p2p_err_test : public uct_p2p_test { OP_AM_SHORT }; + uct_p2p_err_test() : uct_p2p_test(0) { + } + static void log_handler(const char *file, unsigned line, const char *function, unsigned level, const char *prefix, const char *message, va_list ap) diff --git a/test/gtest/uct/test_p2p_rma.cc b/test/gtest/uct/test_p2p_rma.cc index 5615b0c97e8..4aafa3f12a3 100644 --- a/test/gtest/uct/test_p2p_rma.cc +++ b/test/gtest/uct/test_p2p_rma.cc @@ -15,6 +15,9 @@ class uct_p2p_rma_test : public uct_p2p_test { static const uint64_t SEED2 = 0x2222222222222222lu; static const uint64_t SEED3 = 0x3333333333333333lu; + uct_p2p_rma_test() : uct_p2p_test(0) { + } + ucs_status_t put_short(uct_ep_h ep, const mapped_buffer &sendbuf, const mapped_buffer &recvbuf) { diff --git a/test/gtest/uct/test_pd.cc b/test/gtest/uct/test_pd.cc index 53099990482..ef519f91ac0 100644 --- a/test/gtest/uct/test_pd.cc +++ b/test/gtest/uct/test_pd.cc @@ -11,7 +11,7 @@ class test_pd : public uct_test { public: virtual void init() { uct_test::init(); - m_entities.push_back(new entity(GetParam())); + m_entities.push_back(new entity(GetParam(), 0)); } protected: diff --git a/test/gtest/uct/test_uct_perf.cc b/test/gtest/uct/test_uct_perf.cc index c135b6c8099..3017392c38e 100644 --- a/test/gtest/uct/test_uct_perf.cc +++ b/test/gtest/uct/test_uct_perf.cc @@ -381,7 +381,7 @@ test_uct_perf::test_spec test_uct_perf::tests[] = UCS_TEST_P(test_uct_perf, envelope) { uct_resource_desc_t resource = GetParam(); - entity tl(resource); + entity tl(resource, 0); bool check_perf; if (ucs::test_time_multiplier() > 1) { diff --git a/test/gtest/uct/uct_p2p_test.cc b/test/gtest/uct/uct_p2p_test.cc index bdda84c6b38..8c3664bcb38 100644 --- a/test/gtest/uct/uct_p2p_test.cc +++ b/test/gtest/uct/uct_p2p_test.cc @@ -14,12 +14,20 @@ extern "C" { int uct_p2p_test::log_data_count = 0; ucs_log_level_t uct_p2p_test::orig_log_level; + +uct_p2p_test::uct_p2p_test(size_t rx_headroom) : + m_rx_headroom(rx_headroom), + m_completion(NULL), + m_completion_count(0) +{ +} + void uct_p2p_test::init() { uct_test::init(); /* Create 2 connected endpoints */ - entity *e1 = new entity(GetParam()); - entity *e2 = new entity(GetParam()); + entity *e1 = new entity(GetParam(), m_rx_headroom); + entity *e2 = new entity(GetParam(), m_rx_headroom); e1->add_ep(); e2->add_ep(); e1->connect(0, *e2, 0); diff --git a/test/gtest/uct/uct_p2p_test.h b/test/gtest/uct/uct_p2p_test.h index 58ba761e8e4..8b879ec3080 100644 --- a/test/gtest/uct/uct_p2p_test.h +++ b/test/gtest/uct/uct_p2p_test.h @@ -15,6 +15,8 @@ */ class uct_p2p_test : public uct_test { public: + uct_p2p_test(size_t rx_headroom); + virtual void init(); virtual void cleanup(); @@ -48,6 +50,7 @@ class uct_p2p_test : public uct_test { uct_ep_h sender_ep() const; const entity& receiver() const; + const size_t m_rx_headroom; completion *m_completion; unsigned m_completion_count; diff --git a/test/gtest/uct/uct_test.cc b/test/gtest/uct/uct_test.cc index c701ecad376..2569bcccd44 100644 --- a/test/gtest/uct/uct_test.cc +++ b/test/gtest/uct/uct_test.cc @@ -75,7 +75,7 @@ void uct_test::progress() const { } } -uct_test::entity::entity(const uct_resource_desc_t& resource) { +uct_test::entity::entity(const uct_resource_desc_t& resource, size_t rx_headroom) { ucs_status_t status; status = uct_init(&m_ucth); @@ -86,8 +86,8 @@ uct_test::entity::entity(const uct_resource_desc_t& resource) { &iface_config); ASSERT_UCS_OK(status); - status = uct_iface_open(m_ucth, resource.tl_name, resource.dev_name, 0, - iface_config, &m_iface); + status = uct_iface_open(m_ucth, resource.tl_name, resource.dev_name, + rx_headroom, iface_config, &m_iface); ASSERT_UCS_OK(status); status = uct_iface_query(m_iface, &m_iface_attr); diff --git a/test/gtest/uct/uct_test.h b/test/gtest/uct/uct_test.h index 29944d6117f..73edca7c48e 100644 --- a/test/gtest/uct/uct_test.h +++ b/test/gtest/uct/uct_test.h @@ -30,7 +30,7 @@ class uct_test : public testing::TestWithParam, class entity { public: - entity(const uct_resource_desc_t& resource); + entity(const uct_resource_desc_t& resource, size_t rx_headroom); ~entity(); void mem_alloc(void **address_p, size_t *length_p, size_t alignement,