Commit d4b3a174 authored by Sagi Grimberg's avatar Sagi Grimberg Committed by Jens Axboe

nvmet: fill discovery controller sn, fr and mn correctly

Discovery controllers need this information as well.
Signed-off-by: default avatarSagi Grimberg <sagi@grimberg.me>
Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent be3f3114
...@@ -241,6 +241,7 @@ static void nvmet_execute_disc_identify(struct nvmet_req *req) ...@@ -241,6 +241,7 @@ static void nvmet_execute_disc_identify(struct nvmet_req *req)
{ {
struct nvmet_ctrl *ctrl = req->sq->ctrl; struct nvmet_ctrl *ctrl = req->sq->ctrl;
struct nvme_id_ctrl *id; struct nvme_id_ctrl *id;
const char model[] = "Linux";
u16 status = 0; u16 status = 0;
if (!nvmet_check_data_len(req, NVME_IDENTIFY_DATA_SIZE)) if (!nvmet_check_data_len(req, NVME_IDENTIFY_DATA_SIZE))
...@@ -258,8 +259,13 @@ static void nvmet_execute_disc_identify(struct nvmet_req *req) ...@@ -258,8 +259,13 @@ static void nvmet_execute_disc_identify(struct nvmet_req *req)
goto out; goto out;
} }
memset(id->sn, ' ', sizeof(id->sn));
bin2hex(id->sn, &ctrl->subsys->serial,
min(sizeof(ctrl->subsys->serial), sizeof(id->sn) / 2));
memset(id->fr, ' ', sizeof(id->fr)); memset(id->fr, ' ', sizeof(id->fr));
strncpy((char *)id->fr, UTS_RELEASE, sizeof(id->fr)); memcpy_and_pad(id->mn, sizeof(id->mn), model, sizeof(model) - 1, ' ');
memcpy_and_pad(id->fr, sizeof(id->fr),
UTS_RELEASE, strlen(UTS_RELEASE), ' ');
/* no limit on data transfer sizes for now */ /* no limit on data transfer sizes for now */
id->mdts = 0; id->mdts = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment