Commit b6a9493b authored by Changpeng Liu's avatar Changpeng Liu Committed by Ben Walker
Browse files

nvme: enable CMB for submission queue by default



Also provide an option in perf tool let users to
disable it.

Change-Id: If4952513d77cecaa4f9403fbea811d86916ee87c
Signed-off-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/363311


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent ce8de311
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -199,6 +199,7 @@ static int g_time_in_sec;
static uint32_t g_max_completions;
static int g_dpdk_mem;
static int g_shm_id = -1;
static uint32_t g_disable_sq_cmb;

static const char *g_core_mask;

@@ -774,6 +775,7 @@ static void usage(char *program_name)
	printf("\t[-t time in seconds]\n");
	printf("\t[-c core mask for I/O submission/completion.]\n");
	printf("\t\t(default: 1)]\n");
	printf("\t[-D disable submission queue in controller memory buffer, default: enabled]\n");
	printf("\t[-r Transport ID for local PCIe NVMe or NVMeoF]\n");
	printf("\t Format: 'key:value [key:value] ...'\n");
	printf("\t Keys:\n");
@@ -1053,7 +1055,7 @@ parse_args(int argc, char **argv)
	g_core_mask = NULL;
	g_max_completions = 0;

	while ((op = getopt(argc, argv, "c:d:i:lm:q:r:s:t:w:LM:")) != -1) {
	while ((op = getopt(argc, argv, "c:d:i:lm:q:r:s:t:w:DLM:")) != -1) {
		switch (op) {
		case 'c':
			g_core_mask = optarg;
@@ -1095,6 +1097,9 @@ parse_args(int argc, char **argv)
			g_rw_percentage = atoi(optarg);
			mix_specified = true;
			break;
		case 'D':
			g_disable_sq_cmb = 1;
			break;
		default:
			usage(argv[0]);
			return 1;
@@ -1246,6 +1251,10 @@ probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
			return false;
		}

		if (g_disable_sq_cmb) {
			opts->use_cmb_sqs = false;
		}

		pci_id = spdk_pci_device_get_id(pci_dev);

		printf("Attaching to NVMe Controller at %s [%04x:%04x]\n",
+1 −1
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ void
spdk_nvme_ctrlr_opts_set_defaults(struct spdk_nvme_ctrlr_opts *opts)
{
	opts->num_io_queues = DEFAULT_MAX_IO_QUEUES;
	opts->use_cmb_sqs = false;
	opts->use_cmb_sqs = true;
	opts->arb_mechanism = SPDK_NVME_CC_AMS_RR;
	opts->keep_alive_timeout_ms = 10 * 1000;
	opts->io_queue_size = DEFAULT_IO_QUEUE_SIZE;
+1 −1
Original line number Diff line number Diff line
@@ -1316,7 +1316,7 @@ test_ctrlr_opts_set_defaults(void)

	spdk_nvme_ctrlr_opts_set_defaults(&opts);
	CU_ASSERT_EQUAL(opts.num_io_queues, DEFAULT_MAX_IO_QUEUES);
	CU_ASSERT_FALSE(opts.use_cmb_sqs);
	CU_ASSERT_TRUE(opts.use_cmb_sqs);
	CU_ASSERT_EQUAL(opts.arb_mechanism, SPDK_NVME_CC_AMS_RR);
	CU_ASSERT_EQUAL(opts.keep_alive_timeout_ms, 10 * 1000);
	CU_ASSERT_EQUAL(opts.io_queue_size, DEFAULT_IO_QUEUE_SIZE);