[openib-general] [PATCH] OpenSM: Add SA client API for MultiPathRecord queries

Hal Rosenstock halr at voltaire.com
Tue May 9 10:08:57 PDT 2006


OpenSM: Add SA client API for MultiPathRecord queries

Signed-off-by: Hal Rosenstock <halr at voltaire.com>

Index: include/vendor/osm_vendor_sa_api.h
===================================================================
--- include/vendor/osm_vendor_sa_api.h	(revision 7007)
+++ include/vendor/osm_vendor_sa_api.h	(working copy)
@@ -116,6 +116,8 @@ typedef enum _osmv_query_type
 	OSMV_QUERY_UD_MULTICAST_SET,
 	OSMV_QUERY_UD_MULTICAST_DELETE,
 
+	OSMV_QUERY_MULTIPATH_REC,
+
 }	osmv_query_type_t;
 /*
 * VALUES
@@ -318,6 +320,37 @@ typedef struct _osmv_guid_pair
 *****/
 
 
+/****s* OpenSM Vendor SA Client/osmv_multipath_req_t
+* NAME
+*       osmv_guid_pair_t
+*
+* DESCRIPTION
+*       Fields from which to generate a MultiPathiRecord request.
+*
+* SYNOPSIS
+*/
+typedef struct _osmv_multipath_req_t
+{
+	ib_net64_t	comp_mask;
+	uint16_t	pkey;
+	boolean_t	reversible;
+	uint8_t		num_path;
+	uint8_t		sl;
+	uint8_t		independence;
+	uint8_t		sgid_count;
+	uint8_t		dgid_count;
+	ib_gid_t	gids[IB_MULTIPATH_MAX_GIDS];
+} osmv_multipath_req_t;
+/*
+* FIELDS
+*
+* NOTES
+*       This structure is used to describe a multipath request.
+*
+* SEE ALSO
+*****/
+
+
 /****s* OpenSM Vendor SA Client/osmv_query_res_t
 * NAME
 *	osmv_query_res_t
Index: libvendor/osm_vendor_ibumad_sa.c
===================================================================
--- libvendor/osm_vendor_ibumad_sa.c	(revision 7007)
+++ libvendor/osm_vendor_ibumad_sa.c	(working copy)
@@ -545,6 +545,10 @@ __osmv_send_sa_req(
   p_sa_mad->sm_key = p_query_req->sm_key;
   p_sa_mad->attr_offset = 0;
   p_sa_mad->comp_mask = p_sa_mad_data->comp_mask;
+#ifdef DUAL_SIDED_RMPP 
+  if( p_sa_mad->method == IB_MAD_METHOD_GETMULTI )
+    p_sa_mad->rmpp_flags = IB_RMPP_FLAG_ACTIVE;
+#endif
   if( p_sa_mad->comp_mask )
   {
     cl_memcpy( p_sa_mad->data, p_sa_mad_data->p_attr,
@@ -616,6 +620,11 @@ osmv_query_sa(
   ib_node_record_t node_rec;
   ib_portinfo_record_t port_info;
   ib_path_rec_t path_rec;
+#ifdef DUAL_SIDED_RMPP
+  ib_multipath_rec_t multipath_rec;
+  osmv_multipath_req_t *p_mpr_req;
+  int i, j;
+#endif
   ib_class_port_info_t class_port_info;
   osm_log_t *p_log = p_bind->p_log;
   ib_api_status_t status;
@@ -823,6 +832,47 @@ osmv_query_sa(
     sa_mad_data.p_attr = p_user_query->p_attr;
     break;
 
+#ifdef DUAL_SIDED_RMPP
+  case OSMV_QUERY_MULTIPATH_REC:
+    osm_log( p_log, OSM_LOG_DEBUG,
+             "osmv_query_sa DBG:001 %s","MULTIPATH_REC\n" );
+    /* Validate sgid/dgid counts against SA client limit */
+    p_mpr_req = ( osmv_multipath_req_t * ) p_query_req->p_query_input;
+    if ( p_mpr_req->sgid_count + p_mpr_req->dgid_count > IB_MULTIPATH_MAX_GIDS )
+    {
+      osm_log( p_log, OSM_LOG_ERROR,
+               "osmv_query_sa DBG:001 MULTIPATH_REC ",
+               "SGID count %d DGID count %d max count %d\n",
+                p_mpr_req->sgid_count, p_mpr_req->dgid_count,
+                IB_MULTIPATH_MAX_GIDS );
+      CL_ASSERT( 0 );
+      return IB_ERROR;
+    }
+    cl_memclr(&multipath_rec, sizeof(ib_multipath_rec_t ));
+    sa_mad_data.method = IB_MAD_METHOD_GETMULTI;
+    sa_mad_data.attr_id = IB_MAD_ATTR_MULTIPATH_RECORD;
+    sa_mad_data.attr_offset =
+      ib_get_attr_offset( sizeof( ib_multipath_rec_t ) );
+    sa_mad_data.p_attr = &multipath_rec;
+    sa_mad_data.comp_mask = p_mpr_req->comp_mask;
+    multipath_rec.num_path = p_mpr_req->num_path;
+    if ( p_mpr_req->reversible )
+        multipath_rec.num_path |= 0x80;
+    else
+        multipath_rec.num_path &= ~0x80;
+    multipath_rec.pkey = p_mpr_req->pkey;
+    multipath_rec.sl = p_mpr_req->sl;
+    multipath_rec.independence = p_mpr_req->independence;
+    multipath_rec.sgid_count = p_mpr_req->sgid_count;
+    multipath_rec.dgid_count = p_mpr_req->dgid_count;
+    j = 0;
+    for (i = 0; i < p_mpr_req->sgid_count; i++, j++)
+      multipath_rec.gids[j] = p_mpr_req->gids[j];
+    for (i = 0; i < p_mpr_req->dgid_count; i++, j++)
+      multipath_rec.gids[j] = p_mpr_req->gids[j];
+    break;
+#endif
+
   default:
     osm_log( p_log, OSM_LOG_ERROR,
              "osmv_query_sa DBG:001 %s", "UNKNOWN\n" );






More information about the general mailing list