Commit Graph

821 Commits

Author SHA1 Message Date
Ben Walker
e1d06d9954 net: Remove library
Now that we've deprecated the RPCs for a release, we can remove the whole
library.

Change-Id: I0f1a357fcfb3404efac39aa021928841c2f22ff1
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4305
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-07-13 08:57:58 +00:00
Shuhei Matsumoto
ce60606dbc iscsi: Fix data digest degradation by restoring the original code
Due to the recent changes for non block size multiples write I/O,
the data digest feature was degraded. If Linux iSCSI host enables
data digest and tries to detect LU from SPDK iSCSI target, data
mismatch error is detected and the connection is disconnected
unexpectedly.

The cause was that pdu->data_valid_bytes was not set for non-write
response PDUs which have a data segment.

iscsi_pdu_calc_data_digest() has been used only for non-write response
PDUs. Hence we did not need to change iscsi_pdu_calc_data_digest().

Restore the original implementation of iscsi_pdu_calc_data_digest().

Additionally, to avoid future degradation, rename the related
functions to iscsi_pdu_calc_partial_data_digest() and
iscsi_pdu_calc_partial_data_digest_done(), and add comments for
clarification.

This fix was verified by the reporter.

Fixes #2029.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I6babcd1b56e79d3fa3cd26b2dfaad87a52788e63
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8635
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
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>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
2021-07-07 07:26:23 +00:00
Konrad Sztyber
c556b6b892 lib/trace: don't pass zero as a non-argument
Now that the trace library can handle multiple arguments, there's no
point in passing 0 for tracepoints that don't have any arguments.  This
patch removes all such instances.  It allows us to to verify that
`spdk_trace_record()` was issued with the exact number of arguments as
specified in the definition of the tracepoint.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Idbdb6f5111bd6175e145a12c1f0c095b62d744a9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8125
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-28 16:17:35 +00:00
Shuhei Matsumoto
11d76e8c81 iscsi: Set resource pool size to the predetermined values to run with little memory
Add three parameters, pdu_pool_size, immediate_data_pool_size, and
data_out_pool_size to the RPC iscsi_set_options to run iSCSI target
with little memory.

For some use cases, we want to keep the max number of connections,
but simultaneously we want to reduce the pool size and let I/Os wait
until resource is provided.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I74dc785310b1d985f3e338c1e13fba3a3840d113
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8191
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-17 08:59:18 +00:00
Jim Harris
d5af6a0417 iscsi: track whether io_device needs to be unregistered
If iscsi initialization fails (due to a memory allocation
failure for example), we may not even get to the point
where the g_iscsi global is registered as an io_device.
So then when we tear down the iscsi library using
spdk_iscsi_fini(), we need to make sure we don't
try to unregister g_iscsi if it wasn't registered.

For now, just use the g_init_thread global to make this
determination - it's set just after we register the
io_device.

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

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8351
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-06-16 08:53:14 +00:00
Konrad Sztyber
441431d228 lib/trace: don't format arg's name while registering a tpoint
The arguments of a tracepoint are formatted when they're printed now, so
there's no need to append ":" or pad it with spaces.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I74f5568f1982dacc079e3b80bd19a9cd740b48ce
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7955
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-10 10:58:05 +00:00
Ziye Yang
ee8f6dd1d5 sgl.h: Add a new internal header file.
The purpose is to reduce the duplicated code in nvmf and iscsi
layer.

Change-Id: I7e96f0d5bb1ba4b81378addca3cdd929056384e9
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8132
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: <dongx.yi@intel.com>
2021-06-02 11:34:27 +00:00
Jim Harris
a7ea7cbc57 iscsi: use SPDK_TRACE_ARG_TYPE #defines
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I033aa060feb0f6e4a9abedd8cf1335b25437fa99
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7762
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-05-07 11:35:38 +00:00
Jim Harris
b8fb7d67be iscsi: track PDU object for WRITE_START/WRITE_DONE events
We already pass the PDU as arg1, so by changing the
trace register descriptions, we can map the PDUs to
more readable IDs when running the spdk_trace app.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iad7106eeb0f5fe738f81da5ee174515d1cf4b6ce
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7757
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-05-07 11:35:38 +00:00
Jim Harris
7e52eb740a iscsi: fix ISCSI_READ_PDU spdk_trace_record
This was accidentally moved to the wrong place as
part of some earlier iSCSI refactoring.  This trace
record should be executed when we have finished
reading all of the data for any PDU, not just those
with immediate data.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ib1d17e5e79ff220e9e9b3dd55e247e745bd58019
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7756
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-05-07 11:35:38 +00:00
Shuhei Matsumoto
ce43ae2123 lib/iscsi: Merge multiple Data-OUT PDUs up to 64KB in a sequence
Some iSCSI initiators send a Data-OUT PDU sequence whose PDUs do
not have block size multiples data.

