Commit Graph

216 Commits

Author SHA1 Message Date
Shuhei Matsumoto
5b963d40fd lib/iscsi: Move PDU receive repetition into the same file as PDU receive state machine
To make the code clearer,
- make the spdk_iscsi_read_pdu() private in iscsi.c and named iscsi_read_pdu(), and
- make the iscsi_conn_handle_incoming_pdus() public and named
  spdk_iscsi_handle_incoming_pdus().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I967681b8e9b86681a906b18719e91e1d387450d7
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469969
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-10-17 16:27:27 +00:00
Shuhei Matsumoto
4b741fe65e lib/iscsi: Introduce state machine into receive PDUs operation
Add PDU receive state to each connection, and each connection
transits among states during receiving incoming PDUs.

Four states, AWAIT_PDU_READY, AWAIT_PDU_HDR, AWAIT_PDU_PAYLOAD,
and ERROR are same as SPDK NVMe-TCP target.

Move clearing conn->pdu_in_progress just before putting pdu
when PDU processing completes normally to match with error case.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Id24b6d6662896b5685125a46ee20cbf216668838
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469966
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-10-17 16:27:27 +00:00
Shuhei Matsumoto
52e2b86b33 lib/iscsi: Move spdk_iscsi_execute() from iscsi_conn_handle_incoming_pdus() to spdk_iscsi_read_pdu()
Move spdk_iscsi_execute() from iscsi_conn_handle_incoming_pdus()
to spdk_iscsi_read_pdu() and then strip the prefix spdk_ from
spdk_iscsi_execute() and make it private.

This is to introduce state machine into receive incoming PDU processing.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5d5b3e55ece0994532e924d3c75d898cb373875c
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470287
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-10-15 16:23:19 +00:00
Shuhei Matsumoto
349b772415 lib/iscsi: Get IO trace ISCSI_TASK_EXECUTED before PDU is freed
IO trace ISCSI_TASK_EXECUTED was taken after PDU was freed.
spdk_trace_record() doesn't dereference the passed pointers and it's fine,
but get the trace before PDU is freed to make the coder clearer.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I53a19dbd85e9599c4fa9d7458b5344cff9c76ea2
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471203
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-10-15 16:23:19 +00:00
Shuhei Matsumoto
5f37368f19 lib/iscsi: Unify error log of spdk_iscsi_execute()
We can unify several error logs of spdk_iscsi_execute() failure
into a single error log.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I1dd6a7312e5c615c478771beb89fd44fdb1710c1
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470286
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-10-12 01:20:09 +00:00
Shuhei Matsumoto
df46a0b893 lib/iscsi: Move Logout check from iscsi_conn_handle_incoming_pdus() to spdk_iscsi_read_pdu()
Move logout check from iscsi_conn_handle_incoming_pdus() to
spdk_iscsi_read_pdu() to introduce state machine into receive
incoming PDUs processing.

Besides, remove a debug log because similar debug log is already
collected in spdk_iscsi_conn_read_data().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I11ee800eb1fd60796669d5390bd3cd1031066ca7
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470285
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-10-12 01:20:09 +00:00
Shuhei Matsumoto
e4e6c256b9 lib/iscsi: Flush PDUs only when connection state is RUNNING or less
In iscsi_conn_flush_pdus(), call iscsi_conn_flush_pdus_internal()
only when the connection state is RUNNING or INVALID.

Besides, we can remove the iscsi_conn_flush_pdus() call from
iscsi_conn_sock_cb() because the connection state is already EXITING.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I9e1029ffa555e5e43aade53f61e942e98343006d
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469801
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-10-09 02:45:17 +00:00
Shuhei Matsumoto
fe5611b79b lib/iscsi: Request logout to asynchronously to initiator
Request logout to the initiator asynchronously when exiting the
running connection from the target.

Based on this patch, the next patch will make flushing PDUs possible
only when the connection is RUNNING (or INVALID) and remove the
tight loop in iscsi_conn_flush_pdus().

