infiniband-diags/src/saquery.c: New option to saquery InformInfoRecord (IIR)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 infiniband-diags/src/saquery.c: New option to saquery InformInfoRecord (IIR)
From: Dan Ben Yosef <danby-VPRAkNaXOzVWk0Htik3J/[email protected]>
Add the option to display the InformInfoRecord by SubscriberGid
--- src/saquery.c | 30 ++++++++++++++++++++++++++---- 1 files changed, 26 insertions(+), 4 deletions(-)
src/saquery.c +26 -4
@@ -841,6 +841,16 @@ static uint16_t get_lid(struct sa_handle * h, const char *name)return rc_lid; } +static int parse_iir_subscriber_gid (char *str,ib_inform_info_record_t *ir) +{ +int rc =inet_pton (AF_INET6 ,str,&(ir->subscriber_gid.raw)); +if (rc <1 ){ +fprintf (stderr,"Failed to find InformInfoRecord SubscriberGID for \"%s\"\n" ,str); +exit (EINVAL ); + } +return rc; +} +static int parse_lid_and_ports (struct sa_handle * h,char *str,int *lid,int *port1,int *port2) {
@@ -1140,12 +1150,24 @@ static int query_service_records(const struct query_cmd *q, struct sa_handle * h dump_service_record); } -static int query_informinfo_records (const struct query_cmd *q, +static int query_inform_info_records (const struct query_cmd *q,struct sa_handle * h,struct query_params *p,int argc,char *argv[]) { -return get_and_dump_all_records (h,IB_SA_ATTR_INFORMINFORECORD , - dump_inform_info_record); +int rc =0 ; +ib_inform_info_record_t ir; +ib_net64_t comp_mask =0 ; +memset (&ir,0 ,sizeof (ir)); + +if (argc >0 ) { + comp_mask =IB_IIR_COMPMASK_SUBSCRIBERGID ; +if (rc =parse_iir_subscriber_gid (argv[0 ], &ir) <1 ) +return rc; + } + +return get_and_dump_any_records (h,IB_SA_ATTR_INFORMINFORECORD ,0 , comp_mask, + &ir,sizeof (ir), dump_inform_info_record); + } static int query_link_records(const struct query_cmd *q, struct sa_handle * h,
@@ -1305,7 +1327,7 @@ static const struct query_cmd query_cmds[] = { {"VLArbitrationTableRecord" ,"VLAR" ,IB_SA_ATTR_VLARBTABLERECORD , "[[lid]/[port]/[block]]", query_vlarb_records}, {"InformInfoRecord", "IIR", IB_SA_ATTR_INFORMINFORECORD, - NULL, query_informinfo_records}, + "[subscriber_gid]", query_inform_info_records}, {"LinkRecord", "LR", IB_SA_ATTR_LINKRECORD, "[[from_lid]/[from_port]] [[to_lid]/[to_port]]", query_link_records}, {"ServiceRecord", "SR", IB_SA_ATTR_SERVICERECORD,
Signature · 6 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
A message that is not in the archive (sent off-list or not yet received): 1350380725-31221-1-git-send-email-danby-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org
Sorry for the delay on this, comments below.
Quoted 14 lines · On Tue, 16 Oct 2012 11:45:25 +0200 Dan Ben Yosef…
From: Dan Ben Yosef <danby-VPRAkNaXOzVWk0Htik3J/[email protected]>
Add the option to display the InformInfoRecord by SubscriberGid
--- src/saquery.c | 30 ++++++++++++++++++++++++++---- 1 files changed, 26 insertions(+), 4 deletions(-)src/saquery.c +0
-0
src/saquery.c static uint16_t get_lid(struct sa_handle * h, const char *name) · line 848
Quoted 8 lines
src/saquery.c +5
-0@@ -841,6 +841,16 @@ static uint16_t get_lid(struct sa_handle * h, const char *name)return rc_lid; } +static int parse_iir_subscriber_gid (char *str,ib_inform_info_record_t *ir) +{ +int rc =inet_pton (AF_INET6 ,str,&(ir->subscriber_gid.raw)); +if (rc <1 ){ +fprintf (stderr,"Failed to find InformInfoRecord SubscriberGID for \"%s\"\n" ,str);
I changed the error message to:
fprintf(stderr, "Invalid SubscriberGID specified: \"%s\"\n",str);
Quoted 17 lines
src/saquery.c +6
-1+exit (EINVAL ); + } +return rc; +} +static int parse_lid_and_ports (struct sa_handle * h,char *str,int *lid,int *port1,int *port2) {@@ -1140,12 +1150,24 @@ static int query_service_records(const struct query_cmd *q, struct sa_handle * h dump_service_record); } -static int query_informinfo_records (const struct query_cmd *q, +static int query_inform_info_records (const struct query_cmd *q,struct sa_handle * h,struct query_params *p,int argc,char *argv[]) {
src/saquery.c static int query_service_records(const struct query_cmd *q, struct sa_handle * h · line 1164
Quoted 10 lines
src/saquery.c +8
-2-return get_and_dump_all_records (h,IB_SA_ATTR_INFORMINFORECORD , - dump_inform_info_record); +int rc =0 ; +ib_inform_info_record_t ir; +ib_net64_t comp_mask =0 ; +memset (&ir,0 ,sizeof (ir)); + +if (argc >0 ) { + comp_mask =IB_IIR_COMPMASK_SUBSCRIBERGID ; +if (rc =parse_iir_subscriber_gid (argv[0 ], &ir) <1 )
And I added parens around the assignment here.
Applied with changes, Thanks,
Ira
Quoted 25 lines
src/saquery.c +7
-1+return rc; + } + +return get_and_dump_any_records (h,IB_SA_ATTR_INFORMINFORECORD ,0 , comp_mask, + &ir,sizeof (ir), dump_inform_info_record); + } static int query_link_records(const struct query_cmd *q, struct sa_handle * h,@@ -1305,7 +1327,7 @@ static const struct query_cmd query_cmds[] = { {"VLArbitrationTableRecord" ,"VLAR" ,IB_SA_ATTR_VLARBTABLERECORD , "[[lid]/[port]/[block]]", query_vlarb_records}, {"InformInfoRecord", "IIR", IB_SA_ATTR_INFORMINFORECORD, - NULL, query_informinfo_records}, + "[subscriber_gid]", query_inform_info_records}, {"LinkRecord", "LR", IB_SA_ATTR_LINKRECORD, "[[from_lid]/[from_port]] [[to_lid]/[to_port]]", query_link_records}, {"ServiceRecord", "SR", IB_SA_ATTR_SERVICERECORD,Signature · 6 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 · 9 lines
Ira Weiny Member of Technical Staff Lawrence Livermore National Lab 925-423-8008 [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