Skip to contentSkip to conversation

Subject: [PATCHv2] infiniband-diags/vendstat: updated devices supporting extended fw info

PATCH Applied Daniel Klein 2 participants 2 messages Jul 10, 2012 – Jul 11, 2012 1 message not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

Changed devices ID to an array of device ID ranges.

Version 2:
Added range for ConnectX devices: 0x1003 - 0x1011

---
 src/vendstat.c |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)
src/vendstat.c +17 -4
index 413d202..6183a67 100644
@@ -58,8 +58,6 @@
 /* Config space addresses */
 #define IB_MLX_IS3_PORT_XMIT_WAIT	0x10013C
 
-#define IS4_DEV_ID 0x01b3
-#define SX_DEV_ID 0x0245
 
 struct ibmad_port *srcport;
 
@@ -143,6 +141,22 @@ typedef struct {
 	is4_group_select_t group_selects[COUNTER_GROUPS_NUM];
 } is4_config_counter_groups_t;
 
+static uint16_t ext_fw_info_device[][2] = {
+	{0x0245, 0x0245},
+	{0xc738, 0xc738},
+	{0x01b3, 0x01b3},
+	{0x1003, 0x1011},
+	{0x0000, 0x0000}};
+
+static int is_ext_fw_info_supported(uint16_t device_id) {
+	int i;
+	for (i = 0; ext_fw_info_device[i][0]; i++)
+		if (ext_fw_info_device[i][0] <= device_id &&
+		    device_id <= ext_fw_info_device[i][1])
+			return 1;
+	return 0;
+}
+
 static int do_vendor(ib_portid_t *portid, struct ibmad_port *srcport,
 		     uint8_t class, uint8_t method, uint16_t attr_id,
 		     uint32_t attr_mod, void *data)
@@ -398,8 +412,7 @@ int main(int argc, char **argv)
 		      IB_MLX_IS3_GENERAL_INFO, 0, gi_is3))
 		IBERROR("generalinfo query");
 
-	if (IS4_DEV_ID == ntohs(gi_is3->hw_info.device_id) ||
-	    SX_DEV_ID == ntohs(gi_is3->hw_info.device_id)) {
+	if (is_ext_fw_info_supported(ntohs(gi_is3->hw_info.device_id))) {
 		gi_is4 = (is4_general_info_t *) &buf;
 		fw_ver_major = ntohl(gi_is4->ext_fw_info.ext_major);
 		fw_ver_minor = ntohl(gi_is4->ext_fw_info.ext_minor);
Signature · 5 lines
1.7.1
--
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
Applied
#2 lore raw
In reply to a message not in the archive
Quoted 6 lines · On Tue, 10 Jul 2012 18:24:33 +0300 Daniel Klein…

Changed devices ID to an array of device ID ranges.

Version 2:
Added range for ConnectX devices: 0x1003 - 0x1011

Thanks applied,
Ira

Quoted 56 lines
---
 src/vendstat.c |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)
src/vendstat.c +17 -4
index 413d202..6183a67 100644
@@ -58,8 +58,6 @@
 /* Config space addresses */
 #define IB_MLX_IS3_PORT_XMIT_WAIT	0x10013C
 
-#define IS4_DEV_ID 0x01b3
-#define SX_DEV_ID 0x0245
 
 struct ibmad_port *srcport;
 
@@ -143,6 +141,22 @@ typedef struct {
 	is4_group_select_t group_selects[COUNTER_GROUPS_NUM];
 } is4_config_counter_groups_t;
 
+static uint16_t ext_fw_info_device[][2] = {
+	{0x0245, 0x0245},
+	{0xc738, 0xc738},
+	{0x01b3, 0x01b3},
+	{0x1003, 0x1011},
+	{0x0000, 0x0000}};
+
+static int is_ext_fw_info_supported(uint16_t device_id) {
+	int i;
+	for (i = 0; ext_fw_info_device[i][0]; i++)
+		if (ext_fw_info_device[i][0] <= device_id &&
+		    device_id <= ext_fw_info_device[i][1])
+			return 1;
+	return 0;
+}
+
 static int do_vendor(ib_portid_t *portid, struct ibmad_port *srcport,
 		     uint8_t class, uint8_t method, uint16_t attr_id,
 		     uint32_t attr_mod, void *data)
@@ -398,8 +412,7 @@ int main(int argc, char **argv)
 		      IB_MLX_IS3_GENERAL_INFO, 0, gi_is3))
 		IBERROR("generalinfo query");
 
-	if (IS4_DEV_ID == ntohs(gi_is3->hw_info.device_id) ||
-	    SX_DEV_ID == ntohs(gi_is3->hw_info.device_id)) {
+	if (is_ext_fw_info_supported(ntohs(gi_is3->hw_info.device_id))) {
 		gi_is4 = (is4_general_info_t *) &buf;
 		fw_ver_major = ntohl(gi_is4->ext_fw_info.ext_major);
 		fw_ver_minor = ntohl(gi_is4->ext_fw_info.ext_minor);
Signature · 5 lines
1.7.1
--
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