public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] infiniband-diags/saquery.c: switchinfo support added
       [not found] ` <WC20130221094946.530170-DMD6N21cJuFWk0Htik3J/w@public.gmane.org>
@ 2013-02-21 18:09   ` Ira Weiny
       [not found]     ` <20130221100900.87b509d834fc0adc21b6f68b-i2BcT+NCU+M@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Ira Weiny @ 2013-02-21 18:09 UTC (permalink / raw)
  To: Husam Kahalah
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

First Thanks!  Some comments below.

On Thu, 21 Feb 2013 11:49:46 +0200
"Husam Kahalah" <HKahalah-DMD6N21cJuFWk0Htik3J/w@public.gmane.org> wrote:

> 
> From a77cadd4d81ac0e23db836d9382fd642d7e37897 Mon Sep 17 00:00:00 2001
> From: Husam kahalah < hkahalah-DMD6N21cJuFWk0Htik3J/w@public.gmane.org>
> Date: Sun, 3 Feb 2013 14:27:21 +0200
> Subject: [PATCH] infiniband-diags/saquery.c: switchinfo support added
>  
>  Added support in querying SwitchInfoRecords filtered by switch LID
>  
> Signed-off-by: Husam kahalah < hkahalah-DMD6N21cJuFWk0Htik3J/w@public.gmane.org>
> ---
>  src/saquery.c |   61 
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 61 insertions(+), 0 deletions(-)
>  
> diff --git a/src/saquery.c b/src/saquery.c
> index d31d77d..753c7ac 100644
> --- a/src/saquery.c
> +++ b/src/saquery.c
> @@ -74,6 +74,7 @@ struct query_params {
>    uint8_t scope;
>    uint8_t join_state;
>   int proxy_join;
> + ib_net16_t swir_lid;

We don't need this field or lid option.  Other records simply have an optional parameter to specify the lid.

The usage should be:

SwitchRecord [lid]

>  };
>  
>  struct query_cmd {
> @@ -481,6 +482,41 @@ static void dump_service_record(void *data)
>          cl_ntoh64(p_sr->service_data64[1]));
>  }
>  
> +static void dump_switch_info_record(void *data)
> +{
> +  ib_switch_info_record_t *p_sir = data;
> +
> +  printf("SwitchInfoRecord dump:\n"
> +        "\t\tRID\n"
> +        "\t\tlid.....................%u\n"
> +        "\t\tSwitchInfo dump:\n"
> +        "\t\tlin_cap.................0x%X\n"
> +        "\t\trand_cap................0x%X\n"
> +        "\t\tmcast_cap...............0x%X\n"
> +        "\t\tlin_top.................0x%X\n"
> +        "\t\tdef_port................%u\n"
> +        "\t\tdef_mcast_pri_port......%u\n"
> +        "\t\tdef_mcast_not_port......%u\n"
> +        "\t\tlife_state..............%u\n"
> +        "\t\tlids_per_port...........0x%X\n"
> +        "\t\tenforce_cap.............0x%X\n"
> +        "\t\tflags...................%u\n"
> +        "\t\tmcast_top...............0x%X\n",
> +        cl_ntoh16(p_sir->lid),
> +        cl_ntoh16(p_sir->switch_info.lin_cap),
> +        cl_ntoh16(p_sir->switch_info.rand_cap),
> +        cl_ntoh16(p_sir->switch_info.mcast_cap),
> +        cl_ntoh16(p_sir->switch_info.lin_top),
> +        p_sir->switch_info.def_port,
> +        p_sir->switch_info.def_mcast_pri_port,
> +        p_sir->switch_info.def_mcast_not_port,
> +        p_sir->switch_info.life_state,
> +        cl_ntoh16(p_sir->switch_info.lids_per_port),
> +        cl_ntoh16(p_sir->switch_info.enforce_cap),
> +        p_sir->switch_info.flags,
> +        cl_ntoh16(p_sir->switch_info.mcast_top));
> +}
> +
>  static void dump_inform_info_record(void *data)
>  {
>   char gid_str[INET6_ADDRSTRLEN];
> @@ -1090,6 +1126,19 @@ static int query_node_records(const struct query_cmd 
> *q, struct sa_handle * h,
>    &nr, sizeof(nr), dump_node_record);
>  }
>  
> +static int query_switchinfo_records(const struct query_cmd *q,
> + struct sa_handle * h, struct query_params *p,
> + int argc, char *argv[])
> +{
> +  ib_switch_info_record_t swir;
> + ib_net64_t comp_mask = 0;
> +
> +  memset(&swir, 0, sizeof(swir));
> +  CHECK_AND_SET_VAL(p->swir_lid, 16, 0, swir.lid, SWIR, LID);
> + return get_and_dump_any_records(h, IB_SA_ATTR_SWITCHINFORECORD, 0, 
> comp_mask,
> + &swir, 0, dump_switch_info_record);
> +}
> +
>  static int query_portinfo_records(const struct query_cmd *q,
>     struct sa_handle * h, struct query_params *p,
>     int argc, char *argv[])
> @@ -1342,6 +1391,8 @@ static const struct query_cmd query_cmds[] = {
>    "[[mlid]/[position]/[block]]", query_mft_records},
>    {"GUIDInfoRecord", "GIR", IB_SA_ATTR_GUIDINFORECORD,
>    "[[lid]/[block]]", query_guidinfo_records},
> +  {"SWITCHInfoRecord", "SWIR", IB_SA_ATTR_SWITCHINFORECORD,

I would change this to "SwitchInfoRecord"  Why did you use all caps?

> +  NULL, query_switchinfo_records},
>    {0}
>  };
>  
> @@ -1435,6 +1486,9 @@ static int process_opt(void *context, int ch, char 
> *optarg)
>   case 'S':
>    query_type = IB_SA_ATTR_SERVICERECORD;
>    break;
> + case 'W':
> + query_type = IB_SA_ATTR_SWITCHINFORECORD;
> + break;

I would rather not use this option here.  Just support the SwitchInfoRecord/SWIR query names.

>   case 'I':
>    query_type = IB_SA_ATTR_INFORMINFORECORD;
>    break;
> @@ -1551,6 +1605,9 @@ static int process_opt(void *context, int ch, char 
> *optarg)
>   case 'X':
>    p->proxy_join = strtoul(optarg, NULL, 0);
>    break;
> + case 22 :
> +  p->swir_lid = (ib_net16_t) strtoul(optarg, NULL, 0);
> + break;

As above no need for the additional option.

>    default:
>   return -1;
>   }
> @@ -1584,6 +1641,7 @@ int main(int argc, char **argv)
>    {"x", 'x', 0, NULL, "get LinkRecord info"},
>    {"c", 'c', 0, NULL, "get the SA's class port info"},
>    {"S", 'S', 0, NULL, "get ServiceRecord info"},
> +  {"W", 'W', 0, NULL, "get SwitchInfoRecord"},
>    {"I", 'I', 0, NULL, "get InformInfoRecord (subscription) info"},
>    {"list", 'D', 0, NULL, "the node desc of the CA's"},
>    {"src-to-dst", 1, 1, "<src:dst>", "get a PathRecord for"
> @@ -1633,6 +1691,9 @@ int main(int argc, char **argv)
>    {"scope", 21, 1, NULL, "Scope (MCMemberRecord)"},
>    {"join_state", 'J', 1, NULL, "Join state (MCMemberRecord)"},
>    {"proxy_join", 'X', 1, NULL, "Proxy join (MCMemberRecord)"},
> +  {"swir_lid", 22, 1, NULL,
> +  "switchInfo_lid (SwitchInfoRecord)"
> + " LID of switch port 0"},

As above no need for the additional option.

Thanks,
Ira

>    {0}
>    };
>  
> -- 
> 1.7.1
>  


-- 
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] infiniband-diags/saquery.c: switchinfo support added
       [not found]     ` <20130221100900.87b509d834fc0adc21b6f68b-i2BcT+NCU+M@public.gmane.org>
