History

nvmet: add passthru code to process commands

Add passthru command handling capability for the NVMeOF target and export passthru APIs which are used to integrate passthru code with nvmet-core. The new file passthru.c handles passthru cmd parsing and execution. In the passthru mode, we create a block layer request from the nvmet request and map the data on to the block layer request. Admin commands and features are on an allow list as there are a number of each that don't make too much sense with passthrough. We use an allow list such that new commands can be considered before being blindly passed through. In both cases, vendor specific commands are always allowed. We also reject reservation IO commands as the underlying device cannot differentiate between multiple hosts behind a fabric.

Logan Gunthorpe committed 6 years ago

Commit c1fef731 parent 24493b86 files · +510 −2Browse files

Showing the changes to include/linux (1 of 6 files). Show all

Unified · Split

include/linux/nvme.h+4−0
@@ -312,6 +312,7 @@ enum { · 311 unmodified lines
312 NVME_CTRL_ONCS_WRITE_UNCORRECTABLE = 1 << 1,312 NVME_CTRL_ONCS_WRITE_UNCORRECTABLE = 1 << 1,
313 NVME_CTRL_ONCS_DSM = 1 << 2,313 NVME_CTRL_ONCS_DSM = 1 << 2,
314 NVME_CTRL_ONCS_WRITE_ZEROES = 1 << 3,314 NVME_CTRL_ONCS_WRITE_ZEROES = 1 << 3,
315 NVME_CTRL_ONCS_RESERVATIONS = 1 << 5,
315 NVME_CTRL_ONCS_TIMESTAMP = 1 << 6,316 NVME_CTRL_ONCS_TIMESTAMP = 1 << 6,
316 NVME_CTRL_VWC_PRESENT = 1 << 0,317 NVME_CTRL_VWC_PRESENT = 1 << 0,
317 NVME_CTRL_OACS_SEC_SUPP = 1 << 0,318 NVME_CTRL_OACS_SEC_SUPP = 1 << 0,
@@ -982,6 +983,7 @@ enum nvme_admin_opcode { · 664 unmodified lines
982 nvme_admin_security_recv = 0x82,983 nvme_admin_security_recv = 0x82,
983 nvme_admin_sanitize_nvm = 0x84,984 nvme_admin_sanitize_nvm = 0x84,
984 nvme_admin_get_lba_status = 0x86,985 nvme_admin_get_lba_status = 0x86,
986 nvme_admin_vendor_start = 0xC0,
985};987};
986 988
987#define nvme_admin_opcode_name(opcode) { opcode, #opcode }989#define nvme_admin_opcode_name(opcode) { opcode, #opcode }
@@ -1045,6 +1047,8 @@ enum { · 57 unmodified lines
1045 NVME_FEAT_RESV_MASK = 0x82,1047 NVME_FEAT_RESV_MASK = 0x82,
1046 NVME_FEAT_RESV_PERSIST = 0x83,1048 NVME_FEAT_RESV_PERSIST = 0x83,
1047 NVME_FEAT_WRITE_PROTECT = 0x84,1049 NVME_FEAT_WRITE_PROTECT = 0x84,
1050 NVME_FEAT_VENDOR_START = 0xC0,
1051 NVME_FEAT_VENDOR_END = 0xFF,
1048 NVME_LOG_ERROR = 0x01,1052 NVME_LOG_ERROR = 0x01,
1049 NVME_LOG_SMART = 0x02,1053 NVME_LOG_SMART = 0x02,
1050 NVME_LOG_FW_SLOT = 0x03,1054 NVME_LOG_FW_SLOT = 0x03,