Set timeout of logout request as 30 seconds. 30 seconds is as same as
NOP timeout and will be reasonable for now.

Add and use logout_request_timer to check the timeout.

When the connection gets internal a logout request, move the connection
to EXITING state if the connection is in INVALID state, request logout
to initiator and start 30 seconds timer if the connection is in RUNNING
state and logout is not requested yet, or do nothing otherwise.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I43192be9fd7112ad444152c0dd88f99a14aa8d30
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470705
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-10-09 02:45:17 +00:00
Shuhei Matsumoto
7814351539 lib/iscsi: Consolidate call spdk_iscsi_conn_destruct() in a single place
Change logout_timeout() not to call spdk_iscsi_conn_construct() but
to move conn->state to EXITING. Then spdk_iscsi_conn_destruct() will
be called by the poller of iSCSI poll group, iscsi_poll_group_poll()
soon.

This will improve the maitainability slightly.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I78046ae5ad7992ad6c7509884f964d2eff6ced76
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470704
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-10-09 02:45:17 +00:00
Shuhei Matsumoto
8703949c05 lib/iscsi: Replace ISCSI_CONN_STATE_LOGGED_OUT state by is_logged_out flag
The connection state is mainly for flushing PDUs. ISCSI_CONN_STATE_LOGGED_OUT
was as same as ISCSI_CONN_STATE_RUNNING for this point.

Replace ISCSI_CONN_STATE_LOGGED_OUT state by a is_logged_out flag
and use the latter to reject any incoming PDU after sending logout
response.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I3426a3ecbd241db402b1a2f7b3914a18e3591591
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470703
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-10-09 02:45:17 +00:00
Shuhei Matsumoto
1e879636a2 lib/iscsi: Handle IN_LOGIN as the same way as RUNNING for flushing PDUs
Previously When the connection is in login processing, flushing PDUs
had been done by tight loop. Login processing will not fill out
send buffers but we can use poller to flush PDUs as same as when the
connection is running iscsi_conn_flush_pdus().

Hence change the check condition to include INVALID state to use
poller in iscsi_conn_flush_pdus().

This change is necessary because the subsequent patches will change
iscsi_conn_flush_pdus() not to flush PDUs when the connection is not
invalid or running.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I543a912bf1aa957df7033184ce5989ac92367e49
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470702
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-10-09 02:45:17 +00:00
Shuhei Matsumoto
26d6706bc5 lib/iscsi: Remove unnecessary declaration of iscsi_conn_stop()
We can remove the declaration of iscsi_conn_stop() by moving
the related functions before the caller to iscsi_conn_stop(),
_iscsi_conn_check_shutdown() and _iscsi_conn_destruct().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ia86f6685c9e90692d8dae744495bd6f8fc310990
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470556
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-10-09 02:45:17 +00:00
Shuhei Matsumoto
0608e00173 lib/iscsi: Remove unnecessary declaration of iscsi_conn_full_feature_migrate()
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I724f1eb123b4477437ca098f2bbb2b69e6bff131
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470555
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-10-09 02:45:17 +00:00
Shuhei Matsumoto
b72893a6f2 lib/iscsi: Portal group holds CHAP params and passes them to connections
This is another preparation to support per portal group CHAP authentication
for discovery session.

Add CHAP params into struct spdk_iscsi_portal_grp, and initialize them
by global parameters at spdk_iscsi_portal_grp_create().

Copy CHAP params from portal group to connection at spdk_iscsi_conn_construct().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I1ecb812266ac3d090f8e6db21d1d6a090f1811d9
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469368
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-09-27 15:24:14 +00:00
Shuhei Matsumoto
a398d87467 lib/iscsi: Separate CHAP params setup and authentication process
This is a preparation to support per portal group CHAP authentication
for discovery session.

Previously require_chap, disable_chap, and mutual_chap had been set
and used in iscsi_negotiate_param(), and chap_group had been set
and used in iscsi_get_authinfo().

If a connection is in a discovery session, the connection can get
all CHAP params at its creation, spdk_iscsi_conn_construct().

