From 28ff7a0da7a7af1409c0c66c7b3b500e0a8c46f6 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Fri, 15 Dec 2017 14:36:01 +0900 Subject: [PATCH] iscsi: Set cpumask to all available CPUs when PG is created JSON-RPC Currently the default setting of cpumask of network portal is different between iSCSI.conf and JSON-RPC. When a network portal is created by iSCSI.conf, its cpumask is set to all available CPUs by default. However when it is created by JSON-RPC, its cpumask is set to 0 by default. Auto test 'test/iscsi_tgt/idle_migration creates a network portal by JSON-RPC. Hence the auto test cannot test the load balancing function of iSCSI target. Change-Id: I2685172cb9259b643f6d18d4660a8425dcef3f5d Signed-off-by: Shuhei Matsumoto Reviewed-on: https://review.gerrithub.io/391898 Tested-by: SPDK Automated Test System Reviewed-by: Jim Harris Reviewed-by: Daniel Verkamp --- lib/iscsi/iscsi_rpc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/iscsi/iscsi_rpc.c b/lib/iscsi/iscsi_rpc.c index 910091eba..ed85aefd2 100644 --- a/lib/iscsi/iscsi_rpc.c +++ b/lib/iscsi/iscsi_rpc.c @@ -40,6 +40,7 @@ #include "spdk/rpc.h" #include "spdk/util.h" +#include "spdk/event.h" #include "spdk_internal/log.h" @@ -809,6 +810,7 @@ spdk_rpc_add_portal_group(struct spdk_jsonrpc_request *request, struct rpc_portal_group req = {}; struct spdk_iscsi_portal *portal_list[MAX_PORTAL] = {}; struct spdk_json_write_ctx *w; + uint64_t cpumask; size_t i = 0; int rc = -1; @@ -819,9 +821,11 @@ spdk_rpc_add_portal_group(struct spdk_jsonrpc_request *request, goto out; } + cpumask = spdk_app_get_core_mask(); + for (i = 0; i < req.portal_list.num_portals; i++) { portal_list[i] = spdk_iscsi_portal_create(req.portal_list.portals[i].host, - req.portal_list.portals[i].port, 0); + req.portal_list.portals[i].port, cpumask); if (portal_list[i] == NULL) { SPDK_ERRLOG("portal_list allocation failed\n"); goto out;