[ofa-general] [PATCH] libibumad: umad_get_issm_path() addition

Sasha Khapyorsky sashak at voltaire.com
Thu Oct 18 07:02:15 PDT 2007


Recently return value of umad_open_port() was changed from number of umad
device to fd (in order to support multiple opens and for other goodies).
However OpenSM vendor (osm_vendor_ibumad) used this previous undocumented
umad_open_port() return value semantic for resolving number of
/dev/../issm* device (which is needed for PortInfo capmask IsSM bit
setup). So currently it is broken.

This patch introduces new umad_get_issm_path() function for explicit
issm device path resolving which should be used by OpenSM vendor.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 libibumad/include/infiniband/umad.h |    2 ++
 libibumad/libibumad.ver             |    2 +-
 libibumad/src/libibumad.map         |    1 +
 libibumad/src/umad.c                |   18 ++++++++++++++++++
 4 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/libibumad/include/infiniband/umad.h b/libibumad/include/infiniband/umad.h
index 779ac73..2ec8b37 100644
--- a/libibumad/include/infiniband/umad.h
+++ b/libibumad/include/infiniband/umad.h
@@ -155,6 +155,8 @@ int	umad_release_ca(umad_ca_t *ca);
 int	umad_get_port(char *ca_name, int portnum, umad_port_t *port);
 int	umad_release_port(umad_port_t *port);
 
+int	umad_get_issm_path(char *ca_name, int portnum, char path[], int max);
+
 int	umad_open_port(char *ca_name, int portnum);
 int	umad_close_port(int portid);
 
diff --git a/libibumad/libibumad.ver b/libibumad/libibumad.ver
index f2ffbe2..a46b2c5 100644
--- a/libibumad/libibumad.ver
+++ b/libibumad/libibumad.ver
@@ -6,4 +6,4 @@
 # API_REV - advance on any added API
 # RUNNING_REV - advance any change to the vendor files
 # AGE - number of backward versions the API still supports
-LIBVERSION=1:0:0
+LIBVERSION=1:1:0
diff --git a/libibumad/src/libibumad.map b/libibumad/src/libibumad.map
index 211438e..9444aa9 100644
--- a/libibumad/src/libibumad.map
+++ b/libibumad/src/libibumad.map
@@ -11,6 +11,7 @@ IBUMAD_1.0 {
 		umad_release_port;
 		umad_close_port;
 		umad_get_mad;
+		umad_get_issm_path;
 		umad_size;
 		umad_set_grh;
 		umad_set_pkey;
diff --git a/libibumad/src/umad.c b/libibumad/src/umad.c
index 5baa5b8..41373e7 100644
--- a/libibumad/src/umad.c
+++ b/libibumad/src/umad.c
@@ -513,6 +513,24 @@ umad_get_ca_portguids(char *ca_name, uint64_t *portguids, int max)
 }
 
 int
+umad_get_issm_path(char *ca_name, int portnum, char path[], int max)
+{
+	int umad_id;
+
+	TRACE("ca %s port %d", ca_name, portnum);
+
+	if (!(ca_name = resolve_ca_name(ca_name, &portnum)))
+		return -ENODEV;
+
+	if ((umad_id = dev_to_umad_id(ca_name, portnum)) < 0)
+		return -EINVAL;
+
+	snprintf(path, max - 1, "%s/issm%u", UMAD_DEV_DIR , umad_id);
+
+	return 0;
+}
+
+int
 umad_open_port(char *ca_name, int portnum)
 {
 	char dev_file[UMAD_DEV_FILE_SZ];
-- 
1.5.3.4.206.g58ba4




More information about the general mailing list