Commit 65335336 authored by Konrad Sztyber's avatar Konrad Sztyber Committed by Tomasz Zawadzki
Browse files

nvmf: add option to disable command passthru



This option allows user to control whether the target will submit
commands that are not known through NVME_PASSTHRU.

Signed-off-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Change-Id: If1707edec76db97be004db5f09395a8105f26d7c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/23373


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJacek Kalwas <jacek.kalwas@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 3291ed04
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -8163,6 +8163,7 @@ disable_shadow_doorbells | Optional | boolean | disable shadow doorbell suppo
zcopy                       | Optional | boolean | Use zero-copy operations if the underlying bdev supports them
ack_timeout                 | Optional | number  | ACK timeout in milliseconds
data_wr_pool_size           | Optional | number  | RDMA data WR pool size (RDMA only)
disable_command_passthru    | Optional | boolean | Disallow command passthru.

#### Example

+3 −2
Original line number Diff line number Diff line
@@ -76,9 +76,10 @@ struct spdk_nvmf_transport_opts {
	uint32_t	num_shared_buffers;
	uint32_t	buf_cache_size;
	bool		dif_insert_or_strip;
	bool		disable_command_passthru;

	/* Hole at bytes 29-31. */
	uint8_t		reserved29[3];
	/* Hole at bytes 30-31. */
	uint8_t		reserved30[2];

	uint32_t	abort_timeout_sec;
	/* ms */
+4 −0
Original line number Diff line number Diff line
@@ -239,6 +239,10 @@ struct spdk_nvmf_ctrlr_data {

#define MAX_MEMPOOL_NAME_LENGTH 40

/* abidiff has a problem with changes in spdk_nvmf_transport_opts, so spdk_nvmf_transport had to be
 * added to the suppression list, so if spdk_nvmf_transport is changed, we need to remove the
 * suppression and bump up the major version.
 */
struct spdk_nvmf_transport {
	struct spdk_nvmf_tgt			*tgt;
	const struct spdk_nvmf_transport_ops	*ops;
+9 −0
Original line number Diff line number Diff line
@@ -4429,9 +4429,18 @@ nvmf_ctrlr_process_io_cmd(struct spdk_nvmf_request *req)
		case SPDK_NVME_OPC_COPY:
			return nvmf_bdev_ctrlr_copy_cmd(bdev, desc, ch, req);
		default:
			if (spdk_unlikely(qpair->transport->opts.disable_command_passthru)) {
				goto invalid_opcode;
			}
			return nvmf_bdev_ctrlr_nvme_passthru_io(bdev, desc, ch, req);
		}
	}
invalid_opcode:
	SPDK_INFOLOG(nvmf, "Unsupported IO opcode 0x%x\n", cmd->opc);
	response->status.sct = SPDK_NVME_SCT_GENERIC;
	response->status.sc = SPDK_NVME_SC_INVALID_OPCODE;
	response->status.dnr = 1;
	return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
}

static void
+4 −0
Original line number Diff line number Diff line
@@ -2380,6 +2380,10 @@ static const struct spdk_json_object_decoder nvmf_rpc_create_transport_decoder[]
	{
		"data_wr_pool_size", offsetof(struct nvmf_rpc_create_transport_ctx, opts.data_wr_pool_size),
		spdk_json_decode_uint32, true
	},
	{
		"disable_command_passthru", offsetof(struct nvmf_rpc_create_transport_ctx, opts.disable_command_passthru),
		spdk_json_decode_bool, true
	}
};

Loading