Skip to contentSkip to conversation

libibmad: Add NodeRecord query API

PATCH Superseded Hal Rosenstock 2 participants 5 messages Jan 31, 2013 – Feb 14, 2013 4 messages not in the archive InfiniBand

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libibmad: Add NodeRecord query API

Add ib_node_query_via routine similar to ib_path_query_via

---

include/infiniband/mad.h +4 -0
index 0694dc4..02b2353 100644
@@ -65,6 +65,7 @@ BEGIN_C_DECLS
 #define IB_PC_DATA_SZ		(IB_MAD_SIZE - IB_PC_DATA_OFFS)
 #define IB_SA_MCM_RECSZ		53
 #define IB_SA_PR_RECSZ		64
+#define IB_SA_NR_RECSZ		108
 #define IB_SA_GIR_RECSZ		72
 #define IB_BM_DATA_OFFS		64
 #define IB_BM_DATA_SZ		(IB_MAD_SIZE - IB_BM_DATA_OFFS)
@@ -1519,6 +1542,9 @@ MAD_EXPORT int ib_path_query_via(const struct ibmad_port *srcport,
 				 ibmad_gid_t srcgid, ibmad_gid_t destgid,
 				 ib_portid_t * sm_id, void *buf);
 	/* returns lid */
+MAD_EXPORT int ib_node_query_via(const struct ibmad_port *srcport,
+				 uint64_t guid, ib_portid_t * sm_id,
+				 void *buf);
 
 /* resolve.c */
 MAD_EXPORT int ib_resolve_smlid(ib_portid_t * sm_id, int timeout) DEPRECATED;
src/libibmad.map +1 -0
index a4d4418..3f92885 100644
@@ -148,5 +148,6 @@ IBMAD_1.3 {
 		cc_config_status_via;
 		smp_mkey_get;
 		smp_mkey_set;
+		ib_node_query_via;
 	local: *;
 };
src/sa.c +44 -0

47 lines not on this page · raw message

--
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): 510A129E.4000600-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org

#2 lore raw

Due to the fact there is no corresponding patch to the diags I assume this is something you want to support other uses of libibmad?

As this changes the API could you update libibmad.ver as well.

Ira

Quoted 93 lines · On Thu, 31 Jan 2013 01:43:42 -0500 Hal Rosenstock…

Add ib_node_query_via routine similar to ib_path_query_via

---

include/infiniband/mad.h +4 -0
index 0694dc4..02b2353 100644
@@ -65,6 +65,7 @@ BEGIN_C_DECLS
 #define IB_PC_DATA_SZ		(IB_MAD_SIZE - IB_PC_DATA_OFFS)
 #define IB_SA_MCM_RECSZ		53
 #define IB_SA_PR_RECSZ		64
+#define IB_SA_NR_RECSZ		108
 #define IB_SA_GIR_RECSZ		72
 #define IB_BM_DATA_OFFS		64
 #define IB_BM_DATA_SZ		(IB_MAD_SIZE - IB_BM_DATA_OFFS)
@@ -1519,6 +1542,9 @@ MAD_EXPORT int ib_path_query_via(const struct ibmad_port *srcport,
 				 ibmad_gid_t srcgid, ibmad_gid_t destgid,
 				 ib_portid_t * sm_id, void *buf);
 	/* returns lid */
+MAD_EXPORT int ib_node_query_via(const struct ibmad_port *srcport,
+				 uint64_t guid, ib_portid_t * sm_id,
+				 void *buf);
 
 /* resolve.c */
 MAD_EXPORT int ib_resolve_smlid(ib_portid_t * sm_id, int timeout) DEPRECATED;
src/libibmad.map +1 -0
index a4d4418..3f92885 100644
@@ -148,5 +148,6 @@ IBMAD_1.3 {
 		cc_config_status_via;
 		smp_mkey_get;
 		smp_mkey_set;
+		ib_node_query_via;
 	local: *;
 };