If a connection is in a normal session, the connection can get all
CHAP params in iscsi_op_login_negotiate_chap_param().

Each connection is in either discovery session or normal session.

So the following change is possible and is done in this patch.

spdk_iscsi_conn_construct() sets all CHAP params of the connection
by global parameters. Then iscsi_op_login_negotiate_chap_param()
overwrites them by the corresponding target's parameters.
iscsi_negotiate_chap_param() and iscsi_get_authinfo() just refer
the CHAP params.

Besides, iscsi_get_authinfo() changed to call just
spdk_iscsi_chap_get_authinfo() inside, and so inline
spdk_iscsi_chap_get_authinfo() into iscsi_auth_params() and then
remove iscsi_get_authinfo().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I8028673cc6923e1b8bc20af55e0c3cc933972fc0
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469218
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-09-27 15:24:14 +00:00
Seth Howell
72d06a99e1 Revert "iscsi: change the field bhs to pointer type."
This reverts commit 80cf038ced.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: I95e2ddfbc9cd07e874a385b345dc401fc8076e88
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468778
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-09-19 05:04:00 +00:00
Ziye Yang
80cf038ced iscsi: change the field bhs to pointer type.
Purpose: Prepare for the further optimization work
to use one bigger buffer to read more data for
reducing system calls.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Ie92603b09308bd3149263269fdec355b67251b37
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468538
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-09-18 18:14:53 +00:00
Ben Walker
9c36043576 iscsi: No longer set sock recvbuf size
The socket now automatically sets the recvbuf size
to 2MB, so this isn't necessary.

Change-Id: Id2196f4038f6835118047233f18c0395fa3f2670
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466992
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-09-10 17:48:49 +00:00
Shuhei Matsumoto
703a5473f7 iscsi: Restore the previous bug fix for LUN hot plug
One recent commit destroyed the critical bug fix for LUN hot plug.
Hence this patch restores the critical bug fix. Simple revert is
not possible because connections are assigned to poll groups
instead of cores now. But we can revert easily because earlier
version of the recent patch did that.

Fixes #925

The github issue was caused by commit 8cf1945432.
The bug fix restored by this patch is commit 1f6a78620d.
The reference we can follow to create this patch is earlier version
of commit fb641c4b54.

Reported-by: yidong0635 <dongx.yi@intel.com>

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: Ie1ba14a59ce48149a8474cbffc56aa08adc1fc4d
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466108
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-08-23 18:09:16 +00:00
Shuhei Matsumoto
23eb38f1ac iscsi: Use fixed size string for host and port name of connection
This will reduce the potential malloc failure.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ibcd631bf318ef6ece4ac337219652323ca5fd8f1
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/464136
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-08-13 15:46:17 +00:00
Shuhei Matsumoto
b3cf508f56 iscsi: Make get_iscsi_connections RPC asynchronous
iSCSI poll groups are bind to SPDK thread through IO channel now.

This patch changes get_iscsi_connections RPC from synchronous to
asynchronous by using spdk_for_each_channel.

Core ID was removed from the output of the RPC but thread name
is added to the output of the RPC in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I20fdb7f11434acf838a89435ba5052b19869181c
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463569
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-08-12 20:49:36 +00:00
Shuhei Matsumoto
9a17b539f9 iscsi: Factor out JSON information of connection
Factor out writing connection information to JSON context into
a helper function spdk_iscsi_conn_info_json.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I3e92bcb4f21cc7a36af182f850c944b8c5dd559f
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463568
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
2019-08-12 20:49:36 +00:00
Ben Walker
fb641c4b54 iscsi: Assign connections to poll groups instead of lcores.
This patch binds poll groups to SPDK thread through IO channel and
assigns connections to poll groups instead of cores.

iSCSI subsystem registers iSCSI global object as an IO device, and create
poll groups as context of IO channels of the IO device.

Each portal get and hold portal group on which the corresponding acceptor is
running.

When a connection is constructed, iSCSI subsystem assigns a poll group
to the connection by getting it from the corresponding portal.

