* [PATCHv3] infiniband-diags/vendstat.c: Support IS4/SX firmware version info
2012-04-18 8:14 [PATCHv2] infiniband-diags/vendstat.c: Support IS4/SX firmware version info Alex Netes
@ 2012-04-18 13:01 ` Hal Rosenstock
2012-04-18 13:01 ` Hal Rosenstock
2012-04-18 13:27 ` Alex Netes
2 siblings, 0 replies; 5+ messages in thread
From: Hal Rosenstock @ 2012-04-18 13:01 UTC (permalink / raw)
To: Ira Weiny
Cc: Alex Netes, Adam Habari, Vladimir Koushnir,
linux-rdma (linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)
Signed-off-by: Adam Habari <adamh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Alex Netes <alexne-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
Changes since v2:
Added copyright
Some minor cosmetic formatting changes detected by checkpatch
diff --git a/src/vendstat.c b/src/vendstat.c
index 1d3d78c..413d202 100644
--- a/src/vendstat.c
+++ b/src/vendstat.c
@@ -1,4 +1,5 @@
/*
+ * Copyright (c) 2012 Mellanox Technologies LTD. All rights reserved.
* Copyright (c) 2004-2009 Voltaire Inc. All rights reserved.
*
* This software is available to you under a choice of one of two
@@ -57,6 +58,9 @@
/* 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;
typedef struct {
@@ -82,6 +86,12 @@ typedef struct {
} is3_fw_info_t;
typedef struct {
+ uint32_t ext_major;
+ uint32_t ext_minor;
+ uint32_t ext_sub_minor;
+} is4_fw_ext_info_t;
+
+typedef struct {
uint8_t resv1;
uint8_t major;
uint8_t minor;
@@ -98,6 +108,14 @@ typedef struct {
typedef struct {
uint8_t reserved[8];
+ is3_hw_info_t hw_info;
+ is3_fw_info_t fw_info;
+ is4_fw_ext_info_t ext_fw_info;
+ is3_sw_info_t sw_info;
+} is4_general_info_t;
+
+typedef struct {
+ uint8_t reserved[8];
struct is3_record {
uint32_t address;
uint32_t data;
@@ -291,8 +309,11 @@ int main(int argc, char **argv)
ib_portid_t portid = { 0 };
int port = 0;
char buf[1024];
- is3_general_info_t *gi;
-
+ uint32_t fw_ver_major = 0;
+ uint32_t fw_ver_minor = 0;
+ uint32_t fw_ver_sub_minor = 0;
+ is3_general_info_t *gi_is3;
+ is4_general_info_t *gi_is4;
const struct ibdiag_opt opts[] = {
{"N", 'N', 0, NULL, "show IS3 or IS4 general information"},
{"w", 'w', 0, NULL, "show IS3 port xmit wait counters"},
@@ -372,37 +393,48 @@ int main(int argc, char **argv)
IBERROR("classportinfo query");
memset(&buf, 0, sizeof(buf));
- gi = (is3_general_info_t *) & buf;
+ gi_is3 = (is3_general_info_t *) &buf;
if (do_vendor(&portid, srcport, IB_MLX_VENDOR_CLASS, IB_MAD_METHOD_GET,
- IB_MLX_IS3_GENERAL_INFO, 0, gi))
+ 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)) {
+ 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);
+ fw_ver_sub_minor = ntohl(gi_is4->ext_fw_info.ext_sub_minor);
+ } else {
+ fw_ver_major = gi_is3->fw_info.major;
+ fw_ver_minor = gi_is3->fw_info.minor;
+ fw_ver_sub_minor = gi_is3->fw_info.sub_minor;
+ }
+
if (general_info) {
/* dump IS3 or IS4 general info here */
- printf("hw_dev_rev: 0x%04x\n", ntohs(gi->hw_info.hw_revision));
- printf("hw_dev_id: 0x%04x\n", ntohs(gi->hw_info.device_id));
- printf("hw_uptime: 0x%08x\n", ntohl(gi->hw_info.uptime));
+ printf("hw_dev_rev: 0x%04x\n", ntohs(gi_is3->hw_info.hw_revision));
+ printf("hw_dev_id: 0x%04x\n", ntohs(gi_is3->hw_info.device_id));
+ printf("hw_uptime: 0x%08x\n", ntohl(gi_is3->hw_info.uptime));
printf("fw_version: %02d.%02d.%02d\n",
- gi->fw_info.major, gi->fw_info.minor,
- gi->fw_info.sub_minor);
- printf("fw_build_id: 0x%04x\n", ntohl(gi->fw_info.build_id));
- printf("fw_date: %02d/%02d/%04x\n",
- gi->fw_info.month, gi->fw_info.day,
- ntohs(gi->fw_info.year));
- printf("fw_psid: '%s'\n", gi->fw_info.psid);
+ fw_ver_major, fw_ver_minor, fw_ver_sub_minor);
+ printf("fw_build_id: 0x%04x\n", ntohl(gi_is3->fw_info.build_id));
+ printf("fw_date: %02x/%02x/%04x\n",
+ gi_is3->fw_info.month, gi_is3->fw_info.day,
+ ntohs(gi_is3->fw_info.year));
+ printf("fw_psid: '%s'\n", gi_is3->fw_info.psid);
printf("fw_ini_ver: %d\n",
- ntohl(gi->fw_info.ini_file_version));
- printf("sw_version: %02d.%02d.%02d\n", gi->sw_info.major,
- gi->sw_info.minor, gi->sw_info.sub_minor);
+ ntohl(gi_is3->fw_info.ini_file_version));
+ printf("sw_version: %02d.%02d.%02d\n", gi_is3->sw_info.major,
+ gi_is3->sw_info.minor, gi_is3->sw_info.sub_minor);
}
if (xmit_wait) {
is3_config_space_t *cs;
unsigned i;
- if (ntohs(gi->hw_info.device_id) != IS3_DEVICE_ID)
+ if (ntohs(gi_is3->hw_info.device_id) != IS3_DEVICE_ID)
IBERROR("Unsupported device ID 0x%x",
- ntohs(gi->hw_info.device_id));
+ ntohs(gi_is3->hw_info.device_id));
memset(&buf, 0, sizeof(buf));
/* Set record addresses for each port */
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCHv3] infiniband-diags/vendstat.c: Support IS4/SX firmware version info
2012-04-18 8:14 [PATCHv2] infiniband-diags/vendstat.c: Support IS4/SX firmware version info Alex Netes
2012-04-18 13:01 ` [PATCHv3] " Hal Rosenstock
@ 2012-04-18 13:01 ` Hal Rosenstock
[not found] ` <4F8EBB21.2070003-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2012-04-18 13:27 ` Alex Netes
2 siblings, 1 reply; 5+ messages in thread
From: Hal Rosenstock @ 2012-04-18 13:01 UTC (permalink / raw)
To: Ira Weiny
Cc: Alex Netes, Adam Habari, Vladimir Koushnir,
linux-rdma (linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)
Signed-off-by: Adam Habari <adamh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Alex Netes <alexne-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
Changes since v2:
Added copyright
Some minor cosmetic formatting changes detected by checkpatch
diff --git a/src/vendstat.c b/src/vendstat.c
index 1d3d78c..413d202 100644
--- a/src/vendstat.c
+++ b/src/vendstat.c
@@ -1,4 +1,5 @@
/*
+ * Copyright (c) 2012 Mellanox Technologies LTD. All rights reserved.
* Copyright (c) 2004-2009 Voltaire Inc. All rights reserved.
*
* This software is available to you under a choice of one of two
@@ -57,6 +58,9 @@
/* 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;
typedef struct {
@@ -82,6 +86,12 @@ typedef struct {
} is3_fw_info_t;
typedef struct {
+ uint32_t ext_major;
+ uint32_t ext_minor;
+ uint32_t ext_sub_minor;
+} is4_fw_ext_info_t;
+
+typedef struct {
uint8_t resv1;
uint8_t major;
uint8_t minor;
@@ -98,6 +108,14 @@ typedef struct {
typedef struct {
uint8_t reserved[8];
+ is3_hw_info_t hw_info;
+ is3_fw_info_t fw_info;
+ is4_fw_ext_info_t ext_fw_info;
+ is3_sw_info_t sw_info;
+} is4_general_info_t;
+
+typedef struct {
+ uint8_t reserved[8];
struct is3_record {
uint32_t address;
uint32_t data;
@@ -291,8 +309,11 @@ int main(int argc, char **argv)
ib_portid_t portid = { 0 };
int port = 0;
char buf[1024];
- is3_general_info_t *gi;
-
+ uint32_t fw_ver_major = 0;
+ uint32_t fw_ver_minor = 0;
+ uint32_t fw_ver_sub_minor = 0;
+ is3_general_info_t *gi_is3;
+ is4_general_info_t *gi_is4;
const struct ibdiag_opt opts[] = {
{"N", 'N', 0, NULL, "show IS3 or IS4 general information"},
{"w", 'w', 0, NULL, "show IS3 port xmit wait counters"},
@@ -372,37 +393,48 @@ int main(int argc, char **argv)
IBERROR("classportinfo query");
memset(&buf, 0, sizeof(buf));
- gi = (is3_general_info_t *) & buf;
+ gi_is3 = (is3_general_info_t *) &buf;
if (do_vendor(&portid, srcport, IB_MLX_VENDOR_CLASS, IB_MAD_METHOD_GET,
- IB_MLX_IS3_GENERAL_INFO, 0, gi))
+ 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)) {
+ 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);
+ fw_ver_sub_minor = ntohl(gi_is4->ext_fw_info.ext_sub_minor);
+ } else {
+ fw_ver_major = gi_is3->fw_info.major;
+ fw_ver_minor = gi_is3->fw_info.minor;
+ fw_ver_sub_minor = gi_is3->fw_info.sub_minor;
+ }
+
if (general_info) {
/* dump IS3 or IS4 general info here */
- printf("hw_dev_rev: 0x%04x\n", ntohs(gi->hw_info.hw_revision));
- printf("hw_dev_id: 0x%04x\n", ntohs(gi->hw_info.device_id));
- printf("hw_uptime: 0x%08x\n", ntohl(gi->hw_info.uptime));
+ printf("hw_dev_rev: 0x%04x\n", ntohs(gi_is3->hw_info.hw_revision));
+ printf("hw_dev_id: 0x%04x\n", ntohs(gi_is3->hw_info.device_id));
+ printf("hw_uptime: 0x%08x\n", ntohl(gi_is3->hw_info.uptime));
printf("fw_version: %02d.%02d.%02d\n",
- gi->fw_info.major, gi->fw_info.minor,
- gi->fw_info.sub_minor);
- printf("fw_build_id: 0x%04x\n", ntohl(gi->fw_info.build_id));
- printf("fw_date: %02d/%02d/%04x\n",
- gi->fw_info.month, gi->fw_info.day,
- ntohs(gi->fw_info.year));
- printf("fw_psid: '%s'\n", gi->fw_info.psid);
+ fw_ver_major, fw_ver_minor, fw_ver_sub_minor);
+ printf("fw_build_id: 0x%04x\n", ntohl(gi_is3->fw_info.build_id));
+ printf("fw_date: %02x/%02x/%04x\n",
+ gi_is3->fw_info.month, gi_is3->fw_info.day,
+ ntohs(gi_is3->fw_info.year));
+ printf("fw_psid: '%s'\n", gi_is3->fw_info.psid);
printf("fw_ini_ver: %d\n",
- ntohl(gi->fw_info.ini_file_version));
- printf("sw_version: %02d.%02d.%02d\n", gi->sw_info.major,
- gi->sw_info.minor, gi->sw_info.sub_minor);
+ ntohl(gi_is3->fw_info.ini_file_version));
+ printf("sw_version: %02d.%02d.%02d\n", gi_is3->sw_info.major,
+ gi_is3->sw_info.minor, gi_is3->sw_info.sub_minor);
}
if (xmit_wait) {
is3_config_space_t *cs;
unsigned i;
- if (ntohs(gi->hw_info.device_id) != IS3_DEVICE_ID)
+ if (ntohs(gi_is3->hw_info.device_id) != IS3_DEVICE_ID)
IBERROR("Unsupported device ID 0x%x",
- ntohs(gi->hw_info.device_id));
+ ntohs(gi_is3->hw_info.device_id));
memset(&buf, 0, sizeof(buf));
/* Set record addresses for each port */
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCHv3] infiniband-diags/vendstat.c: Support IS4/SX firmware version info
2012-04-18 8:14 [PATCHv2] infiniband-diags/vendstat.c: Support IS4/SX firmware version info Alex Netes
2012-04-18 13:01 ` [PATCHv3] " Hal Rosenstock
2012-04-18 13:01 ` Hal Rosenstock
@ 2012-04-18 13:27 ` Alex Netes
2 siblings, 0 replies; 5+ messages in thread
From: Alex Netes @ 2012-04-18 13:27 UTC (permalink / raw)
To: Hal Rosenstock
Cc: Ira Weiny, Adam Habari, Vladimir Koushnir,
linux-rdma (linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)
Signed-off-by: Adam Habari <adamh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Alex Netes <alexne-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
Changes since v2:
Added copyright
Some minor cosmetic formatting changes detected by checkpatch
diff --git a/src/vendstat.c b/src/vendstat.c
index 1d3d78c..413d202 100644
--- a/src/vendstat.c
+++ b/src/vendstat.c
@@ -1,4 +1,5 @@
/*
+ * Copyright (c) 2012 Mellanox Technologies LTD. All rights reserved.
* Copyright (c) 2004-2009 Voltaire Inc. All rights reserved.
*
* This software is available to you under a choice of one of two
@@ -57,6 +58,9 @@
/* 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;
typedef struct {
@@ -82,6 +86,12 @@ typedef struct {
} is3_fw_info_t;
typedef struct {
+ uint32_t ext_major;
+ uint32_t ext_minor;
+ uint32_t ext_sub_minor;
+} is4_fw_ext_info_t;
+
+typedef struct {
uint8_t resv1;
uint8_t major;
uint8_t minor;
@@ -98,6 +108,14 @@ typedef struct {
typedef struct {
uint8_t reserved[8];
+ is3_hw_info_t hw_info;
+ is3_fw_info_t fw_info;
+ is4_fw_ext_info_t ext_fw_info;
+ is3_sw_info_t sw_info;
+} is4_general_info_t;
+
+typedef struct {
+ uint8_t reserved[8];
struct is3_record {
uint32_t address;
uint32_t data;
@@ -291,8 +309,11 @@ int main(int argc, char **argv)
ib_portid_t portid = { 0 };
int port = 0;
char buf[1024];
- is3_general_info_t *gi;
-
+ uint32_t fw_ver_major = 0;
+ uint32_t fw_ver_minor = 0;
+ uint32_t fw_ver_sub_minor = 0;
+ is3_general_info_t *gi_is3;
+ is4_general_info_t *gi_is4;
const struct ibdiag_opt opts[] = {
{"N", 'N', 0, NULL, "show IS3 or IS4 general information"},
{"w", 'w', 0, NULL, "show IS3 port xmit wait counters"},
@@ -372,37 +393,48 @@ int main(int argc, char **argv)
IBERROR("classportinfo query");
memset(&buf, 0, sizeof(buf));
- gi = (is3_general_info_t *) & buf;
+ gi_is3 = (is3_general_info_t *) &buf;
if (do_vendor(&portid, srcport, IB_MLX_VENDOR_CLASS, IB_MAD_METHOD_GET,
- IB_MLX_IS3_GENERAL_INFO, 0, gi))
+ 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)) {
+ 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);
+ fw_ver_sub_minor = ntohl(gi_is4->ext_fw_info.ext_sub_minor);
+ } else {
+ fw_ver_major = gi_is3->fw_info.major;
+ fw_ver_minor = gi_is3->fw_info.minor;
+ fw_ver_sub_minor = gi_is3->fw_info.sub_minor;
+ }
+
if (general_info) {
/* dump IS3 or IS4 general info here */
- printf("hw_dev_rev: 0x%04x\n", ntohs(gi->hw_info.hw_revision));
- printf("hw_dev_id: 0x%04x\n", ntohs(gi->hw_info.device_id));
- printf("hw_uptime: 0x%08x\n", ntohl(gi->hw_info.uptime));
+ printf("hw_dev_rev: 0x%04x\n", ntohs(gi_is3->hw_info.hw_revision));
+ printf("hw_dev_id: 0x%04x\n", ntohs(gi_is3->hw_info.device_id));
+ printf("hw_uptime: 0x%08x\n", ntohl(gi_is3->hw_info.uptime));
printf("fw_version: %02d.%02d.%02d\n",
- gi->fw_info.major, gi->fw_info.minor,
- gi->fw_info.sub_minor);
- printf("fw_build_id: 0x%04x\n", ntohl(gi->fw_info.build_id));
- printf("fw_date: %02d/%02d/%04x\n",
- gi->fw_info.month, gi->fw_info.day,
- ntohs(gi->fw_info.year));
- printf("fw_psid: '%s'\n", gi->fw_info.psid);
+ fw_ver_major, fw_ver_minor, fw_ver_sub_minor);
+ printf("fw_build_id: 0x%04x\n", ntohl(gi_is3->fw_info.build_id));
+ printf("fw_date: %02x/%02x/%04x\n",
+ gi_is3->fw_info.month, gi_is3->fw_info.day,
+ ntohs(gi_is3->fw_info.year));
+ printf("fw_psid: '%s'\n", gi_is3->fw_info.psid);
printf("fw_ini_ver: %d\n",
- ntohl(gi->fw_info.ini_file_version));
- printf("sw_version: %02d.%02d.%02d\n", gi->sw_info.major,
- gi->sw_info.minor, gi->sw_info.sub_minor);
+ ntohl(gi_is3->fw_info.ini_file_version));
+ printf("sw_version: %02d.%02d.%02d\n", gi_is3->sw_info.major,
+ gi_is3->sw_info.minor, gi_is3->sw_info.sub_minor);
}
if (xmit_wait) {
is3_config_space_t *cs;
unsigned i;
- if (ntohs(gi->hw_info.device_id) != IS3_DEVICE_ID)
+ if (ntohs(gi_is3->hw_info.device_id) != IS3_DEVICE_ID)
IBERROR("Unsupported device ID 0x%x",
- ntohs(gi->hw_info.device_id));
+ ntohs(gi_is3->hw_info.device_id));
memset(&buf, 0, sizeof(buf));
/* Set record addresses for each port */
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread