Commit 8580daa1 authored by Srikanth kaligotla's avatar Srikanth kaligotla Committed by Jim Harris
Browse files

nvmf: SGL support for NVMF RDMA Driver.



Change-Id: I447754c69de432b5a65dc8c1d9ae690926e88c51
Signed-off-by: default avatarJohn Meneghini <johnm@netapp.com>
Signed-off-by: default avatarSrikanth kaligotla <kalis@netapp.com>
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/410302


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent a94accab
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ struct spdk_nvmf_tgt_opts {
	uint32_t in_capsule_data_size;
	uint32_t max_io_size;
	uint32_t max_subsystems;
	uint32_t io_unit_size;
};
/**
 * Initialize the default value of opts.
+6 −0
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ spdk_nvmf_read_config_file_params(struct spdk_conf_section *sp,
	int max_queues_per_sess;
	int in_capsule_data_size;
	int max_io_size;
	int io_unit_size;
	int acceptor_poll_rate;

	max_queue_depth = spdk_conf_section_get_intval(sp, "MaxQueueDepth");
@@ -94,6 +95,11 @@ spdk_nvmf_read_config_file_params(struct spdk_conf_section *sp,
		opts->max_io_size = max_io_size;
	}

	io_unit_size = spdk_conf_section_get_intval(sp, "IOUnitSize");
	if (io_unit_size >= 0) {
		opts->io_unit_size = io_unit_size;
	}

	acceptor_poll_rate = spdk_conf_section_get_intval(sp, "AcceptorPollRate");
	if (acceptor_poll_rate >= 0) {
		g_spdk_nvmf_tgt_conf.acceptor_poll_rate = acceptor_poll_rate;
+3 −3
Original line number Diff line number Diff line
@@ -180,7 +180,7 @@ nvmf_bdev_ctrlr_read_cmd(struct spdk_bdev *bdev, struct spdk_bdev_desc *desc,
	}

	spdk_trace_record(TRACE_NVMF_LIB_READ_START, 0, 0, (uint64_t)req, 0);
	if (spdk_unlikely(spdk_bdev_read_blocks(desc, ch, req->data, start_lba, num_blocks,
	if (spdk_unlikely(spdk_bdev_readv_blocks(desc, ch, req->iov, req->iovcnt, start_lba, num_blocks,
			  nvmf_bdev_ctrlr_complete_cmd, req))) {
		rsp->status.sct = SPDK_NVME_SCT_GENERIC;
		rsp->status.sc = SPDK_NVME_SC_INTERNAL_DEVICE_ERROR;
@@ -219,7 +219,7 @@ nvmf_bdev_ctrlr_write_cmd(struct spdk_bdev *bdev, struct spdk_bdev_desc *desc,
	}

	spdk_trace_record(TRACE_NVMF_LIB_WRITE_START, 0, 0, (uint64_t)req, 0);
	if (spdk_unlikely(spdk_bdev_write_blocks(desc, ch, req->data, start_lba, num_blocks,
	if (spdk_unlikely(spdk_bdev_writev_blocks(desc, ch, req->iov, req->iovcnt, start_lba, num_blocks,
			  nvmf_bdev_ctrlr_complete_cmd, req))) {
		rsp->status.sct = SPDK_NVME_SCT_GENERIC;
		rsp->status.sc = SPDK_NVME_SC_INTERNAL_DEVICE_ERROR;
+11 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ SPDK_LOG_REGISTER_COMPONENT("nvmf", SPDK_LOG_NVMF)
#define SPDK_NVMF_DEFAULT_IN_CAPSULE_DATA_SIZE 4096
#define SPDK_NVMF_DEFAULT_MAX_IO_SIZE 131072
#define SPDK_NVMF_DEFAULT_MAX_SUBSYSTEMS 1024
#define SPDK_NVMF_DEFAULT_IO_UNIT_SIZE 131072

void
spdk_nvmf_tgt_opts_init(struct spdk_nvmf_tgt_opts *opts)
@@ -60,6 +61,7 @@ spdk_nvmf_tgt_opts_init(struct spdk_nvmf_tgt_opts *opts)
	opts->in_capsule_data_size = SPDK_NVMF_DEFAULT_IN_CAPSULE_DATA_SIZE;
	opts->max_io_size = SPDK_NVMF_DEFAULT_MAX_IO_SIZE;
	opts->max_subsystems = SPDK_NVMF_DEFAULT_MAX_SUBSYSTEMS;
	opts->io_unit_size = SPDK_NVMF_DEFAULT_IO_UNIT_SIZE;
}

static int
@@ -165,6 +167,14 @@ spdk_nvmf_tgt_create(struct spdk_nvmf_tgt_opts *opts)
		tgt->opts = *opts;
	}

	if ((tgt->opts.max_io_size % tgt->opts.io_unit_size != 0) ||
	    (tgt->opts.max_io_size / tgt->opts.io_unit_size > SPDK_NVMF_MAX_SGL_ENTRIES)) {
		SPDK_ERRLOG("Unsupported IO size, MaxIO:%d, UnitIO:%d\n", tgt->opts.max_io_size,
			    tgt->opts.io_unit_size);
		free(tgt);
		return NULL;
	}

	tgt->discovery_genctr = 0;
	tgt->discovery_log_page = NULL;
	tgt->discovery_log_page_size = 0;
@@ -187,6 +197,7 @@ spdk_nvmf_tgt_create(struct spdk_nvmf_tgt_opts *opts)
	SPDK_DEBUGLOG(SPDK_LOG_NVMF, "Max In Capsule Data: %d bytes\n",
		      tgt->opts.in_capsule_data_size);
	SPDK_DEBUGLOG(SPDK_LOG_NVMF, "Max I/O Size: %d bytes\n", tgt->opts.max_io_size);
	SPDK_DEBUGLOG(SPDK_LOG_NVMF, "I/O Unit Size: %d bytes\n", tgt->opts.io_unit_size);

	return tgt;
}
+4 −0
Original line number Diff line number Diff line
@@ -43,6 +43,8 @@
#include "spdk/queue.h"
#include "spdk/util.h"

#define SPDK_NVMF_MAX_SGL_ENTRIES	16

enum spdk_nvmf_subsystem_state {
	SPDK_NVMF_SUBSYSTEM_INACTIVE = 0,
	SPDK_NVMF_SUBSYSTEM_ACTIVATING,
@@ -138,6 +140,8 @@ struct spdk_nvmf_request {
	void				*data;
	union nvmf_h2c_msg		*cmd;
	union nvmf_c2h_msg		*rsp;
	struct iovec			iov[SPDK_NVMF_MAX_SGL_ENTRIES];
	uint32_t			iovcnt;

	TAILQ_ENTRY(spdk_nvmf_request)	link;
};
Loading