Commit b3cc183a authored by GangCao's avatar GangCao Committed by Jim Harris
Browse files

nvme/example: add shm_id in identify tool under multi-proc case



Change-Id: Ia5427dda190d984edc79603c4b41e74ce49a7a5a
Signed-off-by: default avatarGangCao <gang.cao@intel.com>
parent b5b9410d
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -67,6 +67,8 @@ static struct spdk_nvme_intel_marketing_description_page intel_md_page;

static bool g_hex_dump = false;

static int g_shm_id = -1;

static struct spdk_nvme_transport_id g_trid;

static void
@@ -885,6 +887,7 @@ usage(const char *program_name)

	spdk_tracelog_usage(stdout, "-t");

	printf(" -i         shared memory group ID\n");
	printf(" -x         print hex dump of raw data\n");
	printf(" -v         verbose (enable warnings)\n");
	printf(" -H         show this usage\n");
@@ -898,8 +901,11 @@ parse_args(int argc, char **argv)
	g_trid.trtype = SPDK_NVME_TRANSPORT_PCIE;
	snprintf(g_trid.subnqn, sizeof(g_trid.subnqn), "%s", SPDK_NVMF_DISCOVERY_NQN);

	while ((op = getopt(argc, argv, "r:t:xH")) != -1) {
	while ((op = getopt(argc, argv, "i:r:t:xH")) != -1) {
		switch (op) {
		case 'i':
			g_shm_id = atoi(optarg);
			break;
		case 'x':
			g_hex_dump = true;
			break;
@@ -955,16 +961,17 @@ int main(int argc, char **argv)
	int				rc;
	struct spdk_env_opts		opts;

	spdk_env_opts_init(&opts);
	opts.name = "identify";
	opts.core_mask = "0x1";
	spdk_env_init(&opts);

	rc = parse_args(argc, argv);
	if (rc != 0) {
		return rc;
	}

	spdk_env_opts_init(&opts);
	opts.name = "identify";
	opts.core_mask = "0x1";
	opts.shm_id = g_shm_id;
	spdk_env_init(&opts);

	rc = 0;
	if (spdk_nvme_probe(&g_trid, NULL, probe_cb, attach_cb, NULL) != 0) {
		fprintf(stderr, "spdk_nvme_probe() failed\n");
+2 −1
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ if [ $(uname -s) = Linux ]; then
	kill -9 $!
	count=0
	while [ $count -le 2 ]; do
		$rootdir/examples/nvme/perf/perf -i 0 -q 1 -w read -s 4096 -t 1 -c 0x10
		$rootdir/examples/nvme/perf/perf -i 0 -q 1 -w read -s 4096 -t 1 -c 0xf
		count=$(($count + 1))
	done
	count=0
@@ -77,6 +77,7 @@ if [ $(uname -s) = Linux ]; then
		core=$((1 << (($count + 4))))
		printf -v hexcore "0x%x" "$core"
		$rootdir/examples/nvme/perf/perf -i 0 -q 128 -w read -s 4096 -t 1 -c $hexcore &
		$rootdir/examples/nvme/identify/identify -i 0 &
		count=$(($count + 1))
	done
	wait $pid