nvmf_tgt: assign different core for subsystems under RPC mode
Change-Id: Ib751c45f916f66b682d3011397f1f8fe794b08d8 Signed-off-by: GangCao <gang.cao@intel.com>
This commit is contained in:
parent
2ea9823c8a
commit
4f752e1d75
@ -84,6 +84,7 @@ struct spdk_nvmf_probe_ctx {
|
|||||||
#define SPDK_NVMF_CONFIG_MAX_IO_SIZE_MAX 131072
|
#define SPDK_NVMF_CONFIG_MAX_IO_SIZE_MAX 131072
|
||||||
|
|
||||||
struct spdk_nvmf_tgt_conf g_spdk_nvmf_tgt_conf;
|
struct spdk_nvmf_tgt_conf g_spdk_nvmf_tgt_conf;
|
||||||
|
static int32_t g_last_rpc_lcore = -1;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
spdk_get_numa_node_value(char *path)
|
spdk_get_numa_node_value(char *path)
|
||||||
@ -659,7 +660,7 @@ spdk_nvmf_parse_conf(void)
|
|||||||
|
|
||||||
int
|
int
|
||||||
spdk_nvmf_parse_subsystem_for_rpc(const char *name,
|
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_listen_addresses, struct rpc_listen_address *addresses,
|
||||||
int num_hosts, char *hosts[], const char *bdf,
|
int num_hosts, char *hosts[], const char *bdf,
|
||||||
const char *sn, int num_devs, char *dev_list[])
|
const char *sn, int num_devs, char *dev_list[])
|
||||||
@ -685,9 +686,14 @@ spdk_nvmf_parse_subsystem_for_rpc(const char *name,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lcore < 0) {
|
||||||
|
lcore = ++g_last_rpc_lcore;
|
||||||
|
}
|
||||||
|
|
||||||
/* Determine which core to assign to the subsystem */
|
/* Determine which core to assign to the subsystem */
|
||||||
mask = spdk_app_get_core_mask();
|
mask = spdk_app_get_core_mask();
|
||||||
lcore = spdk_nvmf_allocate_lcore(mask, lcore);
|
lcore = spdk_nvmf_allocate_lcore(mask, lcore);
|
||||||
|
g_last_rpc_lcore = lcore;
|
||||||
|
|
||||||
/* Determine the mode the subsysem will operate in */
|
/* Determine the mode the subsysem will operate in */
|
||||||
if (mode_str == NULL) {
|
if (mode_str == NULL) {
|
||||||
|
@ -294,6 +294,7 @@ spdk_rpc_construct_nvmf_subsystem(struct spdk_jsonrpc_server_conn *conn,
|
|||||||
struct rpc_subsystem req = {};
|
struct rpc_subsystem req = {};
|
||||||
struct spdk_json_write_ctx *w;
|
struct spdk_json_write_ctx *w;
|
||||||
int ret;
|
int ret;
|
||||||
|
req.core = -1; /* Explicitly set the core as the uninitialized value */
|
||||||
|
|
||||||
if (spdk_json_decode_object(params, rpc_subsystem_decoders,
|
if (spdk_json_decode_object(params, rpc_subsystem_decoders,
|
||||||
sizeof(rpc_subsystem_decoders) / sizeof(*rpc_subsystem_decoders),
|
sizeof(rpc_subsystem_decoders) / sizeof(*rpc_subsystem_decoders),
|
||||||
|
@ -78,7 +78,7 @@ struct nvmf_tgt_subsystem *nvmf_tgt_create_subsystem(const char *name,
|
|||||||
|
|
||||||
int
|
int
|
||||||
spdk_nvmf_parse_subsystem_for_rpc(const char *name,
|
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_listen_addresses, struct rpc_listen_address *addresses,
|
||||||
int num_hosts, char *hosts[], const char *bdf,
|
int num_hosts, char *hosts[], const char *bdf,
|
||||||
const char *sn, int num_devs, char *dev_list[]);
|
const char *sn, int num_devs, char *dev_list[]);
|
||||||
|
@ -375,7 +375,7 @@ def construct_nvmf_subsystem(args):
|
|||||||
jsonrpc_call('construct_nvmf_subsystem', params)
|
jsonrpc_call('construct_nvmf_subsystem', params)
|
||||||
|
|
||||||
p = subparsers.add_parser('construct_nvmf_subsystem', help='Add a nvmf subsystem')
|
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('mode', help='Target mode: Virtual or Direct')
|
||||||
p.add_argument('nqn', help='Target nqn(ASCII)')
|
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
|
p.add_argument('listen', help="""comma-separated list of Listen <transport:transport_name traddr:address trsvcid:port_id> pairs enclosed
|
||||||
|
Loading…
Reference in New Issue
Block a user