SPDK iSCSI target had replied SCSI write error to such initiators
because previously we had sent a write subtask per Data-OUT PDU.
SPDK SCSI library had rejected the write subtask because its data
was not block size multiples.

This patch fixes the issue.

The idea is to aggregate multiple Data-OUT PDUs into a single write
subtask up to 64KB or until F bit is set. MaxRecvDataSegmentLength
is 64KB but MaxBurstLength is 1MB. Hence one Data-OUT PDU data may
be split into multiple data buffers, but the maximum number of split
is two.

When processing the data segment of the Data-OUT PDU, save the data
buffer of the current PDU to the current task if the data buffer is
not full and F bit is not set. In this case, write subtask is not
submitted.

When processing the header of the Data-OUT PDU, if the current task
saves the data buffer from the last Data-OUT PDU, it passes the data
buffer to the Data-OUT PDU.

When reading the data segment of the current PDU, attach the second
data buffer to the current PDU if the first data buffer becomes full.

These are enabled only if DIF is disabled.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ib9cfb53fe8c0807a63e58c61bed3bb52f60f4830
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6439
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>
Community-CI: Mellanox Build Bot
2021-04-19 12:47:40 +00:00
Shuhei Matsumoto
3685228e72 lib/iscsi: Factor out submitting write subtask for Data-OUT PDU
This will be helpful to simplify the upcoming change.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I1f170fe48d2ec1b5ea05da6a8aa3589060c5c32d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6438
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>
2021-04-13 08:38:51 +00:00
Shuhei Matsumoto
b3a3e78a86 lib/iscsi: Track current offset of large write I/O to submit subtasks using current_data_offset
Use current_data_offset of task to track the current offset of
large write I/O by following the last patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Iec3a371c6050fe11478b6f158259d8f4013f5238
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6424
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>
2021-04-13 08:38:51 +00:00
Shuhei Matsumoto
6d573781b5 lib/iscsi: Rename current_datain_offset of task by current_data_offset
The following patches will aggregate multiple Data-OUT PDUs into a
single write subtask and we will not be able to use reqh->buffer_offset
to track the current offset of large write I/O to submit write subtasks.

On the other hand, each iscsi_task or iscsi_subtask is only read or write

Hence rename current_datain_offset of iscsi_task by current_data_offset
in this patch.

The next patch will use it to track the current offset of large write I/O

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I922582c5b9474a3c512f81d0f0425158a38a9a8d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6423
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-04-12 09:49:31 +00:00
Shuhei Matsumoto
00508c8ef1 lib/iscsi: Add data_len to mobj and use mobj to create write subtask
The following patches will aggregate multiple Data-OUT PDUs into a
single SCSI write up to 64KB. Any variable to accumulate data length
is necessary.

Hence add data_len to mobj and accumulate read data length into
mobj->data_len, and then refer mobj instead of pdu->data and
pdu->data_segment_len to submit write subtask.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I6354534769e67c0fd995bbc3c2b4a80d21a23915
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6422
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
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>
2021-04-12 09:49:31 +00:00
Shuhei Matsumoto
7a783b5b38 iscsi: Factor out getting data buffer from mempool into helper function
Wrap an operation to get a data buffer from mempool into a helper
function iscsi_datapool_get() and wrap an operation to put a data
buffer to mempool into a helper function iscsi_data_pool_put().

Use inline for both functions.

Besides, as a minor fix, remove duplicated file inclusion between
iscsi.c and iscsi.h.
7

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ia3005dffaa93a6bca16f19bb467fb5b64ae1aad2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6366
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: sunshihao <sunshihao@huawei.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-12 09:49:31 +00:00
Shuhei Matsumoto
3de09f8ece lib/iscsi: Support data split case for CRC32C computation
Add crc32c to struct spdk_iscsi_pdu and initialize it by SPDK_CRC32C_INITIAL,
and then use it as the initial value of _iscsi_pdu_calc_data_digest().
Separate finalization of crc32c into _iscsi_pdu_finalize_data_digest().

