infiniband-diags/saquery.c: switchinfo support added
PATCH 1/1 infiniband-diags/saquery.c: switchinfo support added
Added support to filter SwitchInfoRecords by switch LID
--- src/saquery.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 55 insertions(+), 0 deletions(-)
src/saquery.c +55 -0
@@ -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} };
Signature · 8 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Husam,
I had to fix a couple of line wraps in your mailer (see below). But even after that the patch does not apply.
13:10:37 > git am \[PATCH_v1\]__infiniband-diags_saquery.c__switchinfo_support_added.eml
Applying: infiniband-diags/saquery.c: switchinfo support added
error: patch failed: src/saquery.c:481
error: src/saquery.c: patch does not apply
Patch failed at 0001 infiniband-diags/saquery.c: switchinfo support added
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".
iweiny iqa-136 ~/dev/management/infiniband-diags
13:10:44 > patch -p 1 < \[PATCH_v1\]__infiniband-diags_saquery.c__switchinfo_support_added.eml patching file src/saquery.c
Hunk #1 FAILED at 481.
Hunk #2 FAILED at 1150.
Hunk #3 FAILED at 1342.
3 out of 3 hunks FAILED -- saving rejects to file src/saquery.c.rej
Could you ensure this is based on the current master branch?
Quoted 57 lines · On Sun, 31 Mar 2013 16:29:17 +0300 Husam Kahalah…
Added support to filter SwitchInfoRecords by switch LID
--- src/saquery.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 55 insertions(+), 0 deletions(-)src/saquery.c +35
-0@@ -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
Quoted 1 line
query_cmd*q, structsa_handle* h
Line wrap here failed to apply.
Quoted 18 lines
dump_service_record);}
src/saquery.c +15
-0+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,
Quoted 1 line
comp_mask,
Line wrap here failed to apply.
Thanks,
Ira
Quoted 24 lines
src/saquery.c +5
-0+ &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} };Signature · 8 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 5 lines
Ira Weiny <[email protected]> -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html