@ 2013-02-21 18:33       ` Ira Weiny
       [not found]         ` <WC20130224082247.780048@asaltech.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Ira Weiny @ 2013-02-21 18:33 UTC (permalink / raw)
  To: Ira Weiny
  Cc: Husam Kahalah, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Thu, 21 Feb 2013 10:09:00 -0800
Ira Weiny <weiny2-i2BcT+NCU+M@public.gmane.org> wrote:

[snip]

> > + ib_net16_t swir_lid;
> 
> We don't need this field or lid option.  Other records simply have an optional parameter to specify the lid.
> 
> The usage should be:
> 
> SwitchRecord [lid]
> 

Sorry I meant "SwitchInfoRecord" or SWIR.

Ira

[snip]
--
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	[flat|nested] 6+ messages in thread

* Re: [PATCH] infiniband-diags/saquery.c: switchinfo support added
       [not found]           ` <WC20130224082247.780048-DMD6N21cJuFWk0Htik3J/w@public.gmane.org>
@ 2013-02-25  1:34             ` Ira Weiny
  0 siblings, 0 replies; 6+ messages in thread
From: Ira Weiny @ 2013-02-25  1:34 UTC (permalink / raw)
  To: Husam Kahalah
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Sun, 24 Feb 2013 10:22:47 +0200
"Husam Kahalah" <HKahalah-DMD6N21cJuFWk0Htik3J/w@public.gmane.org> wrote:

