From: Ira Weiny <weiny2-i2BcT+NCU+M@public.gmane.org>
To: Jim Foraker <foraker1-i2BcT+NCU+M@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH V3 3/8] infiniband-diags/ibportstate.c: Display MKey, lease, and protect bits
Date: Thu, 31 May 2012 15:16:40 -0700 [thread overview]
Message-ID: <20120531151640.6ef7dcb2.weiny2@llnl.gov> (raw)
In-Reply-To: <1338398497-12444-3-git-send-email-foraker1-i2BcT+NCU+M@public.gmane.org>
On Wed, 30 May 2012 10:21:32 -0700
Jim Foraker <foraker1-i2BcT+NCU+M@public.gmane.org> wrote:
> By default, display mkey lease and protection bits.
> With a flag, also display mkey itself
>
> Signed-off-by: Jim Foraker <foraker1-i2BcT+NCU+M@public.gmane.org>
Thanks, applied.
Ira
> ---
> doc/rst/ibportstate.8.in.rst | 1 +
> src/ibportstate.c | 30 ++++++++++++++++++++++++------
> 2 files changed, 25 insertions(+), 6 deletions(-)
>
> diff --git a/doc/rst/ibportstate.8.in.rst b/doc/rst/ibportstate.8.in.rst
> index 3af2aaa..1fc9bb2 100644
> --- a/doc/rst/ibportstate.8.in.rst
> +++ b/doc/rst/ibportstate.8.in.rst
> @@ -89,6 +89,7 @@ Debugging flags
> .. include:: common/opt_h.rst
> .. include:: common/opt_d.rst
> .. include:: common/opt_e.rst
> +.. include:: common/opt_K.rst
> .. include:: common/opt_v.rst
> .. include:: common/opt_V.rst
>
> diff --git a/src/ibportstate.c b/src/ibportstate.c
> index 5559d18..b2df212 100644
> --- a/src/ibportstate.c
> +++ b/src/ibportstate.c
> @@ -142,7 +142,7 @@ static int get_port_info(ib_portid_t * dest, uint8_t * data, int portnum,
> }
>
> static void show_port_info(ib_portid_t * dest, uint8_t * data, int portnum,
> - int espeed_cap)
> + int espeed_cap, int is_switch)
> {
> char buf[2300];
> char val[64];
> @@ -201,18 +201,36 @@ static void show_port_info(ib_portid_t * dest, uint8_t * data, int portnum,
> val);
> sprintf(buf + strlen(buf), "%s", "\n");
> }
> + if (!is_switch || portnum == 0) {
> + if (show_keys) {
> + mad_decode_field(data, IB_PORT_MKEY_F, val);
> + mad_dump_field(IB_PORT_MKEY_F, buf + strlen(buf),
> + sizeof buf - strlen(buf), val);
> + } else
> + snprint_field(buf+strlen(buf), sizeof(buf)-strlen(buf),
> + IB_PORT_MKEY_F, 32, NOT_DISPLAYED_STR);
> + sprintf(buf+strlen(buf), "%s", "\n");
> + mad_decode_field(data, IB_PORT_MKEY_LEASE_F, val);
> + mad_dump_field(IB_PORT_MKEY_LEASE_F, buf + strlen(buf),
> + sizeof buf - strlen(buf), val);
> + sprintf(buf+strlen(buf), "%s", "\n");
> + mad_decode_field(data, IB_PORT_MKEY_PROT_BITS_F, val);
> + mad_dump_field(IB_PORT_MKEY_PROT_BITS_F, buf + strlen(buf),
> + sizeof buf - strlen(buf), val);
> + sprintf(buf+strlen(buf), "%s", "\n");
> + }
>
> printf("# Port info: %s port %d\n%s", portid2str(dest), portnum, buf);
> }
>
> static void set_port_info(ib_portid_t * dest, uint8_t * data, int portnum,
> - int espeed_cap)
> + int espeed_cap, int is_switch)
> {
> if (!smp_set_via(data, dest, IB_ATTR_PORT_INFO, portnum, 0, srcport))
> IBERROR("smp set portinfo failed");
>
> printf("\nAfter PortInfo set:\n");
> - show_port_info(dest, data, portnum, espeed_cap);
> + show_port_info(dest, data, portnum, espeed_cap, is_switch);
> }
>
> static void get_ext_port_info(ib_portid_t * dest, uint8_t * data, int portnum)
> @@ -460,7 +478,7 @@ int main(int argc, char **argv)
> else
> printf("%s PortInfo:\n", is_switch ? "Switch" : "CA");
> espeed_cap = get_port_info(&portid, data, portnum, is_switch);
> - show_port_info(&portid, data, portnum, espeed_cap);
> + show_port_info(&portid, data, portnum, espeed_cap, is_switch);
> if (is_mlnx_ext_port_info_supported(devid)) {
> get_ext_port_info(&portid, data2, portnum);
> show_ext_port_info(&portid, data2, portnum);
> @@ -527,7 +545,7 @@ int main(int argc, char **argv)
> fdr10);
> set_ext_port_info(&portid, data2, portnum);
> }
> - set_port_info(&portid, data, portnum, is_switch);
> + set_port_info(&portid, data, portnum, espeed_cap, is_switch);
>
> } else if (is_switch && portnum) {
> /* Now, make sure PortState is Active */
> @@ -596,7 +614,7 @@ int main(int argc, char **argv)
> get_ext_port_info(&peerportid, data2,
> peerlocalportnum);
> show_port_info(&peerportid, data, peerlocalportnum,
> - peer_espeed_cap);
> + peer_espeed_cap, is_peer_switch);
> if (is_mlnx_ext_port_info_supported(rem_devid))
> show_ext_port_info(&peerportid, data2,
> peerlocalportnum);
> --
> 1.7.9.2
>
--
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-05-31 22:16 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-30 17:20 [PATCH v3 0/8] Mkey support in infiniband-diags Jim Foraker
[not found] ` <1338398414.11948.29.camel-mxTxeWJot8FliZ7u+bvwcg@public.gmane.org>
2012-05-30 17:21 ` [PATCH V3 1/8] infiniband-diags: Obfuscate sensitive output by default Jim Foraker
[not found] ` <1338398497-12444-1-git-send-email-foraker1-i2BcT+NCU+M@public.gmane.org>
2012-05-30 17:21 ` [PATCH V3 2/8] infiniband-diags: install config file mode 400 Jim Foraker
[not found] ` <1338398497-12444-2-git-send-email-foraker1-i2BcT+NCU+M@public.gmane.org>
2012-05-31 22:15 ` Ira Weiny
2012-05-30 17:21 ` [PATCH V3 3/8] infiniband-diags/ibportstate.c: Display MKey, lease, and protect bits Jim Foraker
[not found] ` <1338398497-12444-3-git-send-email-foraker1-i2BcT+NCU+M@public.gmane.org>
2012-05-31 22:16 ` Ira Weiny [this message]
2012-05-30 17:21 ` [PATCH V3 4/8] infiniband-diags: Allow specification of an mkey to use on the command line Jim Foraker
[not found] ` <1338398497-12444-4-git-send-email-foraker1-i2BcT+NCU+M@public.gmane.org>
2012-05-31 11:48 ` Hal Rosenstock
[not found] ` <4FC75A97.7080106-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2012-05-31 15:18 ` Ira Weiny
2012-05-31 19:08 ` Jim Foraker
[not found] ` <1338491297.19133.30.camel-mxTxeWJot8FliZ7u+bvwcg@public.gmane.org>
2012-05-31 19:11 ` [PATCH V3.1 " Jim Foraker
[not found] ` <1338491493-19714-1-git-send-email-foraker1-i2BcT+NCU+M@public.gmane.org>
2012-05-31 22:17 ` Ira Weiny
2012-05-30 17:21 ` [PATCH V3 5/8] infiniband-diags/ibportstate.c: Support changing MKey, lease, and protect bits Jim Foraker
[not found] ` <1338398497-12444-5-git-send-email-foraker1-i2BcT+NCU+M@public.gmane.org>
2012-05-31 22:21 ` Ira Weiny
2012-05-30 17:21 ` [PATCH V3 6/8] infiniband-diags: Add m_key option to config file Jim Foraker
[not found] ` <1338398497-12444-6-git-send-email-foraker1-i2BcT+NCU+M@public.gmane.org>
2012-05-31 22:22 ` Ira Weiny
2012-05-30 17:21 ` [PATCH V3 7/8] ib-diags/saquery: Fix smkey handling Jim Foraker
[not found] ` <1338398497-12444-7-git-send-email-foraker1-i2BcT+NCU+M@public.gmane.org>
2012-05-30 22:14 ` [PATCH V3.1 " Jim Foraker
[not found] ` <1338416060-14025-1-git-send-email-foraker1-i2BcT+NCU+M@public.gmane.org>
2012-05-31 22:23 ` Ira Weiny
2012-05-30 17:21 ` [PATCH V3 8/8] infiniband-diags: Add sa_smkey option to config file Jim Foraker
[not found] ` <1338398497-12444-8-git-send-email-foraker1-i2BcT+NCU+M@public.gmane.org>
2012-05-30 18:06 ` Hal Rosenstock
[not found] ` <4FC66196.5030704-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2012-05-30 18:43 ` Jim Foraker
[not found] ` <1338403407.17237.860.camel-mxTxeWJot8FliZ7u+bvwcg@public.gmane.org>
2012-05-30 22:17 ` Jim Foraker
2012-05-30 22:15 ` [PATCH V3.1 " Jim Foraker
[not found] ` <1338416114-14068-1-git-send-email-foraker1-i2BcT+NCU+M@public.gmane.org>
2012-05-31 11:56 ` Hal Rosenstock
[not found] ` <4FC75C61.7060408-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2012-05-31 22:25 ` Ira Weiny
[not found] ` <20120531152515.410a999a.weiny2-i2BcT+NCU+M@public.gmane.org>
2012-05-31 23:30 ` Hal Rosenstock
[not found] ` <4FC7FF07.6090207-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2012-05-31 23:54 ` Ira Weiny
2012-05-31 22:23 ` Ira Weiny
2012-05-31 11:48 ` [PATCH V3 1/8] infiniband-diags: Obfuscate sensitive output by default Hal Rosenstock
[not found] ` <4FC75A8D.4080305-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2012-05-31 15:10 ` Ira Weiny
2012-05-31 22:15 ` Ira Weiny
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=20120531151640.6ef7dcb2.weiny2@llnl.gov \
--to=weiny2-i2bct+ncu+m@public.gmane.org \
--cc=foraker1-i2BcT+NCU+M@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@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