Move the definition of related macro constants from iscsi.c to iscsi.h.

iscsi_pdu_calc_data_digest() is used for read too. So setting
pdu->valid_data_bytes before calling iscsi_pdu_calc_data_digest()
for read.

Data split will be supported only if DIF is disabled, and hence
DIF case is not changed.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I9d24f605fd0d452782e17695b613cd2f63d2e42f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6421
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-04-12 09:49:31 +00:00
Shuhei Matsumoto
acdeb53f4b lib/iscsi: Increase buffer size to 64KB at most when more Data-OUT PDUs follow
The following patches will want to aggregate multiple Data-OUT PDUs
into the same data buffer, but it will be 64KB at most.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I72eabbeae0b027c2fbff2a5837d180b06b0a1b49
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6418
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
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>
2021-04-12 09:49:31 +00:00
Shuhei Matsumoto
2ef97692bc lib/iscsi: Create subtask after reading data segment for Data-OUT PDU
The following patches will change the handler for Data-OUT PDU to
submit subtask only when 64KB data is read or F bit is set.

Previously, we had created a subtask when processing header and
before reading data segment.  Creating a subtask beforehand is not
convenient for the following changes.

Hence create a subtask after reading data segment.

If LUN is removed while processing the Data-OUT PDU, the corresponding
primary task will be terminated by iscsi_clear_all_transfer_task(),
and any subtask completion is not sent to initiator. Hence we can
reject the received Data-OUT PDU safely.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ifb6d6988676080b458b31d12fef065f3c1de0cb6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6415
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-04-12 09:49:31 +00:00
wanghailiangx
b33da506b5 lib/iscsi: add a comment for iscsi_parse_params()
When param len > 0, param data must not be NULL.
So we add a comment to make it clearer.

Change-Id: I053c3e45ddb8fa23fb67ce899d32dadd8e286946
Signed-off-by: wanghailiangx <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6618
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>
2021-03-26 21:06:15 +00:00
Shuhei Matsumoto
5261f638cb lib/iscsi: Call iscsi_reject() in return statements in iscsi_pdu_hdr_op_data()
iSCSI library had used goto label to consolidate iscsi_reject()
calls but calling iscsi_reject() in return statements will be simpler
and easier to read. This patch series focuses on Data-OUT PDU processing,
and so change goto label to function call in return statements for
Data-OUT PDU first.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5f30aff764820aab87233ea8cf22263611591a96
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6533
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-03-03 08:17:33 +00:00
Tomasz Zawadzki
f3fd56fc3c lib/iscsi: return immediately from iscsi_parse_params if len is 0
The spec does not disallow TEXT PDUs with no data.  In that
case, just return immediately from iscsi_parse_params.

This avoids a NULL pointer dereference with a TEXT PDU that has
no data, but CONTINUE flag is set.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I2605293daf171633a45132d7b5532fdfc9128aff
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6319
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-03-01 14:13:48 +00:00
Shuhei Matsumoto
1160d8e6f5 lib/iscsi: Submit only subtasks for Data-OUT PDU sequence
This change follows the large read which submits only subtasks, and
simplifies large write cases.

Associate the PDU which sends a SCSI Write PDU with immediate data
with both the primary task and the first secondary task. Then stop
incrementing reference count of the primary task twice.

As same as the last patch, copy the failure status directly among
the primary task and the secondary tasks because the primary task
is not submitted now. Then remove related data from struct
spdk_iscsi_task and related helper functions from conn.c.

Finally simplify unit tests for process_non_read_task_completion().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I54aa38c9b9fb7d7352da040dcdd8bcc1b1756a83
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6344
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>
2021-02-25 10:27:53 +00:00
Shuhei Matsumoto
5ddf6f7671 lib/iscsi: Copy failure status directly among secondary tasks and primary task for read
When read is split, only secondary tasks are submitted. Hence we can
copy the failure status directly among secondary tasks and primary
task now.

Additionally, improve the comment in the source code to make us easier
to understand.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I857711dfaf90515231048f8c31c9273eac854d28
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6343
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>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-02-23 08:52:20 +00:00
Shuhei Matsumoto
6358538aa7 lib/iscsi: Pass the range (offset and length) to iscsi_conn_read_data_segment()
This will make the current code simpler and make the following changes easier.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5a06f7e876fee03ed05d880525b594f92cadcdca
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6410
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>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-02-23 08:52:20 +00:00
Shuhei Matsumoto
d752a1755d lib/iscsi: Remove pdu->data_buf and use pdu->data instead for all cases
data_buf was duplicated with data and was not necessary. Hence
remove it and use data instead in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I207047ce73d938f83e39f1454d44a9e4bba6b2f7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6407
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>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-02-23 08:52:20 +00:00
Shuhei Matsumoto
0b576bb738 lib/iscsi: Factor out reading PDU payload operation from iscsi_read_pdu()
This patch follows the last cleanup.