src/sa.c +44 -1
index a9a93cc..352ed9f 100644
@@ -145,3 +145,47 @@ int ib_path_query(ibmad_gid_t srcgid, ibmad_gid_t destgid, ib_portid_t * sm_id,
 {
 	return ib_path_query_via(ibmp, srcgid, destgid, sm_id, buf);
 }
+
+/* NodeRecord */
+#define IB_NR_COMPMASK_LID				(1ull<<0)
+#define IB_NR_COMPMASK_RESERVED1			(1ull<<1)
+#define IB_NR_COMPMASK_BASEVERSION			(1ull<<2)
+#define IB_NR_COMPMASK_CLASSVERSION			(1ull<<3)
+#define IB_NR_COMPMASK_NODETYPE				(1ull<<4)
+#define IB_NR_COMPMASK_NUMPORTS				(1ull<<5)
+#define IB_NR_COMPMASK_SYSIMAGEGUID			(1ull<<6)
+#define IB_NR_COMPMASK_NODEGUID				(1ull<<7)
+#define IB_NR_COMPMASK_PORTGUID				(1ull<<8)
+#define IB_NR_COMPMASK_PARTCAP				(1ull<<9)
+#define IB_NR_COMPMASK_DEVID				(1ull<<10)
+#define IB_NR_COMPMASK_REV				(1ull<<11)
+#define IB_NR_COMPMASK_PORTNUM				(1ull<<12)
+#define IB_NR_COMPMASK_VENDID				(1ull<<13)
+#define IB_NR_COMPMASK_NODEDESC				(1ull<<14)
+
+#define IB_NR_DEF_MASK IB_NR_COMPMASK_PORTGUID
+
+int ib_node_query_via(const struct ibmad_port *srcport, uint64_t guid,
+		      ib_portid_t * sm_id, void *buf)
+{
+	ib_sa_call_t sa = { 0 };
+	uint8_t *p;
+
+	memset(&sa, 0, sizeof sa);
+	sa.method = IB_MAD_METHOD_GET;
+	sa.attrid = IB_SA_ATTR_NODERECORD;
+	sa.mask = IB_NR_DEF_MASK;
+	sa.trid = mad_trid();
+
+	memset(buf, 0, IB_SA_NR_RECSZ);
+
+	mad_encode_field(buf, IB_SA_NR_PORT_GUID_F, &guid);
+
+	p = sa_rpc_call(srcport, buf, sm_id, &sa, 0);
+	if (!p) {
+		IBWARN("sa call node_query failed");
+		return -1;
+	}
+
+	return 0;
+}
--

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

Signature · 9 lines
Ira Weiny
Member of Technical Staff
Lawrence Livermore National Lab
925-423-8008
[email protected]
--
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): 20130213142147.653df0ca629e3d450f9907a9-i2BcT+NCU+M@public.gmane.org

#4 lore raw
Quoted 1 line · Ira Weiny

Due to the fact there is no corresponding patch to the diags I assume this is something you want to support other uses of libibmad?

It's in out of tree apps.

Quoted 1 line

As this changes the API could you update libibmad.ver as well.

I thought that this is done once right before the new release is cut. Otherwise, there is the possibility of too many version updates.

-- Hal

Quoted 90 lines

Ira

Quoted 85 lines · On Thu, 31 Jan 2013 01:43:42 -0500 Hal Rosenstock…

Add ib_node_query_via routine similar to ib_path_query_via

---

include/infiniband/mad.h +4 -0
index 0694dc4..02b2353 100644
@@ -65,6 +65,7 @@ BEGIN_C_DECLS
 #define IB_PC_DATA_SZ		(IB_MAD_SIZE - IB_PC_DATA_OFFS)
 #define IB_SA_MCM_RECSZ		53
 #define IB_SA_PR_RECSZ		64
+#define IB_SA_NR_RECSZ		108
 #define IB_SA_GIR_RECSZ		72
 #define IB_BM_DATA_OFFS		64
 #define IB_BM_DATA_SZ		(IB_MAD_SIZE - IB_BM_DATA_OFFS)
@@ -1519,6 +1542,9 @@ MAD_EXPORT int ib_path_query_via(const struct ibmad_port *srcport,
 				 ibmad_gid_t srcgid, ibmad_gid_t destgid,
 				 ib_portid_t * sm_id, void *buf);
 	/* returns lid */
+MAD_EXPORT int ib_node_query_via(const struct ibmad_port *srcport,
+				 uint64_t guid, ib_portid_t * sm_id,
+				 void *buf);
 
 /* resolve.c */
 MAD_EXPORT int ib_resolve_smlid(ib_portid_t * sm_id, int timeout) DEPRECATED;
src/libibmad.map +1 -0
index a4d4418..3f92885 100644
@@ -148,5 +148,6 @@ IBMAD_1.3 {
 		cc_config_status_via;
 		smp_mkey_get;
 		smp_mkey_set;
+		ib_node_query_via;
 	local: *;
 };
