Skip to contentSkip to conversation

libibumad: added link_layer for RoCEE support and updated umad version

PATCH Yevgeny Kliteynik 2 participants 2 messages Mar 9, 2010 – Mar 23, 2010 1 message not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

Added link_layer field to umad_port_t.
The field is implemented as char[].
If the relevant file doesn't exist in sysfs, the link layer is "IB". Otherwise, the content of link_layer file is used.

The libibumad version is promoted.

---
 libibumad/include/infiniband/umad.h |    2 ++
 libibumad/libibumad.ver             |    2 +-
 libibumad/src/umad.c                |    5 +++++
 3 files changed, 8 insertions(+), 1 deletions(-)
libibumad/include/infiniband/umad.h +2 -0
index 1f82183..f9da204 100644
@@ -116,6 +116,7 @@ typedef struct ib_user_mad {
 #define SYS_PORT_RATE		"rate"
 #define SYS_PORT_GUID		"port_guid"
 #define SYS_PORT_GID		"gids/0"
+#define SYS_PORT_LINK_LAYER	"link_layer"
 
 typedef struct umad_port {
 	char ca_name[UMAD_CA_NAME_LEN];
@@ -132,6 +133,7 @@ typedef struct umad_port {
 	uint64_t port_guid;
 	unsigned pkeys_size;
 	uint16_t *pkeys;
+	char link_layer[UMAD_CA_NAME_LEN];
 } umad_port_t;
 
 typedef struct umad_ca {
libibumad/libibumad.ver +1 -1
index 57cddbd..225738c 100644
@@ -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=2:1:0
+LIBVERSION=2:2:0
libibumad/src/umad.c +5 -0
index 277ae6b..d16e750 100644
@@ -159,6 +159,11 @@ static int get_port(char *ca_name, char *dir, int portnum, umad_port_t * port)
 	if (sys_read_uint(port_dir, SYS_PORT_CAPMASK, &port->capmask) < 0)
 		goto clean;
 
+	if (sys_read_string(port_dir, SYS_PORT_LINK_LAYER,
+	    port->link_layer, UMAD_CA_NAME_LEN) < 0)
+		/* assume IB by default */
+		sprintf(port->link_layer, "IB");
+
 	port->capmask = htonl(port->capmask);
 
 	if (sys_read_gid(port_dir, SYS_PORT_GID, gid) < 0)
Signature · 6 lines
1.5.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 4B96256C.7000406-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org

#2 lore raw
Quoted 8 lines · Yevgeny Kliteynik

Added link_layer field to umad_port_t.
The field is implemented as char[].
If the relevant file doesn't exist in sysfs, the link layer is "IB". Otherwise, the content of link_layer file is used.

The libibumad version is promoted.

Applied but see below. Thanks.

Quoted 31 lines
---
 libibumad/include/infiniband/umad.h |    2 ++
 libibumad/libibumad.ver             |    2 +-
 libibumad/src/umad.c                |    5 +++++
 3 files changed, 8 insertions(+), 1 deletions(-)
libibumad/include/infiniband/umad.h +2 -0
index 1f82183..f9da204 100644
@@ -116,6 +116,7 @@ typedef struct ib_user_mad {
 #define SYS_PORT_RATE		"rate"
 #define SYS_PORT_GUID		"port_guid"
 #define SYS_PORT_GID		"gids/0"
+#define SYS_PORT_LINK_LAYER	"link_layer"
 
 typedef struct umad_port {
 	char ca_name[UMAD_CA_NAME_LEN];
@@ -132,6 +133,7 @@ typedef struct umad_port {
 	uint64_t port_guid;
 	unsigned pkeys_size;
 	uint16_t *pkeys;
+	char link_layer[UMAD_CA_NAME_LEN];
 } umad_port_t;
 
 typedef struct umad_ca {
libibumad/libibumad.ver +0 -0
index 57cddbd..225738c 100644

libibumad/libibumad.ver line 9

Quoted 5 lines
libibumad/libibumad.ver +1 -1
@@ -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=2:1:0
+LIBVERSION=2:2:0

This patch actually breaks ABI (mostly for umad_port_t users - see for example update_umad_port() in opensm/libvendor/osm_vendor_ibumad_sa.c). So it looks that API_REV should be advanced as well.

I will do this before next release.

Sasha

Quoted 24 lines
libibumad/src/umad.c +5 -0
index 277ae6b..d16e750 100644
@@ -159,6 +159,11 @@ static int get_port(char *ca_name, char *dir, int portnum, umad_port_t * port)
 	if (sys_read_uint(port_dir, SYS_PORT_CAPMASK, &port->capmask) < 0)
 		goto clean;
 
+	if (sys_read_string(port_dir, SYS_PORT_LINK_LAYER,
+	    port->link_layer, UMAD_CA_NAME_LEN) < 0)
+		/* assume IB by default */
+		sprintf(port->link_layer, "IB");
+
 	port->capmask = htonl(port->capmask);
 
 	if (sys_read_gid(port_dir, SYS_PORT_GID, gid) < 0)
Signature · 6 lines
1.5.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html