Factor out reading PDU payload operation from iscsi_read_pdu() into a
helper function iscsi_pdu_payload_read(). This reduces the nesting
level, improves the readability, and make the following patches easier.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ie5f51eedefe00f3b43a7b45dcf84be79f8df4e27
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6414
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>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-02-23 08:52:20 +00:00
Ziye Yang
36b9a670c8 lib/iscsi: Refactor the code in iscsi_read_pdu.
For the logic in ISCSI_PDU_RECV_STATE_AWAIT_PDU_PAYLOAD case,
this change will make it easier to read.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Iccc582dd5c749c60b3d22b2b9b73fb8407e59b0d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6360
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>
2021-02-23 08:52:20 +00:00
Tomasz Zawadzki
e4070ee0e0 so_ver: increase all major versions
To allow SO_MINOR updates on LTS for the whole year it is supported,
the major version for all components needs to be increased.
This is to prevent scenario where two versions exists with matching
versions, but conflicting ABI.
Ex. Next SPDK release adds an API call increasing the minor version,
then LTS needs just a subset of those additions.

Increasing major so version after LTS, allows the quarterly releases
to update versions as needed. Yet allowing LTS to increase minor
version separately.

Disabled test for increasing SO version without ABI change, as
that is goal of this patch. This check shall be removed with SPDK 21.04
release.

This patch:
- increases SO_VER by 1 for all components
- resets SO_MINOR to 0 for all components
- removes suppressions for ABI tests

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I44d01154430a074103bd21c7084f44932e81fe72
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6167
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
2021-02-05 14:43:47 +00:00
Ziye Yang
83a544c2a9 lib/iscsi: Support the Datain pdu sending in out of order case.
According to 12.19 in iSCSI 3720.
"If DataSequenceInOrder is set to No, Data PDU sequences may be
transferred in any order."

So if the DataSequence is negotiated with "No", then we can
send Datainpdu in out of order manner. And the initiator will
handle this case.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Ia15f56c606e4f97af019f91fa1118cc9cac5daa7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5719
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>
Community-CI: Mellanox Build Bot
2021-01-07 13:36:39 +00:00
Ziye Yang
6238e1a2d3 lib/iscsi: directly use task->scsi.offset in iscsi_send_datain
For sending data in pdus, we can direclty use task->scsi.offset,
because task->scsi.offset is already set it before (in functions
iscsi_conn_handle_queued_datain_tasks). So we should not update
this offset in the task structure again.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I873a6f7fb174145fd90fe84a00a80a4de2d49161
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5753
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-01-07 13:36:39 +00:00
ShadowMov
d2b0b15406 lib/iscsi: fix op_logout rsph->response judgement
According to iSCSI 7143 spec 11.15.1 (3720 spec 10.15.1),
Rsph->response should be 0 if connection or session closed successfully.

The current code mistakenly compared cid provided by initiator with
inner conn->id parameter, which does not follow the spec.

Change-Id: I12dbb3471be5d49380c6b65bcdb67c57df11665f
Signed-off-by: ShadowMov <jinnian.hjn@alibaba-inc.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5731
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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-01-05 09:38:23 +00:00
GangCao
1665a80fda iscsi: get the member after the NULL check
Change-Id: Ic427463d9e51af4262089ff0dae0dd19164b0995
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5332
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2020-12-01 10:21:50 +00:00
Sochin Jiang
714a3bc3da lib/iscsi: unregister login timeout timer in right place
In commit 9eefbc, we've fixed an iscsi connection leak problem(
use telnet ${ip} ${port} to reproduce), that a connection without
login handshake will be left forever with 'invalid' state. Here,
to avoid killing normal connections by mistake, we need to unregister
login timeout timer in two right places:
1) immediately after login timeout happened
2) when we receive login pdu instead of login success(login may fail
because all kinds of reasons: ACL...)

