From: Ira Weiny <weiny2-i2BcT+NCU+M@public.gmane.org>
To: Hal Rosenstock <hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
Cc: Alex Netes <alexne-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
Adam Habari <adamh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
Vladimir Koushnir
<vladimirk-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
"linux-rdma
(linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)"
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCHv3] infiniband-diags/vendstat.c: Support IS4/SX firmware version info
Date: Mon, 23 Apr 2012 09:18:37 -0700 [thread overview]
Message-ID: <20120423091837.bd757198.weiny2@llnl.gov> (raw)
In-Reply-To: <4F8EBB21.2070003-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
On Wed, 18 Apr 2012 09:01:21 -0400
Hal Rosenstock <hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org> wrote:
>
> 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>
Thanks applied,
Ira
> ---
> 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 */
--
Ira Weiny
Member of Technical Staff
Lawrence Livermore National Lab
925-423-8008
weiny2-i2BcT+NCU+M@public.gmane.org
--
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
next prev parent reply other threads:[~2012-04-23 16:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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-23 16:18 ` Ira Weiny [this message]
2012-04-18 13:27 ` Alex Netes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120423091837.bd757198.weiny2@llnl.gov \
--to=weiny2-i2bct+ncu+m@public.gmane.org \
--cc=adamh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=alexne-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=vladimirk-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox