Skip to content

Commit

Permalink
nvmet: fill discovery controller sn, fr and mn correctly
Browse files Browse the repository at this point in the history
Discovery controllers need this information as well.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Sagi Grimberg authored and Jens Axboe committed Nov 4, 2019
1 parent be3f311 commit d4b3a17
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/nvme/target/discovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ static void nvmet_execute_disc_identify(struct nvmet_req *req)
{
struct nvmet_ctrl *ctrl = req->sq->ctrl;
struct nvme_id_ctrl *id;
const char model[] = "Linux";
u16 status = 0;

if (!nvmet_check_data_len(req, NVME_IDENTIFY_DATA_SIZE))
Expand All @@ -258,8 +259,13 @@ static void nvmet_execute_disc_identify(struct nvmet_req *req)
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));
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 */
id->mdts = 0;
Expand Down

0 comments on commit d4b3a17

Please sign in to comment.