Blame SOURCES/0013-nvme-cli-Add-support-set-feature-event-in-PEL.patch

61fcf4
From 859b8ee99a725bdcfbb7c8352c50449d126cffc4 Mon Sep 17 00:00:00 2001
61fcf4
From: Maurizio Lombardi <mlombard@redhat.com>
61fcf4
Date: Thu, 30 Jun 2022 16:41:59 +0200
61fcf4
Subject: [PATCH 6/7] nvme-cli: Add support set feature event in PEL
61fcf4
61fcf4
Add "Set Feature" event in PEL.
61fcf4
61fcf4
Persistent Event Entries:
61fcf4
Event Number: 0
61fcf4
Event Type: Set Feature Event(0xb)
61fcf4
Event Type Revision: 1
61fcf4
Event Header Length: 21
61fcf4
Controller Identifier: 65
61fcf4
Event Timestamp: 564587204146155
61fcf4
Vendor Specific Information Length: 0
61fcf4
Event Length: 16
61fcf4
Set Feature Event Entry:
61fcf4
Set Feature ID  :0x7 (Number of Queues),  value:0x270027
61fcf4
        Number of IO Completion Queues Allocated (NCQA): 40
61fcf4
        Number of IO Submission Queues Allocated (NSQA): 40
61fcf4
61fcf4
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
61fcf4
---
61fcf4
 nvme-print.c | 15 +++++++++++++++
61fcf4
 1 file changed, 15 insertions(+)
61fcf4
61fcf4
diff --git a/nvme-print.c b/nvme-print.c
61fcf4
index 74ecd95a..37011dbe 100755
61fcf4
--- a/nvme-print.c
61fcf4
+++ b/nvme-print.c
61fcf4
@@ -1436,6 +1436,8 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
61fcf4
 {
61fcf4
 	__u32 offset, por_info_len, por_info_list;
61fcf4
 	__u64 *fw_rev;
61fcf4
+	int fid, cdw11, dword_cnt;
61fcf4
+	unsigned char *mem_buf = NULL;
61fcf4
 	struct nvme_smart_log *smart_event;
61fcf4
 	struct nvme_fw_commit_event *fw_commit_event;
61fcf4
 	struct nvme_time_stamp_change_event *ts_change_event;
61fcf4
@@ -1446,6 +1448,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
61fcf4
 	struct nvme_format_nvm_compln_event *format_cmpln_event;
61fcf4
 	struct nvme_sanitize_start_event *sanitize_start_event;
61fcf4
 	struct nvme_sanitize_compln_event *sanitize_cmpln_event;
61fcf4
+	struct nvme_set_feature_event *set_feat_event;
61fcf4
 	struct nvme_thermal_exc_event *thermal_exc_event;
61fcf4
 	struct nvme_persistent_event_log_head *pevent_log_head;
61fcf4
 	struct nvme_persistent_event_entry_head *pevent_entry_head;
61fcf4
@@ -1659,6 +1662,18 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
61fcf4
 			printf("Completion Information: %u\n",
61fcf4
 				le16_to_cpu(sanitize_cmpln_event->cmpln_info));
61fcf4
 			break;
61fcf4
+		case NVME_SET_FEATURE_EVENT:
61fcf4
+			set_feat_event = pevent_log_info + offset;
61fcf4
+			printf("Set Feature Event Entry: \n");
61fcf4
+			dword_cnt =  set_feat_event->layout & 0x03;
61fcf4
+			fid = le32_to_cpu(set_feat_event->cdw_mem[0]) & 0x000f;
61fcf4
+			cdw11 = le32_to_cpu(set_feat_event->cdw_mem[1]);
61fcf4
+			if (((set_feat_event->layout & 0xff) >> 2) != 0)
61fcf4
+				mem_buf = (unsigned char *)(set_feat_event + 4 + dword_cnt * 4);
61fcf4
+			printf("Set Feature ID  :%#02x (%s),  value:%#08x\n", fid,
61fcf4
+					nvme_feature_to_string(fid), cdw11);
61fcf4
+			nvme_feature_show_fields(fid, cdw11, mem_buf);
61fcf4
+			break;
61fcf4
 		case NVME_THERMAL_EXCURSION_EVENT:
61fcf4
 			thermal_exc_event = pevent_log_info + offset;
61fcf4
 			printf("Thermal Excursion Event Entry: \n");
61fcf4
-- 
61fcf4
2.31.1
61fcf4