[ofa-general] [PATCH] ibutils/ibis: Prepare for pkeys support in osm_get_all_port_attr

Hal Rosenstock hnrose at comcast.net
Thu Mar 5 18:16:46 PST 2009


In order not to break tree, this initialization needs to preceed
the change to the management tree where osm_get_all_port_attr
(at least the umad vendor version) will support pkeys.

Signed-off-by: Hal Rosenstock <hal.rosenstock at gmail.com>

---
diff --git a/ibis/src/ibis.c b/ibis/src/ibis.c
index b5662c6..7797719 100644
--- a/ibis/src/ibis.c
+++ b/ibis/src/ibis.c
@@ -196,11 +196,16 @@ ibis_get_ports_status(
 {
   uint32_t i;
   ib_api_status_t status;
-  ib_port_attr_t attr_array[GUID_ARRAY_SIZE];
+  ib_port_attr_t attr_array[MAX_LOCAL_IBPORTS];
 
   OSM_LOG_ENTER(&(IbisObj.log));
 
-  *num_ports = GUID_ARRAY_SIZE;
+  for (i = 0; i < MAX_LOCAL_IBPORTS; i++)
+  {
+    attr_array[i].num_pkeys = 0;
+    attr_array[i].p_pkey_table = NULL;
+  }
+  *num_ports = MAX_LOCAL_IBPORTS;
   status = osm_vendor_get_all_port_attr(
     IbisObj.p_vendor,
     attr_array,
diff --git a/ibis/src/ibis.i b/ibis/src/ibis.i
index 1bc3f34..a153921 100644
--- a/ibis/src/ibis.i
+++ b/ibis/src/ibis.i
@@ -381,8 +381,8 @@ ibisp_is_debug(void)
 	 ibis_t *p_ibis = &IbisObj;
 	 uint32_t i;
 	 ib_api_status_t status;
-	 uint32_t num_ports = GUID_ARRAY_SIZE;
-	 ib_port_attr_t attr_array[GUID_ARRAY_SIZE];
+	 uint32_t num_ports = MAX_LOCAL_IBPORTS;
+	 ib_port_attr_t attr_array[MAX_LOCAL_IBPORTS];
 	 static char res[128];
 	 Tcl_Obj *p_obj;
 
@@ -402,6 +402,11 @@ ibisp_is_debug(void)
         return TCL_ERROR;
     }
 
+    for (i = 0; i < num_ports; i++)
+    {
+      attr_array[i].num_pkeys = 0;
+      attr_array[i].p_pkey_table = NULL;
+    }
 	 /*
 		Call the transport layer for a list of local port
 		GUID values.
diff --git a/ibis/src/ibis_base.h b/ibis/src/ibis_base.h
index 654ed17..ad26148 100644
--- a/ibis/src/ibis_base.h
+++ b/ibis/src/ibis_base.h
@@ -65,7 +65,7 @@ BEGIN_C_DECLS
 #define IBIS_FILE_PATH_MAX	PATH_MAX
 #endif
 
-#define GUID_ARRAY_SIZE 32
+#define MAX_LOCAL_IBPORTS 32
 #define DISP_HANDLE_MAX 32
 
 END_C_DECLS
diff --git a/ibis/src/ibis_wrap.c b/ibis/src/ibis_wrap.c
index f4d5b64..b3fc659 100644
--- a/ibis/src/ibis_wrap.c
+++ b/ibis/src/ibis_wrap.c
@@ -3134,8 +3134,8 @@ typedef struct {
 	 ibis_t *p_ibis = &IbisObj;
 	 uint32_t i;
 	 ib_api_status_t status;
-	 uint32_t num_ports = GUID_ARRAY_SIZE;
-	 ib_port_attr_t attr_array[GUID_ARRAY_SIZE];
+	 uint32_t num_ports = MAX_LOCAL_IBPORTS;
+	 ib_port_attr_t attr_array[MAX_LOCAL_IBPORTS];
 	 static char res[128];
 	 Tcl_Obj *p_obj;
 
@@ -3155,6 +3155,11 @@ typedef struct {
         return TCL_ERROR;
     }
 
+    for (i = 0; i < MAX_LOCAL_IBPORTS; i++)
+    {
+      attr_array[i].num_pkeys = 0;
+      attr_array[i].p_pkey_table = NULL;
+    }
 	 /*
 		Call the transport layer for a list of local port
 		GUID values.
diff --git a/ibis/src/ibissh_wrap.cpp b/ibis/src/ibissh_wrap.cpp
index e1b43b7..2e498c7 100644
--- a/ibis/src/ibissh_wrap.cpp
+++ b/ibis/src/ibissh_wrap.cpp
@@ -3134,8 +3134,8 @@ typedef struct {
 	 ibis_t *p_ibis = &IbisObj;
 	 uint32_t i;
 	 ib_api_status_t status;
-	 uint32_t num_ports = GUID_ARRAY_SIZE;
-	 ib_port_attr_t attr_array[GUID_ARRAY_SIZE];
+	 uint32_t num_ports = MAX_LOCAL_IBPORTS;
+	 ib_port_attr_t attr_array[MAX_LOCAL_IBPORTS];
 	 static char res[128];
 	 Tcl_Obj *p_obj;
 
@@ -3155,6 +3155,11 @@ typedef struct {
         return TCL_ERROR;
     }
 
+    for (i = 0; i < num_ports; i++)
+    {
+      attr_array[i].num_pkeys = 0;
+      attr_array[i].p_pkey_table = NULL;
+    }
 	 /*
 		Call the transport layer for a list of local port
 		GUID values.



More information about the general mailing list