> Thank you for your time, I have the following notes:
> I plan to add support for more records other than switchInfoRecord like 
> smInfo, multipath, nodeInfo

That would be great!

> I plan also to add component filter to those records attributes in the same 
> way that pathInfo and MCR were implemented, this is the reason why I started 
> adding attributes to query_params structure 
> I'am not talking about RID(record identifier) attributes only, but also 
> about other attributes that may differ between records.
> If it is available to add to query_params structure in that way let me know 
> , otherwise I will add just RID attributes in the suggested way.
> 

I am not against adding fields to query_params.  However, we have a standard way to specify the RID components like LID which should be followed.

If you need new components to be specified for new attributes it is fine to add them to query_params.  That said, any components which already have options should be overloaded; for example MultiPathRecord.SL should use the --sl option.

Does this make sense?

Thanks,
Ira

> 
> -----Original Message-----
> From: Ira Weiny <weiny2-i2BcT+NCU+M@public.gmane.org>
> To: Ira Weiny <weiny2-i2BcT+NCU+M@public.gmane.org>
> Cc: "Husam Kahalah" <HKahalah-DMD6N21cJuFWk0Htik3J/w@public.gmane.org>, linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, 
> linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Date: Thu, 21 Feb 2013 10:33:44 -0800
> Subject: Re: [PATCH] infiniband-diags/saquery.c: switchinfo support added
> 
> On Thu, 21 Feb 2013 10:09:00 -0800
> Ira Weiny <weiny2-i2BcT+NCU+M@public.gmane.org> wrote:
> 
> [snip]
> 
> > > + ib_net16_t swir_lid;
> >
> > We don't need this field or lid option.  Other records simply have an 
> optional parameter to specify the lid.
> >
> > The usage should be:
> >
> > SwitchRecord [lid]
> >
> 
> Sorry I meant "SwitchInfoRecord" or SWIR.
> 
> Ira
> 
> [snip]
> --
> 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


-- 
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH]  infiniband-diags/saquery.c: switchinfo support added
       [not found] <WC20130228061138.140078@asaltech.com>