Signed-off-by: Sochin Jiang <jiangxiaoqing.sochin@bytedance.com>
Change-Id: I55bbc1c6ac6d2e0b6545b9f7d802ba057b2a09dc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5209
Community-CI: Mellanox Build Bot
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>
2020-11-25 08:52:27 +00:00
Shuhei Matsumoto
d4ad1f9cc1 lib/iscsi: Add wait parameter to iscsi_create_portal_group RPC
Add an new optional parameter wait to the RPC, iscsi_create_portal_group
not to listen on portals until it is started explicitly.

Fixes the issue #1676.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ic217f1ccceb618e70fdb2aff3f710d262a8a9bdb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5091
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
2020-11-24 08:20:37 +00:00
Shuhei Matsumoto
024d286527 lib/iscsi: Add iscsi_start_portal_group RPC to start listening if not yet
Add an new RPC, iscsi_start_portal_group, to start listening on
portals if the specified portal group is not started yet.
The next patch will add an new parameter wait to the existing RPC,
iscsi_create_portal_group.

The RPC allows the specified portal group to be already started,
and returns a success response in this case.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I631d6bccffb38092c95694f922f10648e24d6ff7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5090
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
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>
2020-11-24 08:20:37 +00:00
Shuhei Matsumoto
7ac4961b33 lib/iscsi: Factor out internal of rpc_iscsi_delete_portal_group
Factor out the internal of rpc_iscsi_delete_portal_group() into
a function _rpc_iscsi_change_portal_group() and rename the related
data structure to use them for the upcoming RPC,
iscsi_start_portal_group.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I965f1e52f04fb54c6a89987836f89c508441a37e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5089
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2020-11-24 08:20:37 +00:00
Shuhei Matsumoto
8381b98ef4 lib/iscsi: Add portal_group_resume() and add pause parameter to portal_group_open()
Add an new function iscsi_portal_group_resume() and add an new parameter
pause to iscsi_portal_group_open(). They will be used in the following
patches to pause listening portals while target nodes are created at
start-up because Windows hosts do not retry login.

Pausing and resuming portal group is possible because we can unlisten
temporarily by simply not calling accept(). Any inbound connection
requests are queued to the backlog and once the backlog queue is full,
further inbound connection requests are simply dropped. If we restart
calling accept(), we will dequeue the backlog and be ready for more
connecitons.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: If7403f91ebd729b47d98a23e589cba8b35569dc6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5088
Community-CI: Mellanox Build Bot
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>
2020-11-24 08:20:37 +00:00
Nick Connolly
b8c99a3aad lib: Use PRId64 for portability
POSIX defines PRId64/PRIu64/PRIx64 for printing 64-bit values in a
portable way. Replace a few references to %ld to remove the assumption
about the size of a long. Similarly, use %z with size_t arguments.

Where the value being printed is an unsigned 64-bit value, use PRIu64
instead of %ld.

Explicitly test for not __linux__ where that is the intent, rather
than testing for __FreeBSD__.

Cast pointer to uintptr_t before aligning it, rather than using
a specific integer size which may not be large enough to store a
pointer.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: Icfe219e1bbb2d06b3ef05710fac5b7091d340251
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5142
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2020-11-20 11:01:37 +00:00
yidong0635
d73077b84a lib/jsonrpc: Add a new API to send response for writing bool result.
There are many duplicated codes about sending response for writing bool result.
That we need a function to do this.
Then we can reduce many codes.

Signed-off-by: yidong0635 <dongx.yi@intel.com>
Change-Id: Ic439111b1e9ca1013f8c657ab925f0c27a7be699
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5033
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-11-16 15:08:47 +00:00
Ziye Yang
57833a5dff iscsi: fix the warning issue in tgt_node.c reported by vagrant.
The allocated size of buf is too large,i.e., 4096. And we will
have host to be assigned with buf, host = buf. But the tmp_buf (destination)
buffer is not so big. So restrict the buf size and make the vagrant happy.

The max size of conn->target_addr is MAX_TARGET_ADDR, so add additional 2 is enough
according the format to print.

The warning is:

/home/vagrant/spdk_repo/spdk/lib/iscsi/tgt_node.c:377:47: warning: ‘%s’ directive output may be
truncated writing up to 4095 bytes into a region of size 301 [-Wformat-truncation=]
00:03:02.381    377 |     snprintf(tmp_buf, len + 1, "TargetAddress=%s:%s,%d", host, p->port, pg->tag);

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Ib64e7140d5e14909d2a86dd2d47413abe5cd027e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5092
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-11-13 14:05:05 +00:00
Ziye Yang
abb6823d5d iscsi: Add the support for long text response.
This patch adds the support for long text response.

