Skip to content

Commit

Permalink
TEST/FC: Fix grant mpool leak when FC is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
yosefe committed Feb 16, 2018
1 parent cf17d05 commit 647c01a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions test/gtest/uct/ib/test_rc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,24 @@ void test_rc_flow_control::init()
}
test_rc::init();

ucs_assert(rc_iface(m_e1)->config.fc_enabled);
ucs_assert(rc_iface(m_e2)->config.fc_enabled);

uct_iface_set_am_handler(m_e1->iface(), FLUSH_AM_ID, am_handler,
NULL, UCT_CB_FLAG_SYNC);
uct_iface_set_am_handler(m_e2->iface(), FLUSH_AM_ID, am_handler,
NULL, UCT_CB_FLAG_SYNC);

}

void test_rc_flow_control::cleanup()
{
/* Restore FC state to enabled, so iface cleanup will destroy the grant mpool */
rc_iface(m_e1)->config.fc_enabled = 1;
rc_iface(m_e2)->config.fc_enabled = 1;
test_rc::cleanup();
}

void test_rc_flow_control::send_am_and_flush(entity *e, int num_msg)
{
m_am_rx_count = 0;
Expand Down
3 changes: 2 additions & 1 deletion test/gtest/uct/ib/test_rc.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class test_rc_flow_control : public test_rc {
} pending_send_request_t;

void init();
void cleanup();

virtual uct_rc_fc_t* get_fc_ptr(entity *e, int ep_idx = 0) {
return &rc_ep(e, ep_idx)->fc;
Expand Down Expand Up @@ -87,7 +88,7 @@ class test_rc_flow_control : public test_rc {

void set_fc_disabled(entity *e) {
/* same as default settings in rc_iface_init */
set_fc_attributes(m_e1, false, std::numeric_limits<int16_t>::max(), 0, 0);
set_fc_attributes(e, false, std::numeric_limits<int16_t>::max(), 0, 0);
}

void send_am_and_flush(entity *e, int num_msg);
Expand Down

0 comments on commit 647c01a

Please sign in to comment.