[ofa-general] ***SPAM*** [PATCH] opensm/libvendor: Add pkey table request handling in osm_get_all_port_attrs

Hal Rosenstock hnrose at comcast.net
Wed Feb 18 07:31:32 PST 2009


in all other (than osm_vendor_ibumad) OpenSM vendor layers
Done by code inspection; not even compile tested

Signed-off-by: Hal Rosenstock <hal.rosenstock at gmail.com>
---
 opensm/libvendor/osm_vendor_al.c            |    4 ++++
 opensm/libvendor/osm_vendor_mlx_hca.c       |    4 ++++
 opensm/libvendor/osm_vendor_mlx_hca_anafa.c |    5 ++++-
 opensm/libvendor/osm_vendor_mlx_hca_pfs.c   |    4 ++++
 opensm/libvendor/osm_vendor_mlx_hca_sim.c   |    4 ++++
 opensm/libvendor/osm_vendor_mlx_sa.c        |    7 +++++++
 opensm/libvendor/osm_vendor_mtl_hca_guid.c  |    9 +++++++++
 7 files changed, 36 insertions(+), 1 deletions(-)

diff --git a/opensm/libvendor/osm_vendor_al.c b/opensm/libvendor/osm_vendor_al.c
index d5d78c9..2bcbf9f 100644
--- a/opensm/libvendor/osm_vendor_al.c
+++ b/opensm/libvendor/osm_vendor_al.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -670,6 +671,9 @@ osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend,
 			num_ports = osm_ca_info_get_num_ports(p_ca_info);
 
 			for (port_num = 0; port_num < num_ports; port_num++) {
+				if (p_attr_array[port_count].num_pkeys &&
+				    p_attr_array[port_count].p_pkey_table)
+					status = IB_UNSUPPORTED;
 				p_attr_array[port_count] =
 				    *__osm_ca_info_get_port_attr_ptr(p_ca_info,
 								     port_num);
diff --git a/opensm/libvendor/osm_vendor_mlx_hca.c b/opensm/libvendor/osm_vendor_mlx_hca.c
index e98e272..554fd87 100644
--- a/opensm/libvendor/osm_vendor_mlx_hca.c
+++ b/opensm/libvendor/osm_vendor_mlx_hca.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -367,6 +368,9 @@ osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend,
 			num_ports = p_ca_infos[ca].p_attr->num_ports;
 
 			for (port_num = 0; port_num < num_ports; port_num++) {
+				if (p_attr_array[port_count].num_pkeys &&
+				    p_attr_array[port_count].p_pkey_table)
+					status = IB_UNSUPPORTED;
 				p_attr_array[port_count] =
 				    *__osm_ca_info_get_port_attr_ptr(&p_ca_infos
 								     [ca],
diff --git a/opensm/libvendor/osm_vendor_mlx_hca_anafa.c b/opensm/libvendor/osm_vendor_mlx_hca_anafa.c
index 81506e4..d1b11e5 100644
--- a/opensm/libvendor/osm_vendor_mlx_hca_anafa.c
+++ b/opensm/libvendor/osm_vendor_mlx_hca_anafa.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -182,8 +183,10 @@ osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend,
 
 	*p_num_ports = 1;
 
-	p_attr_array[0] = ca_info.attr.p_port_attr[0];	/* anafa has only one port */
 	status = IB_SUCCESS;
+	if (p_attr_array[0].num_pkeys && p_attr_array[0].p_pkey_table)
+		status = IB_UNSUPPORTED;
+	p_attr_array[0] = ca_info.attr.p_port_attr[0];	/* anafa has only one port */
 
 Exit:
 
diff --git a/opensm/libvendor/osm_vendor_mlx_hca_pfs.c b/opensm/libvendor/osm_vendor_mlx_hca_pfs.c
index 512b7bf..8c879a9 100644
--- a/opensm/libvendor/osm_vendor_mlx_hca_pfs.c
+++ b/opensm/libvendor/osm_vendor_mlx_hca_pfs.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -649,6 +650,9 @@ osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend,
 			num_ports = p_ca_infos[caIdx - 1].p_attr->num_ports;
 
 			for (port_num = 0; port_num < num_ports; port_num++) {
+				if (p_attr_array[port_count].num_pkeys &&
+				    p_attr_array[port_count].p_pkey_table)
+					status = IB_UNSUPPORTED;
 				p_attr_array[port_count] =
 				    *__osm_ca_info_get_port_attr_ptr(&p_ca_infos
 								     [caIdx -
diff --git a/opensm/libvendor/osm_vendor_mlx_hca_sim.c b/opensm/libvendor/osm_vendor_mlx_hca_sim.c
index b6c0193..d46b869 100644
--- a/opensm/libvendor/osm_vendor_mlx_hca_sim.c
+++ b/opensm/libvendor/osm_vendor_mlx_hca_sim.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -695,6 +696,9 @@ osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend,
 			num_ports = p_ca_infos[caIdx - 1].p_attr->num_ports;
 
 			for (port_num = 0; port_num < num_ports; port_num++) {
+				if (p_attr_array[port_count].num_pkeys &&
+				    p_attr_array[port_count].p_pkey_table)
+					status = IB_UNSUPPORTED;
 				p_attr_array[port_count] =
 				    *__osm_ca_info_get_port_attr_ptr(&p_ca_infos
 								     [caIdx -
diff --git a/opensm/libvendor/osm_vendor_mlx_sa.c b/opensm/libvendor/osm_vendor_mlx_sa.c
index 7bd5aea..a76c330 100644
--- a/opensm/libvendor/osm_vendor_mlx_sa.c
+++ b/opensm/libvendor/osm_vendor_mlx_sa.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -242,6 +243,7 @@ __osmv_get_lid_and_sm_lid_by_port_guid(IN osm_vendor_t * const p_vend,
 	ib_port_attr_t *p_attr_array;
 	uint32_t num_ports;
 	uint32_t port_num;
+	int i;
 
 	OSM_LOG_ENTER(p_vend->p_log);
 
@@ -278,6 +280,11 @@ __osmv_get_lid_and_sm_lid_by_port_guid(IN osm_vendor_t * const p_vend,
 	p_attr_array =
 	    (ib_port_attr_t *) malloc(sizeof(ib_port_attr_t) * num_ports);
 
+	for (i = 0; i < num_ports; i++) {
+		p_attr_array[i].num_pkeys = 0;
+		p_attr_array[i].p_pkey_table = NULL;
+	}
+
 	/* obtain the attributes */
 	status = osm_vendor_get_all_port_attr(p_vend, p_attr_array, &num_ports);
 	if (status != IB_SUCCESS) {
diff --git a/opensm/libvendor/osm_vendor_mtl_hca_guid.c b/opensm/libvendor/osm_vendor_mtl_hca_guid.c
index 58d961a..c48d9db 100644
--- a/opensm/libvendor/osm_vendor_mtl_hca_guid.c
+++ b/opensm/libvendor/osm_vendor_mtl_hca_guid.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -389,6 +390,9 @@ osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend,
 			num_ports = osm_ca_info_get_num_ports(p_ca_info);
 
 			for (port_num = 0; port_num < num_ports; port_num++) {
+				if (p_attr_array[port_count].num_pkeys &&
+				    p_attr_array[port_count].p_pkey_table)
+					status = IB_UNSUPPORTED;
 				p_attr_array[port_count] =
 				    *__osm_ca_info_get_port_attr_ptr(p_ca_info,
 								     port_num);
@@ -571,6 +575,11 @@ ib_net64_t get_port_guid()
 	p_vend = &vend;
 	p_vend->p_log = p_osm_log;
 
+	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.
-- 
1.5.6.4




More information about the general mailing list