@ 2013-03-01  1:37 ` Ira Weiny
  0 siblings, 0 replies; 6+ messages in thread
From: Ira Weiny @ 2013-03-01  1:37 UTC (permalink / raw)
  To: Husam Kahalah; +Cc: linux-rdma, linux-kernel

Your mailer line wrapped the patch.  Could you resend.

Also, could you add this to doc/rst/saquery.8.in.rst

Thanks,
Ira

On Thu, 28 Feb 2013 08:11:38 +0200
"Husam Kahalah" <HKahalah@asaltech.com> wrote:

> From d61f2580b829fa2fc56aea15bd98ef3a607d9aba Mon Sep 17 00:00:00 2001
> 
> From: Husam kahalah <hkahalah@asaltech.com>
> Date: Mon, 25 Feb 2013 10:53:25 +0200
> Subject: [PATCH]  infiniband-diags/saquery.c: switchinfo support added
> 
> ---
>  src/saquery.c |   55 
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 55 insertions(+), 0 deletions(-)
> 
> diff --git a/src/saquery.c b/src/saquery.c
> index d31d77d..6390bcd 100644
> --- a/src/saquery.c
> +++ b/src/saquery.c
> @@ -481,6 +481,41 @@ static void dump_service_record(void *data)
>          cl_ntoh64(p_sr->service_data64[1]));
>  }
> 
> +static void dump_switch_info_record(void *data)
> +{
> +  ib_switch_info_record_t *p_sir = data;
> +
> +  printf("SwitchInfoRecord dump:\n"
> +        "\t\tRID\n"
> +        "\t\tlid.....................%u\n"
> +        "\t\tSwitchInfo dump:\n"
> +        "\t\tlin_cap.................0x%X\n"
> +        "\t\trand_cap................0x%X\n"
> +        "\t\tmcast_cap...............0x%X\n"
> +        "\t\tlin_top.................0x%X\n"
> +        "\t\tdef_port................%u\n"
> +        "\t\tdef_mcast_pri_port......%u\n"
> +        "\t\tdef_mcast_not_port......%u\n"
> +        "\t\tlife_state..............%u\n"
> +        "\t\tlids_per_port...........0x%X\n"
> +        "\t\tenforce_cap.............0x%X\n"
> +        "\t\tflags...................%u\n"
> +        "\t\tmcast_top...............0x%X\n",
> +        cl_ntoh16(p_sir->lid),
> +        cl_ntoh16(p_sir->switch_info.lin_cap),
> +        cl_ntoh16(p_sir->switch_info.rand_cap),
> +        cl_ntoh16(p_sir->switch_info.mcast_cap),
> +        cl_ntoh16(p_sir->switch_info.lin_top),
> +        p_sir->switch_info.def_port,
> +        p_sir->switch_info.def_mcast_pri_port,
> +        p_sir->switch_info.def_mcast_not_port,
> +        p_sir->switch_info.life_state,
> +        cl_ntoh16(p_sir->switch_info.lids_per_port),
> +        cl_ntoh16(p_sir->switch_info.enforce_cap),
> +        p_sir->switch_info.flags,
> +        cl_ntoh16(p_sir->switch_info.mcast_top));
> +}
> +
>  static void dump_inform_info_record(void *data)
>  {
>   char gid_str[INET6_ADDRSTRLEN];
> @@ -1150,6 +1185,24 @@ static int query_service_records(const struct 
> query_cmd *q, struct sa_handle * h
>    dump_service_record);
>  }
> 
> +static int query_switchinfo_records(const struct query_cmd *q,
> + struct sa_handle * h, struct query_params *p,
> + int argc, char *argv[])
> +{
> +  ib_switch_info_record_t swir;
> + ib_net64_t comp_mask = 0;
> + int lid = 0;
> +
> + if (argc > 0)
> +  parse_lid_and_ports(h, argv[0], &lid, NULL, NULL);
> +
> +  memset(&swir, 0, sizeof(swir));
> +  CHECK_AND_SET_VAL(lid, 16, 0, swir.lid, SWIR, LID);
> +
> + return get_and_dump_any_records(h, IB_SA_ATTR_SWITCHINFORECORD, 0, 
> comp_mask,
> + &swir, sizeof(swir), dump_switch_info_record);
> +}
> +
>  static int query_inform_info_records(const struct query_cmd *q,
>       struct sa_handle * h, struct query_params *p,
>       int argc, char *argv[])
> @@ -1342,6 +1395,8 @@ static const struct query_cmd query_cmds[] = {
>    "[[mlid]/[position]/[block]]", query_mft_records},
>    {"GUIDInfoRecord", "GIR", IB_SA_ATTR_GUIDINFORECORD,
>    "[[lid]/[block]]", query_guidinfo_records},
> +  {"SwitchInfoRecord", "SWIR", IB_SA_ATTR_SWITCHINFORECORD,
> +  "[lid]", query_switchinfo_records},
>    {0}
>  };
> 
> -- 
> 1.7.1


-- 
Ira Weiny
Member of Technical Staff
Lawrence Livermore National Lab
925-423-8008
weiny2@llnl.gov

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH]  infiniband-diags/saquery.c: switchinfo support added
@ 2013-03-27 13:10 Husam Kahalah
       [not found] ` <5152EFB2.9040809-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Husam Kahalah @ 2013-03-27 13:10 UTC (permalink / raw)
  To: ira.weiny-ral2JQCrhuEAvxtiuMwx3w,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA

 From d61f2580b829fa2fc56aea15bd98ef3a607d9aba Mon Sep 17 00:00:00 2001
