From d13c14ec823594760232d57209b8fd8619b08b87 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 15 Jan 2015 11:38:58 -0800 Subject: [PATCH] CSCus22527: fix off-by-one error in checking the number of VFs Ensure to count *this* process when checking for how many VFs we need on the local server. (cherry picked from commit 386c01934e98cb8dcb48ff648ecdfb0c8677baa9) --- opal/mca/btl/usnic/btl_usnic_component.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/opal/mca/btl/usnic/btl_usnic_component.c b/opal/mca/btl/usnic/btl_usnic_component.c index 5ef8be47d0..6003377eb9 100644 --- a/opal/mca/btl/usnic/btl_usnic_component.c +++ b/opal/mca/btl/usnic/btl_usnic_component.c @@ -319,13 +319,17 @@ static int check_usnic_config(opal_btl_usnic_module_t *module, int num_local_procs) { char str[128]; - unsigned unlp = (unsigned) num_local_procs; + unsigned unlp; struct fi_usnic_info *uip; struct fi_info *info; info = module->fabric_info; uip = &module->usnic_info; + /* Note: we add one to num_local_procs to account for *this* + process */ + unlp = (unsigned) num_local_procs + 1; + /* usNIC allocates QPs as a combination of PCI virtual functions (VFs) and resources inside those VFs. Ensure that: @@ -348,7 +352,7 @@ static int check_usnic_config(opal_btl_usnic_module_t *module, if (uip->ui_num_vf < unlp) { snprintf(str, sizeof(str), "Not enough usNICs (found %d, need %d)", - uip->ui_num_vf, num_local_procs); + uip->ui_num_vf, unlp); goto error; } @@ -356,7 +360,7 @@ static int check_usnic_config(opal_btl_usnic_module_t *module, unlp * USNIC_NUM_CHANNELS) { snprintf(str, sizeof(str), "Not enough WQ/RQ (found %d, need %d)", uip->ui_num_vf * uip->ui_qp_per_vf, - num_local_procs * USNIC_NUM_CHANNELS); + unlp * USNIC_NUM_CHANNELS); goto error; } if (uip->ui_num_vf * uip->ui_cq_per_vf < @@ -364,7 +368,7 @@ static int check_usnic_config(opal_btl_usnic_module_t *module, snprintf(str, sizeof(str), "Not enough CQ per usNIC (found %d, need %d)", uip->ui_num_vf * uip->ui_cq_per_vf, - num_local_procs * USNIC_NUM_CHANNELS); + unlp * USNIC_NUM_CHANNELS); goto error; }