When a connection enters full-feature phase, iSCSI subsystem schedules
the connection to a poll group by round-robin.

Then, each connection can know its running SPDK thread directly and can
use SPDK message passing infrastructure instead of SPDK event framework.

By this change, iSCSI connections are binded to SPDK thread, and not
binded to processor core anymore.

Some other changes in this patch are
- core ID is removed from the output of get_iscsi_connections RPC. The
  upcoming patches will change the RPC to use spdk_for_each_channel and can
  access SPDK thread safely, and add SPDK thread ID instead.
- utilize UT multithread framework added by the last patch to test
  iSCSI poll groups by UT.

Change-Id: Iec73c778aa413bcabdb63141cc41d4160911ea0e
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463359
Reviewed-by: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-08-12 20:49:36 +00:00
Shuhei Matsumoto
8cf1945432 iscsi: Hot remove callback closes LUN directly without using event call
This patch is in the patch series to migrate iSCSI connection management
from core based to SPDK thread based.

The callback to hot removal of LUN, iscsi_conn_remove_lun, is called
on the same core when the corresponding LUN is opened. Additionally,
all operations in iscsi_conn_remove_lun are completed synchronously.

Hence inline _iscsi_conn_remove_lun into iscsi_conn_remove_lun.
Add assert to check the function is called on the specified core.

This change is helpful to achieve the goal of the patch series
because spdk_event can have two parameters but spdk_msg can have
only a single variable, and hence we cannot convert simply and have
to introduce a context allocated dynamically otherwise.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Iaebf18265dfe839f7361b09539527a1806aed1c4
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463551
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
2019-08-08 05:35:01 +00:00
Ben Walker
39e850d17b iscsi: Remove cpumask from portals
Connections will soon be assigned to poll groups, which will be
dynamically moved between CPU cores based on load. It no longer makes
sense to restrict certain portal groups to specific cpu cores in this
model.

Change-Id: Iee983d75febc9797aa60021c5bc0680335e895cd
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463358
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-08-08 05:35:01 +00:00
Shuhei Matsumoto
666a0b5cb4 iscsi: Assign not pointer but instance of spdk_cpuset in struct spdk_iscsi_portal_grp
This will reduce pontential malloc failures.

Change-Id: I9b1965e0be95af4c0496dfbae80c86b25c460c94
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459718
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-04 00:30:22 +00:00
Changpeng Liu
77c1f90e98 iscsi: change ERRLOG to DEBUGLOG for read socket error
Since spdk_iscsi_conn_read_data() can print error log, so we
don't need to print again in the caller, existing code will
print error log for LOGOUT and DISCOVERY cases.

Fix issue #845.

Change-Id: I547d3d667b6412ab6a59c9b401d0f28c5026307d
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460110
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-02 22:56:01 +00:00
Ziye Yang
ba3adc4367 iscsi: return the correct error code in spdk_iscsi_read_pdu
We shoud not always return SPDK_ISCSI_CONNECTION_FATAL
in spdk_iscsi_read_pdu function.

Reason: In iscsi_conn_handle_incoming_pdus, the loop
directly return only rc==SPDK_ISCSI_CONNECTION_FATAL.
But it masks all the necessary information. So we would like
to keep some information of the return value for spdk_iscsi_read_pdu,
and we can use error log to track those information.

Then we can return SPDK_ISCSI_CONNECTION_FATAL as the error
return value for iscsi_conn_handle_incoming_pdus function.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I4c40fcb27052b55cb92e06273701a881def18e12
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457078
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-13 06:04:31 +00:00
Li Feng
02363ccb3b lib/iscsi: fix iscsi connection schedule
If the qualified core wasn't found, then we should compare
spdk_env_get_core_count() with i, instead of lcore.

Signed-off-by: Li Feng <fengli@smartx.com>
Change-Id: Ie92f56712b7f0e51636008fe12fff5584b6be8ab
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456415
Reviewed-by: wuzhouhui <wuzhouhui14@mails.ucas.ac.cn>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-05 17:39:12 +00:00
GangCao
9a73633190 iscsi: add a cleanup utility function
Added a utility function for the cleanup related operations.

