1 /* 2 * NVMe admin command implementation. 3 * Copyright (c) 2015-2016 HGST, a Western Digital Company. 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms and conditions of the GNU General Public License, 7 * version 2, as published by the Free Software Foundation. 8 * 9 * This program is distributed in the hope it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 * more details. 13 */ 14 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 15 #include <linux/module.h> 16 #include <linux/rculist.h> 17 18 #include <generated/utsrelease.h> 19 #include <asm/unaligned.h> 20 #include "nvmet.h" 21 22 u32 nvmet_get_log_page_len(struct nvme_command *cmd) 23 { 24 u32 len = le16_to_cpu(cmd->get_log_page.numdu); 25 26 len <<= 16; 27 len += le16_to_cpu(cmd->get_log_page.numdl); 28 /* NUMD is a 0's based value */ 29 len += 1; 30 len *= sizeof(u32); 31 32 return len; 33 } 34 35 static void nvmet_execute_get_log_page_noop(struct nvmet_req *req) 36 { 37 nvmet_req_complete(req, nvmet_zero_sgl(req, 0, req->data_len)); 38 } 39 40 static u16 nvmet_get_smart_log_nsid(struct nvmet_req *req, 41 struct nvme_smart_log *slog) 42 { 43 struct nvmet_ns *ns; 44 u64 host_reads, host_writes, data_units_read, data_units_written; 45 46 ns = nvmet_find_namespace(req->sq->ctrl, req->cmd->get_log_page.nsid); 47 if (!ns) { 48 pr_err("nvmet : Could not find namespace id : %d\n", 49 le32_to_cpu(req->cmd->get_log_page.nsid)); 50 return NVME_SC_INVALID_NS; 51 } 52 53 /* we don't have the right data for file backed ns */ 54 if (!ns->bdev) 55 goto out; 56 57 host_reads = part_stat_read(ns->bdev->bd_part, ios[READ]); 58 data_units_read = part_stat_read(ns->bdev->bd_part, sectors[READ]); 59 host_writes = part_stat_read(ns->bdev->bd_part, ios[WRITE]); 60 data_units_written = part_stat_read(ns->bdev->bd_part, sectors[WRITE]); 61 62 put_unaligned_le64(host_reads, &slog->host_reads[0]); 63 put_unaligned_le64(data_units_read, &slog->data_units_read[0]); 64 put_unaligned_le64(host_writes, &slog->host_writes[0]); 65 put_unaligned_le64(data_units_written, &slog->data_units_written[0]); 66 out: 67 nvmet_put_namespace(ns); 68 69 return NVME_SC_SUCCESS; 70 } 71 72 static u16 nvmet_get_smart_log_all(struct nvmet_req *req, 73 struct nvme_smart_log *slog) 74 { 75 u64 host_reads = 0, host_writes = 0; 76 u64 data_units_read = 0, data_units_written = 0; 77 struct nvmet_ns *ns; 78 struct nvmet_ctrl *ctrl; 79 80 ctrl = req->sq->ctrl; 81 82 rcu_read_lock(); 83 list_for_each_entry_rcu(ns, &ctrl->subsys->namespaces, dev_link) { 84 /* we don't have the right data for file backed ns */ 85 if (!ns->bdev) 86 continue; 87 host_reads += part_stat_read(ns->bdev->bd_part, ios[READ]); 88 data_units_read += 89 part_stat_read(ns->bdev->bd_part, sectors[READ]); 90 host_writes += part_stat_read(ns->bdev->bd_part, ios[WRITE]); 91 data_units_written += 92 part_stat_read(ns->bdev->bd_part, sectors[WRITE]); 93 94 } 95 rcu_read_unlock(); 96 97 put_unaligned_le64(host_reads, &slog->host_reads[0]); 98 put_unaligned_le64(data_units_read, &slog->data_units_read[0]); 99 put_unaligned_le64(host_writes, &slog->host_writes[0]); 100 put_unaligned_le64(data_units_written, &slog->data_units_written[0]); 101 102 return NVME_SC_SUCCESS; 103 } 104 105 static void nvmet_execute_get_log_page_smart(struct nvmet_req *req) 106 { 107 struct nvme_smart_log *log; 108 u16 status = NVME_SC_INTERNAL; 109 110 if (req->data_len != sizeof(*log)) 111 goto out; 112 113 log = kzalloc(sizeof(*log), GFP_KERNEL); 114 if (!log) 115 goto out; 116 117 if (req->cmd->get_log_page.nsid == cpu_to_le32(NVME_NSID_ALL)) 118 status = nvmet_get_smart_log_all(req, log); 119 else 120 status = nvmet_get_smart_log_nsid(req, log); 121 if (status) 122 goto out_free_log; 123 124 status = nvmet_copy_to_sgl(req, 0, log, sizeof(*log)); 125 out_free_log: 126 kfree(log); 127 out: 128 nvmet_req_complete(req, status); 129 } 130 131 static void nvmet_execute_get_log_cmd_effects_ns(struct nvmet_req *req) 132 { 133 u16 status = NVME_SC_INTERNAL; 134 struct nvme_effects_log *log; 135 136 log = kzalloc(sizeof(*log), GFP_KERNEL); 137 if (!log) 138 goto out; 139 140 log->acs[nvme_admin_get_log_page] = cpu_to_le32(1 << 0); 141 log->acs[nvme_admin_identify] = cpu_to_le32(1 << 0); 142 log->acs[nvme_admin_abort_cmd] = cpu_to_le32(1 << 0); 143 log->acs[nvme_admin_set_features] = cpu_to_le32(1 << 0); 144 log->acs[nvme_admin_get_features] = cpu_to_le32(1 << 0); 145 log->acs[nvme_admin_async_event] = cpu_to_le32(1 << 0); 146 log->acs[nvme_admin_keep_alive] = cpu_to_le32(1 << 0); 147 148 log->iocs[nvme_cmd_read] = cpu_to_le32(1 << 0); 149 log->iocs[nvme_cmd_write] = cpu_to_le32(1 << 0); 150 log->iocs[nvme_cmd_flush] = cpu_to_le32(1 << 0); 151 log->iocs[nvme_cmd_dsm] = cpu_to_le32(1 << 0); 152 log->iocs[nvme_cmd_write_zeroes] = cpu_to_le32(1 << 0); 153 154 status = nvmet_copy_to_sgl(req, 0, log, sizeof(*log)); 155 156 kfree(log); 157 out: 158 nvmet_req_complete(req, status); 159 } 160 161 static void nvmet_execute_get_log_changed_ns(struct nvmet_req *req) 162 { 163 struct nvmet_ctrl *ctrl = req->sq->ctrl; 164 u16 status = NVME_SC_INTERNAL; 165 size_t len; 166 167 if (req->data_len != NVME_MAX_CHANGED_NAMESPACES * sizeof(__le32)) 168 goto out; 169 170 mutex_lock(&ctrl->lock); 171 if (ctrl->nr_changed_ns == U32_MAX) 172 len = sizeof(__le32); 173 else 174 len = ctrl->nr_changed_ns * sizeof(__le32); 175 status = nvmet_copy_to_sgl(req, 0, ctrl->changed_ns_list, len); 176 if (!status) 177 status = nvmet_zero_sgl(req, len, req->data_len - len); 178 ctrl->nr_changed_ns = 0; 179 clear_bit(NVME_AEN_CFG_NS_ATTR, &ctrl->aen_masked); 180 mutex_unlock(&ctrl->lock); 181 out: 182 nvmet_req_complete(req, status); 183 } 184 185 static void nvmet_execute_identify_ctrl(struct nvmet_req *req) 186 { 187 struct nvmet_ctrl *ctrl = req->sq->ctrl; 188 struct nvme_id_ctrl *id; 189 u16 status = 0; 190 const char model[] = "Linux"; 191 192 id = kzalloc(sizeof(*id), GFP_KERNEL); 193 if (!id) { 194 status = NVME_SC_INTERNAL; 195 goto out; 196 } 197 198 /* XXX: figure out how to assign real vendors IDs. */ 199 id->vid = 0; 200 id->ssvid = 0; 201 202 memset(id->sn, ' ', sizeof(id->sn)); 203 bin2hex(id->sn, &ctrl->subsys->serial, 204 min(sizeof(ctrl->subsys->serial), sizeof(id->sn) / 2)); 205 memcpy_and_pad(id->mn, sizeof(id->mn), model, sizeof(model) - 1, ' '); 206 memcpy_and_pad(id->fr, sizeof(id->fr), 207 UTS_RELEASE, strlen(UTS_RELEASE), ' '); 208 209 id->rab = 6; 210 211 /* 212 * XXX: figure out how we can assign a IEEE OUI, but until then 213 * the safest is to leave it as zeroes. 214 */ 215 216 /* we support multiple ports and multiples hosts: */ 217 id->cmic = (1 << 0) | (1 << 1); 218 219 /* no limit on data transfer sizes for now */ 220 id->mdts = 0; 221 id->cntlid = cpu_to_le16(ctrl->cntlid); 222 id->ver = cpu_to_le32(ctrl->subsys->ver); 223 224 /* XXX: figure out what to do about RTD3R/RTD3 */ 225 id->oaes = cpu_to_le32(NVMET_AEN_CFG_OPTIONAL); 226 id->ctratt = cpu_to_le32(1 << 0); 227 228 id->oacs = 0; 229 230 /* 231 * We don't really have a practical limit on the number of abort 232 * comands. But we don't do anything useful for abort either, so 233 * no point in allowing more abort commands than the spec requires. 234 */ 235 id->acl = 3; 236 237 id->aerl = NVMET_ASYNC_EVENTS - 1; 238 239 /* first slot is read-only, only one slot supported */ 240 id->frmw = (1 << 0) | (1 << 1); 241 id->lpa = (1 << 0) | (1 << 1) | (1 << 2); 242 id->elpe = NVMET_ERROR_LOG_SLOTS - 1; 243 id->npss = 0; 244 245 /* We support keep-alive timeout in granularity of seconds */ 246 id->kas = cpu_to_le16(NVMET_KAS); 247 248 id->sqes = (0x6 << 4) | 0x6; 249 id->cqes = (0x4 << 4) | 0x4; 250 251 /* no enforcement soft-limit for maxcmd - pick arbitrary high value */ 252 id->maxcmd = cpu_to_le16(NVMET_MAX_CMD); 253 254 id->nn = cpu_to_le32(ctrl->subsys->max_nsid); 255 id->mnan = cpu_to_le32(NVMET_MAX_NAMESPACES); 256 id->oncs = cpu_to_le16(NVME_CTRL_ONCS_DSM | 257 NVME_CTRL_ONCS_WRITE_ZEROES); 258 259 /* XXX: don't report vwc if the underlying device is write through */ 260 id->vwc = NVME_CTRL_VWC_PRESENT; 261 262 /* 263 * We can't support atomic writes bigger than a LBA without support 264 * from the backend device. 265 */ 266 id->awun = 0; 267 id->awupf = 0; 268 269 id->sgls = cpu_to_le32(1 << 0); /* we always support SGLs */ 270 if (ctrl->ops->has_keyed_sgls) 271 id->sgls |= cpu_to_le32(1 << 2); 272 if (req->port->inline_data_size) 273 id->sgls |= cpu_to_le32(1 << 20); 274 275 strcpy(id->subnqn, ctrl->subsys->subsysnqn); 276 277 /* Max command capsule size is sqe + single page of in-capsule data */ 278 id->ioccsz = cpu_to_le32((sizeof(struct nvme_command) + 279 req->port->inline_data_size) / 16); 280 /* Max response capsule size is cqe */ 281 id->iorcsz = cpu_to_le32(sizeof(struct nvme_completion) / 16); 282 283 id->msdbd = ctrl->ops->msdbd; 284 285 /* 286 * Meh, we don't really support any power state. Fake up the same 287 * values that qemu does. 288 */ 289 id->psd[0].max_power = cpu_to_le16(0x9c4); 290 id->psd[0].entry_lat = cpu_to_le32(0x10); 291 id->psd[0].exit_lat = cpu_to_le32(0x4); 292 293 status = nvmet_copy_to_sgl(req, 0, id, sizeof(*id)); 294 295 kfree(id); 296 out: 297 nvmet_req_complete(req, status); 298 } 299 300 static void nvmet_execute_identify_ns(struct nvmet_req *req) 301 { 302 struct nvmet_ns *ns; 303 struct nvme_id_ns *id; 304 u16 status = 0; 305 306 if (le32_to_cpu(req->cmd->identify.nsid) == NVME_NSID_ALL) { 307 status = NVME_SC_INVALID_NS | NVME_SC_DNR; 308 goto out; 309 } 310 311 id = kzalloc(sizeof(*id), GFP_KERNEL); 312 if (!id) { 313 status = NVME_SC_INTERNAL; 314 goto out; 315 } 316 317 /* return an all zeroed buffer if we can't find an active namespace */ 318 ns = nvmet_find_namespace(req->sq->ctrl, req->cmd->identify.nsid); 319 if (!ns) 320 goto done; 321 322 /* 323 * nuse = ncap = nsze isn't always true, but we have no way to find 324 * that out from the underlying device. 325 */ 326 id->ncap = id->nuse = id->nsze = 327 cpu_to_le64(ns->size >> ns->blksize_shift); 328 329 /* 330 * We just provide a single LBA format that matches what the 331 * underlying device reports. 332 */ 333 id->nlbaf = 0; 334 id->flbas = 0; 335 336 /* 337 * Our namespace might always be shared. Not just with other 338 * controllers, but also with any other user of the block device. 339 */ 340 id->nmic = (1 << 0); 341 342 memcpy(&id->nguid, &ns->nguid, sizeof(id->nguid)); 343 344 id->lbaf[0].ds = ns->blksize_shift; 345 346 nvmet_put_namespace(ns); 347 done: 348 status = nvmet_copy_to_sgl(req, 0, id, sizeof(*id)); 349 kfree(id); 350 out: 351 nvmet_req_complete(req, status); 352 } 353 354 static void nvmet_execute_identify_nslist(struct nvmet_req *req) 355 { 356 static const int buf_size = NVME_IDENTIFY_DATA_SIZE; 357 struct nvmet_ctrl *ctrl = req->sq->ctrl; 358 struct nvmet_ns *ns; 359 u32 min_nsid = le32_to_cpu(req->cmd->identify.nsid); 360 __le32 *list; 361 u16 status = 0; 362 int i = 0; 363 364 list = kzalloc(buf_size, GFP_KERNEL); 365 if (!list) { 366 status = NVME_SC_INTERNAL; 367 goto out; 368 } 369 370 rcu_read_lock(); 371 list_for_each_entry_rcu(ns, &ctrl->subsys->namespaces, dev_link) { 372 if (ns->nsid <= min_nsid) 373 continue; 374 list[i++] = cpu_to_le32(ns->nsid); 375 if (i == buf_size / sizeof(__le32)) 376 break; 377 } 378 rcu_read_unlock(); 379 380 status = nvmet_copy_to_sgl(req, 0, list, buf_size); 381 382 kfree(list); 383 out: 384 nvmet_req_complete(req, status); 385 } 386 387 static u16 nvmet_copy_ns_identifier(struct nvmet_req *req, u8 type, u8 len, 388 void *id, off_t *off) 389 { 390 struct nvme_ns_id_desc desc = { 391 .nidt = type, 392 .nidl = len, 393 }; 394 u16 status; 395 396 status = nvmet_copy_to_sgl(req, *off, &desc, sizeof(desc)); 397 if (status) 398 return status; 399 *off += sizeof(desc); 400 401 status = nvmet_copy_to_sgl(req, *off, id, len); 402 if (status) 403 return status; 404 *off += len; 405 406 return 0; 407 } 408 409 static void nvmet_execute_identify_desclist(struct nvmet_req *req) 410 { 411 struct nvmet_ns *ns; 412 u16 status = 0; 413 off_t off = 0; 414 415 ns = nvmet_find_namespace(req->sq->ctrl, req->cmd->identify.nsid); 416 if (!ns) { 417 status = NVME_SC_INVALID_NS | NVME_SC_DNR; 418 goto out; 419 } 420 421 if (memchr_inv(&ns->uuid, 0, sizeof(ns->uuid))) { 422 status = nvmet_copy_ns_identifier(req, NVME_NIDT_UUID, 423 NVME_NIDT_UUID_LEN, 424 &ns->uuid, &off); 425 if (status) 426 goto out_put_ns; 427 } 428 if (memchr_inv(ns->nguid, 0, sizeof(ns->nguid))) { 429 status = nvmet_copy_ns_identifier(req, NVME_NIDT_NGUID, 430 NVME_NIDT_NGUID_LEN, 431 &ns->nguid, &off); 432 if (status) 433 goto out_put_ns; 434 } 435 436 if (sg_zero_buffer(req->sg, req->sg_cnt, NVME_IDENTIFY_DATA_SIZE - off, 437 off) != NVME_IDENTIFY_DATA_SIZE - off) 438 status = NVME_SC_INTERNAL | NVME_SC_DNR; 439 out_put_ns: 440 nvmet_put_namespace(ns); 441 out: 442 nvmet_req_complete(req, status); 443 } 444 445 /* 446 * A "minimum viable" abort implementation: the command is mandatory in the 447 * spec, but we are not required to do any useful work. We couldn't really 448 * do a useful abort, so don't bother even with waiting for the command 449 * to be exectuted and return immediately telling the command to abort 450 * wasn't found. 451 */ 452 static void nvmet_execute_abort(struct nvmet_req *req) 453 { 454 nvmet_set_result(req, 1); 455 nvmet_req_complete(req, 0); 456 } 457 458 static void nvmet_execute_set_features(struct nvmet_req *req) 459 { 460 struct nvmet_subsys *subsys = req->sq->ctrl->subsys; 461 u32 cdw10 = le32_to_cpu(req->cmd->common.cdw10[0]); 462 u32 val32; 463 u16 status = 0; 464 465 switch (cdw10 & 0xff) { 466 case NVME_FEAT_NUM_QUEUES: 467 nvmet_set_result(req, 468 (subsys->max_qid - 1) | ((subsys->max_qid - 1) << 16)); 469 break; 470 case NVME_FEAT_KATO: 471 val32 = le32_to_cpu(req->cmd->common.cdw10[1]); 472 req->sq->ctrl->kato = DIV_ROUND_UP(val32, 1000); 473 nvmet_set_result(req, req->sq->ctrl->kato); 474 break; 475 case NVME_FEAT_ASYNC_EVENT: 476 val32 = le32_to_cpu(req->cmd->common.cdw10[1]); 477 if (val32 & ~NVMET_AEN_CFG_ALL) { 478 status = NVME_SC_INVALID_FIELD | NVME_SC_DNR; 479 break; 480 } 481 482 WRITE_ONCE(req->sq->ctrl->aen_enabled, val32); 483 nvmet_set_result(req, val32); 484 break; 485 case NVME_FEAT_HOST_ID: 486 status = NVME_SC_CMD_SEQ_ERROR | NVME_SC_DNR; 487 break; 488 default: 489 status = NVME_SC_INVALID_FIELD | NVME_SC_DNR; 490 break; 491 } 492 493 nvmet_req_complete(req, status); 494 } 495 496 static void nvmet_execute_get_features(struct nvmet_req *req) 497 { 498 struct nvmet_subsys *subsys = req->sq->ctrl->subsys; 499 u32 cdw10 = le32_to_cpu(req->cmd->common.cdw10[0]); 500 u16 status = 0; 501 502 switch (cdw10 & 0xff) { 503 /* 504 * These features are mandatory in the spec, but we don't 505 * have a useful way to implement them. We'll eventually 506 * need to come up with some fake values for these. 507 */ 508 #if 0 509 case NVME_FEAT_ARBITRATION: 510 break; 511 case NVME_FEAT_POWER_MGMT: 512 break; 513 case NVME_FEAT_TEMP_THRESH: 514 break; 515 case NVME_FEAT_ERR_RECOVERY: 516 break; 517 case NVME_FEAT_IRQ_COALESCE: 518 break; 519 case NVME_FEAT_IRQ_CONFIG: 520 break; 521 case NVME_FEAT_WRITE_ATOMIC: 522 break; 523 #endif 524 case NVME_FEAT_ASYNC_EVENT: 525 nvmet_set_result(req, READ_ONCE(req->sq->ctrl->aen_enabled)); 526 break; 527 case NVME_FEAT_VOLATILE_WC: 528 nvmet_set_result(req, 1); 529 break; 530 case NVME_FEAT_NUM_QUEUES: 531 nvmet_set_result(req, 532 (subsys->max_qid-1) | ((subsys->max_qid-1) << 16)); 533 break; 534 case NVME_FEAT_KATO: 535 nvmet_set_result(req, req->sq->ctrl->kato * 1000); 536 break; 537 case NVME_FEAT_HOST_ID: 538 /* need 128-bit host identifier flag */ 539 if (!(req->cmd->common.cdw10[1] & cpu_to_le32(1 << 0))) { 540 status = NVME_SC_INVALID_FIELD | NVME_SC_DNR; 541 break; 542 } 543 544 status = nvmet_copy_to_sgl(req, 0, &req->sq->ctrl->hostid, 545 sizeof(req->sq->ctrl->hostid)); 546 break; 547 default: 548 status = NVME_SC_INVALID_FIELD | NVME_SC_DNR; 549 break; 550 } 551 552 nvmet_req_complete(req, status); 553 } 554 555 static void nvmet_execute_async_event(struct nvmet_req *req) 556 { 557 struct nvmet_ctrl *ctrl = req->sq->ctrl; 558 559 mutex_lock(&ctrl->lock); 560 if (ctrl->nr_async_event_cmds >= NVMET_ASYNC_EVENTS) { 561 mutex_unlock(&ctrl->lock); 562 nvmet_req_complete(req, NVME_SC_ASYNC_LIMIT | NVME_SC_DNR); 563 return; 564 } 565 ctrl->async_event_cmds[ctrl->nr_async_event_cmds++] = req; 566 mutex_unlock(&ctrl->lock); 567 568 schedule_work(&ctrl->async_event_work); 569 } 570 571 static void nvmet_execute_keep_alive(struct nvmet_req *req) 572 { 573 struct nvmet_ctrl *ctrl = req->sq->ctrl; 574 575 pr_debug("ctrl %d update keep-alive timer for %d secs\n", 576 ctrl->cntlid, ctrl->kato); 577 578 mod_delayed_work(system_wq, &ctrl->ka_work, ctrl->kato * HZ); 579 nvmet_req_complete(req, 0); 580 } 581 582 u16 nvmet_parse_admin_cmd(struct nvmet_req *req) 583 { 584 struct nvme_command *cmd = req->cmd; 585 u16 ret; 586 587 ret = nvmet_check_ctrl_status(req, cmd); 588 if (unlikely(ret)) 589 return ret; 590 591 switch (cmd->common.opcode) { 592 case nvme_admin_get_log_page: 593 req->data_len = nvmet_get_log_page_len(cmd); 594 595 switch (cmd->get_log_page.lid) { 596 case NVME_LOG_ERROR: 597 /* 598 * We currently never set the More bit in the status 599 * field, so all error log entries are invalid and can 600 * be zeroed out. This is called a minum viable 601 * implementation (TM) of this mandatory log page. 602 */ 603 req->execute = nvmet_execute_get_log_page_noop; 604 return 0; 605 case NVME_LOG_SMART: 606 req->execute = nvmet_execute_get_log_page_smart; 607 return 0; 608 case NVME_LOG_FW_SLOT: 609 /* 610 * We only support a single firmware slot which always 611 * is active, so we can zero out the whole firmware slot 612 * log and still claim to fully implement this mandatory 613 * log page. 614 */ 615 req->execute = nvmet_execute_get_log_page_noop; 616 return 0; 617 case NVME_LOG_CHANGED_NS: 618 req->execute = nvmet_execute_get_log_changed_ns; 619 return 0; 620 case NVME_LOG_CMD_EFFECTS: 621 req->execute = nvmet_execute_get_log_cmd_effects_ns; 622 return 0; 623 } 624 break; 625 case nvme_admin_identify: 626 req->data_len = NVME_IDENTIFY_DATA_SIZE; 627 switch (cmd->identify.cns) { 628 case NVME_ID_CNS_NS: 629 req->execute = nvmet_execute_identify_ns; 630 return 0; 631 case NVME_ID_CNS_CTRL: 632 req->execute = nvmet_execute_identify_ctrl; 633 return 0; 634 case NVME_ID_CNS_NS_ACTIVE_LIST: 635 req->execute = nvmet_execute_identify_nslist; 636 return 0; 637 case NVME_ID_CNS_NS_DESC_LIST: 638 req->execute = nvmet_execute_identify_desclist; 639 return 0; 640 } 641 break; 642 case nvme_admin_abort_cmd: 643 req->execute = nvmet_execute_abort; 644 req->data_len = 0; 645 return 0; 646 case nvme_admin_set_features: 647 req->execute = nvmet_execute_set_features; 648 req->data_len = 0; 649 return 0; 650 case nvme_admin_get_features: 651 req->execute = nvmet_execute_get_features; 652 req->data_len = 0; 653 return 0; 654 case nvme_admin_async_event: 655 req->execute = nvmet_execute_async_event; 656 req->data_len = 0; 657 return 0; 658 case nvme_admin_keep_alive: 659 req->execute = nvmet_execute_keep_alive; 660 req->data_len = 0; 661 return 0; 662 } 663 664 pr_err("unhandled cmd %d on qid %d\n", cmd->common.opcode, 665 req->sq->qid); 666 return NVME_SC_INVALID_OPCODE | NVME_SC_DNR; 667 } 668