Skip to content

Commit 6cd285e

Browse files
Paul Woodigaw
authored andcommitted
ocp-telemetry-decode: fix ascii string lookup
Lookup ascii string in VU Event Identifier String Table for vendor unique event classes. Fix typo. Signed-off-by: Paul Wood <[email protected]>
1 parent b7822bd commit 6cd285e

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

plugins/ocp/ocp-telemetry-decode.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -489,9 +489,9 @@ int get_telemetry_das_offset_and_size(
489489
return 0;
490490
}
491491

492-
int get_static_id_ascii_string(int identifier, char *description)
492+
int get_statistic_id_ascii_string(int identifier, char *description)
493493
{
494-
if (pstring_buffer == NULL)
494+
if (!pstring_buffer || !description)
495495
return -1;
496496

497497
struct nvme_ocp_telemetry_string_header *pocp_ts_header =
@@ -522,16 +522,17 @@ int get_static_id_ascii_string(int identifier, char *description)
522522
memcpy(description, pdescription,
523523
peach_statistic_entry->ascii_id_length + 1);
524524

525-
// If ASCII string isn't found, see in our internal Map
526-
// for 2.5 Spec defined strings (id < 0x1D).
527-
if ((description == NULL) && (identifier < 0x1D))
528-
memcpy(description,
529-
statistic_identifiers_map[identifier].description,
530-
peach_statistic_entry->ascii_id_length + 1);
531525
return 0;
532526
}
533527
}
534528

529+
// If ASCII string isn't found, see in our internal Map
530+
// for 2.5 Spec defined strings
531+
if (identifier <= 0x1D) {
532+
strcpy(description, statistic_identifiers_map[identifier].description);
533+
return 0;
534+
}
535+
535536
return -1;
536537
}
537538

@@ -629,10 +630,10 @@ int parse_ocp_telemetry_string_log(int event_fifo_num, int identifier, int debug
629630
}
630631

631632
if (string_table == STATISTICS_IDENTIFIER_STRING)
632-
get_static_id_ascii_string(identifier, description);
633-
else if (string_table == EVENT_STRING)
633+
get_statistic_id_ascii_string(identifier, description);
634+
else if (string_table == EVENT_STRING && debug_event_class < 0x80)
634635
get_event_id_ascii_string(identifier, debug_event_class, description);
635-
else if (string_table == VU_EVENT_STRING)
636+
else if (string_table == VU_EVENT_STRING || debug_event_class >= 0x80)
636637
get_vu_event_id_ascii_string(identifier, debug_event_class, description);
637638

638639
return 0;

plugins/ocp/ocp-telemetry-decode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,7 @@ int print_ocp_telemetry_json(struct ocp_telemetry_parse_options *options);
11741174
*
11751175
* @return 0 success
11761176
*/
1177-
int get_static_id_ascii_string(int identifier, char *description);
1177+
int get_statistic_id_ascii_string(int identifier, char *description);
11781178

11791179
/**
11801180
* @brief gets event id ascii string

0 commit comments

Comments
 (0)