infiniband-diags/saquery: Report SA MAD Class specific status.
PATCH 1/1 infiniband-diags/saquery: Report SA MAD Class specific status.
Report SA MAD Class specific status.
Fixes wrong error report for SA query status.
--- infiniband-diags/src/saquery.c | 41 ++++++++++++++++++++++++++++++++++++--- 1 files changed, 37 insertions(+), 4 deletions(-)
infiniband-diags/src/saquery.c +37 -4
@@ -124,6 +124,41 @@ int requested_lid_flag = 0;uint64_t requested_guid =0 ;int requested_guid_flag =0 ; +#define SA_ERR_UNKNOWN IB_SA_MAD_STATUS_PRIO_SUGGESTED + +const char *ib_sa_error_str[] = { +"SA_NO_ERROR" , +"SA_ERR_NO_RESOURCES" , +"SA_ERR_REQ_INVALID" , +"SA_ERR_NO_RECORDS" , +"SA_ERR_TOO_MANY_RECORDS" , +"SA_ERR_REQ_INVALID_GID" , +"SA_ERR_REQ_INSUFFICIENT_COMPONENTS" , +"SA_ERR_REQ_DENIED" , +"SA_ERR_STATUS_PRIO_SUGGESTED" , +"SA_ERR_UNKNOWN" +}; + +static inline const char *ib_sa_err_str(IN uint8_t status) +{ +if (status >SA_ERR_UNKNOWN ) + status =SA_ERR_UNKNOWN ; +return (ib_sa_error_str[status]); +} + +static inline void report_err (int status) +{ +int st = status &0xff ; + +if (st) +fprintf (stderr,"ERROR: Query result returned: %s (0x%x)\n" , +ib_get_err_str (st), status); + st = status >>8 ; +if (st) +fprintf (stderr,"ERROR: Query result returned: %s (0x%x)\n" , +ib_sa_err_str (st), status); +} +static int sa_query (struct bind_handle *h,uint8_t method,uint16_t attr,uint32_t mod,uint64_t comp_mask,uint64_t sm_key,void *data)
@@ -794,8 +829,7 @@ static int get_any_records(bind_handle_t h, }if (result.status !=IB_SUCCESS ) { -fprintf (stderr,"Query result returned: %s\n" , -ib_get_err_str (result.status)); +report_err (result.status);return result.status; }
@@ -1009,8 +1043,7 @@ static int get_print_class_port_info(bind_handle_t h)return ret; }if (result.status !=IB_SUCCESS ) { -fprintf (stderr,"ERROR: Query result returned: %s\n" , -ib_get_err_str (result.status)); +report_err (result.status);return (result.status); }dump_results (&result, dump_class_port_info);
Signature · 6 lines
1.5.5 -- 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): [email protected]
Quoted 3 lines · Eli Dorfman (Voltaire)
Report SA MAD Class specific status.
Fixes wrong error report for SA query status.
I agree with patch, but one comment is below.
Quoted 37 lines
--- infiniband-diags/src/saquery.c | 41 ++++++++++++++++++++++++++++++++++++--- 1 files changed, 37 insertions(+), 4 deletions(-)infiniband-diags/src/saquery.c +23
-0@@ -124,6 +124,41 @@ int requested_lid_flag = 0;uint64_t requested_guid =0 ;int requested_guid_flag =0 ; +#define SA_ERR_UNKNOWN IB_SA_MAD_STATUS_PRIO_SUGGESTED + +const char *ib_sa_error_str[] = { +"SA_NO_ERROR" , +"SA_ERR_NO_RESOURCES" , +"SA_ERR_REQ_INVALID" , +"SA_ERR_NO_RECORDS" , +"SA_ERR_TOO_MANY_RECORDS" , +"SA_ERR_REQ_INVALID_GID" , +"SA_ERR_REQ_INSUFFICIENT_COMPONENTS" , +"SA_ERR_REQ_DENIED" , +"SA_ERR_STATUS_PRIO_SUGGESTED" , +"SA_ERR_UNKNOWN" +}; + +static inline const char *ib_sa_err_str(IN uint8_t status) +{ +if (status >SA_ERR_UNKNOWN ) + status =SA_ERR_UNKNOWN ; +return (ib_sa_error_str[status]); +} + +static inline void report_err (int status)
infiniband-diags/src/saquery.c int requested_lid_flag = 0; · line 159
Quoted 10 lines
infiniband-diags/src/saquery.c +10
-0+{ +int st = status &0xff ; + +if (st) +fprintf (stderr,"ERROR: Query result returned: %s (0x%x)\n" , +ib_get_err_str (st), status); + st = status >>8 ; +if (st) +fprintf (stderr,"ERROR: Query result returned: %s (0x%x)\n" , +ib_sa_err_str (st), status);
Such two identical messages with different error strings seems confusing to me. Wouldn't it be better to merge it in a single line, like:
ERROR: Query result returned 0xNNNN: SM blah1 , SA blah2
(or similar), with making each part optional.
Sasha
Quoted 28 lines
infiniband-diags/src/saquery.c +4
-4+} +static int sa_query (struct bind_handle *h,uint8_t method,uint16_t attr,uint32_t mod,uint64_t comp_mask,uint64_t sm_key,void *data)@@ -794,8 +829,7 @@ static int get_any_records(bind_handle_t h, }if (result.status !=IB_SUCCESS ) { -fprintf (stderr,"Query result returned: %s\n" , -ib_get_err_str (result.status)); +report_err (result.status);return result.status; }@@ -1009,8 +1043,7 @@ static int get_print_class_port_info(bind_handle_t h)return ret; }if (result.status !=IB_SUCCESS ) { -fprintf (stderr,"ERROR: Query result returned: %s\n" , -ib_get_err_str (result.status)); +report_err (result.status);return (result.status); }dump_results (&result, dump_class_port_info);Signature · 1 line
1.5.5
--
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
Quoted 58 lines · Sasha Khapyorsky
Quoted 3 lines · Eli Dorfman (Voltaire)
Report SA MAD Class specific status.
Fixes wrong error report for SA query status.
I agree with patch, but one comment is below.
Quoted 36 lines
--- infiniband-diags/src/saquery.c | 41 ++++++++++++++++++++++++++++++++++++--- 1 files changed, 37 insertions(+), 4 deletions(-)infiniband-diags/src/saquery.c +23
-0@@ -124,6 +124,41 @@ int requested_lid_flag = 0;uint64_t requested_guid =0 ;int requested_guid_flag =0 ; +#define SA_ERR_UNKNOWN IB_SA_MAD_STATUS_PRIO_SUGGESTED + +const char *ib_sa_error_str[] = { +"SA_NO_ERROR" , +"SA_ERR_NO_RESOURCES" , +"SA_ERR_REQ_INVALID" , +"SA_ERR_NO_RECORDS" , +"SA_ERR_TOO_MANY_RECORDS" , +"SA_ERR_REQ_INVALID_GID" , +"SA_ERR_REQ_INSUFFICIENT_COMPONENTS" , +"SA_ERR_REQ_DENIED" , +"SA_ERR_STATUS_PRIO_SUGGESTED" , +"SA_ERR_UNKNOWN" +}; + +static inline const char *ib_sa_err_str(IN uint8_t status) +{ +if (status >SA_ERR_UNKNOWN ) + status =SA_ERR_UNKNOWN ; +return (ib_sa_error_str[status]); +} + +static inline void report_err (int status)infiniband-diags/src/saquery.c int requested_lid_flag = 0; · line 159
Quoted 10 lines
infiniband-diags/src/saquery.c +10
-0+{ +int st = status &0xff ; + +if (st) +fprintf (stderr,"ERROR: Query result returned: %s (0x%x)\n" , +ib_get_err_str (st), status); + st = status >>8 ; +if (st) +fprintf (stderr,"ERROR: Query result returned: %s (0x%x)\n" , +ib_sa_err_str (st), status);Such two identical messages with different error strings seems confusing to me. Wouldn't it be better to merge it in a single line, like:
Quoted 3 lines
ERROR: Query result returned 0xNNNN: SM blah1 , SA blah2(or similar), with making each part optional.
I agree.
Is it possible according to the spec to have both SM and SA (i don't think so)
Eli
Quoted 18 lines
Sasha
Quoted 15 lines
infiniband-diags/src/saquery.c +3
-2+} +static int sa_query (struct bind_handle *h,uint8_t method,uint16_t attr,uint32_t mod,uint64_t comp_mask,uint64_t sm_key,void *data)@@ -794,8 +829,7 @@ static int get_any_records(bind_handle_t h, }if (result.status !=IB_SUCCESS ) { -fprintf (stderr,"Query result returned: %s\n" , -ib_get_err_str (result.status)); +report_err (result.status);return result.status; }
Quoted 13 lines
Quoted 13 lines
infiniband-diags/src/saquery.c +1
-2@@ -1009,8 +1043,7 @@ static int get_print_class_port_info(bind_handle_t h)return ret; }if (result.status !=IB_SUCCESS ) { -fprintf (stderr,"ERROR: Query result returned: %s\n" , -ib_get_err_str (result.status)); +report_err (result.status);return (result.status); }dump_results (&result, dump_class_port_info);Signature · 1 line
1.5.5
--
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): [email protected]
Quoted 17 lines · Eli Dorfman (Voltaire)
Quoted 17 lines
infiniband-diags/src/saquery.c int requested_lid_flag = 0; · line 159
Quoted 12 lines
infiniband-diags/src/saquery.c +12
-0+ +static inline void report_err (int status) +{ +int st = status &0xff ; + +if (st) +fprintf (stderr,"ERROR: Query result returned: %s (0x%x)\n" , +ib_get_err_str (st), status); + st = status >>8 ; +if (st) +fprintf (stderr,"ERROR: Query result returned: %s (0x%x)\n" , +ib_sa_err_str (st), status);Such two identical messages with different error strings seems confusing to me. Wouldn't it be better to merge it in a single line, like:
Quoted 6 lines
Quoted 3 lines
ERROR: Query result returned 0xNNNN: SM blah1 , SA blah2(or similar), with making each part optional.
I agree.
Is it possible according to the spec to have both SM and SA (i don't think so)
I don't know really, don't remember that it stated somewhere in the spec explicitly. But even if so - it is slightly dangerous to assume in the code that this will never happen.
Sasha
--
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
Report SA MAD Class specific status.
In addition to SM status.
--- infiniband-diags/src/saquery.c | 45 ++++++++++++++++++++++++++++++++++++--- 1 files changed, 41 insertions(+), 4 deletions(-)
infiniband-diags/src/saquery.c +41 -4
@@ -124,6 +124,45 @@ int requested_lid_flag = 0;uint64_t requested_guid =0 ;int requested_guid_flag =0 ; +#define SA_ERR_UNKNOWN IB_SA_MAD_STATUS_PRIO_SUGGESTED + +const char *ib_sa_error_str[] = { +"SA_NO_ERROR" , +"SA_ERR_NO_RESOURCES" , +"SA_ERR_REQ_INVALID" , +"SA_ERR_NO_RECORDS" , +"SA_ERR_TOO_MANY_RECORDS" , +"SA_ERR_REQ_INVALID_GID" , +"SA_ERR_REQ_INSUFFICIENT_COMPONENTS" , +"SA_ERR_REQ_DENIED" , +"SA_ERR_STATUS_PRIO_SUGGESTED" , +"SA_ERR_UNKNOWN" +}; + +static inline const char *ib_sa_err_str(IN uint8_t status) +{ +if (status >SA_ERR_UNKNOWN ) + status =SA_ERR_UNKNOWN ; +return (ib_sa_error_str[status]); +} + +static inline void report_err (int status) +{ +int st = status &0xff ; +char sm_err_str[64 ] = {0 }; +char sa_err_str[64 ] = {0 }; + +if (st) +sprintf (sm_err_str," SM(%s)" ,ib_get_err_str (st)); + + st = status >>8 ; +if (st) +sprintf (sa_err_str," SA(%s)" ,ib_sa_err_str (st)); + +fprintf (stderr,"ERROR: Query result returned 0x%04x, %s%s\n" , + status, sm_err_str, sa_err_str); +} +static int sa_query (struct bind_handle *h,uint8_t method,uint16_t attr,uint32_t mod,uint64_t comp_mask,uint64_t sm_key,void *data)
@@ -794,8 +833,7 @@ static int get_any_records(bind_handle_t h, }if (result.status !=IB_SUCCESS ) { -fprintf (stderr,"Query result returned: %s\n" , -ib_get_err_str (result.status)); +report_err (result.status);return result.status; }
@@ -1009,8 +1047,7 @@ static int get_print_class_port_info(bind_handle_t h)return ret; }if (result.status !=IB_SUCCESS ) { -fprintf (stderr,"ERROR: Query result returned: %s\n" , -ib_get_err_str (result.status)); +report_err (result.status);return (result.status); }dump_results (&result, dump_class_port_info);
Signature · 6 lines
1.5.5 -- 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): [email protected]
Sasha Khapyorsky
AppliedQuoted 5 lines · Eli Dorfman (Voltaire)
Report SA MAD Class specific status.
In addition to SM status.
Applied. Thanks.
Sasha
--
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