From: Husam kahalah <hkahalah-DMD6N21cJuFWk0Htik3J/w@public.gmane.org>
Date: Mon, 25 Feb 2013 10:53:25 +0200
Subject: [PATCH]  infiniband-diags/saquery.c: switchinfo support added

---
  src/saquery.c |   55 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1 files changed, 55 insertions(+), 0 deletions(-)

diff --git a/src/saquery.c b/src/saquery.c
index d31d77d..6390bcd 100644
--- a/src/saquery.c
+++ b/src/saquery.c
@@ -481,6 +481,41 @@ static void dump_service_record(void *data)
             cl_ntoh64(p_sr->service_data64[1]));
  }

+static void dump_switch_info_record(void *data)
+{
+    ib_switch_info_record_t *p_sir = data;
+
+    printf("SwitchInfoRecord dump:\n"
+           "\t\tRID\n"
+           "\t\tlid.....................%u\n"
+           "\t\tSwitchInfo dump:\n"
+           "\t\tlin_cap.................0x%X\n"
+           "\t\trand_cap................0x%X\n"
+           "\t\tmcast_cap...............0x%X\n"
+           "\t\tlin_top.................0x%X\n"
+           "\t\tdef_port................%u\n"
+           "\t\tdef_mcast_pri_port......%u\n"
+           "\t\tdef_mcast_not_port......%u\n"
+           "\t\tlife_state..............%u\n"
+           "\t\tlids_per_port...........0x%X\n"
+           "\t\tenforce_cap.............0x%X\n"
+           "\t\tflags...................%u\n"
+           "\t\tmcast_top...............0x%X\n",
+           cl_ntoh16(p_sir->lid),
+           cl_ntoh16(p_sir->switch_info.lin_cap),
+           cl_ntoh16(p_sir->switch_info.rand_cap),
+           cl_ntoh16(p_sir->switch_info.mcast_cap),
+           cl_ntoh16(p_sir->switch_info.lin_top),
+           p_sir->switch_info.def_port,
+           p_sir->switch_info.def_mcast_pri_port,
+           p_sir->switch_info.def_mcast_not_port,
+           p_sir->switch_info.life_state,
+           cl_ntoh16(p_sir->switch_info.lids_per_port),
+           cl_ntoh16(p_sir->switch_info.enforce_cap),
+           p_sir->switch_info.flags,
+           cl_ntoh16(p_sir->switch_info.mcast_top));
+}
+
  static void dump_inform_info_record(void *data)
  {
      char gid_str[INET6_ADDRSTRLEN];
@@ -1150,6 +1185,24 @@ static int query_service_records(const struct 
query_cmd *q, struct sa_handle * h
                      dump_service_record);
  }

