[ofa-general] Re: [PATCH] opensm: diags add DR path support to some utils
Sasha Khapyorsky
sashak at voltaire.com
Sat Jan 26 03:07:36 PST 2008
On 14:59 Thu 24 Jan , Timothy A. Meier wrote:
> Sasha,
>
> At LLNL, we find these -D options useful (some diagnostic messages give us
> only direct paths).
>
> From 3c681566514f0c948cfb5002f7536af9ca563e33 Mon Sep 17 00:00:00 2001
> From: Tim Meier <meier3 at llnl.gov>
> Date: Thu, 24 Jan 2008 14:49:02 -0800
> Subject: [PATCH] opensm: diags add DR path support to some utils
>
> Added direct route support to iblinkinfo.pl and ibqueryerrors.pl.
>
> Signed-off-by: Tim Meier <meier3 at llnl.gov>
Applied. Thanks.
Please note that inlined patch has mangled whitespaces and didn't apply
(I used attached version). Also a formatting nit is below.
> ---
> infiniband-diags/scripts/IBswcountlimits.pm | 51
> +++++++++++++++++++++++++++
> infiniband-diags/scripts/iblinkinfo.pl | 12 +++++-
> infiniband-diags/scripts/ibqueryerrors.pl | 12 +++++-
> 3 files changed, 71 insertions(+), 4 deletions(-)
>
> diff --git a/infiniband-diags/scripts/IBswcountlimits.pm
> b/infiniband-diags/scripts/IBswcountlimits.pm
> index 6985750..1ada8a8 100755
> --- a/infiniband-diags/scripts/IBswcountlimits.pm
> +++ b/infiniband-diags/scripts/IBswcountlimits.pm
> @@ -373,3 +373,54 @@ sub get_num_ports
> return ($num_ports);
> }
>
> +# =========================================================================
> +# convert_dr_to_guid(direct_route)
> +#
> +sub convert_dr_to_guid
> +{
> + my $guid = undef;
> +
> + my $data = `smpquery nodeinfo -D $_[0]`;
> + my @lines = split("\n", $data);
> + foreach my $line (@lines) {
> + if ($line =~ /^PortGuid:\.+(.*)/) { $guid = $1; }
> + }
> + $guid;
> +}
> +
> +# =========================================================================
> +# get_node_type(guid_or_direct_route)
> +#
> +sub get_node_type
> +{
> + my $type = undef;
> + my $query_arg = "smpquery nodeinfo ";
> + if($_[0] =~ /x/)
> + {
> + # assume arg is a guid if contains an x
> + $query_arg .= "-G " . $_[0];
> + }
> + else
> + {
> + # assume arg is a direct path
> + $query_arg .= "-D " . $_[0];
> + }
> +
> + my $data = `$query_arg`;
> + my @lines = split("\n", $data);
> + foreach my $line (@lines)
> + {
> + if ($line =~ /^NodeType:\.+(.*)/) { $type = $1; }
> + }
> + $type;
> +}
> +
> +# =========================================================================
> +# is_switch(guid_or_direct_route)
> +#
> +sub is_switch
> +{
> + my $node_type = &get_node_type($_[0]);
> + ($node_type =~ /Switch/);
> +}
> +
What about to use unified indentation for scripts too?
Sasha
More information about the general
mailing list