Change-Id: I4e49dd9c2da899a5bda289bc36778b636af9c5df
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456599
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-06-04 23:51:15 +00:00
Jim Harris
59a1fbe937 iscsi: fix hang on high QD large reads
We throttle the number of data_in operations per
connection.  Currently after a read is completed,
we try to send more data_in operations since one
has just been completed.

But we are trying to send more too early.  The data_in_cnt
doesn't actually get decremented until after the PDU is
written on the socket.  So this results in a case
where data_in_cnt == 64, and all 64 read operations
complete before any of those 64 are actually transmitted
onto the TCP socket.  There are no more read operations
waiting, so we won't try to handle the data_in list
again, and if none of these 64 resulted in a SCSI
command completing, then the initiator may not send us
any more read I/O which would have also kicked the data_in
list.

So the solution is to kick the data_in list after the
PDU has been written - not after a read I/O is completed
back from the SCSI layer.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ia01cf96e8eb6e08ddcaaeff449386e78de7c5bc5

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455454
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: GangCao <gang.cao@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-05-24 04:19:03 +00:00
Jim Harris
462c12d9e9 iscsi: free pdus in hot remove path with no lun
The datain handling code path will set the LUN to
NULL if it finds a task's LUN has been hotremoved.
This could happen before the iscsi hotplug routine
actually gets a chance to run.  If this happens,
one of these tasks doesn't actually get freed, and
then will be freed after the lun is closed -
causing a segfault in the bdev layer since it may
have a bdev_io associated with it.

Found by running the iscsi_tgt/fio test after
applying the next patch in this series.

There's more work needed in this hot remove clean up
path - currently we are just freeing a lot of PDUs
rather than completing them with error status when
a LUN is hot removed.  But let's tackle that
separately.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I8d27f0c7a79ae91cb6504e5ff6ffc8e346c9e54c

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455460
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-05-24 04:19:03 +00:00
Ben Walker
bdb595cfb3 iscsi: spdk_iscsi_poll_group_add_conn now takes a poll group argument
Make this explicit instead of implicit.

Change-Id: Iab1b856648e1f11722e1f76602f1eee4bc4ed0b5
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454381
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-05-15 18:45:46 +00:00
Ben Walker
c6f43b89bc iscsi: Always schedule discovery sessions on the acceptor thread
Change-Id: I0b8aee43f8b4cc380c91a7bb69fb33b307edb412
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453019
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-05-06 17:10:48 +00:00
Ben Walker
fc35f1ae3e iscsi: inline spdk_iscsi_conn_allocate_reactor
This function was only called from a single place, so just
move the code there.

Change-Id: I78c05ef41ca0d5684385e80cb75d699453c90792
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453018
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-05-06 17:10:48 +00:00
Ben Walker
1224a5a049 iscsi: Remove out-dated comment above spdk_iscsi_conn_construct
This went stale and the code is currently in flux.

Change-Id: Ib0b2171f253db0f54d41573c07668eb3b2bd83b4
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452781
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-05-06 17:10:48 +00:00
Ben Walker
07c9541082 iscsi: Assign connections to cores using round robin
Previously, this searched the list of cores for the one
with the fewest connections and scheduled there. iSCSI
is being migrated to a new threading model where the
threads themselves will float, so simplify this part
of the code while that's implemented.

Change-Id: I05a1ff51a45df9c176c0e57d7f1ae9e97928adcd
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452780
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-05-06 17:10:48 +00:00
Ben Walker
af8affd1a9 iscsi: Deprecate MinConnectionsPerCore
iSCSI is currently being adapted to SPDK's new threading model,
and this parameter doesn't make sense anymore. Remove it for
now until something functionally equivalent is added later.

Change-Id: Ia0e2f5aa81b72d99467c5a900619fbeeb42b2069
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452779
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-05-06 17:10:48 +00:00
Ben Walker
1f41fb365b iscsi: Simplify iscsi_poll_group_add/remove conn operations
We don't need to have operations to remove just the socket.

