-
Notifications
You must be signed in to change notification settings - Fork 710
Allow specifiying data areas 1-4 when generating telemetry logs #2755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -980,9 +980,10 @@ | |
|
|
||
| int status = 0; | ||
| unsigned int event_fifo_number = fifo_num + 1; | ||
| char *description = (char *)malloc((40 + 1) * sizeof(char)); | ||
| const size_t desc_size = sizeof(char) * (40 + 1); | ||
| char *description = (char *)malloc(desc_size); | ||
|
|
||
| memset(description, 0, sizeof(40)); | ||
| memset(description, 0, desc_size); | ||
|
|
||
| status = | ||
| parse_ocp_telemetry_string_log(event_fifo_number, 0, 0, EVENT_STRING, description); | ||
|
|
@@ -1202,9 +1203,9 @@ | |
| (event_fifo[fifo_no].event_fifo_size * SIZE_OF_DWORD); | ||
| __u8 *pfifo_start = NULL; | ||
|
|
||
| if (event_fifo[fifo_no].event_fifo_da == 1) | ||
| if (event_fifo[fifo_no].event_fifo_da == DATA_AREA_1) | ||
| pfifo_start = pda1_header_offset + fifo_offset; | ||
| else if (event_fifo[fifo_no].event_fifo_da == 2) | ||
| else if (event_fifo[fifo_no].event_fifo_da == DATA_AREA_2) | ||
| pfifo_start = pda2_offset + fifo_offset; | ||
| else { | ||
| nvme_show_error("Unsupported Data Area:[%d]", poffsets->data_area); | ||
|
|
@@ -1222,7 +1223,7 @@ | |
| } | ||
|
|
||
| if (pevent_fifos_object != NULL && root != NULL) { | ||
| const char *data_area = (poffsets->data_area == 1 ? STR_DA_1_EVENT_FIFO_INFO : | ||
| const char *data_area = (poffsets->data_area == DATA_AREA_1 ? STR_DA_1_EVENT_FIFO_INFO : | ||
| STR_DA_2_EVENT_FIFO_INFO); | ||
|
|
||
| json_object_add_value_array(root, data_area, pevent_fifos_object); | ||
|
|
@@ -1410,7 +1411,7 @@ | |
| __u8 *pstats_offset = NULL; | ||
| int parse_rc = 0; | ||
|
|
||
| if (poffsets->data_area == 1) { | ||
| if (poffsets->data_area == DATA_AREA_1) { | ||
| __u32 stats_da_1_start = *(__u32 *)(pda1_ocp_header_offset + | ||
| offsetof(struct nvme_ocp_header_in_da1, da1_statistic_start)); | ||
| __u32 stats_da_1_size = *(__u32 *)(pda1_ocp_header_offset + | ||
|
|
@@ -1422,7 +1423,7 @@ | |
|
|
||
| pstats_offset = pda1_ocp_header_offset + stats_da_1_start_dw; | ||
| statistics_size = stats_da_1_size_dw; | ||
| } else if (poffsets->data_area == 2) { | ||
| } else if (poffsets->data_area == DATA_AREA_2) { | ||
| __u32 stats_da_2_start = *(__u32 *)(pda1_ocp_header_offset + | ||
| offsetof(struct nvme_ocp_header_in_da1, da2_statistic_start)); | ||
| __u32 stats_da_2_size = *(__u32 *)(pda1_ocp_header_offset + | ||
|
|
@@ -1459,7 +1460,7 @@ | |
|
|
||
| if (root != NULL && pstats_array != NULL) { | ||
| const char *pdata_area = | ||
| (poffsets->data_area == 1 ? STR_DA_1_STATS : STR_DA_2_STATS); | ||
| (poffsets->data_area == DATA_AREA_1 ? STR_DA_1_STATS : STR_DA_2_STATS); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this also correct to use the data area 2 statistics for the data area 3 or 4?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Data area 3 and 4 are vendor-specific. This is just to ensure data area 2 also gets parsed. |
||
|
|
||
| json_object_add_value_array(root, pdata_area, pstats_array); | ||
| } | ||
|
|
@@ -1509,7 +1510,7 @@ | |
| //Set DA to 1 and get offsets | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Below seems better for the comment. Anyway a space needed after - //Set DA to 1 and get offsets
+ /* Set DA to 1 and get offsets */
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, I will change it. |
||
| struct nvme_ocp_telemetry_offsets offsets = { 0 }; | ||
|
|
||
| offsets.data_area = 1;// Default DA - DA1 | ||
| offsets.data_area = DATA_AREA_1;// Default DA - DA1 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Below seems better for the comment. - offsets.data_area = DATA_AREA_1;// Default DA - DA1
+ offsets.data_area = DATA_AREA_1; /* Default DA - DA1 */
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, will change it. |
||
|
|
||
| struct nvme_ocp_telemetry_common_header *ptelemetry_common_header = | ||
| (struct nvme_ocp_telemetry_common_header *) ptelemetry_buffer; | ||
|
|
@@ -1562,8 +1563,8 @@ | |
| } | ||
|
|
||
| //Set the DA to 2 | ||
| if (options->data_area == 2) { | ||
| offsets.data_area = 2; | ||
| if (options->data_area >= DATA_AREA_2) { | ||
| offsets.data_area = DATA_AREA_2; | ||
| fprintf(fp, STR_LINE); | ||
| fprintf(fp, "%s\n", STR_DA_2_STATS); | ||
| fprintf(fp, STR_LINE); | ||
|
|
@@ -1622,7 +1623,7 @@ | |
| //Set DA to 1 and get offsets | ||
| struct nvme_ocp_telemetry_offsets offsets = { 0 }; | ||
|
|
||
| offsets.data_area = 1; | ||
| offsets.data_area = DATA_AREA_1; | ||
|
|
||
| struct nvme_ocp_telemetry_common_header *ptelemetry_common_header = | ||
| (struct nvme_ocp_telemetry_common_header *) ptelemetry_buffer; | ||
|
|
@@ -1671,8 +1672,8 @@ | |
| } | ||
|
|
||
| //Set the DA to 2 | ||
| if (options->data_area == 2) { | ||
| offsets.data_area = 2; | ||
| if (options->data_area >= DATA_AREA_2) { | ||
| offsets.data_area = DATA_AREA_2; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not necessary to set DATA_AREA_3 or DATA_AREA_4 for the data area 3 and 4?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Data areas 3 and 4 are vendor specific. |
||
| printf(STR_LINE); | ||
| printf("%s\n", STR_DA_2_STATS); | ||
| printf(STR_LINE); | ||
|
|
@@ -1730,7 +1731,7 @@ | |
| struct nvme_ocp_telemetry_offsets offsets = { 0 }; | ||
|
|
||
| //Set DA to 1 and get offsets | ||
| offsets.data_area = 1; | ||
| offsets.data_area = DATA_AREA_1; | ||
| struct nvme_ocp_telemetry_common_header *ptelemetry_common_header = | ||
| (struct nvme_ocp_telemetry_common_header *) ptelemetry_buffer; | ||
|
|
||
|
|
@@ -1776,9 +1777,9 @@ | |
| return -1; | ||
| } | ||
|
|
||
| if (options->data_area == 2) { | ||
| if (options->data_area >= DATA_AREA_2) { | ||
| //Set the DA to 2 | ||
| offsets.data_area = 2; | ||
| offsets.data_area = DATA_AREA_2; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this also really expected for the data area 3 and 4?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Anyway if for the option data area 3 or 4 specified it is expected to use the data area 2 internally then the description comment needed I think.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I will add a comment. |
||
| //Data Area 2 Statistics | ||
| status = parse_statistics(root, &offsets, NULL); | ||
| if (status != 0) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the data area is 3 or 4 then the data area 2 event fifo information used but is it expected as correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also there are checkpatch.pl 2 warnings as below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the behavior makes sense. Is there a maintainer I can contact to confirm if this is the intended behavior? The specification is not very clear, but I based it on the original behavior where, if a user requested data area 2, they also received data areas 1 and 2 parsed into a human-readable format. Following that logic, I would expect data area 3 to include data areas 1 and 2 parsed into a human-readable format, with data areas >= 3 remaining in the raw binary log since it is vendor-specific.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The base spec has the following on telemetry log:
I assume the ocp spec will follow the base spec, so no need to include the areas 1,2 if 3 is selected.
To clarify this you could contact the authors of the ocp spec though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I will try contacting the authors.