src/sa.c +40 -0
index a9a93cc..352ed9f 100644
@@ -145,3 +145,47 @@ int ib_path_query(ibmad_gid_t srcgid, ibmad_gid_t destgid, ib_portid_t * sm_id,
 {
 	return ib_path_query_via(ibmp, srcgid, destgid, sm_id, buf);
 }
+
+/* NodeRecord */
+#define IB_NR_COMPMASK_LID				(1ull<<0)
+#define IB_NR_COMPMASK_RESERVED1			(1ull<<1)
+#define IB_NR_COMPMASK_BASEVERSION			(1ull<<2)
+#define IB_NR_COMPMASK_CLASSVERSION			(1ull<<3)
+#define IB_NR_COMPMASK_NODETYPE				(1ull<<4)
+#define IB_NR_COMPMASK_NUMPORTS				(1ull<<5)
+#define IB_NR_COMPMASK_SYSIMAGEGUID			(1ull<<6)
+#define IB_NR_COMPMASK_NODEGUID				(1ull<<7)
+#define IB_NR_COMPMASK_PORTGUID				(1ull<<8)
+#define IB_NR_COMPMASK_PARTCAP				(1ull<<9)
+#define IB_NR_COMPMASK_DEVID				(1ull<<10)
+#define IB_NR_COMPMASK_REV				(1ull<<11)
+#define IB_NR_COMPMASK_PORTNUM				(1ull<<12)
+#define IB_NR_COMPMASK_VENDID				(1ull<<13)
+#define IB_NR_COMPMASK_NODEDESC				(1ull<<14)
+
+#define IB_NR_DEF_MASK IB_NR_COMPMASK_PORTGUID
+
+int ib_node_query_via(const struct ibmad_port *srcport, uint64_t guid,
+		      ib_portid_t * sm_id, void *buf)
+{
+	ib_sa_call_t sa = { 0 };
+	uint8_t *p;
+
+	memset(&sa, 0, sizeof sa);
+	sa.method = IB_MAD_METHOD_GET;
+	sa.attrid = IB_SA_ATTR_NODERECORD;
+	sa.mask = IB_NR_DEF_MASK;
+	sa.trid = mad_trid();
+
+	memset(buf, 0, IB_SA_NR_RECSZ);
+
+	mad_encode_field(buf, IB_SA_NR_PORT_GUID_F, &guid);
+
+	p = sa_rpc_call(srcport, buf, sm_id, &sa, 0);
+	if (!p) {
+		IBWARN("sa call node_query failed");
+		return -1;
Quoted 10 lines
Quoted 8 lines
src/sa.c +4 -1
+	}
+
+	return 0;
+}
--

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

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

#6 lore raw
Quoted 9 lines · On Wed, 13 Feb 2013 18:16:18 -0500 Hal Rosenstock…
Quoted 1 line · Ira Weiny

Due to the fact there is no corresponding patch to the diags I assume this is something you want to support other uses of libibmad?

It's in out of tree apps.

Quoted 1 line

As this changes the API could you update libibmad.ver as well.

I thought that this is done once right before the new release is cut. Otherwise, there is the possibility of too many version updates.

I would rather do it on the first change then all builds with this lib are versioned correctly. Also, if you do it just before release you have to review all the patches to see if/how they affect the api.

Ira

Quoted 108 lines

-- Hal

Quoted 90 lines

Ira

Quoted 85 lines · On Thu, 31 Jan 2013 01:43:42 -0500 Hal Rosenstock…

Add ib_node_query_via routine similar to ib_path_query_via

---

include/infiniband/mad.h +4 -0
index 0694dc4..02b2353 100644
@@ -65,6 +65,7 @@ BEGIN_C_DECLS
 #define IB_PC_DATA_SZ		(IB_MAD_SIZE - IB_PC_DATA_OFFS)
 #define IB_SA_MCM_RECSZ		53
 #define IB_SA_PR_RECSZ		64
+#define IB_SA_NR_RECSZ		108
 #define IB_SA_GIR_RECSZ		72
 #define IB_BM_DATA_OFFS		64
 #define IB_BM_DATA_SZ		(IB_MAD_SIZE - IB_BM_DATA_OFFS)
@@ -1519,6 +1542,9 @@ MAD_EXPORT int ib_path_query_via(const struct ibmad_port *srcport,
 				 ibmad_gid_t srcgid, ibmad_gid_t destgid,
 				 ib_portid_t * sm_id, void *buf);
 	/* returns lid */
+MAD_EXPORT int ib_node_query_via(const struct ibmad_port *srcport,
+				 uint64_t guid, ib_portid_t * sm_id,
+				 void *buf);
 
 /* resolve.c */
 MAD_EXPORT int ib_resolve_smlid(ib_portid_t * sm_id, int timeout) DEPRECATED;
src/libibmad.map +1 -0
index a4d4418..3f92885 100644
@@ -148,5 +148,6 @@ IBMAD_1.3 {
 		cc_config_status_via;
 		smp_mkey_get;
 		smp_mkey_set;
+		ib_node_query_via;
 	local: *;
 };
src/sa.c +40 -0
index a9a93cc..352ed9f 100644
@@ -145,3 +145,47 @@ int ib_path_query(ibmad_gid_t srcgid, ibmad_gid_t destgid, ib_portid_t * sm_id,
 {
 	return ib_path_query_via(ibmp, srcgid, destgid, sm_id, buf);
 }
+
+/* NodeRecord */
+#define IB_NR_COMPMASK_LID				(1ull<<0)
+#define IB_NR_COMPMASK_RESERVED1			(1ull<<1)
+#define IB_NR_COMPMASK_BASEVERSION			(1ull<<2)
+#define IB_NR_COMPMASK_CLASSVERSION			(1ull<<3)
+#define IB_NR_COMPMASK_NODETYPE				(1ull<<4)
+#define IB_NR_COMPMASK_NUMPORTS				(1ull<<5)
+#define IB_NR_COMPMASK_SYSIMAGEGUID			(1ull<<6)
+#define IB_NR_COMPMASK_NODEGUID				(1ull<<7)
+#define IB_NR_COMPMASK_PORTGUID				(1ull<<8)
+#define IB_NR_COMPMASK_PARTCAP				(1ull<<9)
+#define IB_NR_COMPMASK_DEVID				(1ull<<10)
+#define IB_NR_COMPMASK_REV				(1ull<<11)
+#define IB_NR_COMPMASK_PORTNUM				(1ull<<12)
+#define IB_NR_COMPMASK_VENDID				(1ull<<13)
+#define IB_NR_COMPMASK_NODEDESC				(1ull<<14)
+
+#define IB_NR_DEF_MASK IB_NR_COMPMASK_PORTGUID
+
+int ib_node_query_via(const struct ibmad_port *srcport, uint64_t guid,
+		      ib_portid_t * sm_id, void *buf)
+{
+	ib_sa_call_t sa = { 0 };
+	uint8_t *p;
+
+	memset(&sa, 0, sizeof sa);
+	sa.method = IB_MAD_METHOD_GET;
+	sa.attrid = IB_SA_ATTR_NODERECORD;
+	sa.mask = IB_NR_DEF_MASK;
+	sa.trid = mad_trid();
+
+	memset(buf, 0, IB_SA_NR_RECSZ);
+
+	mad_encode_field(buf, IB_SA_NR_PORT_GUID_F, &guid);
+
+	p = sa_rpc_call(srcport, buf, sm_id, &sa, 0);
+	if (!p) {
+		IBWARN("sa call node_query failed");
+		return -1;
Quoted 10 lines
Quoted 8 lines
src/sa.c +4 -1
+	}
+
+	return 0;
+}
--

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

Signature · 9 lines
Ira Weiny
Member of Technical Staff
Lawrence Livermore National Lab
925-423-8008
[email protected]
--
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): 20130213152117.a7e9828bcf6069b1604d2f36-i2BcT+NCU+M@public.gmane.org

#8 lore raw
Quoted 6 lines · Ira Weiny
Quoted 3 lines · On Wed, 13 Feb 2013 18:16:18 -0500 Hal Rosenstock…
Quoted 1 line · Ira Weiny

Due to the fact there is no corresponding patch to the diags I assume this is something you want to support other uses of libibmad?

Quoted 8 lines
Quoted 6 lines

It's in out of tree apps.

Quoted 1 line

As this changes the API could you update libibmad.ver as well.

I thought that this is done once right before the new release is cut. Otherwise, there is the possibility of too many version updates.

I would rather do it on the first change then all builds with this lib are versioned correctly. Also, if you do it just before release you have to review all the patches to see if/how they affect the api.

I'll do this if that's what you want but:

http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html

states:

Here are a set of rules to help you update your library version information:

Update the version information only immediately before a public release of your software. More frequent updates are unnecessary, and only guarantee that the current interface number gets larger faster.

-- Hal

Quoted 112 lines

Ira

Quoted 108 lines

-- Hal

Quoted 90 lines

Ira

Quoted 85 lines · On Thu, 31 Jan 2013 01:43:42 -0500 Hal Rosenstock…

Add ib_node_query_via routine similar to ib_path_query_via

---

include/infiniband/mad.h +4 -0
index 0694dc4..02b2353 100644
@@ -65,6 +65,7 @@ BEGIN_C_DECLS
 #define IB_PC_DATA_SZ		(IB_MAD_SIZE - IB_PC_DATA_OFFS)
 #define IB_SA_MCM_RECSZ		53
 #define IB_SA_PR_RECSZ		64
+#define IB_SA_NR_RECSZ		108
 #define IB_SA_GIR_RECSZ		72
 #define IB_BM_DATA_OFFS		64
 #define IB_BM_DATA_SZ		(IB_MAD_SIZE - IB_BM_DATA_OFFS)
@@ -1519,6 +1542,9 @@ MAD_EXPORT int ib_path_query_via(const struct ibmad_port *srcport,
 				 ibmad_gid_t srcgid, ibmad_gid_t destgid,
 				 ib_portid_t * sm_id, void *buf);
 	/* returns lid */
+MAD_EXPORT int ib_node_query_via(const struct ibmad_port *srcport,
+				 uint64_t guid, ib_portid_t * sm_id,
+				 void *buf);
 
 /* resolve.c */
 MAD_EXPORT int ib_resolve_smlid(ib_portid_t * sm_id, int timeout) DEPRECATED;
src/libibmad.map +1 -0
index a4d4418..3f92885 100644
@@ -148,5 +148,6 @@ IBMAD_1.3 {
 		cc_config_status_via;
 		smp_mkey_get;
 		smp_mkey_set;
+		ib_node_query_via;
 	local: *;
 };
src/sa.c +40 -0
index a9a93cc..352ed9f 100644
@@ -145,3 +145,47 @@ int ib_path_query(ibmad_gid_t srcgid, ibmad_gid_t destgid, ib_portid_t * sm_id,
 {
 	return ib_path_query_via(ibmp, srcgid, destgid, sm_id, buf);
 }
+
+/* NodeRecord */
+#define IB_NR_COMPMASK_LID				(1ull<<0)
+#define IB_NR_COMPMASK_RESERVED1			(1ull<<1)
+#define IB_NR_COMPMASK_BASEVERSION			(1ull<<2)
+#define IB_NR_COMPMASK_CLASSVERSION			(1ull<<3)
+#define IB_NR_COMPMASK_NODETYPE				(1ull<<4)
+#define IB_NR_COMPMASK_NUMPORTS				(1ull<<5)
+#define IB_NR_COMPMASK_SYSIMAGEGUID			(1ull<<6)
+#define IB_NR_COMPMASK_NODEGUID				(1ull<<7)
+#define IB_NR_COMPMASK_PORTGUID				(1ull<<8)
+#define IB_NR_COMPMASK_PARTCAP				(1ull<<9)
+#define IB_NR_COMPMASK_DEVID				(1ull<<10)
+#define IB_NR_COMPMASK_REV				(1ull<<11)
+#define IB_NR_COMPMASK_PORTNUM				(1ull<<12)
+#define IB_NR_COMPMASK_VENDID				(1ull<<13)
+#define IB_NR_COMPMASK_NODEDESC				(1ull<<14)
+
+#define IB_NR_DEF_MASK IB_NR_COMPMASK_PORTGUID
+
+int ib_node_query_via(const struct ibmad_port *srcport, uint64_t guid,
+		      ib_portid_t * sm_id, void *buf)
+{
+	ib_sa_call_t sa = { 0 };
+	uint8_t *p;
+
+	memset(&sa, 0, sizeof sa);
+	sa.method = IB_MAD_METHOD_GET;
+	sa.attrid = IB_SA_ATTR_NODERECORD;
+	sa.mask = IB_NR_DEF_MASK;
+	sa.trid = mad_trid();
+
+	memset(buf, 0, IB_SA_NR_RECSZ);
+
+	mad_encode_field(buf, IB_SA_NR_PORT_GUID_F, &guid);
+
+	p = sa_rpc_call(srcport, buf, sm_id, &sa, 0);
+	if (!p) {
+		IBWARN("sa call node_query failed");
+		return -1;
Quoted 10 lines
Quoted 8 lines
src/sa.c +4 -1
+	}
+
+	return 0;
+}
--

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

--
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