+static int query_switchinfo_records(const struct query_cmd *q,
+                struct sa_handle * h, struct query_params *p,
+                int argc, char *argv[])
+{
+    ib_switch_info_record_t swir;
+    ib_net64_t comp_mask = 0;
+    int lid = 0;
+
+    if (argc > 0)
+        parse_lid_and_ports(h, argv[0], &lid, NULL, NULL);
+
+    memset(&swir, 0, sizeof(swir));
+    CHECK_AND_SET_VAL(lid, 16, 0, swir.lid, SWIR, LID);
+
+    return get_and_dump_any_records(h, IB_SA_ATTR_SWITCHINFORECORD, 0, 
comp_mask,
+                    &swir, sizeof(swir), dump_switch_info_record);
+}
+
  static int query_inform_info_records(const struct query_cmd *q,
                      struct sa_handle * h, struct query_params *p,
                      int argc, char *argv[])
@@ -1342,6 +1395,8 @@ static const struct query_cmd query_cmds[] = {
       "[[mlid]/[position]/[block]]", query_mft_records},
      {"GUIDInfoRecord", "GIR", IB_SA_ATTR_GUIDINFORECORD,
       "[[lid]/[block]]", query_guidinfo_records},
+    {"SwitchInfoRecord", "SWIR", IB_SA_ATTR_SWITCHINFORECORD,
+     "[lid]", query_switchinfo_records},
      {0}
  };

-- 
1.7.1

--
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] 6+ messages in thread

* Re: [PATCH] infiniband-diags/saquery.c: switchinfo support added
       [not found] ` <5152EFB2.9040809-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
@ 2013-03-27 13:21   ` Denis Kirjanov
  0 siblings, 0 replies; 6+ messages in thread
From: Denis Kirjanov @ 2013-03-27 13:21 UTC (permalink / raw)
  To: Husam Kahalah
  Cc: ira.weiny-ral2JQCrhuEAvxtiuMwx3w,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA

You have missed Signed-off-by ;)

