[PATCH V2 4/5] nvme-cli: Add support set feature event in PEL

Chaitanya Kulkarni chaitanyak at nvidia.com
Sun Dec 12 23:56:04 PST 2021


On 11/18/21 8:57 AM, wenxiong at linux.ibm.com wrote:
> External email: Use caution opening links or attachments
> 
> 
> From: Wen Xiong <wenxiong at linux.ibm.com>
> 
> Add "Set Feature" event in PEL.
> 
> Persistent Event Entries:
> Event Number: 0
> Event Type: Set Feature Event(0xb)
> Event Type Revision: 1
> Event Header Length: 21
> Controller Identifier: 65
> Event Timestamp: 564587204146155
> Vendor Specific Information Length: 0
> Event Length: 16
> Set Feature Event Entry:
> Set Feature ID  :0x7 (Number of Queues),  value:0x270027
>          Number of IO Completion Queues Allocated (NCQA): 40
>          Number of IO Submission Queues Allocated (NSQA): 40
> 
> Signed-off-by: Wen Xiong <wenxiong at us.ibm.com>
> ---
>   nvme-print.c | 18 ++++++++++++++++++
>   1 file changed, 18 insertions(+)
> 
> diff --git a/nvme-print.c b/nvme-print.c
> index fb7cec3..8d7ecee 100644
> --- a/nvme-print.c
> +++ b/nvme-print.c
> @@ -1472,6 +1472,8 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
>   {
>          __u32 offset, por_info_len, por_info_list;
>          __u64 *fw_rev;
> +       int fid, cdw11, dword_cnt;
> +       unsigned char *mem_buf = NULL;
>          struct nvme_smart_log *smart_event;
>          struct nvme_fw_commit_event *fw_commit_event;
>          struct nvme_time_stamp_change_event *ts_change_event;
> @@ -1482,6 +1484,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
>          struct nvme_format_nvm_compln_event *format_cmpln_event;
>          struct nvme_sanitize_start_event *sanitize_start_event;
>          struct nvme_sanitize_compln_event *sanitize_cmpln_event;
> +       struct nvme_set_feature_event *set_feat_event;
>          struct nvme_thermal_exc_event *thermal_exc_event;
>          struct nvme_persistent_event_log *pevent_log_head;
>          struct nvme_persistent_event_entry *pevent_entry_head;
> @@ -1694,6 +1697,21 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
>                          printf("Completion Information: %u\n",
>                                  le16_to_cpu(sanitize_cmpln_event->cmpln_info));
>                          break;
> +               case NVME_PEL_SET_FEATURE_EVENT:
> +                       set_feat_event = pevent_log_info + offset;
> +                       printf("Set Feature Event Entry: \n");

Usually prinf() statements are grouped together, is there a reason
why above printf is not grouped with follwing printf() for in this
switch case ?

> +                       dword_cnt =  set_feat_event->layout & 0x03;
> +                       fid = le32_to_cpu(set_feat_event->cdw_mem[0]) & 0x000f;
> +                       cdw11 = le32_to_cpu(set_feat_event->cdw_mem[1]);
> +
> +                       if (((set_feat_event->layout & 0xff) >> 2) != 0)
> +                               mem_buf = (unsigned char *)(set_feat_event + 4 + dword_cnt * 4);
> +
> +                       printf("Set Feature ID  :%#02x (%s),  value:%#08x\n", fid,
> +                               nvme_feature_to_string(fid), cdw11);
> +
> +                       nvme_feature_show_fields(fid, cdw11, mem_buf);
> +                       break;
>                  case NVME_PEL_THERMAL_EXCURSION_EVENT:
>                          thermal_exc_event = pevent_log_info + offset;
>                          printf("Thermal Excursion Event Entry: \n");
> --
> 2.27.0
> 



More information about the Linux-nvme mailing list