This log has been observed often after recent refinements but
this log does not mean any error. So use SPDK_DEBUGLOG instead
of SPDK_ERRLOG here.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I3aa39ab3773ae83586c99699fd2473ca02c35eb9
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475182
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>
This patch series orders login related functions top down in iscsi.c.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I23ea7101030c6d2d3fbccba878bdf77d89b814cf
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476415
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>
This patch series orders login related functions top down in iscsi.c.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I39431b213216b1e4e677f80de8c14c40dd7da150
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476414
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>
This patch series orders login related functions top down in iscsi.c.
Other than code movement, fix a typo.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ib55fe86295f47c1c86bb99d5e3a6862f508bfcfa
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476413
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>
This patch series orders login related functions top down in iscsi.c.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I82fe06e3488a1c623c5fc875cf797790ee4ea48f
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476412
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>
This patch series orders login related functions top down in iscsi.c.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2f7dd681ca430c810dac6fcea122f84a142152d7
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476411
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>
This patch series orders login related functions top down in iscsi.c.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I8e123177124b4526e9bbe9001293c6f668b9c3bb
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476410
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>
conn->data_out_cnt does not control anything now but adding assert
for conn->data_out_cnt will be helpful at least to ensure that the
current SPDK works correctly.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I31ee90769ce0555e64bd41c283e8b437326efebf
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476409
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>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
When a iSCSI write is large and split, if LUN is removed between
creating and submitting the last subtask, spdk_clear_all_transfer_task()
completes the primary task and then process_non_read_task_completion()
tries to complete the primary task.
This is the double free case, and the later have to be skipped.
We add a flag is_r2t_active to struct spdk_iscsi_task and use it to
check the duplication. We may be able to use primary's initiator task tag
(ITT) instead but we can not rely on ITT because it is set by the initiator.
We clear is_r2t_active even when primary is removed from
conn->queued_r2t_tasks but it will be no harm.
Fixes the issue #1064.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ia6511bd7adaa8fcb9a07bc40d498e8ee0b7a7ccf
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475044
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>
The type of pdu deferred to be free only have
two types, R2T or DATA_IN. And the two types of pdus
are all assoicated a task, so updateing both the code and unit test case.
Also for all pdu free, we should use spdk_iscsi_conn_free function since
for normal pdu free, we all use this function.
PS: I also tested the calsoft local, it does not trigger the assert.
Fixes#1074.
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I0524965baf5349a100210ef717aedaa5f8ff105e
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475657
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This revert commit 6e4e85dcef.
Causing intermittent build pool failures. We had different operations
in remove_acked_pdu() and _iscsi_conn_free_tasks(). The patch tried
to unify them but was wrong. The operation in removed_acked_pdu()
was correct. This patch restores it. The next patch will fix the
operation in _iscsi_conn_free_tasks().
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ia398fd295769b786ba4777cc9f7df6e134f15e48
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475791
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Purpose: Simply the code, doing data_cnt_in every where
will make the code diffcult to maintain. If we put the
management in iscsi task get and free related function, then
the code will be easy to be read and easy to maintain.
Change-Id: Ib9af067326630657877a94afc2eb0db28f5d5fd1
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/474914
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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Purpose: Do not let the primary task do the I/O if it is
splitted into subtasks. This will make the code simplier,
when all the sub I/Os are finished, we can free the
primary task.
Update the corresponding unit test also.
As a result of this change, when read I/O is split into subtasks,
the primary task uses only some of its data. Hence separate
iscsi_pdu_payload_op_scsi_read() into split and non-split
case explicitly.
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I9bbe4b8dd92a2996f35ad810b33676e34670c77e
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/473532
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
After recent refinement of LUN hotplug, it is possible that
for large write I/O, primary task is freed doubly as a github issue
is reported.
However we could not notice the case because spdk_del_transfer_task()
had not return success/failure, and to make matters worse,
the second call of TAILQ_REMOVE() to the same header and instance
caused no error if the first call succeeded.
This patch changes spdk_del_transfer_task() to return success/failure.
Besides, the next after patch expects the stub of spdk_del_transfer_task()
returns true in the unit test, and hence do that.
The next after patch will fix the issue of double free of primary task
by using this patch.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ibc0b65723050362d5fafa913417b64393feb874e
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475042
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
By the recent refactoring, SCSI task is configured when getting
DIF context from SCSI layer. Passing not CDB and offset separately
but SCSI task to SCSI layer is more concise and do in this patch.
In iscsi_send_datain(), we have to update task->scsi.offset for the
case that data is split into a sequence, but the update is no harm
because task has completed what it must to do.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I153352dfa7aa7325db4452f03d863df11b3e0cfa
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472510
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>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
We have separated PDU header handler and payload handler, and have
PDU header handlers for each PDU type now.
By using this refinement, we can remove an aggregated helper function
spdk_iscsi_get_dif_ctx() and embed spdk_scsi_lun_get_dif_ctx() into
each PDU header handler.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ib4d9939b625858466224647c545cb67a04babf86
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471699
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
During testing, we observed both conn->data_in_cnt went negative or was
left positive unexpectedly. Hence add assert to detect both cases.
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I102d4eb7c8beb0e56b6a46fd0f85b3eb1c447da5
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/474437
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>
We had not decremented conn->data_in_cnt when the primary is removed
from conn->queued_datain_tasks after submitting it.
If we simply add decrement into iscsi_conn_free_tasks() and
_iscsi_conn_remove_lun(), it conflicts with iscsi_transfer_in().
By recent refinements, primary is freed in either spdk_iscsi_conn_free_pdu()
or iscsi_conn_free_tasks()/_iscsi_conn_remove_lun().
Hence let's make decrement of conn->data_in_cnt for primary follow
the management of primary.
In iscsi_conn_free_tasks()/_iscsi_conn_remove_lun(), if
primary->current_datain_offset, conn->data_in_cnt is incremented, and
hence decrement it.
In spdk_iscsi_conn_free_pdu(), if primary and all subtasks are
completed, decrement conn->data_in_cnt.
This patch will fix the issue that conn->data_in_cnt ls still
positive even after all tasks are freed when removing LUN dynamically.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I70cb431ab968387749ff7a5c77cd109904687797
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/474436
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: Ziye Yang <ziye.yang@intel.com>
We had checked LUN again but we had not checked primary task
in iscsi_pdu_payload_op_data(). This had caused unexpected behavior
during LUN hotplug. Hence we check if primary task exists again
in iscsi_pdu_payload_op_data(), and abort the subtask immediately
if not.
This change fixes one of the failures we observed.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5315badf0b90902e77dd5270dd0eda1437a771da
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/474440
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>
Due to recent refinement of primary/secondary task management,
remove_acked_pdu() cannot use spdk_iscsi_conn_free_pdu(). As done
in iscsi_conn_free_tasks(), we can replace spdk_iscsi_conn_free_pdu()
by spdk_iscsi_task_put() and spdk_put_pdu() and we do that in this
patch.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I9f83569becfc6e9440fb859709f04b6123674f25
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/474438
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>
In spdk_iscsi_conn_handle_queued_datain_tasks(), we had overwritten
task->scsi.lun. However, if the primary task is already submitted,
it cannot process IO completion correctly because task->scsi.lun is
NULL. This patch fixes the issue.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ia63f4c2e37b43477eaccbfd6dfea28fa357bde12
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/473627
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>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Data segment length of the PDU is already cached in pdu->data_segment_len.
Hence additional caching to the local variable data_len is not necessary.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I1e596999640229b1b0fa85cbdb342b1636af5076
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471879
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Based on the following description in Chapter 4.3 "iSCSI Session Types in
iSCSI specification
b) Discovery session - a session only opened for target discovery.
The target MUST ONLY accept Text Requests with the SendTargets
key and a Logout Request with reason "close the session". All
other requests MUST be rejected.
update the comment slightly, add macro constants for iSCSI logout
reason, and change the ordering of checks to be session type and then
logout reason.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ifc2ecc5b6dde546700662d3cda59d8cc465fd83a
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472672
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>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
conn->sess->session_type must be accessed when conn->sess is not NULL.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I3d41443352b65ee5ef4cc1f0d152b9e3221975c9
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471877
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Previously iSCSI task was created after allocating data buffer
and reading all data, and hence creating iSCSI task and processing
iSCSI task were not separated.
However, the recent refactoring separate PDU header handling and
PDU payload handling, and then inserted allocating data buffer and
reading data segment in the middle.
If any critical error occurs during allocating data buffer or
reading data segment, PDU payload handling is not done, and hence
created iSCSI task is left in PDU receive process.
If any critical error occurs, the current connection starts exiting
and there is no way to continue PDU receive process.
The task left in PDU receive process is never freed, and hence
LUN hotplug or exiting connection never complete.
This patch do the following:
- Consolidate freeing pre-allocated PDU to spdk_iscsi_conn_destruct()
because this is the only path to exit connection.
- Abort SCSI task of the task left in PDU receive process if found
when freeing pre-allocated PDU. If the task is not SCSI or Data Out,
remove it simply.
Fix issues #1018.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I8a2464c446c43bf4cfb5afbc0cd78b5bdef7d080
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472896
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>
Recent patches refactored iSCSI target to separate PDU header
and payload handling. However for SCSI Data-Out PDU, the division
of roles done by refactoring was wrong. Before refactoring, LUN
hotplug was checked after sending R2T, but after refactoring LUN
hotplug is checked before sending R2T. This change stopped PDU
exchange between iSCSI initiator and target and caused timeout of
LUN removal.
This patch restores the original ordering of checking LUN hotplug
and sending R2T by changing the division of roles.
SCSI Write Command PDU handling don't have any issue related with
this.
Fixes#1004
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I7b2866d8394b522fb5420d2936de2fbddc7d1daa
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472308
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>
To use zero copy bdev I/O APIs for write I/O, we have to allocate
iSCSI task before allocating data buffer because allocating data
buffer will be changed to spdk_bdev_zcopy_start() call and the
allocated iSCSI task will be passed to the call.
One critical change is that we have to read all data for the
current PDU even if handling the PDU is rejected. For that purpose,
use is_rejected flag and do not call iscsi_pdu_payload_handle()
is is_rejected is true. If iscsi_pdu_hdr_handle() returns negative,
close the connection, so return the state machine immediately.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ice77b7266af8ac392d9094478523e6e6fe6d131a
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470413
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>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Insert _pdu_payload_ into iscsi_op_login(), iscsi_op_text(),
iscsi_op_scsi_read(), iscsi_op_scsi_write(), iscsi_op_scsi(),
iscsi_op_nopout(), and iscsi_op_data() to clarify that they
handle PDU payload.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Id28ea90948118321c7889084149083bcc6bbd27c
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471562
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>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Extract PDU header handling from PDU payload handling for all PDU
types, and then group them into a new function iscsi_pdu_hdr_handle().
Then the original iscsi_execute() is renamed to iscsi_pdu_payload_handle().
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I1fb1937cfaf502797f2c4edb3aeeb97d4697c7d4
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471015
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>
To use zero copy bdev I/O APIs, we have to allocate iSCSI task
before allocating data buffer.
Hence we separate PDU header and payload handling for SCSI Data-Out,
and include iSCSI task allocation into PDU header handling.
Factor out PDU header handling in iscsi_op_data() into iscsi_pdu_hdr_op_data().
spdk_nvmf_tcp_h2c_data_hdr_handle() and spdk_nvmf_tcp_h2c_data_payload_handle()
in lib/nvmf/tcp.c are used as a reference implementation.
Use pdu->task to pass the task allocated by iscsi_pdu_hdr_op_data() into
iscsi_op_data().
In iscsi_op_data(), if it sees pdu->is_rejected is true or pdu->task
is NULL, do nothing. Besides, check LUN hot plug again to separate
PDU header handling and PDU payload handling.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5074e945254081960744577e4ed8e0170793e5e0
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470291
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>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Rename iscsi_op_snack() to iscsi_pdu_hdr_op_snack() because SNACK
Request PDU has only header and doesn't have PDU payload handling.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I4d236c7963588729c32566e2be80db899edd2828
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471012
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>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Rename iscsi_op_logout() to iscsi_pdu_hdr_op_logout() because
Logout Request PDU has only header and doesn't have PDU payload
handling.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Id788e5da56ee51b311cff2ec448c5cf0492ace13
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471009
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>
Rename iscsi_op_task() to iscsi_pdu_hdr_op_task() because Task
Management Request PDU has only header and doesn't have PDU
payload handling.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I66f842aecd2c1031a6bb0be4921e0f16930117aa
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471010
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>
As same as SCSI Command Request and SCSI Data-Out, separate PDU
header handling and payload handling into different functions.
In iscsi_op_nopout(), if it sees pdu->is_rejected is true, do nothing.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: If50cd64bacf18c014e2aa232fd84357b877d9821
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471011
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Separate PDU header and payload handling for Login Request PDU.
This will clarify the header handling and payload handling.
Especially store the allocated and initialized response PDU to
the current connection and refer it later. This idea is as same as
iSCSI task and will work because login processing is synchronous
and only once per connection.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I7e0eb413ee5f759724a685b83a742515a3546780
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471472
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
cid had been got in iscsi_op_login_rsp_init() but it was not
intuitive. Get cid in iscsi_op_login() and pass it simply to
iscsi_op_login_phase_none().
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ief7b865784aa72f7872b6e4a98809dbab49807de
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471471
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: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Use rsp_pdu->data_buf_len in iscsi_op_login_rsp_handle() and its
calling functions.
This makes the code a little clearer.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I89aa7155e97c1b770b333f7f12e84e13811af953
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471470
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>
Use rsp_pdu->data_buf_len in iscsi_op_login_phase_none() and its
calling functions.
This makes the code a little clearer.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Id9c1f01bdfa95e8a2e9f6512777341334cb621e0
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471469
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>
A local variable alloc_len had been used to hold the data buffer
length of the response PDU. But it's more intuitive to use
rsp_pdu->data_buf_len instead.
The subsequent two patches will replace related functions accordingly.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I48f96a542d6c177ba1d8409ff0230fa61c11e154
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471468
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>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Including getting incoming login parameters into iscsi_op_login_rsp_init()
was not so intuitive.
Initializing login response done in iscsi_op_login_rsp_init() can be
done before reading data segment but getting incoming login parameters
can be done only after reading data segment.
As a preparation to separate PDU header and payload handling for
Login Request PDU, extract getting incoming login parameters from
iscsi_op_login_rsp_init() into an new function
iscsi_op_login_store_incoming_params().
Besides, refine a few pointer and return code handling to make the
code a little clearer.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I6b677bf6e93b830e6e6fead24c8b78d9d9bc1df4
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471467
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>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Previously, pdu->data_segment_len had been set after reading all
data segment to the allocate data buffer pdu->data_bur together with
pdu->data and pdu->data_from_mempool.
But we don't have any ordering constraint to do that and the value of
pdu->data_segment_len has been fixed when reading all PDU BHS.
Hence move setting pdu->data_segment_len up to immediately after
reading PDU Basic Header Segment to pdu->bhs in iscsi_read_pdu().
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: If6f690623687ee974c5a1d73814e8675bb7077c8
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471852
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Fix static analyzer error by ensuring 4 * total_ahs_len is
not larger than ISCSI_AHS_LEN.
When ./configure -enable-werror --enable-ubsan --enable-asan,
iscsi target reports heap-buffer-overflow error
when I feeding unexpeted pdu opcode.
Change-Id: Ib8053e1a19b5e49385642106eb79c458d35ab3c6
Signed-off-by: Hailiang Wang <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471489
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Liang Yan <liang.z.yan@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
SCSI command uses iSCSI task and data buffer, and will use zero copy
bdev I/O APIs.
To use zero copy bdev I/O APIs, we have to allocate iSCSI task
before allocating data buffer.
Hence we separate PDU header and payload handling for SCSI command,
include iSCSI task allocation into PDU header handling first.
Use pdu->task to pass the task allocated by the former to the latter.
In iscsi_pdu_hdr_op_scsi(), we can not expect pdu->data_segment_len
is set. So getting data segment length from PDU BHS instead.
In the updated iscsi_op_scsi(), if it sees pdu->task is NULL or
pdu->is_rejected is true, do nothing. Besides, check LUN hot plug
again to separate PDU header handling and PDU payload handling.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ic09451ab022b9714381f03c63bd3008c39fedb8e
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470290
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
We want to move iSCSI task allocation before data buffer allocation
to use zero copy APIs in iSCSI target. As a preparation, we have to
separate PDU header and payload handling. This patch makes it a little
easier.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ib7f5ec71933fd6022fd2248aff0a0bd89b7ad830
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470289
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: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Separate PDU header and payload handling for Text Request PDU.
This will clarify the header handling and payload handling.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I162af0b4bf281852bb13af5f3261dacb38dee5e0
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471451
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: Changpeng Liu <changpeng.liu@intel.com>
Double pointer is clever but reference to pointer is easier to understand.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5168e08ca67942c22ba2cbdc10925e8a9fd6da6c
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471007
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: Changpeng Liu <changpeng.liu@intel.com>
The subsequent patches will separate PDU header handling and PDU
payload handling. But for the PDUs which have data segment,
if PDU header is correct, we have to read data segment even if any other
error is found and the PDU is rejected.
To do that, add a flag is_rejected to pass if the PDU is rejected or
not from PDU header handling to PDU payload handling.
If PDU payload handling sees the PDU is already relected, do nothing.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ie3fe518fc0f452da9965a2fe3642568c86866480
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471005
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>
Subsequent patches will separate PDU handler into PDU header handler
and PDU payload handler.
Some PDU types will have both PDU header handler and PDU payload handler,
and command is executed in PDU payload handler.
Some PDU types will have only PDU header handler, and command is
executed in PDU header handler.
CmdSN must be updated appropriately depending on the case.
As a preparation, factor out updating CmdSN into a helper function
iscsi_update_cmdsn().
Besides, storing the passed CmdSN into PDU is duplicated and remove
the duplication in this patch.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ib5f271a1624a39e82d6271dfebcc181e3850e260
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471333
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: Changpeng Liu <changpeng.liu@intel.com>
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>
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>
If PDU header digest error is detected, it indicates that the length
field of the header may have been corrupted. Hence it's may not be
possible to identify the location of the beginning of a later PDU.
So move checking header digest before handling payload and then
close the connection if header digest error is detected.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I56f6bc082dc0b244e71ad996b4da08e0203f8cdd
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471014
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>
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>
LUN ID was not saved in iSCSI task, and it didn't work when we attached
more than one LUN.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I75388ee6c1e69bb567cf7c5c691315c51cab70eb
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471202
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>
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>
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>
iscsi_check_data_segment_length() is NOP now and can be removed.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I3ba473c2989d1adf7f0fcbaef026f0b60bc1beb7
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470726
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>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
We can move data segment length check from iscsi_check_data_segment_length()
to iscsi_op_text() and iscsi_op_scsi().
Task Management Function request, SNACK request, and Logout request
don't have data segment, and so any related check is not added.
Of course we can add check if data segment length is zero though.
This patch also changes the return type of spdk_get_max_immediate_data_size()
and a related variable spdk_iscsi_pdu::data_segment_len to uint32_t to
remove unnecessary casts. They are little to stand as an independent
patch.
The next patch will remove iscsi_check_data_segment_length().
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I736ec234d2726de0c70bbae7e748a5b1b5134a32
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470725
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>
For SCSI Data-Out and NOP-Out, we can move data segment length check from
iscsi_check_data_segment_length() to iscsi_op_data() and iscsi_op_nopout(),
respectively.
In iscsi_op_nopout(), data_len had been got from reqh->data_segment_len
but reqh->data_segment_len is already copied to pdu->data_segment_len at
spdk_iscsi_read_pdu(). So add a change to use pdu->data_segment_len to
this patch. This is little change to create a single independent patch.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Iff7d763d8ce48bdb483b809a98be82996f73f471
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470724
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
During login processing, only login request is accepted. So we
can move data segment length check from iscsi_check_data_segment_length()
to iscsi_op_login().
A few patches from this will inline data segment length check into
each opcode handler and then remove iscsi_check_data_segment_length().
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I527ab27e8e0d69a067839b47635584d5262b0e49
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470723
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: Changpeng Liu <changpeng.liu@intel.com>
When we introduce state machine, allocating data buffer and reading
PDU payload will be done in the different state. Hence separate
them into the different code block.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ic54a31d7da9dbc46f558ad0f0ad26bf8b99a3ea7
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470101
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: Changpeng Liu <changpeng.liu@intel.com>
The subsequent patches will separate handling header and payload.
Move getting data_len down because data_len is for payload.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I654b33e9539ed1dba63f6d303de7955eee9bb200
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469964
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: Changpeng Liu <changpeng.liu@intel.com>
USE_RANDOM is not defined anywhere in SPDK since long ago. Hence
remove the code included if and only if USE_RANDOM is defined in
lib/iscsi.c.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I0481f938fef2df21af49a2755b3c1fe0dbcaee36
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470554
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>
The subsequent patches will merge spdk_iscsi_read_pdu(),
spdk_iscsi_execute(), and iscsi_conn_handle_incoming_pdus() into
a single function by introducing state machine.
Current ordering will create unnecessary function declaration.
Hence move spdk_iscsi_read_pdu() down to the next to
spdk_iscsi_execute() to avoid it.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I289ebcfc20d90753545ab9500b64fd93ca9dfb6d
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470284
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>
spdk_iscsi_task_response() is for not management task but for
I/O task. Hence locating it in the middle of management task
functions is not easy to understand.
spdk_iscsi_task_response() has close relationship with
iscsi_transfer_in() and hence move it up to next to
iscsi_task_transfer_in().
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ib81c11164168d48885a176b6d54771528c79b70c
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470271
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>
Move iscsi_queue_mgmt_task() down in the file to close to the
location that uses it.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I9c39a9211f0bf01165abebfba7a2eb846c10284f
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470270
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>
Move spdk_iscsi_send_nopin() up to the location just above
iscsi_op_nopout().
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I8792f838ac482d93ae347a355c7964f587e78daf
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470269
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>
Move get_transfer_task() up in the file closer to the location
of related functions.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I7ca7fff3e193367992d556d4cd28ef65efe55ef2
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470268
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>
Move get_scsi_task_from_ttt() and get_scsi_task_from_itt() down
in the file close to the location that uses them.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5218eac3fda85e238d40eed7282d126ebe81c16b
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470267
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>
Double pointer is clever but reference to pointer is easier to understand
because it may be familiar and reference to pointer has been used
for alloc_len and cid in the same function.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I9b8f886bd99d3ab5b9c82c72a040816b398b308f
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470266
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>
Move session related functions, spdk_free_sess(), create_iscsi_sess(),
get_iscsi_sess_by_tsih(), and append_iscsi_sess() up in the file,
and them remove declaration of create_iscsi_sess() and append_iscsi_sess().
This makes the structure of the source code more top-down.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I30f948abc1630b82afbdca512089d950ec73df05
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470265
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>
Remove declaration of iscsi_reject(), and move it up in the file.
This makes the structure of the source code more top-down.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I4b812bf200bba86c58c84c504134bbe7afe1e967
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470264
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>
Remove unnecessary declaration of remove_acked_pdu(), and move it
down to just above the caller, spdk_iscsi_execute().
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I4af2c9707735669f3baac1fa6fee9bcaaa1cd64f
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470263
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>
Group iscsi_send_r2t(), iscsi_send_r2t_recovery(), and
iscsi_remove_r2t_pdu_from_snack_list() to the following ordering:
iscsi_send_r2t()
iscsi_remove_r2t_pdu_from_snack_list()
iscsi_send_r2t_recovery(),
move the group to just above add_transfer_task(), and then
remove declaration of iscsi_send_r2t() and iscsi_send_r2t_recovery().
This makes the structure of the source code more top-down.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I473ba13a1ac656d4a4553c7e2ac8bae463a6d441
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470262
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>
We can remove unnecessary function declarations and make the
structure of the source code top-down.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I8d00c6cec0c0d05a6cd3b70e92062ce9c315ff3b
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470261
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>
LUN hot plug was not checked after aborting SCSI Data-In tasks.
This patch is for the Github issue #938.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I131f9944d71e5fdab53f3010072ea7ed5293158c
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469827
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>
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>
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>
portal_host and portal_name were added to struct spdk_iscsi_conn long
ago but had not been used yet. Portal group and its portals can be
removed dynamically even if there is any binded connection. Using
cached pg_tag will avoid potential errors.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I56d02664a3e8b2398bbb9162b1c85856e991b5b4
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463879
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>
pg_tag was added to struct spdk_iscsi_conn long ago but had not
been used yet. Portal group and its portals can be removed
dynamically even if there is any binded connection. Using cached
pg_tag will avoid potential errors.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ic7a96ef97c3cab7e5a58aa7f439364b53694a1e4
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463874
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>
conn->target is initialized to NULL in iscsi_op_login_phase_none
and then configured in iscsi_op_login_session_normal. Hence
subsequent references to target node can be done by conn->target and
related local variables can be removed.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I68b94cb8e136522ef1e0ed74c0035ec2b666bb9e
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463700
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>
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>
Using malloc'ed string for string in iSCSI target has caused
scan-build error.
Maximum size of target name is already defined to be MAX_TARGET_NAME,
and hence use fixed size string whose size is MAX_TARGET_NAME + 1 for
spdk_iscsi_tgt_node::name.
Change psdk_iscsi_tgt_node::alias together.
This change will reduce the potential malloc failure.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Iac4cd6e9d60173ddeb68ca21ce712126c13bc3c4
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459707
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This bug was found by code inspection. When PDU read restarts
after data segment, iov_offset must be reduced by data length.
However iov_offset had been reduced by buffer length by mistake.
Lack of UT code was the main reason of this bug. Hence add UT
code to test the fix of the bug together in this patch.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I74f2f6ae8dca2e78a64bfdef8080c8031dfabb87
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458530
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This patch changes the meaning of the data_len parameter of
spdk_dif_set_md_interleave_iovs from `Expected data length of the payload`
to `Expected length of the newly read data in the extended LBA payload`.
This change will align the parameters of spdk_dif_set_md_intereleave_iovs
to of spdk_dif_generate_stream.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I7f9c45e78be977625713acb79d2ae82d4375f419
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457543
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
In several error cases, the status_class and status_detail
is not properly set.
Change-Id: Ie9cf8ec13b971d7295862872e8c7e834d08e7f14
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457932
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>
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>
This patch uses the change by the last patch to initialize DIF
context in SCSI layer. Besides this patch changes the name of a
parameter from offset to data_offset to clarify the meaning.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I54bf1168ec5959432aa15dae0360c0640138b033
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457541
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Previously the connection was scheduled to another core just
after setting conn->full_feature to 1, but conn->state was still
ISCSI_CONN_STATE_INVALID. The connection started to run on another
core but could not run normally until conn->state became
ISCSI_CONN_STATE_RUNNING. conn->state was changed late to
ISCSI_CONN_STATE_RUNNING after sending the first login reponse.
This gap window had caused intermittent critical failures.
Based on this analysis, this patch changes to call
spdk_iscsi_conn_schedule() just after sending the final login response.
Whether any login response is final or not can be known by checking
conn->full_feature is not zero.
Fixes#785
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I8ea55fef27e2f332fcd789d32daf479a24c0588d
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457414
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
In some test cases, unknown iSCSI PDU other than the login request
has been sent to the iSCSI target when the iSCSI target is not in
runnable state, and it has caused failure in iSCSI target.
To know what PDU was received by the iSCSI target, this patch changes
the iSCSI taget to collect dump of the PDU.
SPDK has already the SPDK_LOGDUMP macro but the SPDK_ERRLOGDUMP macro
will be appropriate in this use case and added. Then the SPDK_ERRLOGDUMP
is used in iSCSI library.
We can decode PDU and output any format easy to read by human, but
creating good format is not easy task and error prone. So this patch
uses simple dump.
Dump outputs like:
PDU
00000000 40 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 @...............
00000010 0b 06 00 10 ff ff ff ff 00 00 00 5a 00 00 00 03 ...........Z....
00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I3ed2fca7fec24ccff17b89ba749a58c397b72c13
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456952
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
SPDK_SUCCESS is a remnant and all other SPDK libraries have used
just 0. So this patch removes SPDK_SUCCESS from iSCSI library and
uses 0 instead.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ie33fd26238411e994ea9ea0c898da1abb502cad6
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456928
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>
This patch uses the newly added API spdk_dif_update_crc32c() when
DIF insert/strip is enabled.
Change-Id: Icf32a0ddef6cf92b0887b38495457e7fcac30987
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456172
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
iscsi_sgl_append_with_md had not increment _iscsi_sgl::iov
by appended count of iovecs. Hence if data digest is enabled,
data segment will be overwritten by data digest.
This patch fixes the bug.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ibcdacb883b2b97ad86cfc39a035c76264090401d
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456451
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
DIF context had been got for every read of data segment but
DIF context is not changed and so getting DIF context once
when allocating data buffer is enough and is done in this
patch.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I0f386ab594a0d9076fa0206d5fc240f5c790181d
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456772
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>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
The only caller iscsi_conn_handle_incoming_pdus accesses the returned
pdu only when the return code is 1. So we can remove update of
_pdu for other cases in spdk_iscsi_read_pdu.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I54b9f050c3b45c87f4797a90d7606638d6c821ad
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456771
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>
Instead of just return "-1", the proper error detail will be
returned and reported out.
Change-Id: Ief900494081ddc9ae6329ee7a56723d9cb5efe13
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456937
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>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
According to https://tools.ietf.org/html/rfc3720#page-196,
Error detail of "Authorization failure" is for the case that
the initiator is not allowed to the given target.
Change-Id: Ie628c4c857e965aa6694399a9832ce0501e50745
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456826
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>