474564a6b1
addition to my design and testing, it was conceptually approved by Gil, Gleb, Pasha, Brad, and Galen. Functionally [probably somewhat lightly] tested by Galen. We may still have to shake out some bugs during the next few months, but it seems to be working for all the cases that I can throw at it. Here's a summary of the changes from that branch: * Move MCA parameter registration to a new file (btl_openib_mca.c): * Properly check the retun status of registering MCA params * Check for valid values of MCA parameters * Make help strings better * Otherwise, the only default value of an MCA param that was changed was max_btls; it went from 4 to -1 (meaning: use all available) * Properly prototyped internal functions in _component.c * Made a bunch of functions static that didn't need to be public * Renamed to remove "mca_" prefix from static functions * Call new MCA param registration function * Call new INI file read/lookup/finalize functions * Updated a bunch of macros to be "BTL_" instead of "ORTE_" * Be a little more consistent with return values * Handle -1 for the max_btls MCA param * Fixed a free() that should have been an OBJ_RELEASE() * Some re-indenting * Added INI-file parsing * New flex file: btl_openib_ini.l * New default HCA params .ini file (probably to be expanded over time by other HCA vendors) * Added more show_help messages for parsing problems * Read in INI files and cache the values for later lookup * When component opens an HCA, lookup to see if any corresponding values were found in the INI files (ID'ed by the HCA vendor_id and vendor_part_id) * Added btl_openib_verbose MCA param that shows what the INI-file stuff does (e.g., shows which MTU your HCA ends up using) * Added btl_openib_hca_param_files as a colon-delimited list of INI files to check for values during startup (in order, left-to-right, just like the MCA base directory param). * MTU is currently the only value supported in this framework. * It is not a fatal error if we don't find params for the HCA in the INI file(s). Instead, just print a warning. New MCA param btl_openib_warn_no_hca_params_found can be used to disable printing the warning. * Add MTU to peer negotiation when making a connection * Exchange maximum MTU; select the lesser of the two This commit was SVN r11182.
143 строки
4.2 KiB
C
143 строки
4.2 KiB
C
%{ /* -*- C -*- */
|
|
/*
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
* University Research and Technology
|
|
* Corporation. All rights reserved.
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
* of Tennessee Research Foundation. All rights
|
|
* reserved.
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
* University of Stuttgart. All rights reserved.
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
* All rights reserved.
|
|
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
|
|
* $COPYRIGHT$
|
|
*
|
|
* Additional copyrights may follow
|
|
*
|
|
* $HEADER$
|
|
*/
|
|
|
|
#include "opal_config.h"
|
|
|
|
#include <stdio.h>
|
|
#if HAVE_UNISTD_H
|
|
#include <unistd.h>
|
|
#endif
|
|
|
|
#include "btl_openib_lex.h"
|
|
|
|
/*
|
|
* local functions
|
|
*/
|
|
static int finish_parsing(void) ;
|
|
static int btl_openib_ini_yywrap(void);
|
|
|
|
/*
|
|
* global variables
|
|
*/
|
|
int btl_openib_ini_yynewlines = 1;
|
|
bool btl_openib_ini_parse_done = false;
|
|
char *btl_openib_ini_string = NULL;
|
|
|
|
#define yyterminate() \
|
|
return finish_parsing()
|
|
|
|
%}
|
|
|
|
WHITE [\f\t\v ]
|
|
CHAR [A-Za-z0-9_\-\.]
|
|
NAME_CHAR [A-Za-z0-9_\-\.\\\/]
|
|
|
|
%x comment
|
|
%x section_name
|
|
%x section_end
|
|
%x value
|
|
|
|
%%
|
|
|
|
{WHITE}*\n { ++btl_openib_ini_yynewlines;
|
|
return BTL_OPENIB_INI_PARSE_NEWLINE; }
|
|
#.*\n { ++btl_openib_ini_yynewlines;
|
|
return BTL_OPENIB_INI_PARSE_NEWLINE; }
|
|
"//".*\n { ++btl_openib_ini_yynewlines;
|
|
return BTL_OPENIB_INI_PARSE_NEWLINE; }
|
|
|
|
"/*" { BEGIN(comment);
|
|
return BTL_OPENIB_INI_PARSE_NEWLINE; }
|
|
<comment>[^*\n]* ; /* Eat up non '*'s */
|
|
<comment>"*"+[^*/\n]* ; /* Eat '*'s not followed by a '/' */
|
|
<comment>\n { ++btl_openib_ini_yynewlines;
|
|
return BTL_OPENIB_INI_PARSE_NEWLINE; }
|
|
<comment>"*"+"/" { BEGIN(INITIAL); /* Done with block comment */
|
|
return BTL_OPENIB_INI_PARSE_NEWLINE; }
|
|
|
|
{WHITE}*\[{WHITE}* { BEGIN(section_name); }
|
|
<section_name>({NAME_CHAR}|{WHITE})*{NAME_CHAR}/{WHITE}*\] {
|
|
BEGIN(section_end);
|
|
return BTL_OPENIB_INI_PARSE_SECTION; }
|
|
<section_name>\n { ++btl_openib_ini_yynewlines;
|
|
return BTL_OPENIB_INI_PARSE_ERROR; }
|
|
<section_name>. { return BTL_OPENIB_INI_PARSE_ERROR; }
|
|
<section_end>{WHITE}*\]{WHITE}*\n { BEGIN(INITIAL);
|
|
++btl_openib_ini_yynewlines;
|
|
return BTL_OPENIB_INI_PARSE_NEWLINE; }
|
|
|
|
{WHITE}*"="{WHITE}* { BEGIN(value);
|
|
return BTL_OPENIB_INI_PARSE_EQUAL; }
|
|
{WHITE}+ ; /* whitespace */
|
|
{CHAR}+ { return BTL_OPENIB_INI_PARSE_SINGLE_WORD; }
|
|
|
|
<value>{WHITE}*\n { BEGIN(INITIAL);
|
|
++btl_openib_ini_yynewlines;
|
|
return BTL_OPENIB_INI_PARSE_NEWLINE; }
|
|
<value>[^\n]*[^\t \n]/[\t ]* {
|
|
return BTL_OPENIB_INI_PARSE_VALUE; }
|
|
|
|
. { return BTL_OPENIB_INI_PARSE_ERROR; }
|
|
|
|
%%
|
|
|
|
|
|
/*
|
|
* This cleans up at the end of the parse (since, in this case, we
|
|
* always parse the entire file) and prevents a memory leak.
|
|
*/
|
|
static int finish_parsing(void)
|
|
{
|
|
if (NULL != YY_CURRENT_BUFFER) {
|
|
yy_delete_buffer(YY_CURRENT_BUFFER);
|
|
#if defined(YY_CURRENT_BUFFER_LVALUE)
|
|
YY_CURRENT_BUFFER_LVALUE = NULL;
|
|
#else
|
|
YY_CURRENT_BUFFER = NULL;
|
|
#endif /* YY_CURRENT_BUFFER_LVALUE */
|
|
}
|
|
return YY_NULL;
|
|
}
|
|
|
|
|
|
static int btl_openib_ini_yywrap(void)
|
|
{
|
|
btl_openib_ini_parse_done = true;
|
|
return 1;
|
|
}
|
|
|
|
|
|
/*
|
|
* Ensure that we have a valid yybuffer to use. Specifically, if this
|
|
* scanner is invoked a second time, finish_parsing() (above) will
|
|
* have been executed, and the current buffer will have been freed.
|
|
* Flex doesn't recognize this fact because as far as it's concerned,
|
|
* its internal state was already initialized, so it thinks it should
|
|
* have a valid buffer. Hence, here we ensure to give it a valid
|
|
* buffer.
|
|
*/
|
|
int btl_openib_ini_init_buffer(FILE *file)
|
|
{
|
|
YY_BUFFER_STATE buf = yy_create_buffer(file, YY_BUF_SIZE);
|
|
yy_switch_to_buffer(buf);
|
|
|
|
return 0;
|
|
}
|