Loading drivers/nvme/target/admin-cmd.c +33 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,7 @@ static void nvmet_execute_get_supported_log_pages(struct nvmet_req *req) logs->lids[NVME_LOG_CHANGED_NS] = cpu_to_le32(NVME_LIDS_LSUPP); logs->lids[NVME_LOG_CMD_EFFECTS] = cpu_to_le32(NVME_LIDS_LSUPP); logs->lids[NVME_LOG_ANA] = cpu_to_le32(NVME_LIDS_LSUPP); logs->lids[NVME_LOG_FEATURES] = cpu_to_le32(NVME_LIDS_LSUPP); logs->lids[NVME_LOG_RESERVATION] = cpu_to_le32(NVME_LIDS_LSUPP); status = nvmet_copy_to_sgl(req, 0, logs, sizeof(*logs)); Loading Loading @@ -347,6 +348,36 @@ static void nvmet_execute_get_log_page_ana(struct nvmet_req *req) nvmet_req_complete(req, status); } static void nvmet_execute_get_log_page_features(struct nvmet_req *req) { struct nvme_supported_features_log *features; u16 status; features = kzalloc(sizeof(*features), GFP_KERNEL); if (!features) { status = NVME_SC_INTERNAL; goto out; } features->fis[NVME_FEAT_NUM_QUEUES] = cpu_to_le32(NVME_FIS_FSUPP | NVME_FIS_CSCPE); features->fis[NVME_FEAT_KATO] = cpu_to_le32(NVME_FIS_FSUPP | NVME_FIS_CSCPE); features->fis[NVME_FEAT_ASYNC_EVENT] = cpu_to_le32(NVME_FIS_FSUPP | NVME_FIS_CSCPE); features->fis[NVME_FEAT_HOST_ID] = cpu_to_le32(NVME_FIS_FSUPP | NVME_FIS_CSCPE); features->fis[NVME_FEAT_WRITE_PROTECT] = cpu_to_le32(NVME_FIS_FSUPP | NVME_FIS_NSCPE); features->fis[NVME_FEAT_RESV_MASK] = cpu_to_le32(NVME_FIS_FSUPP | NVME_FIS_NSCPE); status = nvmet_copy_to_sgl(req, 0, features, sizeof(*features)); kfree(features); out: nvmet_req_complete(req, status); } static void nvmet_execute_get_log_page(struct nvmet_req *req) { if (!nvmet_check_transfer_len(req, nvmet_get_log_page_len(req->cmd))) Loading @@ -372,6 +403,8 @@ static void nvmet_execute_get_log_page(struct nvmet_req *req) return nvmet_execute_get_log_cmd_effects_ns(req); case NVME_LOG_ANA: return nvmet_execute_get_log_page_ana(req); case NVME_LOG_FEATURES: return nvmet_execute_get_log_page_features(req); case NVME_LOG_RESERVATION: return nvmet_execute_get_log_page_resv(req); } Loading include/linux/nvme.h +11 −0 Original line number Diff line number Diff line Loading @@ -1256,6 +1256,7 @@ enum { NVME_LOG_TELEMETRY_CTRL = 0x08, NVME_LOG_ENDURANCE_GROUP = 0x09, NVME_LOG_ANA = 0x0c, NVME_LOG_FEATURES = 0x12, NVME_LOG_DISC = 0x70, NVME_LOG_RESERVATION = 0x80, NVME_FWACT_REPL = (0 << 3), Loading @@ -1271,6 +1272,16 @@ enum { NVME_LIDS_LSUPP = 1 << 0, }; struct nvme_supported_features_log { __le32 fis[256]; }; enum { NVME_FIS_FSUPP = 1 << 0, NVME_FIS_NSCPE = 1 << 20, NVME_FIS_CSCPE = 1 << 21, }; /* NVMe Namespace Write Protect State */ enum { NVME_NS_NO_WRITE_PROTECT = 0, Loading Loading
drivers/nvme/target/admin-cmd.c +33 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,7 @@ static void nvmet_execute_get_supported_log_pages(struct nvmet_req *req) logs->lids[NVME_LOG_CHANGED_NS] = cpu_to_le32(NVME_LIDS_LSUPP); logs->lids[NVME_LOG_CMD_EFFECTS] = cpu_to_le32(NVME_LIDS_LSUPP); logs->lids[NVME_LOG_ANA] = cpu_to_le32(NVME_LIDS_LSUPP); logs->lids[NVME_LOG_FEATURES] = cpu_to_le32(NVME_LIDS_LSUPP); logs->lids[NVME_LOG_RESERVATION] = cpu_to_le32(NVME_LIDS_LSUPP); status = nvmet_copy_to_sgl(req, 0, logs, sizeof(*logs)); Loading Loading @@ -347,6 +348,36 @@ static void nvmet_execute_get_log_page_ana(struct nvmet_req *req) nvmet_req_complete(req, status); } static void nvmet_execute_get_log_page_features(struct nvmet_req *req) { struct nvme_supported_features_log *features; u16 status; features = kzalloc(sizeof(*features), GFP_KERNEL); if (!features) { status = NVME_SC_INTERNAL; goto out; } features->fis[NVME_FEAT_NUM_QUEUES] = cpu_to_le32(NVME_FIS_FSUPP | NVME_FIS_CSCPE); features->fis[NVME_FEAT_KATO] = cpu_to_le32(NVME_FIS_FSUPP | NVME_FIS_CSCPE); features->fis[NVME_FEAT_ASYNC_EVENT] = cpu_to_le32(NVME_FIS_FSUPP | NVME_FIS_CSCPE); features->fis[NVME_FEAT_HOST_ID] = cpu_to_le32(NVME_FIS_FSUPP | NVME_FIS_CSCPE); features->fis[NVME_FEAT_WRITE_PROTECT] = cpu_to_le32(NVME_FIS_FSUPP | NVME_FIS_NSCPE); features->fis[NVME_FEAT_RESV_MASK] = cpu_to_le32(NVME_FIS_FSUPP | NVME_FIS_NSCPE); status = nvmet_copy_to_sgl(req, 0, features, sizeof(*features)); kfree(features); out: nvmet_req_complete(req, status); } static void nvmet_execute_get_log_page(struct nvmet_req *req) { if (!nvmet_check_transfer_len(req, nvmet_get_log_page_len(req->cmd))) Loading @@ -372,6 +403,8 @@ static void nvmet_execute_get_log_page(struct nvmet_req *req) return nvmet_execute_get_log_cmd_effects_ns(req); case NVME_LOG_ANA: return nvmet_execute_get_log_page_ana(req); case NVME_LOG_FEATURES: return nvmet_execute_get_log_page_features(req); case NVME_LOG_RESERVATION: return nvmet_execute_get_log_page_resv(req); } Loading
include/linux/nvme.h +11 −0 Original line number Diff line number Diff line Loading @@ -1256,6 +1256,7 @@ enum { NVME_LOG_TELEMETRY_CTRL = 0x08, NVME_LOG_ENDURANCE_GROUP = 0x09, NVME_LOG_ANA = 0x0c, NVME_LOG_FEATURES = 0x12, NVME_LOG_DISC = 0x70, NVME_LOG_RESERVATION = 0x80, NVME_FWACT_REPL = (0 << 3), Loading @@ -1271,6 +1272,16 @@ enum { NVME_LIDS_LSUPP = 1 << 0, }; struct nvme_supported_features_log { __le32 fis[256]; }; enum { NVME_FIS_FSUPP = 1 << 0, NVME_FIS_NSCPE = 1 << 20, NVME_FIS_CSCPE = 1 << 21, }; /* NVMe Namespace Write Protect State */ enum { NVME_NS_NO_WRITE_PROTECT = 0, Loading