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
312312 NVME_CTRL_ONCS_WRITE_UNCORRECTABLE = 1 << 1,
313313 NVME_CTRL_ONCS_DSM = 1 << 2,
314314 NVME_CTRL_ONCS_WRITE_ZEROES = 1 << 3,
315+ NVME_CTRL_ONCS_RESERVATIONS = 1 << 5,
315316 NVME_CTRL_ONCS_TIMESTAMP = 1 << 6,
316317 NVME_CTRL_VWC_PRESENT = 1 << 0,
317318 NVME_CTRL_OACS_SEC_SUPP = 1 << 0,
@@ -982,6 +983,7 @@ enum nvme_admin_opcode { · 664 unmodified lines
982983 nvme_admin_security_recv = 0x82,
983984 nvme_admin_sanitize_nvm = 0x84,
984985 nvme_admin_get_lba_status = 0x86,
986+ nvme_admin_vendor_start = 0xC0,
985987 };
986988
987989 #define nvme_admin_opcode_name(opcode) { opcode, #opcode }
@@ -1045,6 +1047,8 @@ enum { · 57 unmodified lines
10451047 NVME_FEAT_RESV_MASK = 0x82,
10461048 NVME_FEAT_RESV_PERSIST = 0x83,
10471049 NVME_FEAT_WRITE_PROTECT = 0x84,
1050+ NVME_FEAT_VENDOR_START = 0xC0,
1051+ NVME_FEAT_VENDOR_END = 0xFF,
10481052 NVME_LOG_ERROR = 0x01,
10491053 NVME_LOG_SMART = 0x02,
10501054 NVME_LOG_FW_SLOT = 0x03,