1
1

Fixing openib partition support.

This commit was SVN r19705.
Этот коммит содержится в:
Pavel Shamis 2008-10-08 09:56:43 +00:00
родитель ceb3e04d0d
Коммит eefb66a133
5 изменённых файлов: 36 добавлений и 22 удалений

Просмотреть файл

@ -54,6 +54,7 @@ BEGIN_C_DECLS
#define MCA_BTL_IB_LEAVE_PINNED 1 #define MCA_BTL_IB_LEAVE_PINNED 1
#define IB_DEFAULT_GID_PREFIX 0xfe80000000000000ll #define IB_DEFAULT_GID_PREFIX 0xfe80000000000000ll
#define MCA_BTL_IB_PKEY_MASK 0x7fff
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/

Просмотреть файл

@ -1726,9 +1726,13 @@ static int init_one_device(opal_list_t *btl_list, struct ibv_device* ib_dev)
&ib_port_attr); &ib_port_attr);
} else { } else {
uint16_t pkey,j; uint16_t pkey,j;
for (j=0; j < device->ib_dev_attr.max_pkeys; j++) { for (j = 0; j < device->ib_dev_attr.max_pkeys; j++) {
ibv_query_pkey(device->ib_dev_context, i, j, &pkey); if(ibv_query_pkey(device->ib_dev_context, i, j, &pkey)){
pkey=ntohs(pkey); BTL_ERROR(("error getting pkey for index %d, device %s "
"port number %d errno says %s",
j, ibv_get_device_name(device->ib_dev), i, strerror(errno)));
}
pkey = ntohs(pkey) & MCA_BTL_IB_PKEY_MASK;
if(pkey == mca_btl_openib_component.ib_pkey_val){ if(pkey == mca_btl_openib_component.ib_pkey_val){
ret = init_one_port(btl_list, device, i, j, &ib_port_attr); ret = init_one_port(btl_list, device, i, j, &ib_port_attr);
break; break;

Просмотреть файл

@ -10,6 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2006-2008 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2006-2008 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2008 Mellanox Technologies. All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -91,8 +92,6 @@ static int parse_line(parsed_section_values_t *item);
static void reset_section(bool had_previous_value, parsed_section_values_t *s); static void reset_section(bool had_previous_value, parsed_section_values_t *s);
static void reset_values(ompi_btl_openib_ini_values_t *v); static void reset_values(ompi_btl_openib_ini_values_t *v);
static int save_section(parsed_section_values_t *s); static int save_section(parsed_section_values_t *s);
static int intify(char *string);
static int intify_list(char *str, uint32_t **values, int *len);
static inline void show_help(const char *topic); static inline void show_help(const char *topic);
@ -365,14 +364,14 @@ static int parse_line(parsed_section_values_t *sv)
all whitespace at the beginning and ending of the value. */ all whitespace at the beginning and ending of the value. */
if (0 == strcasecmp(key_buffer, "vendor_id")) { if (0 == strcasecmp(key_buffer, "vendor_id")) {
if (OMPI_SUCCESS != (ret = intify_list(value, &sv->vendor_ids, if (OMPI_SUCCESS != (ret = ompi_btl_openib_ini_intify_list(value, &sv->vendor_ids,
&sv->vendor_ids_len))) { &sv->vendor_ids_len))) {
return ret; return ret;
} }
} }
else if (0 == strcasecmp(key_buffer, "vendor_part_id")) { else if (0 == strcasecmp(key_buffer, "vendor_part_id")) {
if (OMPI_SUCCESS != (ret = intify_list(value, &sv->vendor_part_ids, if (OMPI_SUCCESS != (ret = ompi_btl_openib_ini_intify_list(value, &sv->vendor_part_ids,
&sv->vendor_part_ids_len))) { &sv->vendor_part_ids_len))) {
return ret; return ret;
} }
@ -380,13 +379,13 @@ static int parse_line(parsed_section_values_t *sv)
else if (0 == strcasecmp(key_buffer, "mtu")) { else if (0 == strcasecmp(key_buffer, "mtu")) {
/* Single value */ /* Single value */
sv->values.mtu = (uint32_t) intify(value); sv->values.mtu = (uint32_t) ompi_btl_openib_ini_intify(value);
sv->values.mtu_set = true; sv->values.mtu_set = true;
} }
else if (0 == strcasecmp(key_buffer, "use_eager_rdma")) { else if (0 == strcasecmp(key_buffer, "use_eager_rdma")) {
/* Single value */ /* Single value */
sv->values.use_eager_rdma = (uint32_t) intify(value); sv->values.use_eager_rdma = (uint32_t) ompi_btl_openib_ini_intify(value);
sv->values.use_eager_rdma_set = true; sv->values.use_eager_rdma_set = true;
} }
@ -398,7 +397,7 @@ static int parse_line(parsed_section_values_t *sv)
else if (0 == strcasecmp(key_buffer, "max_inline_data")) { else if (0 == strcasecmp(key_buffer, "max_inline_data")) {
/* Single value */ /* Single value */
sv->values.max_inline_data = (uint32_t) intify(value); sv->values.max_inline_data = (uint32_t) ompi_btl_openib_ini_intify(value);
sv->values.max_inline_data_set = true; sv->values.max_inline_data_set = true;
} }
@ -582,7 +581,7 @@ static int save_section(parsed_section_values_t *s)
/* /*
* Do string-to-integer conversion, for both hex and decimal numbers * Do string-to-integer conversion, for both hex and decimal numbers
*/ */
static int intify(char *str) int ompi_btl_openib_ini_intify(char *str)
{ {
while (isspace(*str)) { while (isspace(*str)) {
++str; ++str;
@ -603,7 +602,7 @@ static int intify(char *str)
/* /*
* Take a comma-delimited list and infity them all * Take a comma-delimited list and infity them all
*/ */
static int intify_list(char *value, uint32_t **values, int *len) int ompi_btl_openib_ini_intify_list(char *value, uint32_t **values, int *len)
{ {
char *comma; char *comma;
char *str = value; char *str = value;
@ -619,7 +618,7 @@ static int intify_list(char *value, uint32_t **values, int *len)
if (NULL == *values) { if (NULL == *values) {
return OMPI_ERR_OUT_OF_RESOURCE; return OMPI_ERR_OUT_OF_RESOURCE;
} }
*values[0] = (uint32_t) intify(str); *values[0] = (uint32_t) ompi_btl_openib_ini_intify(str);
*len = 1; *len = 1;
} else { } else {
int newsize = 1; int newsize = 1;
@ -641,7 +640,7 @@ static int intify_list(char *value, uint32_t **values, int *len)
comma = strchr(str, ','); comma = strchr(str, ',');
do { do {
*comma = '\0'; *comma = '\0';
(*values)[*len] = (uint32_t) intify(str); (*values)[*len] = (uint32_t) ompi_btl_openib_ini_intify(str);
++(*len); ++(*len);
str = comma + 1; str = comma + 1;
comma = strchr(str, ','); comma = strchr(str, ',');
@ -649,7 +648,7 @@ static int intify_list(char *value, uint32_t **values, int *len)
/* Get the last value (i.e., the value after the last /* Get the last value (i.e., the value after the last
comma, because it won't have been snarfed in the comma, because it won't have been snarfed in the
loop) */ loop) */
(*values)[*len] = (uint32_t) intify(str); (*values)[*len] = (uint32_t) ompi_btl_openib_ini_intify(str);
++(*len); ++(*len);
} }

Просмотреть файл

@ -1,5 +1,6 @@
/* /*
* Copyright (c) 2006-2008 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2006-2008 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2008 Mellanox Technologies. All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -52,6 +53,12 @@ BEGIN_C_DECLS
*/ */
int ompi_btl_openib_ini_finalize(void); int ompi_btl_openib_ini_finalize(void);
/**
* string to int convertors with dec/hex autodetection
*/
int ompi_btl_openib_ini_intify(char *string);
int ompi_btl_openib_ini_intify_list(char *str, uint32_t **values, int *len);
END_C_DECLS END_C_DECLS
#endif #endif

Просмотреть файл

@ -31,6 +31,7 @@
#include "opal/mca/base/mca_base_param.h" #include "opal/mca/base/mca_base_param.h"
#include "btl_openib.h" #include "btl_openib.h"
#include "btl_openib_mca.h" #include "btl_openib_mca.h"
#include "btl_openib_ini.h"
#include "connect/base.h" #include "connect/base.h"
#ifdef HAVE_IBV_FORK_INIT #ifdef HAVE_IBV_FORK_INIT
@ -132,7 +133,7 @@ int btl_openib_register_mca_params(void)
char default_qps[100]; char default_qps[100];
uint32_t mid_qp_size; uint32_t mid_qp_size;
int i; int i;
char *msg, *str; char *msg, *str, *pkey;
int ival, ival2, ret, tmp; int ival, ival2, ret, tmp;
ret = OMPI_SUCCESS; ret = OMPI_SUCCESS;
@ -280,16 +281,18 @@ int btl_openib_register_mca_params(void)
0, &ival, REGINT_GE_ZERO)); 0, &ival, REGINT_GE_ZERO));
mca_btl_openib_component.ib_pkey_ix = (uint32_t) ival; mca_btl_openib_component.ib_pkey_ix = (uint32_t) ival;
CHECK(reg_int("of_pkey_val", "ib_pkey_val", "OpenFabrics pkey value" CHECK(reg_string("of_pkey_val", "ib_pkey_val", "OpenFabrics pkey value"
"(must be > 0 and < 0xffff)", "(must be > 0 and < 0xffff)",
0, &ival, REGINT_GE_ZERO)); "0", &pkey, 0));
if (ival > 0xffff) { mca_btl_openib_component.ib_pkey_val = ompi_btl_openib_ini_intify(pkey) & MCA_BTL_IB_PKEY_MASK;
if (mca_btl_openib_component.ib_pkey_val > 0x7fff ||
mca_btl_openib_component.ib_pkey_val < 0) {
orte_show_help("help-mpi-btl-openib.txt", "invalid mca param value", orte_show_help("help-mpi-btl-openib.txt", "invalid mca param value",
true, "invalid value for btl_openib_ib_pkey_val", true, "invalid value for btl_openib_ib_pkey_val",
"btl_openib_ib_pkey_val ignored"); "btl_openib_ib_pkey_val ignored");
} else { mca_btl_openib_component.ib_pkey_val = 0;
mca_btl_openib_component.ib_pkey_val = (uint32_t) ival;
} }
free(pkey);
CHECK(reg_int("of_psn", "ib_psn", CHECK(reg_int("of_psn", "ib_psn",
"OpenFabrics packet sequence starting number " "OpenFabrics packet sequence starting number "