Change-Id: I00e0c7fb81af98d1c072ba126ce22b41954e313b
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452728
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-05-06 17:10:48 +00:00
Ben Walker
d6d5f870c4 iscsi: Only call iscsi_conn_stop in exit path
For migrating a connection, don't stop it entirely.

Change-Id: I0e09698e03127c04257485a0a2af262ed1a7761a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453017
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-05-06 17:10:48 +00:00
Jim Harris
b6206d657c trace: shorten max name from 44 to 24 characters
This restriction helps reduce the amount of padding when
printing out the event trace, allowing it to fit in a
small number of columns.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ifa31e5a6967c7b9bc7028069effb71533f80596f

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452736
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-05-02 08:41:56 +00:00
Jim Harris
617184be3b trace: remove short_name
This was not used by any of the trace register descriptions.
Let's remove it rather keeping it around if we don't need it.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Idda809e2911db5be555ff6aa13695484a14bf665

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452734
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2019-05-02 08:41:56 +00:00
Ben Walker
8df1f6b220 iscsi: Rename spdk_iscsi_conn_migrate to spdk_iscsi_conn_schedule
This function is in charge of scheduling new connections
onto cores. It used to be used to dynamically migrate
connections, but we no longer do that.

Change-Id: I2fa04a7dfb43bf9fae7902376ba5ba6d18744469
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452727
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-05-02 08:33:48 +00:00
Ben Walker
31dd18697a iscsi: Use threads in iscsi_conn_check_shutdown
This can use threads instead of events.

Change-Id: I8a55ad512038dd75218a9a6af17d135eba6949f7
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452726
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-05-02 08:33:48 +00:00
Shuhei Matsumoto
9470d65e8d lib/scsi: Add lun to the names of descriptors and callback for LUN
The next patch will add the function ponter typedef
spdk_scsi_dev_destruct_cb for SCSI device destruction.
Hence add lun to the names of descriptors and callback for SCSI
LUN for clarification.

This patch doesn't change any behavior.

Change-Id: I73f2bce9129f7a6f16770ab6ed18428b16589108
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450883
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-04-22 16:00:42 +00:00
Shuhei Matsumoto
e5108dfaa5 lib/iscsi: Fix the issue that the array of connections is not invalidated
In iscsi_conns_cleanup(), g_conns_array was unmapped but was not
invalidated by setting MAP_FAILED.

So, find_iscsi_connection_by_id() caused segmentation fault if
it is called after iscsi_conns_cleanup().

Change-Id: Ib91c9240c62c2aaa32713dd4aa382d31e5ea2eed
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450901
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-04-22 16:00:42 +00:00
Shuhei Matsumoto
d09eff6a0f lib/iscsi: Make two helper functions from private to public in iSCSI library
These change will be used in the next patch.

Change-Id: Ifdb4ccf20049b46e850122a4021cbbe7441e1270
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450736
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-11 18:33:18 +00:00
Shuhei Matsumoto
d72f73b26e lib/iscsi: Add target to get_active_conns() as an argument
Subsequent patches will exit only connections belonging to the
specific target node. So add target to get_active_conns() as
an argument.

Change-Id: If0d9cad46614310e0fe17e69e75c1185146730f4
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450735
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-11 18:33:18 +00:00
Shuhei Matsumoto
13935275fb lib/iscsi: Add target to iscsi_conns_start_exit() as an argument
When target is specified, the function starts exiting any
connection that belongs to the target. When target is not
specified, the function starts exiting all connections.

Change-Id: I0dfb56ceac5ee36d10547a9ab9a0f768ca8e02ec
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450734
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-11 18:33:18 +00:00
Shuhei Matsumoto
170d18f0d4 lib/iscsi: Factor out the operation to start exiting connections
Factor out the operation to start exiting connections into a
function. This patch doesn't change any behavior.

Change-Id: I8f48961bcc95c480636e0e0d8fbb8ef029818d9e
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450733
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-04-11 18:33:18 +00:00