[openib-general] [PATCH] OpenSM - add guid to opensm opts - branch patch
Yael Kalka
yael at mellanox.co.il
Wed Mar 22 03:52:12 PST 2006
Hi Hal,
Attached is the patch for adding guid to opensm opts for the 1.0 branch.
Thanks,
Yael
Signed-off-by: Yael Kalka <yael at mellanox.co.il>
Index: include/opensm/osm_subnet.h
===================================================================
--- include/opensm/osm_subnet.h (revision 5955)
+++ include/opensm/osm_subnet.h (working copy)
@@ -190,6 +190,7 @@ typedef enum _osm_testability_modes
*/
typedef struct _osm_subn_opt
{
+ ib_net64_t guid;
ib_net64_t m_key;
ib_net64_t sm_key;
ib_net64_t subnet_prefix;
@@ -240,6 +241,9 @@ typedef struct _osm_subn_opt
/*
* FIELDS
*
+* guid
+* The port guid that the SM is binding to.
+*
* m_key
* M_Key value sent to all ports qualifing all Set(PortInfo).
*
Index: opensm/osm_subnet.c
===================================================================
--- opensm/osm_subnet.c (revision 5955)
+++ opensm/osm_subnet.c (working copy)
@@ -393,6 +393,7 @@ osm_subn_set_default_opt(
IN osm_subn_opt_t* const p_opt )
{
cl_memclr(p_opt, sizeof(osm_subn_opt_t));
+ p_opt->guid = 0;
p_opt->m_key = OSM_DEFAULT_M_KEY;
p_opt->sm_key = OSM_DEFAULT_SM_KEY;
p_opt->subnet_prefix = IB_DEFAULT_SUBNET_PREFIX;
@@ -632,6 +633,9 @@ osm_subn_parse_conf_file(
p_val = strtok_r(NULL, " \t\n", &p_last);
__osm_subn_opts_unpack_net64(
+ "guid", p_key, p_val, &p_opts->guid);
+
+ __osm_subn_opts_unpack_net64(
"m_key", p_key, p_val, &p_opts->m_key);
__osm_subn_opts_unpack_net64(
@@ -798,6 +802,8 @@ osm_subn_write_conf_file(
fprintf(
opts_file,
"#\n# DEVICE ATTRIBUTES OPTIONS\n#\n"
+ "# The port GUID on which the OpenSM is running.\n"
+ "guid 0x%016" PRIx64 "\n\n"
"# M_Key value sent to all ports qualifing all Set(PortInfo).\n"
"m_key 0x%016" PRIx64 "\n\n"
"# The lease period used for the M_Key on this subnet in [msec]\n"
@@ -829,6 +835,7 @@ osm_subn_write_conf_file(
"local_phy_errors_threshold 0x%02x\n\n"
"# Threshold of credits over-run errors for sending Trap 129\n"
"overrun_errors_threshold 0x%02x\n\n",
+ cl_ntoh64(p_opts->guid),
cl_ntoh64(p_opts->m_key),
cl_ntoh16(p_opts->m_key_lease_period),
cl_ntoh64(p_opts->sm_key),
Index: opensm/main.c
===================================================================
--- opensm/main.c (revision 5955)
+++ opensm/main.c (working copy)
@@ -500,7 +500,6 @@ main(
char* argv[] )
{
osm_subn_opt_t opt;
- ib_net64_t guid = 0;
ib_net64_t sm_key = 0;
ib_api_status_t status;
uint32_t log_flags = OSM_LOG_DEFAULT_LEVEL;
@@ -613,14 +612,14 @@ main(
/*
Specifies port guid with which to bind.
*/
- guid = cl_hton64( strtoull( optarg, NULL, 16 ));
- if (!guid)
+ opt.guid = cl_hton64( strtoull( optarg, NULL, 16 ));
+ if (!opt.guid)
{
/* If guid is 0 - need to display the guid list */
- guid = INVALID_GUID;
+ opt.guid = INVALID_GUID;
}
else
- printf(" Guid <0x%"PRIx64">\n", cl_hton64( guid ));
+ printf(" Guid <0x%"PRIx64">\n", cl_hton64( opt.guid ));
break;
case 's':
@@ -806,9 +805,6 @@ main(
if (vendor_debug)
osm_vendor_set_debug( osm.p_vendor, vendor_debug );
- if ( cache_options == TRUE )
- osm_subn_write_conf_file( &opt );
-
block_signals();
status = osm_opensm_init( &osm, &opt );
@@ -831,17 +827,20 @@ main(
If the user didn't specify a GUID on the command line,
then get a port GUID value with which to bind.
*/
- if( guid == 0 || cl_hton64(guid) == CL_HTON64(INVALID_GUID))
- guid = get_port_guid( &osm, guid );
+ if( opt.guid == 0 || cl_hton64(opt.guid) == CL_HTON64(INVALID_GUID))
+ opt.guid = get_port_guid( &osm, opt.guid );
- if ( guid == 0 )
+ if ( opt.guid == 0 )
{
printf( "Error: Could not get port guid\n" );
status = IB_ERROR;
goto Exit;
}
- status = osm_opensm_bind( &osm, guid );
+ if ( cache_options == TRUE )
+ osm_subn_write_conf_file( &opt );
+
+ status = osm_opensm_bind( &osm, opt.guid );
if( status != IB_SUCCESS )
{
printf( "\nError from osm_opensm_bind (0x%X)\n", status );
More information about the general
mailing list