Commit 4f752e1d authored by GangCao's avatar GangCao Committed by Daniel Verkamp
Browse files

nvmf_tgt: assign different core for subsystems under RPC mode



Change-Id: Ib751c45f916f66b682d3011397f1f8fe794b08d8
Signed-off-by: default avatarGangCao <gang.cao@intel.com>
parent 2ea9823c
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -84,6 +84,7 @@ struct spdk_nvmf_probe_ctx {
#define SPDK_NVMF_CONFIG_MAX_IO_SIZE_MAX 131072

struct spdk_nvmf_tgt_conf g_spdk_nvmf_tgt_conf;
static int32_t g_last_rpc_lcore = -1;

static int
spdk_get_numa_node_value(char *path)
@@ -659,7 +660,7 @@ spdk_nvmf_parse_conf(void)

int
spdk_nvmf_parse_subsystem_for_rpc(const char *name,
				  const char *mode_str, uint32_t lcore,
				  const char *mode_str, int32_t lcore,
				  int num_listen_addresses, struct rpc_listen_address *addresses,
				  int num_hosts, char *hosts[], const char *bdf,
				  const char *sn, int num_devs, char *dev_list[])
@@ -685,9 +686,14 @@ spdk_nvmf_parse_subsystem_for_rpc(const char *name,
		return -1;
	}

	if (lcore < 0) {
		lcore = ++g_last_rpc_lcore;
	}

	/* Determine which core to assign to the subsystem */
	mask = spdk_app_get_core_mask();
	lcore = spdk_nvmf_allocate_lcore(mask, lcore);
	g_last_rpc_lcore = lcore;

	/* Determine the mode the subsysem will operate in */
	if (mode_str == NULL) {
+1 −0
Original line number Diff line number Diff line
@@ -294,6 +294,7 @@ spdk_rpc_construct_nvmf_subsystem(struct spdk_jsonrpc_server_conn *conn,
	struct rpc_subsystem req = {};
	struct spdk_json_write_ctx *w;
	int ret;
	req.core = -1;	/* Explicitly set the core as the uninitialized value */

	if (spdk_json_decode_object(params, rpc_subsystem_decoders,
				    sizeof(rpc_subsystem_decoders) / sizeof(*rpc_subsystem_decoders),
+1 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ struct nvmf_tgt_subsystem *nvmf_tgt_create_subsystem(const char *name,

int
spdk_nvmf_parse_subsystem_for_rpc(const char *name,
				  const char *mode, uint32_t lcore,
				  const char *mode, int32_t lcore,
				  int num_listen_addresses, struct rpc_listen_address *addresses,
				  int num_hosts, char *hosts[], const char *bdf,
				  const char *sn, int num_devs, char *dev_list[]);
+1 −1
Original line number Diff line number Diff line
@@ -375,7 +375,7 @@ def construct_nvmf_subsystem(args):
    jsonrpc_call('construct_nvmf_subsystem', params)

p = subparsers.add_parser('construct_nvmf_subsystem', help='Add a nvmf subsystem')
p.add_argument("-c", "--core", help='The core Nvmf target run on', type=int, default=0)
p.add_argument("-c", "--core", help='The core Nvmf target run on', type=int, default=-1)
p.add_argument('mode', help='Target mode: Virtual or Direct')
p.add_argument('nqn', help='Target nqn(ASCII)')
p.add_argument('listen', help="""comma-separated list of Listen <transport:transport_name traddr:address trsvcid:port_id> pairs enclosed