Change-Id: I8ef146069c9b8d86eb6df4c9e60cc6a3b2ff1ad7
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4993
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>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-11-11 00:53:52 +00:00
Tomasz Zawadzki
6d86242dc5 subsystem/iscsi: remove legacy config support
This patch removes legacy config support in iscsi subsystem.
All options through the legacy config are already reflected in JSON.

Following RPCs are corresponding to removed legacy config sections:
Initiator groups - iscsi_create_initiator_group and iscsi_initiator_group_*
Subsystem options - iscsi_set_options
Portal groups - iscsi_create_portal_group
Target node - iscsi_create_target_node and iscsi_target_node_*

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I11326a84d4d580b19db422b8522198eea5a5be0d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4747
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-10-20 08:53:53 +00:00
Tomasz Zawadzki
cda1d2cf11 build: remove unused references to conf library
- Removed slew of conf.h includes
- No longer require mk vars that include conf

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ica7e8e8bf1d4a5d0b0200bfe689aa13afd77bfaf
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4746
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>
2020-10-20 02:42:16 +00:00
Shuhei Matsumoto
9eefbc5b10 lib/iscsi: Add login timeout not to leave hunged connection
An issue is reported that connections were left forever without any
progress during login processing.

Not to leave these connections, add the login timeout feature as
described in the iSCSI specification.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Signed-off-by: Sochin Jiang <jiangxiaoqing.sochin@bytedance.com>
Change-Id: I9483a5b5540b433df6235aa7fc13b99eaca0bfa4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4609
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>
2020-10-19 09:54:44 +00:00
Sochin Jiang
e9c815ad4c lib/iscsi: add 'state' and 'login_phase' to RPC 'iscsi_get_connections'
In some abnormal condition, iscsi connections can be exceptional,
add these two infomation for monitoring iscsi connections state.

Signed-off-by: Sochin Jiang <jiangxiaoqing.sochin@bytedance.com>
Change-Id: Ib43128302e8ea057d665e4d6294e28ec7e4f4194
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4613
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>
2020-10-16 08:15:40 +00:00
Tomasz Zawadzki
1a884e94e4 lib/log: do not use spdk_log_get_flag() in macro for log flags
Especially SPDK_INFOLOG() should not call spdk_log_get_flag() function,
instead rely on the log flag structure.

This caused performance degradation in places that used SPDK_INFOLOG
too extensively.

Due to nature of the macros, in the meantime new debug log in
iscsi was improperly named. This wasn't caught because of the
macros reliance on spdk_log_get_flag(), where if name wasn't
registered - no log was printed and no compilation occurred.
Going back to using the structures, gives immediate feedback
that there is no SPDK_LOG_ISCSI log flag.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I262eadb5aee29caa2a5cd719c82ca4963ea24576
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4712
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: Aleksey Marchuk <alexeymar@mellanox.com>
2020-10-16 08:14:59 +00:00
Tomasz Zawadzki
4e8e97c886 log: remove internal log.h header
There is nothing left here, so remove it.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ib947d42bc577dbebb4650b1be885e05a80f8f8cf
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4541
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Anil Veerabhadrappa <anil.veerabhadrappa@broadcom.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Broadcom CI
2020-10-15 08:23:39 +00:00
Tomasz Zawadzki
324ebbfcb9 log: remove SPDK_ERRLOGDUMP
This macro was used in only single place and served no real
purpose.

spdk_log_dump() is more commonly used directly, so use it.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Idea720cdee767c7c6cdc30db10003ef42b88c4a3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4540
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Mellanox Build Bot
2020-10-15 08:23:39 +00:00
Tomasz Zawadzki
2172c432cf log: simplify SPDK_LOG_REGISTER_COMPONENT
This patch removes the string from register component.
Removed are all instances in libs or hardcoded in apps.

Starting with this patch literal passed to register,
serves as name for the flag.

All instances of SPDK_LOG_* were replaced with just *
in lowercase.
No actual name change for flags occur in this patch.

Affected are SPDK_LOG_REGISTER_COMPONENT() and
SPDK_*LOG() macros.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I002b232fde57ecf9c6777726b181fc0341f1bb17
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4495
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Mellanox Build Bot
Reviewed-by: Anil Veerabhadrappa <anil.veerabhadrappa@broadcom.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Broadcom CI
2020-10-14 08:00:35 +00:00