]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme: add lba status information attributes feature support
authorGollu Appalanaidu <anaidu.gollu@samsung.com>
Tue, 16 Mar 2021 13:06:50 +0000 (18:36 +0530)
committerKeith Busch <kbusch@kernel.org>
Tue, 16 Mar 2021 19:28:14 +0000 (13:28 -0600)
Adding LBA Status Information Attributes Feature with FID = 0x15.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
linux/nvme.h
nvme-print.c
nvme-print.h
nvme.c

index 966e4cbc131eec99bf2726a523ec8452728ce7a3..aa678c974fd27aa53ff3bd569fb665b17e7e0ef2 100644 (file)
@@ -1280,6 +1280,7 @@ enum nvme_feat {
        NVME_FEAT_RRL           = 0x12,
        NVME_FEAT_PLM_CONFIG    = 0x13,
        NVME_FEAT_PLM_WINDOW    = 0x14,
+       NVME_LBA_STATUS_INFO    = 0x15,
        NVME_FEAT_HOST_BEHAVIOR = 0x16,
        NVME_FEAT_SANITIZE      = 0x17,
       NVME_FEAT_ENDURANCE     = 0x18,
index ad731f87e63b97dd8854de0c9cb4c166515a74de..4e9966ef01fc5346b5c5f0cda16641847384fe05 100755 (executable)
@@ -5012,6 +5012,7 @@ const char *nvme_feature_to_string(enum nvme_feat feature)
        case NVME_FEAT_RRL:             return "Read Recovery Level";
        case NVME_FEAT_PLM_CONFIG:      return "Predicatable Latency Mode Config";
        case NVME_FEAT_PLM_WINDOW:      return "Predicatable Latency Mode Window";
+       case NVME_LBA_STATUS_INFO:      return "LBA Status Infomation Attributes";
       case NVME_FEAT_ENDURANCE:       return "Enduarance Event Group Configuration";
        case NVME_FEAT_IOCS_PROFILE:    return "I/O Command Set Profile";
        case NVME_FEAT_SW_PROGRESS:     return "Software Progress";
@@ -5516,6 +5517,11 @@ static const char *nvme_plm_window(__u32 plm)
        }
 }
 
+void nvme_show_lba_status_info(__u32 result) {
+       printf("\tLBA Status Information Poll Interval (LSIPI)  : %u\n", (result >> 16) & 0xffff);
+       printf("\tLBA Status Information Report Interval (LSIRI): %u\n", result & 0xffff);
+}
+
 static void nvme_show_plm_config(struct nvme_plm_config *plmcfg)
 {
        printf("\tEnable Event          :%04x\n", le16_to_cpu(plmcfg->enable_event));
@@ -5610,6 +5616,9 @@ void nvme_feature_show_fields(enum nvme_feat fid, unsigned int result, unsigned
        case NVME_FEAT_PLM_WINDOW:
                printf("\tWindow Select: %s", nvme_plm_window(result));
                break;
+       case NVME_LBA_STATUS_INFO:
+               nvme_show_lba_status_info(result);
+               break;
       case NVME_FEAT_ENDURANCE:
               printf("\tEndurance Group Identifier (ENDGID): %u\n", result & 0xffff);
               printf("\tEndurance Group Critical Warnings  : %u\n", (result >> 16) & 0xff);
index 0b4482efd19ade9205a8ba1447b288eb8fd905ed..ead03a1edd0fd367520db111a37625bb048659b0 100644 (file)
@@ -88,6 +88,7 @@ void nvme_feature_show_fields(enum nvme_feat fid, unsigned int result, unsigned
 void nvme_directive_show(__u8 type, __u8 oper, __u16 spec, __u32 nsid, __u32 result,
        void *buf, __u32 len, enum nvme_print_flags flags);
 void nvme_show_select_result(__u32 result);
+void nvme_show_lba_status_info(__u32 result);
 
 void nvme_show_zns_id_ctrl(struct nvme_zns_id_ctrl *ctrl, unsigned int mode);
 void nvme_show_id_ctrl_nvm(struct nvme_id_ctrl_nvm *ctrl_nvm,
diff --git a/nvme.c b/nvme.c
index 3dc57465118753c27d068db5420dae50bbdf621f..020f1b305c007ff52356b28c171a73dcba58e080 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -3643,6 +3643,9 @@ static int set_feature(int argc, char **argv, struct command *cmd, struct plugin
                printf("set-feature:%#02x (%s), value:%#08"PRIx64", cdw12:%#08"PRIx32", \
                        save:%#x\n", cfg.feature_id, nvme_feature_to_string(cfg.feature_id),
                        (uint64_t)cfg.value, cfg.cdw12, cfg.save);
+               if (cfg.feature_id == NVME_LBA_STATUS_INFO) {
+                       nvme_show_lba_status_info(result);
+               }
                if (buf) {
                        if (cfg.feature_id == NVME_FEAT_LBA_RANGE)
                                nvme_show_lba_range((struct nvme_lba_range_type *)buf,