Skip to content

Conversation

@jeff-lien-sndk
Copy link
Contributor

The Statistics Snapshot FIFO Event is in a slightly different format from the other FIFO Events. These changes are required for the correct parsing of the statistics snapshot event.

@jeff-lien-sndk jeff-lien-sndk force-pushed the ocp-stats-snapshot branch 2 times, most recently from 545d109 to 44a3d74 Compare April 18, 2025 19:59
} else
} else if ((pevent_descriptor != NULL) &&
(pevent_descriptor->debug_event_class_type ==
STATISTIC_SNAPSHOT_CLASS_TYPE)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to check for event_data_size here, as it's checked above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no event_data_size field in a statistic snapshot event class; it's reserved in that event class. Therefore, it can't be checked in this case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could check stat_data_size instead, which should be the statistic snapshot equivalent. A size of 0 is allowed by the spec, so it'd be good to handle that gracefully here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, this is already being checked below before parsing and after having confirmed that it is a statistic snapshot. LGTM then.

description_str);

struct json_object *pevent_descriptor_obj =
((pevent_fifos_object != NULL)?json_create_object():NULL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should probably be spaces here, something like:

Suggested change
((pevent_fifos_object != NULL)?json_create_object():NULL);
pevent_fifos_object ? json_create_object() : NULL;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the spaces, but decided to keep the parathesis.

__u8 stat_info; // Byte 6
__u8 namespace_info; // Byte 7
__le16 stat_data_size; // Bytes 9:8
__le16 reserved2; // Bytes 11:10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be more consistent as __u8 reserved2[2];, but it could alternatively just be updated to the OCP 2.6 definition as __le16 nsid.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated it to __le16 nsid;

The Statistics Snapshot FIFO Event is in a slightly
different format from the other FIFO Events.  These
changes account for the differences in the event formats.

Signed-off-by: jeff-lien-wdc <[email protected]>
@igaw igaw force-pushed the ocp-stats-snapshot branch from 3693889 to 7f152c3 Compare April 22, 2025 17:12
@igaw
Copy link
Collaborator

igaw commented Apr 22, 2025

squashed both patches together.

@igaw igaw merged commit 555a4a8 into linux-nvme:master Apr 22, 2025
15 checks passed
@igaw
Copy link
Collaborator

igaw commented Apr 22, 2025

Thanks!

@jeff-lien-sndk jeff-lien-sndk deleted the ocp-stats-snapshot branch July 22, 2025 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants