From 00223042750f8494fca28c10df1730c7a2c962de Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Mon, 15 Aug 2016 10:22:04 -0700 Subject: [PATCH] iscsi: track conn lcore for informational purposes The lcore_id field in the get_iscsi_connections RPC was removed in commit 5d8c94536a7d1d4c1f0ee3349188bf0e7e8c9e74; add a field to spdk_iscsi_conn to track the lcore so this can be re-added. Change-Id: I6c9574829466b168880728f4620401987fc7dd3c Signed-off-by: Daniel Verkamp --- lib/iscsi/conn.c | 15 ++++++++++----- lib/iscsi/conn.h | 1 + lib/iscsi/iscsi_rpc.c | 3 +++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/iscsi/conn.c b/lib/iscsi/conn.c index 7b012b868..cf80a7caf 100644 --- a/lib/iscsi/conn.c +++ b/lib/iscsi/conn.c @@ -396,10 +396,11 @@ error_return: * core, suspend the connection here. This ensures any necessary libuns * housekeeping for TCP socket to lcore associations gets cleared. */ + conn->lcore = spdk_app_get_current_core(); spdk_net_framework_clear_socket_association(conn->sock); - rte_atomic32_inc(&g_num_connections[spdk_app_get_current_core()]); + rte_atomic32_inc(&g_num_connections[conn->lcore]); spdk_poller_register(&conn->poller, spdk_iscsi_conn_login_do_work, conn, - spdk_app_get_current_core(), NULL, 0); + conn->lcore, NULL, 0); return 0; } @@ -637,8 +638,9 @@ void spdk_shutdown_iscsi_conns(void) */ STAILQ_FOREACH_SAFE(conn, &g_idle_conn_list_head, link, tmp) { STAILQ_REMOVE(&g_idle_conn_list_head, conn, spdk_iscsi_conn, link); + conn->lcore = rte_get_master_lcore(); spdk_poller_register(&conn->poller, spdk_iscsi_conn_full_feature_do_work, conn, - rte_get_master_lcore(), NULL, 0); + conn->lcore, NULL, 0); conn->is_idle = 0; del_idle_conn(conn); } @@ -1187,8 +1189,9 @@ spdk_iscsi_conn_full_feature_migrate(struct spdk_event *event) struct spdk_iscsi_conn *conn = spdk_event_get_arg1(event); /* The poller has been unregistered, so now we can re-register it on the new core. */ + conn->lcore = spdk_app_get_current_core(); spdk_poller_register(&conn->poller, spdk_iscsi_conn_full_feature_do_work, conn, - spdk_app_get_current_core(), NULL, 0); + conn->lcore, NULL, 0); } void @@ -1288,6 +1291,7 @@ void spdk_iscsi_conn_idle_do_work(void *arg) lcore = spdk_iscsi_conn_allocate_reactor(tconn->portal->cpumask); rte_atomic32_inc(&g_num_connections[lcore]); spdk_net_framework_clear_socket_association(tconn->sock); + tconn->lcore = lcore; spdk_poller_register(&tconn->poller, spdk_iscsi_conn_full_feature_do_work, tconn, lcore, NULL, 0); SPDK_TRACELOG(SPDK_TRACE_DEBUG, "add conn id = %d, cid = %d poller = %p to lcore = %d active\n", tconn->id, tconn->cid, &tconn->poller, lcore); @@ -1308,8 +1312,9 @@ __add_idle_conn(spdk_event_t e) * process. */ if (conn->state == ISCSI_CONN_STATE_EXITING) { + conn->lcore = rte_get_master_lcore(); spdk_poller_register(&conn->poller, spdk_iscsi_conn_full_feature_do_work, conn, - rte_get_master_lcore(), NULL, 0); + conn->lcore, NULL, 0); return; } diff --git a/lib/iscsi/conn.h b/lib/iscsi/conn.h index 1a48c5566..1bf343725 100644 --- a/lib/iscsi/conn.h +++ b/lib/iscsi/conn.h @@ -80,6 +80,7 @@ struct spdk_iscsi_conn { * are initialized when allocated. */ struct spdk_iscsi_portal *portal; + uint32_t lcore; int sock; struct spdk_iscsi_sess *sess; diff --git a/lib/iscsi/iscsi_rpc.c b/lib/iscsi/iscsi_rpc.c index 05f566034..98ba7166e 100644 --- a/lib/iscsi/iscsi_rpc.c +++ b/lib/iscsi/iscsi_rpc.c @@ -908,6 +908,9 @@ spdk_rpc_get_iscsi_connections(struct spdk_jsonrpc_server_conn *conn, spdk_json_write_name(w, "is_idle"); spdk_json_write_int32(w, c->is_idle); + spdk_json_write_name(w, "lcore_id"); + spdk_json_write_int32(w, c->lcore); + spdk_json_write_name(w, "initiator_addr"); spdk_json_write_string(w, c->initiator_addr);