admin-cmd.c (546121b65f47384e11ec1fa2e55449fc9f4846b2) | admin-cmd.c (013b7ebe5a0d70e2a02fd225174595e79c591b3e) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * NVMe admin command implementation. 4 * Copyright (c) 2015-2016 HGST, a Western Digital Company. 5 */ 6#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 7#include <linux/module.h> 8#include <linux/rculist.h> --- 308 unchanged lines hidden (view full) --- 317 return nvmet_execute_get_log_page_ana(req); 318 } 319 pr_err("unhandled lid %d on qid %d\n", 320 req->cmd->get_log_page.lid, req->sq->qid); 321 req->error_loc = offsetof(struct nvme_get_log_page_command, lid); 322 nvmet_req_complete(req, NVME_SC_INVALID_FIELD | NVME_SC_DNR); 323} 324 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * NVMe admin command implementation. 4 * Copyright (c) 2015-2016 HGST, a Western Digital Company. 5 */ 6#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 7#include <linux/module.h> 8#include <linux/rculist.h> --- 308 unchanged lines hidden (view full) --- 317 return nvmet_execute_get_log_page_ana(req); 318 } 319 pr_err("unhandled lid %d on qid %d\n", 320 req->cmd->get_log_page.lid, req->sq->qid); 321 req->error_loc = offsetof(struct nvme_get_log_page_command, lid); 322 nvmet_req_complete(req, NVME_SC_INVALID_FIELD | NVME_SC_DNR); 323} 324 |
325static void nvmet_id_set_model_number(struct nvme_id_ctrl *id, 326 struct nvmet_subsys *subsys) 327{ 328 const char *model = NVMET_DEFAULT_CTRL_MODEL; 329 struct nvmet_subsys_model *subsys_model; 330 331 rcu_read_lock(); 332 subsys_model = rcu_dereference(subsys->model); 333 if (subsys_model) 334 model = subsys_model->number; 335 memcpy_and_pad(id->mn, sizeof(id->mn), model, strlen(model), ' '); 336 rcu_read_unlock(); 337} 338 |
|
325static void nvmet_execute_identify_ctrl(struct nvmet_req *req) 326{ 327 struct nvmet_ctrl *ctrl = req->sq->ctrl; 328 struct nvme_id_ctrl *id; 329 u16 status = 0; | 339static void nvmet_execute_identify_ctrl(struct nvmet_req *req) 340{ 341 struct nvmet_ctrl *ctrl = req->sq->ctrl; 342 struct nvme_id_ctrl *id; 343 u16 status = 0; |
330 const char model[] = "Linux"; | |
331 332 id = kzalloc(sizeof(*id), GFP_KERNEL); 333 if (!id) { 334 status = NVME_SC_INTERNAL; 335 goto out; 336 } 337 338 /* XXX: figure out how to assign real vendors IDs. */ 339 id->vid = 0; 340 id->ssvid = 0; 341 342 memset(id->sn, ' ', sizeof(id->sn)); 343 bin2hex(id->sn, &ctrl->subsys->serial, 344 min(sizeof(ctrl->subsys->serial), sizeof(id->sn) / 2)); | 344 345 id = kzalloc(sizeof(*id), GFP_KERNEL); 346 if (!id) { 347 status = NVME_SC_INTERNAL; 348 goto out; 349 } 350 351 /* XXX: figure out how to assign real vendors IDs. */ 352 id->vid = 0; 353 id->ssvid = 0; 354 355 memset(id->sn, ' ', sizeof(id->sn)); 356 bin2hex(id->sn, &ctrl->subsys->serial, 357 min(sizeof(ctrl->subsys->serial), sizeof(id->sn) / 2)); |
345 memcpy_and_pad(id->mn, sizeof(id->mn), model, sizeof(model) - 1, ' '); | 358 nvmet_id_set_model_number(id, ctrl->subsys); |
346 memcpy_and_pad(id->fr, sizeof(id->fr), 347 UTS_RELEASE, strlen(UTS_RELEASE), ' '); 348 349 id->rab = 6; 350 351 /* 352 * XXX: figure out how we can assign a IEEE OUI, but until then 353 * the safest is to leave it as zeroes. --- 576 unchanged lines hidden --- | 359 memcpy_and_pad(id->fr, sizeof(id->fr), 360 UTS_RELEASE, strlen(UTS_RELEASE), ' '); 361 362 id->rab = 6; 363 364 /* 365 * XXX: figure out how we can assign a IEEE OUI, but until then 366 * the safest is to leave it as zeroes. --- 576 unchanged lines hidden --- |