Commit 372942e5 authored by GangCao's avatar GangCao Committed by Ben Walker
Browse files

nvme: move global request_mempool allocation into nvme_impl



The user no longer needs to create the request pool.

Change-Id: I83bb8948143d4cc961d232f9f30df3106d5e0eab
Signed-off-by: default avatarGangCao <gang.cao@intel.com>
parent d7734d16
Loading
Loading
Loading
Loading
+1 −8
Original line number Diff line number Diff line
@@ -55,8 +55,6 @@
#include "spdk/nvme.h"
#include "spdk/io_channel.h"

struct rte_mempool *request_mempool;

#define SPDK_NVMF_BUILD_ETC "/usr/local/etc/nvmf"
#define SPDK_NVMF_DEFAULT_CONFIG SPDK_NVMF_BUILD_ETC "/nvmf.conf"

@@ -70,11 +68,7 @@ static bool g_subsystems_shutdown;
static void
shutdown_complete(void)
{
	int rc;

	rc = spdk_nvmf_check_pools();

	spdk_app_stop(rc);
	spdk_app_stop(0);
}

static void
@@ -380,7 +374,6 @@ This is the main file.
	nvmf=>nvmf [label="spdk_event_allocate()"];
	nvmf=>nvmf [label="spdk_app_start()"];
	nvmf=>nvmf [label="spdk_app_fini()"];
	nvmf=>nvmf [label="spdk_nvmf_check_pools()"];
	c_runtime<<nvmf;

\endmsc
+1 −12
Original line number Diff line number Diff line
@@ -112,7 +112,6 @@ struct feature {
	bool					valid;
};

struct rte_mempool *request_mempool		= NULL;
static struct rte_mempool *task_pool		= NULL;

static struct ctrlr_entry *g_controllers	= NULL;
@@ -1141,17 +1140,7 @@ main(int argc, char **argv)
		return 1;
	}

	request_mempool = rte_mempool_create("nvme_request", 8192,
					     spdk_nvme_request_size(), 128, 0,
					     NULL, NULL, NULL, NULL,
					     SOCKET_ID_ANY, 0);

	if (request_mempool == NULL) {
		fprintf(stderr, "could not initialize request mempool\n");
		return 1;
	}

	task_pool = rte_mempool_create("task_pool", 8192,
	task_pool = rte_mempool_create("arbitration_task_pool", 8192,
				       sizeof(struct arb_task),
				       64, 0, NULL, NULL, task_ctor, NULL,
				       SOCKET_ID_ANY, 0);
+0 −12
Original line number Diff line number Diff line
@@ -89,9 +89,6 @@ struct spdk_fio_thread {

};

// Global request_mempool is used by libspdk_nvme.a and must be defined
struct rte_mempool         *request_mempool;

static bool
probe_cb(void *cb_ctx, struct spdk_pci_device *dev, struct spdk_nvme_ctrlr_opts *opts)
{
@@ -209,15 +206,6 @@ static int spdk_fio_setup(struct thread_data *td)
		return 1;
	}

	request_mempool = rte_mempool_create("nvme_request", 8192,
					     spdk_nvme_request_size(), 128, 0,
					     NULL, NULL, NULL, NULL,
					     SOCKET_ID_ANY, 0);
	if (!request_mempool) {
		fprintf(stderr, "rte_mempool_create failed\n");
		return 1;
	}

	/* Enumerate all of the controllers */
	if (spdk_nvme_probe(td, probe_cb, attach_cb, NULL) != 0) {
		fprintf(stderr, "spdk_nvme_probe() failed\n");
+0 −18
Original line number Diff line number Diff line
@@ -55,8 +55,6 @@ struct ns_entry {
	struct spdk_nvme_qpair	*qpair;
};

struct rte_mempool *request_mempool;

static struct ctrlr_entry *g_controllers = NULL;
static struct ns_entry *g_namespaces = NULL;

@@ -356,22 +354,6 @@ int main(int argc, char **argv)
		return 1;
	}

	/*
	 * Create the NVMe request buffer pool.  This will be used internally
	 *  by the SPDK NVMe driver to allocate an spdk_nvme_request data
	 *  structure for each I/O request.  This is implicitly passed to
	 *  the SPDK NVMe driver via an extern declaration in nvme_impl.h.
	 */
	request_mempool = rte_mempool_create("nvme_request", 8192,
					     spdk_nvme_request_size(), 128, 0,
					     NULL, NULL, NULL, NULL,
					     SOCKET_ID_ANY, 0);

	if (request_mempool == NULL) {
		fprintf(stderr, "could not initialize request mempool\n");
		return 1;
	}

	printf("Initializing NVMe Controllers\n");

	/*
+0 −12
Original line number Diff line number Diff line
@@ -43,8 +43,6 @@
#include "spdk/nvme_intel.h"
#include "spdk/pci_ids.h"

struct rte_mempool *request_mempool;

static int outstanding_commands;

struct feature {
@@ -920,16 +918,6 @@ int main(int argc, char **argv)
		exit(1);
	}

	request_mempool = rte_mempool_create("nvme_request", 8192,
					     spdk_nvme_request_size(), 128, 0,
					     NULL, NULL, NULL, NULL,
					     SOCKET_ID_ANY, 0);

	if (request_mempool == NULL) {
		fprintf(stderr, "could not initialize request mempool\n");
		exit(1);
	}

	rc = 0;
	if (spdk_nvme_probe(NULL, probe_cb, attach_cb, NULL) != 0) {
		fprintf(stderr, "spdk_nvme_probe() failed\n");
Loading