On 3/27/13, Husam Kahalah <husamkahalah-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:
>  From d61f2580b829fa2fc56aea15bd98ef3a607d9aba Mon Sep 17 00:00:00 2001
> From: Husam kahalah <hkahalah-DMD6N21cJuFWk0Htik3J/w@public.gmane.org>
> Date: Mon, 25 Feb 2013 10:53:25 +0200
> Subject: [PATCH]  infiniband-diags/saquery.c: switchinfo support added
>
> ---
>   src/saquery.c |   55
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>   1 files changed, 55 insertions(+), 0 deletions(-)
>
> diff --git a/src/saquery.c b/src/saquery.c
> index d31d77d..6390bcd 100644
> --- a/src/saquery.c
> +++ b/src/saquery.c
> @@ -481,6 +481,41 @@ static void dump_service_record(void *data)
>              cl_ntoh64(p_sr->service_data64[1]));
>   }
>
> +static void dump_switch_info_record(void *data)
> +{
> +    ib_switch_info_record_t *p_sir = data;
> +
> +    printf("SwitchInfoRecord dump:\n"
> +           "\t\tRID\n"
> +           "\t\tlid.....................%u\n"
> +           "\t\tSwitchInfo dump:\n"
> +           "\t\tlin_cap.................0x%X\n"
> +           "\t\trand_cap................0x%X\n"
> +           "\t\tmcast_cap...............0x%X\n"
> +           "\t\tlin_top.................0x%X\n"
> +           "\t\tdef_port................%u\n"
> +           "\t\tdef_mcast_pri_port......%u\n"
> +           "\t\tdef_mcast_not_port......%u\n"
> +           "\t\tlife_state..............%u\n"
> +           "\t\tlids_per_port...........0x%X\n"
> +           "\t\tenforce_cap.............0x%X\n"
> +           "\t\tflags...................%u\n"
> +           "\t\tmcast_top...............0x%X\n",
> +           cl_ntoh16(p_sir->lid),
> +           cl_ntoh16(p_sir->switch_info.lin_cap),
> +           cl_ntoh16(p_sir->switch_info.rand_cap),
> +           cl_ntoh16(p_sir->switch_info.mcast_cap),
> +           cl_ntoh16(p_sir->switch_info.lin_top),
> +           p_sir->switch_info.def_port,
> +           p_sir->switch_info.def_mcast_pri_port,
> +           p_sir->switch_info.def_mcast_not_port,
> +           p_sir->switch_info.life_state,
> +           cl_ntoh16(p_sir->switch_info.lids_per_port),
> +           cl_ntoh16(p_sir->switch_info.enforce_cap),
> +           p_sir->switch_info.flags,
> +           cl_ntoh16(p_sir->switch_info.mcast_top));
> +}
> +
>   static void dump_inform_info_record(void *data)
>   {
>       char gid_str[INET6_ADDRSTRLEN];
> @@ -1150,6 +1185,24 @@ static int query_service_records(const struct
> query_cmd *q, struct sa_handle * h
>                       dump_service_record);
>   }
>
> +static int query_switchinfo_records(const struct query_cmd *q,
> +                struct sa_handle * h, struct query_params *p,
> +                int argc, char *argv[])
> +{
> +    ib_switch_info_record_t swir;
> +    ib_net64_t comp_mask = 0;
> +    int lid = 0;
> +
> +    if (argc > 0)
> +        parse_lid_and_ports(h, argv[0], &lid, NULL, NULL);
> +
> +    memset(&swir, 0, sizeof(swir));
> +    CHECK_AND_SET_VAL(lid, 16, 0, swir.lid, SWIR, LID);
> +
> +    return get_and_dump_any_records(h, IB_SA_ATTR_SWITCHINFORECORD, 0,
> comp_mask,
> +                    &swir, sizeof(swir), dump_switch_info_record);
> +}
> +
>   static int query_inform_info_records(const struct query_cmd *q,
>                       struct sa_handle * h, struct query_params *p,
>                       int argc, char *argv[])
> @@ -1342,6 +1395,8 @@ static const struct query_cmd query_cmds[] = {
>        "[[mlid]/[position]/[block]]", query_mft_records},
>       {"GUIDInfoRecord", "GIR", IB_SA_ATTR_GUIDINFORECORD,
>        "[[lid]/[block]]", query_guidinfo_records},
> +    {"SwitchInfoRecord", "SWIR", IB_SA_ATTR_SWITCHINFORECORD,
> +     "[lid]", query_switchinfo_records},
>       {0}
>   };
>
> --
> 1.7.1
>
> --
> 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
>
--
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	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-03-27 13:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-27 13:10 [PATCH] infiniband-diags/saquery.c: switchinfo support added Husam Kahalah
     [not found] ` <5152EFB2.9040809-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
2013-03-27 13:21   ` Denis Kirjanov
     [not found] <WC20130228061138.140078@asaltech.com>
2013-03-01  1:37 ` Ira Weiny
     [not found] <WC20130221094946.530170@asaltech.com>
     [not found] ` <WC20130221094946.530170-DMD6N21cJuFWk0Htik3J/w@public.gmane.org>
2013-02-21 18:09   ` Ira Weiny
     [not found]     ` <20130221100900.87b509d834fc0adc21b6f68b-i2BcT+NCU+M@public.gmane.org>
2013-02-21 18:33       ` Ira Weiny
     [not found]         ` <WC20130224082247.780048@asaltech.com>
     [not found]           ` <WC20130224082247.780048-DMD6N21cJuFWk0Htik3J/w@public.gmane.org>
2013-02-25  1:34             ` Ira Weiny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox