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 <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-08-15 10:22:04 -07:00
parent 81976ebd55
commit 0022304275
3 changed files with 14 additions and 5 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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);