Skip to content

Commit bd5b8ed

Browse files
committed
usnic: ensure that queues are long enough
Double check the queue lengths that we get back from libfabric to ensure that they are at least as long as we need. They *should* never be shorter than we need, but let's just check to be sure. Signed-off-by: Jeff Squyres <[email protected]>
1 parent 53dc75a commit bd5b8ed

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

opal/mca/btl/usnic/btl_usnic_module.c

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* All rights reserved.
1313
* Copyright (c) 2006 Sandia National Laboratories. All rights
1414
* reserved.
15-
* Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved.
15+
* Copyright (c) 2009-2017 Cisco Systems, Inc. All rights reserved.
1616
* Copyright (c) 2014-2016 Los Alamos National Security, LLC. All rights
1717
* reserved.
1818
* Copyright (c) 2014 Intel, Inc. All rights reserved
@@ -1611,6 +1611,31 @@ static int create_ep(opal_btl_usnic_module_t* module,
16111611
return OPAL_ERR_OUT_OF_RESOURCE;
16121612
}
16131613

1614+
/* Check to ensure that the RX/TX queue lengths are at least as
1615+
long as we asked for */
1616+
if ((int) channel->info->rx_attr->size < channel->chan_rd_num) {
1617+
rc = FI_ETOOSMALL;
1618+
opal_show_help("help-mpi-btl-usnic.txt",
1619+
"internal error during init",
1620+
true,
1621+
opal_process_info.nodename,
1622+
module->linux_device_name,
1623+
"endpoint RX queue length is too short", __FILE__, __LINE__,
1624+
rc, fi_strerror(rc));
1625+
return OPAL_ERR_OUT_OF_RESOURCE;
1626+
}
1627+
if ((int) channel->info->tx_attr->size < channel->chan_sd_num) {
1628+
rc = FI_ETOOSMALL;
1629+
opal_show_help("help-mpi-btl-usnic.txt",
1630+
"internal error during init",
1631+
true,
1632+
opal_process_info.nodename,
1633+
module->linux_device_name,
1634+
"endpoint TX queue length is too short", __FILE__, __LINE__,
1635+
rc, fi_strerror(rc));
1636+
return OPAL_ERR_OUT_OF_RESOURCE;
1637+
}
1638+
16141639
/* attach CQ to EP */
16151640
rc = fi_ep_bind(channel->ep, &channel->cq->fid, FI_SEND);
16161641
if (0 != rc) {
@@ -1783,6 +1808,20 @@ static int init_one_channel(opal_btl_usnic_module_t *module,
17831808
goto error;
17841809
}
17851810

1811+
/* Ensure that we got a CQ that is at least as long as we asked
1812+
for */
1813+
if ((int) cq_attr.size < cq_num) {
1814+
rc = FI_ETOOSMALL;
1815+
opal_show_help("help-mpi-btl-usnic.txt",
1816+
"internal error during init",
1817+
true,
1818+
opal_process_info.nodename,
1819+
module->linux_device_name,
1820+
"created CQ is too small", __FILE__, __LINE__,
1821+
rc, fi_strerror(rc));
1822+
goto error;
1823+
}
1824+
17861825
/* Set up the endpoint for this channel */
17871826
rc = create_ep(module, channel);
17881827
if (OPAL_SUCCESS != rc) {

0 commit comments

Comments
 (0)