Commit Graph

5780 Commits

Author SHA1 Message Date
Ben Walker
09ef0593d4 nvmf: Leverage bdev uuid to correctly detected remove+add ns while
paused

Change-Id: Idbf00956394f7ee7ff7e27f2627785cd7146b01f
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459605
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
2019-07-10 01:59:05 +00:00
Ben Walker
85e9760161 nvmf: Capture ns_info onto stack in poll_group_update_subsystem
By capturing this pointer onto the stack, we inform the compiler
that we don't expect it to change. That allows the compiler to
generate more efficient code.

Change-Id: I0f3ff9373662198e915269c4498e4902a2cdb808
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459754
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
2019-07-10 01:59:05 +00:00
Ben Walker
ab3abc15aa nvmf: Capture channel variable to stack when updating poll groups
This signals to the compiler and analysis programs that this
won't change during iteration, so it may produce better code.

Change-Id: I478c0c9445d4ddf8a69ab1b3deaf628b82a0eaea
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459753
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
2019-07-10 01:59:05 +00:00
Ben Walker
75b4f332f4 bdev: All bdevs now have a UUID.
For devices that don't have a UUID, the UUID is generated at
registration time. That means that some devices will not have the same
UUID from run to run, but this seems no worse than having no UUID at
all.

Change-Id: Icf6b8517ffcffabafa2b73176dc03d896d0017fe
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459604
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>
2019-07-10 01:59:05 +00:00
Changpeng Liu
5317a9f795 rpc/nvmf: add RPC support to add the persistent configuration file for one NS
Change-Id: Ic4963d3e55cffceca35d18ba8d406658e51a189a
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455913
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-10 01:40:26 +00:00
Changpeng Liu
7b74274fbf nvmf: add parameter check when loading reservation information from a JSON file
Change-Id: Id217212fd82e57a4cfb32f62f11798c72187879e
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460794
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-10 01:40:26 +00:00
Shuhei Matsumoto
390cffb64e rpc: Add dif_insert_or_strip parameter to nvmf_create_transport RPC
Add an new optional parameter dif_insert_or_strip to
nvmf_create_transport RPC.

.INI config file will be deprecated and dif_insert_or_strip is not
supported in .INI config file.

Change-Id: Ibf38b599cff75eeb0056dd2125d6ec10d444f339
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458927
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-10 00:43:02 +00:00
Shuhei Matsumoto
aa322721cb nvmf: Add dif_insert_or_strip to transport options
This is a place holder and subsequent patches will use the option
dif_insert_or_strip and provide JSON RPCs to configure it.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I7e3fbb1d49c47647a9a0a1a2149152801591b283
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456452
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-10 00:43:02 +00:00
Shuhei Matsumoto
ddb680ebab nvmf: Add helper function to get DIF context from NVMf request
Add a helper function to get DIF context when the passed NVMf request
is for I/O queue, NVMe read, write, or compare command, and its NSID
is valid.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I796c20607c7b64a8be85da5131c5ea95ffd9f8e4
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458713
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2019-07-10 00:43:02 +00:00
Shuhei Matsumoto
9b04e29173 nvmf: Add helper function to get DIF context from bdev and NVMe cmd
Add a helper function to get necessary DIF information and set
them into the passed DIF context and return. This function will
be called only when the specific requirement is satisfied and
the caller will be added in the next patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ic435886ca936a211f34278b813f547ffa43b9000
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458712
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>
2019-07-10 00:43:02 +00:00
Jeffry Molanus
9bba21c969 app.c: --huge-dir has not effect
`struct option` is set incorrectly for long_opt --huge-dir causing the value
to be ignored.

Change-Id: I5bb84f391e1ac551b2a91c43fe8da658ae54f115
Signed-off-by: Jeffry Molanus <jeffry.molanus@gmail.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460581
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-09 05:33:03 +00:00
Wojciech Malikowski
fe73e3072c lib/env: Added parent field to spdk_pci_device
VMD introduce parent/child relationship
between pci devices. Parent filed allow
to associate NVMe disk with VMD device.

Change-Id: Ie363dbe83fefbe05e3347888dc6bd361a235da4a
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459637
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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-09 04:04:16 +00:00
Shuhei Matsumoto
7bfbc388d7 nvmf/tcp: Pass extended LBA based length as I/O length to NVMf controller
When DIF is inserted or stripped,
- in the TCP transport layer, we can use LBA based length throughout, but
- in the NVMf controller layer and BDEV layer, extended LBA based
  length must be used, and NVMf controller gets the length from
  tcp_req->req.length.

Hence by adding and using two variables, elba_length and orig_length
to struct spdk_nvmf_tcp_req, set the extended LBA length to
tcp_req->req.length before calling spdk_nvmf_request_exec(), and then
restore the original LBA based length to tcp_req->req.length after
calling spdk_nvmf_tcp_req_complete().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I9309b8923c6386644c4fd8ef3ee83a19f5d21ce5
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458926
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-09 03:39:25 +00:00
Shuhei Matsumoto
51b643648c nvmf/tcp: Increase buffer to insert/strip DIF in spdk_nvmf_tcp_req_parse_sgl
If tcp_req->dif_insert_or_strip, increase the length from LBA based
to extended LBA based by using its own DIF context.

Change-Id: Ie9f5cf757328dda795b43a7b6c70a72259865115
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458925
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>
2019-07-09 03:39:25 +00:00
Shuhei Matsumoto
536bd70eb4 nvmf/tcp: Use cached length variable in spdk_nvmf_tcp_req_parse_sgl
The next patch will extend the length from LBA based to extended
LBA based and use it as buffer length to insert or strip DIF.

So cache sgl.unkeyed.length at the top of spdk_nvmf_tcp_req_parse_sgl
and use it throughout.

Besides, one unrelated change-the-line to improve the readability
is included.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2a1dc9379bb5671ec80b5b478504c9879a4f0fff
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458924
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>
2019-07-09 03:39:25 +00:00
Shuhei Matsumoto
975239c29d nvmf/tcp: Insert DIF to the newly read data to create extended LBA payload
Generate and insert DIF to each data block when reading more than a single
byte.

This update is very similar with the use case of spdk_dif_generate_stream
in iSCSI target.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I063919a32153ac0daf6d6eb1836c0d5995b65d33
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459092
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-09 03:39:25 +00:00
yidong0635
ff0a7dfc42 nvme: Handle CQ polling failures by marking the controller as failed.
nvme_transport_qpair_process_completions calls nvme_rdma_qpair_process_completions
There are some cases return -1 due to failure of "CQ errors".

Handle CQ polling failures by marking the controller as failed.
That a completion with an error will be treated as controller failed.
Requests will be aborted after retry counter exceeded. Otherwise, code will keep on
reporting errors without recovery.

This is to fix issue #850.

Change-Id: I0b324232310e107bf7fd5722aca54d402a19b14d
Signed-off-by: yidong0635 <dongx.yi@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460569
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-09 01:43:02 +00:00
yidong0635
16fdf46600 bdev: Fix warning about scanbuild error on fedora30.
In file included from bdev_ut.c:43:
/root/yidong/spdk/lib/bdev/bdev.c:4373:9: warning: Access to field 'bdev'
results in a dereference of a null pointer (loaded from variable 'desc')
        return desc->bdev;
               ^~~~~~~~~~

This is related to issue #822.

Change-Id: I8cd2bafadeff9846169bc9ca67b3c4110e9c0da8
Signed-off-by: yidong0635 <dongx.yi@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459529
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-09 00:38:22 +00:00
Andrey Kuzmin
fa6bfa80af Nvme: check spdk_nvme_qpair_process_completions return value.
nvme_tcp_qpair_process_completions returns -1 on socket I/O
error. Unless the caller checks this return value (which
spdk_nvme_wait_for_completion_robust_lock currently doesn't),
on connection loss or any other fatal connection
error spdk_nvme_wait_for_completion will never exit the completion
check loop.

Change-Id: I92bb349beb071db312e6c31b84db2a7b51ec486c
Signed-off-by: Andrey Kuzmin <akuzmin@jetstreamsoft.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460657
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>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-09 00:27:54 +00:00
paul luse
06f6c90626 bdev/crypto: add IO queueing for out of mem condition via bdev layer
Also made on the prints a DEBUG message instead and noticed the really
name that was being registered by this component so updated it to
make it look like the rest of SPDK.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I747a846cb365e7db49be50db941e83fb1b265ea0
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460244
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-07-08 09:24:29 +00:00
Changpeng Liu
1edc5f0040 nvmf: restore the loaded reservation information to NS
Load reservation information based on ptpl configuration file, and
restore the information to NS data structure.

Change-Id: I5f46d49a6d1e6e49aab93ca7cd654469a3a08659
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455912
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-08 08:21:03 +00:00
Shuhei Matsumoto
8448adaefa nvmf/tcp: Verify DIF before sending C2H data in spdk_nvmf_tcp_send_c2h_data
If DIF mode is local and C2H data is extended LBA payload, DIF should
be verified just before sending the payload.

Add a helper function nvmf_tcp_pdu_verify_dif and call it in
spdk_nvmf_tcp_send_c2h_data after completing nvme_tcp_pdu_set_data_buf.

When nvmf_tcp_pdu_verify_dif returns error, treat the error as fatal
transport error because the error is caused by the target itself.

Handle the fatal NVMe/TCP transport error by terminating the connection
as described in the NVMe specification.

On the other hand, data digest error is treated as a non-fatal transport
error because the error is caused outside the target. This is reasonable.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I9680af2556c08f5888aeaf0a772097e4744182be
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458921
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>
2019-07-08 03:33:07 +00:00
Shuhei Matsumoto
457afd77b1 bdev/split: Fix orphan'ed config when removing the base bdev first
When we create a base bdev and then create a split vbdev on top of
the base bdev, if we delete the base bdev first, we have no way to
remove the configuration of the split vbdev. Hence even if we
create a base bdev again, we cannot create any split vbdev on top
of the base bdev again.

The meaning of flag, `removed` of `struct spdk_vbdev_split_config`
is not clear and there will be no issue even if the flag `removed`.

Hence remove the flag `removed` in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I053c95e647721004cecfe4fd8b0f1ff5bb9bf38a
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460580
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>
2019-07-08 03:30:39 +00:00
Darek Stojaczyk
fcbbcf4905 bdev: cleanup child iov rewind code
When we run out of bdev_io's child iovs and we had
to round down I/O size to nearest block size boundary,
we used to decrease the existing child_iovcnt and
set a new "child_iov_run_out" flag to terminate the
uppermost splitting loop.

We can get rid of that new flag by just not decreasing
child_iovcnt when rewinding the last few iovs - it
will make the uppermost loop naturally terminate using
the existing checks.

Change-Id: Ie40c7ce135e7fb8fe284afdf7beeebd10af85cb7
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459911
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-05 12:11:46 +00:00
Hailiang Wang
5926236661 bdev/raid: fix a warning of freed memory
Compilation Warning on fedora30.
In file included from bdev_raid_ut.c:38:
spdk/lib/bdev/raid/bdev_raid.c:325:11: warning:
Use of memory after it is freed. raid_ch->base_channel[pd_idx],
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is related to issue #822.

Change-Id: I6432772fb38ca02bc4f0a02a36ed3fe61b8607c7
Signed-off-by: Hailiang Wang <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460069
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: yidong0635 <dongx.yi@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-05 12:10:07 +00:00
paul luse
63d9d2e2b0 lib/reduce: eliminate RMW on writes with chunk_size length
Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I6545a91e2ae4805f7bd1d92baa6dcbce0f1f8fba
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459864
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-07-05 11:56:03 +00:00
paul luse
d23c36a169 lib/reduce: eliminate two more memcpy operations
For callers of _reduce_vol_compress_chunk()

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I9ac1da8f9bcfd902fe58e4c5ffc20ce16e9bafcd
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459863
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-05 11:56:03 +00:00
paul luse
89a9a50497 lib/reduce: eliminate memcpy in read decompression path
This is the first in a series of patches to eliminate memcpy ops
in the comp/decomp paths. Currently the lib uses 2 scratch buffers
and copies all data in and out of them to the user buffers following
a comp/decomp. This patch replaces the memcpy in one of the paths by
constructing an iovec array that points to a combination of the
scratch buffer and user buffer so that user data decompresses
directly into the user buffer and any data in the chunk that isn't
needed by the user will be sent to the scratch buffer.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ib1956875729a82d218527bc81795f750d1df2b89
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459662
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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-05 11:56:03 +00:00
Shuhei Matsumoto
8b539eb553 nvme: Set appropriate value to max_xfer_size and max_sge
SPDK NVMe-oF initiator driver could not transfer IO whose size is
more than 128KiB even if NVMe-oF target allows IO whose size is
more than 128KiB both for RDMA and TCP transport.

Some use cases need to transfer IO larger than 128KiB.

For RDMA transport, max_mr_size by ibv_query_device of RDMA devices
indicates the maximum size of a single memory region and is independent
from the actual I/O size, and is very likely to be larger than 2 MiB
which is the granularity we currently register memory regions.

Actually some RDMA NICs return UINT64_MAX for max_mr_size by ibv_query_device.

Hence use UINT32_MAX and let the generic layer use the controller data
to moderate this value.

On the other hand, for TCP transport, there is no limit for maximum IO
size and hence use UINT32_MAX.

Besides, for RDMA transport, max_sges should be the minimum of
max_sge got by querying RDMA devices and NVME_RDMA_MAX_SGL_DESCRIPTORS.
Hence do this change together in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Idc813afd3e525bf5f370c0fcd2623f9c146a5528
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459218
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-05 06:35:41 +00:00
Shuhei Matsumoto
cf3c54bc03 nvme: Ensure max_sges not to exceed what controller supports in generic layer
Previously comparing the transport supported value and the target value
was done in RDMA transport layer. However this comparison should be
done in the generic layer like the maximum IO transfer size. Hence
change the comparison to do in the generic layer in this patch.

Besides, for MSDBD, the value 0 indicates no limit but we had handled
this as maximum number of SGS entries was 0 by mistake. This patch fixes
the bug together.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I54365cf114169b10180ec2c659f9c7302672674c
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459574
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-05 06:35:41 +00:00
Chunyang Hui
993ab4908c RocksDB: Remove static and assert for SpdkInitializeThread
RocksDB spdk-v5.13.4 and spdk-v5.18.4 still need
to call SpdkInitializeThread in its env init.
Static will trigger make error. Thus removed.

For removing assert, we already have enough check to
make sure the allocate won't happen twice. The assert
here is redundant.

Signed-off-by: Chunyang Hui <chunyang.hui@intel.com>
Change-Id: I058c580349398b83fed8a8408b089e065b5d2988
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460465
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>
2019-07-05 04:19:11 +00:00
Ziye Yang
57efada508 nvmf/tcp: reorg the structure of struct spdk_nvmf_tcp_req
I used pahole to see whether the alignment of the structure
is reasonable. After reorgnization, we can saved 16 bytes and 1
cacheline according to the information by pahole.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I1347e7c582fe2b00707e2841690b87d53cc61e33
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460572
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-05 04:18:41 +00:00
Darek Stojaczyk
89021c6c6c nvme/rpc: switch to spdk_*malloc().
spdk_dma_*malloc() is about to be deprecated.

Change-Id: I6fd1106c2278c2ef8899c822e920252f62266547
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459550
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-05 03:48:51 +00:00
Chunyang Hui
fbd2f3fd2e opal: add support for getting locking range info
Change-Id: I8e3e39673c260f823a9703e86006b5334dedc987
Signed-off-by: Chunyang Hui <chunyang.hui@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457576
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-05 02:23:28 +00:00
Chunyang Hui
505dbf59ff Opal: Add locking range support
Change-Id: I4974d4134aed3b63e204b79c9292ce940e32d40c
Signed-off-by: Chunyang Hui <chunyang.hui@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455175
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>
2019-07-05 02:23:28 +00:00
Chunyang Hui
755b4390f9 Opal: Add activate locking SP method
Change-Id: I4189bdefdb5a6651bb73bd32e61c16e899b2ae5a
Signed-off-by: Chunyang Hui <chunyang.hui@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454211
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>
2019-07-05 02:23:28 +00:00
Shuhei Matsumoto
bcfb2b2b9c bdev/passthru: Pass-through metadata and DIF setting of base bdev
Allow I/O requests using metadata and DIF if base bdev supports them.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ie1b4b301a3d72d3fbd6e459ee2ab7d1a85425162
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460394
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>
2019-07-04 09:23:07 +00:00
Shuhei Matsumoto
3ff1ff004e nvme/tcp: Minor cleanups for SGL operations
Using naming rules consistent with other related libraries is helpful
to ensure the quality as verified by this patch series.

This patch changes a few parts to use iov and iovcnt for SGL operations.
Besides, name of an array points to the head of the array and is
constant. So copying name of array to an another pointer is not
necessary and can be removed.

Change-Id: I2324f28126b3088098c1c767cf6c060f22c175c3
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455629
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2019-07-04 08:58:40 +00:00
Shuhei Matsumoto
127cfac020 nvmf/tcp: Use nvme_tcp_pdu_set_data_buf for incapsule data
Previously we had used nvme_tcp_pdu_set_data() for incapsule data.
This patch changes handling incapsule data to use
nvme_tcp_pdu_set_data_buf() as same as H2C and C2H.

This unification is necessary to support DIF insert and strip
in NVMe/TCP target later.

Change-Id: I02cae8db94e51cf79a354dd64ad45f0e491ec08e
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455920
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>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2019-07-04 08:58:40 +00:00
Shuhei Matsumoto
3184884f9d nvmf/tcp: Properly handle multiple iovecs in processing H2C and C2H
NVMe/TCP target had assumed the size of each iovec was io_unit_size.
Using nvme_tcp_pdu_set_data_buf() instead removes the assumption
and supports any alignment transparently.

Hence this patch moves nvme_tcp_pdu_set_data_buf() to
include/spdk_internal/nvme_tcp.h and replaces the current code to use it.

Besides, this patch simplifies spdk_nvmf_tcp_calc_c2h_data_pdu_num()
because sum of iov_len of iovecs is equal to the variable length now.

We cannot separate code movement (lib/nvme/nvme_tcp.c to include/
spdk_internal/nvme_tcp.h) and code replacement (lib/nvmf/tcp.c)
because moved functions are static and compiler give warning if
they are not referenced in lib/nvmf/tcp.c.

The next patch will add UT code.

Change-Id: Iaece5639c6d9a41bd35ee4eb2b75220682dcecd1
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455625
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-04 08:58:40 +00:00
Ziye Yang
b09bd95ad3 sock: update spdk_sock_group_add_sock
And also add spdk_sock_group_get_ctx function

Change-Id: I2a2a58b0588ff7d99d3538ea0a633a3b8c7a234b
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454538
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
2019-07-04 08:21:05 +00:00
Ziye Yang
8bb174f87d sock: add function spdk_sock_get_optimal_sock_group
Also add the mapping table and the operations between placement_id and
sock_group

Change-Id: I31868e241fdd20252c2d79792ff1239e6d23afb8
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454537
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-04 08:21:05 +00:00
Changpeng Liu
bdb90726ee scsi: fix error break when checking SCSI reservation
We should return for the registrant case when the reservation holder
exists.

Change-Id: Ie3cf31554eafdad03294aef2eeb6eaef1536b8c3
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460305
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Liang Yan <liang.z.yan@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-04 08:15:44 +00:00
Shuhei Matsumoto
666a0b5cb4 iscsi: Assign not pointer but instance of spdk_cpuset in struct spdk_iscsi_portal_grp
This will reduce pontential malloc failures.

Change-Id: I9b1965e0be95af4c0496dfbae80c86b25c460c94
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459718
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-04 00:30:22 +00:00
Shuhei Matsumoto
752fa1ca27 thread: Assign not pointer but instance of spdk_cpuset in struct spdk_thread
This will reduce potential malloc failures.

Change-Id: Ie67554fec877e33bbd1044fc61eb4d79df306168
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459717
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-04 00:30:22 +00:00
Shuhei Matsumoto
6de3d418df cpuset: Expose internal of struct spdk_cpuset in header file
This will make other structures to allocate struct spdk_cpuset
statically and will reduce potential malloc failures.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I067ec2c79824b04796a8b6f717e610727a861461
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459716
Reviewed-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-04 00:30:22 +00:00
Shuhei Matsumoto
12d6dce2aa nvmf: Use not malloc'ed but fixed size string for host NQN
Maximum size of NQN is already defined to be SPDK_NVMF_NQN_MAX_LEN,
and hence use fixed size string whose size is SPDK_NVMF_NQN_MAX_LEN
+ 1 for spdk_nvmf_vhost::nqn.

This change will reduce the potential malloc failure.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2b9c7cc21200b3e88b5485ebfdcd5040bc6e3589
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459742
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-04 00:30:22 +00:00
yidong0635
21740a7cac ftl_reloc: Fix scanbuild warning about moves.
/spdk/lib/ftl/ftl_reloc.c:507:8: warning: Assigned value is garbage or undefined
                move = moves[i];
                     ^ ~~~~~~~~
lib/ftl/ftl_reloc.c:508:11: warning: Access to field 'state' results in a dereference
of a null pointer (loaded from variable 'move')
                switch (move->state) {
                        ^~~~~~~~~~~

Change-Id: I9cc1c2b52a93957bb4c56b1ed463c23289b5a43d
Signed-off-by: yidong0635 <dongx.yi@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460120
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-04 00:25:17 +00:00
Wojciech Malikowski
e0bf5e3e4f lib/ftl: Enable ANM events handling
Added ANM events processing by relocation
module.

Change-Id: I6d20b2dd66309fd7cf0fddb44b6027848b29446b
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455253
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-03 04:28:13 +00:00
Wojciech Malikowski
fdf3c5a30f lib/ftl: Temporarily disable relocation on open bands
Handling ANMs on open band leads to many
corner cases in FTL and on the other hand
such event should be very rare.

Disable it until we will have stable test
results from current implementation with
extended dirty shutdown tests.

Change-Id: Id438c7274ed2be1712bf581d6aabfc27bcbd53dc
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459434
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-03 04:28:13 +00:00
Changpeng Liu
77c1f90e98 iscsi: change ERRLOG to DEBUGLOG for read socket error
Since spdk_iscsi_conn_read_data() can print error log, so we
don't need to print again in the caller, existing code will
print error log for LOGOUT and DISCOVERY cases.

Fix issue #845.

Change-Id: I547d3d667b6412ab6a59c9b401d0f28c5026307d
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460110
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-02 22:56:01 +00:00
Shuhei Matsumoto
3d1995c35b thread: Use not malloc'ed but fixed size string for IO device name
256 bytes will be enough but not too large for the name of SPDK IO
device. Use fixed size string for the name of SPDK IO device and
reduce the potential malloc failure. If the length of passed name
is longer then 256, it will be cut off without error.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I618b82a1d07769df7c775280fbf364cbcfdde403
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459721
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2019-07-02 07:04:58 +00:00
Shuhei Matsumoto
09013306c3 thread: Use not malloc'ed but fixed size string for thread name
256 bytes will be enough but not too large for the name of SPDK
thread. Use fixed size string for the name of SPDK thread and
reduce the potential malloc failure. If the length of passed name
is longer then 256, it will be cut off without error.

Change-Id: I13a24997a73a8365c8bf5e093f2bd78861ba6660
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459720
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-02 07:04:58 +00:00
Ziye Yang
404d27263f sock: add get_placement_id function.
Placement_id is related with getsockopt with the optname=
SO_INCOMING_NAPI_ID. For some testing platform,  it is not
supported with this macro, so use ifdef to avoid send this
to the kernel.

Change-Id: I9e49e6e15810af0cd5085b92469c15a53ac09ada
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454468
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-02 06:47:36 +00:00
Changpeng Liu
af6ed1e94a nvmf: update the reservation information for ACQUIRE/RLEASE commands
Change-Id: Ibfebffa4d683da08ae8f9350cce144fafe6a5538
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455910
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-07-02 00:06:59 +00:00
Changpeng Liu
196d4f704a nvmf: enable ptpl feature with reservation register command
Add file based reservation information definition, the data structure
can be used to store all the reservation information to a json
based configuration file, and enable this feature with REGISTER
command.

Change-Id: Ic93cfc5934a4ad96f11b96ec77bacb877edf6c10
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455909
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-07-02 00:06:59 +00:00
Mateusz Kozlowski
d679b0ec6a lib/ftl: Remove num_pad_bands counter from restore
Base off restore completion on list population rather than another
counter.

Signed-off-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Change-Id: I8f9d8f13aea42e1c350640efd84ff6c247eded0a
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457606
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-07-01 14:49:14 +00:00
Shuhei Matsumoto
a57daa6976 env: Add an API to lookup the memory pool created by the primary process
Add spdk_mempool_lookup to lookup the memory pool created by the
primary process. This will be utilized in SPDK multi process
application future.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I90505b6566dfc93ef5957ef4c73b1a6438c30742
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459739
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-07-01 14:47:30 +00:00
Mateusz Kozlowski
60c8845fd0 bdev/ftl: construct_ftl_bdev respects default ftl config
Changed initialization of the ftl lib when using an rpc call to
allow for usage of any default configuration parameters (currently
only allow_open_bands is exposed).

Signed-off-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Change-Id: I73457dfcacc6b1adeffd13ecc6e98001749e00cf
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459741
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-01 14:46:26 +00:00
Pawel Kaminski
d270cd36ad jsonrpc: Reorder spdk_jsonrpc_server_write_cb
We'll use it in spdk_jsonrpc_parse_request() soon.

Change-Id: I78ad2a931787b095e65053bea4dce663a92bb3b0
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459657
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-01 13:09:52 +00:00
Hailiang Wang
3a65c8729b lib/nvme: fix a warning of spdk_pci_addr->domain
Compilation Warning on fedora30.
In file included from nvme_ut.c:42:
/home/vagrant/spdk_repo/spdk/test/common/lib/test_env.c:517:17:
warning: The left operand of '>' is a garbage value
        if (a1->domain > a2->domain) {
            ~~~~~~~~~~ ^
This is related to issue #822.

Change-Id: I2b61e821130b89af04db3c475e81d2e91a380a90
Signed-off-by: Hailiang Wang <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459923
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-07-01 13:07:48 +00:00
Darek Stojaczyk
dad4c43a88 vhost: add a single dpdk semaphore
The semaphore was a part of struct spdk_vhost_session_fn_ctx
so far, but since there's only one pthread waiting on that
semaphore and hence only one event using it, we could just
use a single global sem_t. Same thing with response code
for those callbacks - there's only one needed.

Going a step further, the function complete_session_event()
was removed - it would only operate on global variables now,
and its signature wouldn't make much sense after this
refactor, so it's been inlined.

This serves as cleanup.

Change-Id: I63ef41d7e1564fff5e785de101d887bc1014aad9
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459160
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-01 12:50:57 +00:00
Darek Stojaczyk
5fb7330151 vhost: introduce g_vhost_init_thread
Enforce spdk_vhost_fini() to be called on the same
thread which called spdk_vhost_init(). We'll also use
the newly added g_vhost_init_thread for other purposes
later on.

Change-Id: I99aebeda2d8ddaf42554aa422c32ed935634595f
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459159
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-07-01 12:50:57 +00:00
Darek Stojaczyk
ccdc0b615f vhost: operate on poll groups instead of lcores
With all the pieces in place we can finally remove
the legacy cross thread messages from vhost.

We replace spdk_vhost_allocate_reactor() with
spdk_vhost_get_poll_group(). The returned poll_group
has to be passed to spdk_vhost_session_send_event(),
where it will be assigned to the session. After the
session it started, that poll group will be used for
all the internal vhost cross-thread messaging.

Change-Id: I17f13d3cc6e2b64e4b614c3ceb1eddb31056669b
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452207
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-07-01 12:50:57 +00:00
Shuhei Matsumoto
f62d5ccbe6 nvme/tcp: Properly handle multiple iovecs in nvme_tcp_pdu_set_data_buf
nvme_tcp_pdu_set_data_buf() has been used to process C2H and H2C for
NVMe/TCP initiator.

In this case, NVMe/TCP cuts out the part of the input data buffer
and transfers the part, and repeats these cut and transfers until
the whole data buffer is transferred. NVMe/TCP uses two SGLs, and
use one to parse from the offset datao to datao + datal and another
to append from the offset 0 to datal.

However, the current nvme_tcp_pdu_set_data_buf() had used
data_length as not data length of this transfer but total length
of the whole transfers by mistake.

Recently DIF library updated to properly handle very similar
cases, and so this patch takes DIF library as a reference and
corrects the implementation.

The next patch will add UT code to verify the bug will be fixed.
The code size is pretty large and so UT code is separated.

Change-Id: Ibeed4de182b8b8740566e874e2757280dc21f9e8
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455623
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: Ziye Yang <ziye.yang@intel.com>
2019-07-01 08:28:20 +00:00
Shuhei Matsumoto
a7b6d2ef00 nvme/tcp: Change parameters of nvme_tcp_pdu_set_data_buf to use in target
This patch is the first patch of the patch series.

The purpose of this patch series is to correct the bug of
nvme_tcp_pdu_set_data_buf() when the multiple iovecs array is
passed, to share nvme_tcp_pdu_set_data_buf() between NVMe/TCP
initiator and target, and utilize nvme_tcp_pdu_set_data_buf()
not only for C2H and H2C but also in-capsule data in NVMe/TCP
target.

This patch is necessary to satisfy the second requirement, to
share nvme_tcp_pdu_set_data_buf() between NVMe/TCP initiator and target
because struct nvme_tcp_req and struct spdk_nvmf_tcp_req are different.

Four variables, iov, iovcnt, data_offset, and data_len are common,
and hence this patch changes the parameters of nvme_tcp_pdu_set_data_buf()
to accept them.

The bug is fixed in the next patch and tested in after the next patch.

Change-Id: Ifabd9a2227b25f4820738656e804d05dc3f874a5
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455622
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: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2019-07-01 08:28:20 +00:00
Shuhei Matsumoto
f341e69a50 iscsi: Use not malloc'ed but fixed size string for portal porta number
Using malloc'ed string for string in iSCSI target has caused
scan-build error.

Define maximum port number of portal to be 32 and use fixed size string
whose size is 33 for spdk_iscsi_portal_grp::port.

This change will reduce the potential malloc failure.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ie1fcdbd45ce000a9c1c53761195697555b8d030a
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459709
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>
2019-07-01 05:03:07 +00:00
Shuhei Matsumoto
8f64724e86 iscsi: Use not malloc'ed but fixed size string for portal IP address
Using malloc'ed string for string in iSCSI target has caused
scan-build error.

Define maximum IP address of portal to be 256 and use fixed size string
whose size is 257 for spdk_iscsi_portal_grp::host.

This change will reduce the potential malloc failure.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Iceeae94e250ea426f72ff72355a213606308da51
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459708
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>
2019-07-01 05:03:07 +00:00
Shuhei Matsumoto
d1961b5e41 iscsi: Use not malloc'ed but fixed size string for target name and alias
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>
2019-07-01 05:03:07 +00:00
Shuhei Matsumoto
975e48ae8a iscsi: Use not malloc'ed but fixed size string for initiator address
Using malloc'ed string for string in iSCSI target has caused
scan-build error.

Maximum size of initiator address is already defined to be
MAX_INITIATOR_ADDR, and hence use fixed size string whose size
is MAX_INITIATOR_ADDR + 1 for spdk_iscsi_initiator_mask::mask.

This change will reduce the potential malloc failure.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ic39e08986c9377800ce58a1cb5b8401c6b71cf96
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459706
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>
2019-07-01 05:03:07 +00:00
Shuhei Matsumoto
4a3ad8371c iscsi: Use not malloc'ed but fixed size for initiator name
Using malloc'ed string for string in iSCSI target has caused
scan-build error.

Maximum size of initiator name is already defined to be
MAX_INITIATOR_NAME, and hence use fixed size string whose size
is MAX_INITIATOR_NAME + 1 for spdk_iscsi_initiator_name::name.

This will also reduce the potential malloc failure.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ic6bc172125fc6c9c0896499704d2a9b522106da0
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459705
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>
2019-07-01 05:03:07 +00:00
Shuhei Matsumoto
1eba9812f2 iscsi: Simplify include relationships to avoid cyclic inclusion
Including tgt_node.h in iscsi.h will prevent us from including
iscsi.h in tgt_node.h. Subsequent patches will require tgt_node.h
to refer the macro constants in iscsi.h.

Hence
- remove inclusion of tgt_node.h from iscsi.h,
- add inclusion of spdk/scsi.h to iscsi.h, and
- remove inclusion of spdk/scsi.h from tgt_node.h

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5ac808a83754c157e4140bcd2a83c4d210e30d91
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459704
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: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-01 05:03:07 +00:00
Changpeng Liu
efd7b514d4 bdev: rewind child offset to last block size aligned iov
Here is the an example to describe existing issue:

There is a Write request with 64KiB data length, and this IO is cross the IO
boundary.  We assume that the parent IO will have 2 children requests, one is
33KiB length, the other one is 31KiB.  Here is the view of parent iovs, the
first 33KiB length data has 33 iovs:

iov.[0].iov_length = 1024;
.
.
iov.[31].iov_length = 256;
iov.[32].iov_length = 768;
.
.
iov.[64].iov_length = 1024;

In function _spdk_bdev_io_split(), then you can see that for the 33KiB length
child request, exiting code will run out of child child_iov space and return
error due to last one data buffer is not block size aligned.

Here we can rewind the existing offset to last block size aligned buffer to
avoid the error case, for backend which need aligned data buffer such as
AIO backend, the request will go through spdk_bdev_io_get_buf() again to
do the data copy, otherwise for those backend devices such as NVMe with
hardware SGL support, 256 data segment is fine for them.

Change-Id: I96ebdf29829d86f9b38fab28a7406eedc9fa44ef
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453604
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-01 04:20:21 +00:00
Wojciech Malikowski
091bc429d7 lib/event/subsystems: Added VMD dependency to bdev subsystem
Bdev initialization need to be done after VMD.

Change-Id: Ia680ccbdb8fc6db1d3c09cf9d917105e183a3845
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459768
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-01 03:54:45 +00:00
Wojciech Malikowski
a044e19470 lib/rocksdb: Optional VMD enumeration
VMD section with Enable flag set to true
need to be defined in config file to
enumerate devices behind VMD.

Change-Id: I0b35d93b224025050ae0c081af720ed816c9f0fa
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459765
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-01 03:53:06 +00:00
Wojciech Malikowski
e2fb1b80e1 lib/ftl: Check if any additional relocation was added
Return immediatly from ftl_reloc_add() if no
new blocks was added to relocation.

Change-Id: If80dfa725e0bb9f3b8987740012858a671c5ad90
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457626
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2019-07-01 03:29:00 +00:00
Wojciech Malikowski
a74b79dc74 lib/ftl: Drop relocation for empty bands immediately
Added check if band that is added to reloc
have any valid blocks. Return immediately
if there is no valid blocks.

Change-Id: I2bce088e0ad71479c6899fff96845397d12e2e92
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457625
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-01 03:29:00 +00:00
Wojciech Malikowski
c149f9597f lib/ftl: Prevent from adding active reloc to pending queue
In case ANM event occurs on band being
relocating (band is on active reloc queue)
we shoudn't add such band to pending queue.

Change-Id: I92a8bee11309097e19afaea549460f1d4387e3e5
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458617
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-01 03:29:00 +00:00
Wojciech Malikowski
76cff6da81 lib/ftl: Remove band from active/pending queue
In case high priority band was added
for relocation it should be removed
from active/pending queue if it was
already on one of them.

Change-Id: Id0591b1d3a4174dd05eb1c32227e4d3b3a9cbcd0
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458057
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2019-07-01 03:29:00 +00:00
Wojciech Malikowski
2cc6bd2a26 lib/ftl: Skip block with ongoing write during relocation
In case ANM event occurs on open band there
can be situation that reloc will try to read
block on which there is ongoing write.
This is happening because lba valid map is
updated before write  submission to allow sent
consistent metadata to disk before all user
writes are completed.

Added write offset to the each chunk and
add check to reloc if particular ppa is written
on that chunk.

Change-Id: Ic95a06e69381d2152a86984b65a0975afaff955d
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458056
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-01 03:29:00 +00:00
Wojciech Malikowski
bf4973087f lib/ftl: Allow for relocating open band
In case ANM event occurs on open band
reloc need to be able to process such
event.

If band is not in closed sate do not
alloc lba map for it and do not set
it to free state after relocation.

Change-Id: I2f4a5770fef08271d222936ca19f3cc98e5e5be1
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457612
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2019-07-01 03:29:00 +00:00
Wojciech Malikowski
f8a9112292 lib/ftl: Mark all lba map segments as cached for open bands
Open bands need to have lba map segments
set to cached state to prevent read lba
map from disk during relocation events.

Change-Id: Ib4f1ed19131fad174c1d2f70e4c02e83701e2a0a
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457853
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-01 03:29:00 +00:00
Wojciech Malikowski
bfd67f9405 lib/ftl: Initialize band tail metadata physical address
Band tail PPA should be initialized when
new FTL instance is created.

Change-Id: Ie2fb72aa3f29eece0b6f8912998b33af3ba6b355
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457777
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-01 03:29:00 +00:00
Wojciech Malikowski
4be37a57f4 lib/ftl: Consume ANM event on core thread
Send ANM event to core thread for further
processing. This will remove a need of locking
in relocate module when ANM event occur.

Change-Id: I0efb1f1b8c96c107cda5fe78e8ee5672cde39f11
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457611
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-01 03:29:00 +00:00
Ziye Yang
cdc0170c1b nvmf/tcp: Add a maximal PDU loop number
In our previous code, we will handle all the PDU until there is
no incoming data from the network if we can continue the loop.
However this is not quite fair when we handling multiple connections
in a polling group.

And this change is setting a maximal NVME/TCP PDU we can handle
for each conneciton, it can improve the performance. After some
tuing, 32 should be a good loop number. Our iSCSI target uses
16.

The following shows some performance data:

Configuration:
1 Command used in the initiator side:
./examples/nvme/perf/perf -r 'trtype:TCP adrfam:IPv4 traddr:192.168.4.11 trsvcid:4420'
-q 128 -o 4096 -w randrw -M 50 -t 10

2 target side, export 4 malloc bdev in a same subsystem

Result:

Before patch:

Starting thread on core 0
========================================================
                                                                                                           Latency(us)
Device Information                                                    :       IOPS      MiB/s    Average        min        max
TCP  (addr:192.168.4.11 subnqn:nqn.2016-06.io.spdk:cnode1) from core 0:   51554.20     201.38    2483.07     462.31    4158.45
TCP  (addr:192.168.4.11 subnqn:nqn.2016-06.io.spdk:cnode1) from core 0:   51533.00     201.30    2484.12     508.06    4464.07
TCP  (addr:192.168.4.11 subnqn:nqn.2016-06.io.spdk:cnode1) from core 0:   51630.20     201.68    2479.30     481.19    4120.83
TCP  (addr:192.168.4.11 subnqn:nqn.2016-06.io.spdk:cnode1) from core 0:   51700.70     201.96    2475.85     442.61    4018.67
========================================================
Total                                                                 :  206418.10     806.32    2480.58     442.61    4464.07

After patch:
Starting thread on core 0
========================================================
                                                                                                           Latency(us)
Device Information                                                    :       IOPS      MiB/s    Average        min        max
TCP  (addr:192.168.4.11 subnqn:nqn.2016-06.io.spdk:cnode1) from core 0:   57445.30     224.40    2228.46     450.03    4231.23
TCP  (addr:192.168.4.11 subnqn:nqn.2016-06.io.spdk:cnode1) from core 0:   57529.50     224.72    2225.17     676.07    4251.76
TCP  (addr:192.168.4.11 subnqn:nqn.2016-06.io.spdk:cnode1) from core 0:   57524.80     224.71    2225.29     627.08    4193.28
TCP  (addr:192.168.4.11 subnqn:nqn.2016-06.io.spdk:cnode1) from core 0:   57476.50     224.52    2227.17     663.14    4205.12
========================================================
Total                                                                 :  229976.10     898.34    2226.52     450.03    4251.76

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I86b7af1b669169eee2225de2d28c2cc313e7d905
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459572
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-06-28 12:28:54 +00:00
Changpeng Liu
6c9b6abf5e blobfs: make internal asynchronous APIs as public APIs
SPDK blobfs has asynchronous APIs defined in blobfs_internal.h file,
as users may want to use them, so we remove them to the public .h file.

Change-Id: I1835d97060101f6315a73cb8638b15ff7e13ba54
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457547
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-06-28 09:50:50 +00:00
Changpeng Liu
1966f1eef3 blobfs: add writev/readv asynchronous APIs support
Change-Id: Id1172f546852fcf25c6d13cb63f9d875b02e768c
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453493
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-06-28 09:50:50 +00:00
Takeshi Yoshimura
c74ea9fa8e rocksdb: Fix null deref at blobfs calls
I tried experimental binding of SPDK with Mongo-rocks. However,
the binding sometimes invoke blobfs APIs without thread
initializations. In that case, null dereferences occur. In other
words, we need to carefully use blobfs not to invoke any threads
that are not registered to blobfs.

This patch simply adds a sanity check at every use of blobfs APIs.
By doing this, we do not need to care about which threads can use
blobfs APIs.

Change-Id: I5b37b0267306a7c76d20e81c1773a6a33be7828c
Signed-off-by: Takeshi Yoshimura <t.yoshimura8869@gmail.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/418966
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-06-28 08:37:54 +00:00
Anil Veerabhadrappa
9d1e666798 conf: parse "C2HSuccess" parameter for TCP transport only
"C2HSuccess" is only valid for TCP transport. So this parameter
should be looked up only for TCP transport. Without the change,
spdk_nvmf_parse_transport() would bailout early for RDMA and
other transports without every creating them.

Signed-off-by: Anil Veerabhadrappa <anil.veerabhadrappa@broadcom.com>
Change-Id: I34bdff2f4ab930516743cd5dbf022d75e60fd85c
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459571
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-28 07:03:45 +00:00
Shuhei Matsumoto
0c26ea5a2b dif: Factor out converting size from LBA based to extended LBA based
In DIF library there are many functions that converts offset or
length from LBA based to extended LBA based.

Factor out them by adding a helper function _to_size_with_md().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Id5576edacc8a07095726f659c4b53ac3aa83727d
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459530
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>
2019-06-28 04:13:02 +00:00
Shuhei Matsumoto
1d1c60e53d dif: Add helper function to convert buffer range to extended LBA based
This will be used to get extended LBA based range or length in NVMe/TCP
target later.

Change-Id: Id0f08bdaeea634dbc05b34a0f7914be21aef9aae
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458706
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-28 04:13:02 +00:00
Shuhei Matsumoto
767c046e77 dif: Add spdk_dif_update_crc32c_stream to update CRC32C by stream fashion
Add spdk_dif_update_crc32c_stream to update CRC32C by stream fashion.
spdk_dif_update_crc32c_stream utilizes the updated _dif_update_crc32c_split.

A minor bug was found in UT for spdk_dif_update_crc32c and is fixed
together in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I92358e845e8e2e17c6f288aa718b947e71e6e1fb
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458919
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>
2019-06-28 04:13:02 +00:00
Shuhei Matsumoto
4c2e52b935 dif: Process partial data block properly in _dif_update_crc32c_split
For NVMe/TCP target, data segments which correspond to H2C or C2H PDU
will have any alignment, and _dif_update_crc32c_split will have to
process partial data block, particularly the following types:
- start and end are both within a data block.
- start is within a data block, and end is at the end of a block

On the other hand, _dif_update_crc32c_split had assumed that passed
block is always a complete block.

This patch exposes offset_in_block, data_len, and guard as parameters
of _dif_update_crc32c_split() and make _dif_verify_split() process
the above two types of data block properly.

The next patch will utilize the updated _dif_update_crc32c_split to
add spdk_dif_update_crc32c_stream().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Iee29377ad49d4f209673fffb4de4a23a54f31766
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458918
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>
2019-06-28 04:13:02 +00:00
Tomasz Zawadzki
699a5f35e5 net/vpp: switch to session.api
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I94ce2735c3d15dd7ee5e4ad33280e9996740e244
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/417056
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-06-27 08:23:08 +00:00
Darek Stojaczyk
f9a6588f57 nvme: switch to spdk_*malloc().
spdk_dma_*malloc() is about to be deprecated.

Change-Id: I6c308ee546c28c479ceb903bc1749bf5209dc6fe
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/448172
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <uma.willpower@gmail.com>
2019-06-27 04:34:50 +00:00
Shuhei Matsumoto
a019feec62 dif: Factor out setup operation of spdk_dif_generate/verify_stream
spdk_dif_generate_stream() and spdk_dif_verify_stream() are very
similar. Factoring out the common part into a function will improve
the maintainability and do in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I16ecd0860c75037d9182298d7513749dfe8e9b56
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458376
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-27 00:36:25 +00:00
Shuhei Matsumoto
6db126c24c dif: Add spdk_dif_verify_stream to verify DIF by stream fashion
Add spdk_dif_verify_stream to verify DIF by stream fashion.
spdk_dif_verify_stream utilizes the updated _dif_verify_split.
spdk_dif_verify_stream is very similar with spdk_dif_generate_stream().

UT code demonstrates how it is realized.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I1c5d197cf4c0bbc82c8e7f4fa45ddc0b94051058
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458330
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-27 00:36:25 +00:00
Shuhei Matsumoto
80f2ca0d90 dif: Process partial data block properly in _dif_verify_split
For NVMe/TCP target, data segments which correspond to H2C or C2H PDU
will have any alignment, and _dif_verify_split will have to process
partial data block, particularly the following types:
- start and end are both within a data block.
- start is within a data block, and end is at the end of a block

On the other hand, _dif_verify_split had assumed that passed block
is always a complete block.

According to the refactoring done in the last patch, this patch
exposes offset_in_block, data_len, and guard as parameters of
_dif_verify_split() and make _dif_verify_split() process the
above two types of data block properly.

The next patch will utilize the updated _dif_verify_split to
add spdk_dif_verify_stream().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ic371d3ccefbd5fe8147a948a624013be2702128e
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458329
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-27 00:36:25 +00:00
Shuhei Matsumoto
d69dc28b00 dif: Separate _dif_verify_split into three parts
For NVMe/TCP target, data segments which correspond to H2C or C2H PDU
will have any alignment, and _dif_verify_split will have to process
partial data block, particularly the following types:
- start and end are both within a data block.
- start is within a data block, and end is at the end of a block

On the other hand, _dif_verify_split had assumed that passed block
is always a complete block.

To process the above types, separating guard computation, DIF copy
and skipping metadata field, and  DIF verification into three parts
will be helpful and is done in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ic4f1765e01507efa812dfaf7a8018666c6346f8e
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458328
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-27 00:36:25 +00:00
Konrad Sztyber
42287a6954 lib/ftl: error logging around getting chunk info
Some of the errors were silent, making it hard to pinpoint the exact
failing call. This patch adds SPDK_ERRLOGs for each error path.

Change-Id: I71be6c97cab916ac52314e5f4e4d63358877bd96
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458426
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>
2019-06-26 14:21:52 +00:00
Konrad Sztyber
18b1de97d8 lib/ftl: store metadata on non-volatile cache
Send LBA along with the data block when mirroring writes to the
non-volatile cache. The metadata buffer is retrieved from the metadata
pool, so the maximum number of concurrent requests is limited to
nv_cache.max_request_cnt, while the number of blocks in a single request
is limited by nv_cache.max_requets_size.

Change-Id: If260302d16039183fb0fe073ef7419947532cfab
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458093
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-26 09:36:57 +00:00
Konrad Sztyber
11ff1f4a2b lib/ftl: non-volatile cache metadata pool
Initialize the memory pool for storing metadata (LBAs) when writing data
to the non-volatile cache. The mempool's object count and size can be
configured via nv_cache.max_request_cnt / nv_cache.max_request_size
respectively.

Change-Id: I376df9a75be13d4b29ba475f350edf402c868d48
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458092
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>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
2019-06-26 09:36:57 +00:00
Mateusz Kozlowski
8c2cff02b6 lib/ftl: Fix ppa pack function
Address translation wasn't correct for >32 bit length packed address.
This commit fixes the issue and adds a corresponding unit test.

This patch fixes issue #774:
https://github.com/spdk/spdk/issues/774

Signed-off-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Change-Id: Idce67c47f2a9888f9e2ae2eadaf71ccc34e5c260
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457114
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-06-26 08:38:32 +00:00
Wojciech Malikowski
f056bc6524 lib/env_dpdk: Allow iterating over all detected PCI devices
Added spdk_pci_get_first_device() and
spdk_pci_get_next_device() to iterate
over all devices on g_pci_devices list.

Change-Id: I65079fb3e274195707dee64bc1fb8b4b72d07352
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450924
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-06-26 08:24:02 +00:00
Darek Stojaczyk
b9e8dc71f7 env_dpdk/pci: cleanup locks
Put the locks inside cleanup_pci_devices().
This serves as cleanup.

Change-Id: I040b28006e5584d1f33af26b63cafedbafe04fdb
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458934
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
2019-06-26 08:24:02 +00:00
Darek Stojaczyk
fe511d03d2 env_dpdk/pci: reduce g_pci_mutex scope
The global pci tailq is no longer modified on the dpdk
thread, so on the spdk thread we can access it safely
without any lock. The code is slightly more readable
then.

This shows that cleanup_pci_devices() is always wrapped
with lock/unlock. We'll put the locks inside this
function in the next patch.

Change-Id: Ia4d386b78a87078761df0a3b953bfc4ff44102f8
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458933
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-06-26 08:24:02 +00:00
Darek Stojaczyk
b941b2983a env_dpdk/pci: don't hotplug devices directly on the dpdk intr thread
To safely access the global pci device list on an spdk
thread, we'll need not to modify this list on any other
thread. When device gets hotplugged on a dpdk thread,
it will be now inserted into a new global tailq that
can be accessed only under g_pci_mutex. Then any
subsequently called public pci function will add it to
the regular device tailq.

Change-Id: I9cb9d6b24fd731641fd764d0da71bedab38824c9
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458932
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-06-26 08:24:02 +00:00
Darek Stojaczyk
cf0abd0e83 env_dpdk/pci: don't hotremove devices directly on the dpdk intr thread
To safely access the global pci device list on an spdk
thread, we'll need not to modify this list on any other
thread. When device gets hotremoved on a dpdk thread,
it will now set a new per-device `removed` flag. Then
any subsequently called public pci function will remove
it from the list.

Change-Id: I0f16237617e0bea75b322ab402407780616424c3
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458931
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-06-26 08:24:02 +00:00
Darek Stojaczyk
49c12890aa env_dpdk/pci: remove thread safety from PCI APIs
For VMD driver we'll need to introduce some way of
iterating over all spdk pci device objects and we would
like to achieve that with simple spdk_pci_get_first_dev()/get_next_dev()
APIs. To make it thread safe though, we would have to
expose some public pci mutex to be locked around the
iteration and we don't want to do that, so we'll make
PCI APIs usable from only a single thread - this will
prevent any pci devices from being removed inbetween
subsequent get_first/get_next calls.

We currently have the following players accessing pci
device state:
 1) public APIs, obviously (on any thread right now)
 2) VFIO hotremove callback (dpdk interrupt thread)
 3) rte_eal_alarm for detaching rte_pci_devices (dpdk
    interrupt thread)
 4) DPDK hotplug IPC (dpdk interrupt thread)

There is g_pci_mutex providing the thread safety, but
even today it doesn't protect #3 and #4, making the
entire pci layer prone to data corruption.

To make #3 and #4 safe, we would have to lock inside
device init/fini callbacks (spdk_pci_device_init/fini),
but those are called directly inside the public device
attach/detach functions which already lock.

So now, with the decision to drop thread safety from
public pci APIs, we narrow down the locks inside public
functions and introduce locks inside those lower-level
init/fini callbacks.

Change-Id: I5dcbc9cdcbab65ee76cd3c42890f596069ec9a8a
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458930
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-06-26 08:24:02 +00:00
Ziye Yang
016d933793 lib/virtio: change the definition of cookie
Converting to the struct virtio_req is useless.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I141268314d28cf87bdef529808c8e18bd1b41c9d
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459360
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>
2019-06-26 08:03:37 +00:00
Maciej Szwed
e8356fd233 blobstore: Cleanup after power failure while creating snapshot
Currently we are missing cleanup routine for case when
power failure interrupts creating snapshot. This patch
add such routine.

For the case where we find blob with a parent snapshot ID
matching newly created snapshot we can finish whole process
during recovery by processing forward with setting snpashot
as read only, removing xattr and syncing. We should remove
snapshot only if there is no blob with parent pointing at
snapshot.

Fixes github issue #760

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I2f0e298164e07a2b4dfa5367e8878facef640702
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455216
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2019-06-26 08:00:14 +00:00
paul luse
bfda995be2 bdev/compress: add RPC to specify PMD
By default QAT will be selected if available however a new RPC
can be used to either auto-select (default) or specify either
ISAL or QAT.

Change-Id: I37cf7640bbd8cef455583e1eccb8adb59cc419d8
Signed-off-by: paul luse <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456693
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-26 07:57:09 +00:00
Mateusz Kozlowski
ef6878072c lib/ftl: Band seq is restored from head md only
Fixed issue when restoring from a dirty shutdown - sometimes end md
wasn't erased after a band was prepared from writing when a shutdown
happened. This resulted in inconsistency between the new head md and
old tail md, which was technically valid. Band sequence numbers would
then be reused, causing a failure on any subsequent restore.

Signed-off-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Change-Id: Ic3e968be02bb814d6c85f0a3279403fe99337b86
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459287
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-26 07:09:00 +00:00
Mateusz Kozlowski
38bb4bcdee lib/ftl: Fix I/O alignment in dirty shutdown restore
Changed to use 4k alignment in dirty shutdown I/Os. Otherwise the
scatter gather lists used in QEMU for underlying file/block device
would use an extra entry (e.g. 17 for 16 sector writes), and eventually
some I/Os would write to offset 0 in underlying file, corrupting head
metadata.

Signed-off-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Change-Id: If8c88ce708529b094a09c8ee952912cc22cd53b9
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458090
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-26 07:09:00 +00:00
Mateusz Kozlowski
67d027ece9 lib/ftl: Fix lba_map cleanup during restore
Band's lba_map needs to be set to NULL before restore completes, as
it's not allocated on a per band basis and instead uses a pool from
restore struct itself. Without the fix initializing a band for writing
would hit an assert during proper allocation in ftl_band_alloc_lba_map.

Signed-off-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Change-Id: Icff4f54cbe722cb6030b9dfd55726b9b0d6c1e27
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458422
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-26 07:09:00 +00:00
Shuhei Matsumoto
8c69654d5a dif: Process unaligned data segment properly in DIF insert
This patch makes spdk_dif_set_md_interleave_iovs() and
spdk_dif_generate_stream() process unaligned start of data segment
properly by using ctx->data_offset.

Separating this patch into two may be required but this patch is
small and aggregating into a patch is good to test.

UT code demonstrates how it is realized.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Idb5250aba4e12a34102e5ce067d725c685681177
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458142
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>
2019-06-26 06:56:25 +00:00
Shuhei Matsumoto
2819718176 dif: Add an API to update data offset of DIF context
To process unaligned data segment properly when a whole data buffer
is splitted into multiple data segments and each data segment has
any alignment, we have to update only data offset of DIF context
according to the progress.

Hence this patch adds an new API spdk_dif_ctx_set_data_offset().
The API will be used in the next patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I346ab583518b80792ea40d34cf0c8536ecc3d904
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458141
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>
2019-06-26 06:56:25 +00:00
yidong0635
17c006a7c3 lib/jsonrpc: Fix memory leaks about connection request.
There're outstanding requests in spdk_jsonrpc_parse_request which caused by
	connection close.
There are methods to call spdk_jsonrpc_server_conn_close, including
	spdk_jsonrpc_server_conn_remove and spdk_jsonrpc_server_shutdown,
Some rpc methods call these functions to terminate connections ,that leads to
	memory leaks.
Try to free outstanding requests after deciding to terminate a connection.
And do this follwing with close(conn->sockfd).

Fix issue #784, and can resolve other similar memory leaks about this.

Signed-off-by: yidong0635 <dongx.yi@intel.com>
Change-Id: Icd287bd0c5670ee8ec32750b999f82b0fa89cf84
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458438
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>
2019-06-26 06:26:50 +00:00
Or Gerlitz
6629202cbd nvmf/tcp: Use the success optimization by default
By now (5.1 is released), the Linux kernel initiator supports the
success optimization and further, the version that doesn't support
it (5.0) was EOL-ed. As such, lets open it up @ spdk by default.

Doing so provides a notable performance improvement: running perf with
iodepth of 64, randread, two threads and block size of 512 bytes for 60s
("-q 64 -w randread -o 512 -c 0x5000 -t 60") over the VMA socket acceleration
library and null backing store, we got 730K IOPS with the success
optimization vs 550K without it.

IOPS           MiB/s    Average       min      max
549274.10     268.20     232.99      93.23 3256354.96
728117.57     355.53     175.76      85.93   14632.16

To allow for interop with older kernel initiators, we added
a config knob under which the success optimization can be
enabled or disabled.

Change-Id: Ia4c79f607f82c3563523ae3e07a67eac95b56dbb
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457644
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-26 06:24:03 +00:00
Changpeng Liu
cf5c4a8a2e nvmf: add ptpl activated flag to Namespace
If users set the persist through power loss configuation file,
that means the Namespace has the capability to support ptpl
feature, here we added a ptpl_activated flag to indicate that
the users enable the feature or not.  Users can use Set features
or Reservation Register commands to change the value.

Change-Id: Iae3fd44085c5be5bf9574e49efa567e8212dee20
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455906
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-06-26 01:54:10 +00:00
Chunyang Hui
863f17d609 reduce: check pmem buf before unmap
Fixed issue #831

Change-Id: Id589290f3aa729572fa81daf735cecdc8e2adb84
Signed-off-by: Chunyang Hui <chunyang.hui@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458563
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-06-25 13:39:09 +00:00
Hailiang Wang
73a171a07c rdma: assert ibv_send_wr is not NULL
Vhost testing crashed from Nightly testing, because a member
access within null pointer of type 'struct ibv_send_wr'.

Change-Id: If8f34f23864883ea73516d2d1fe3b30137c04316
Signed-off-by: Hailiang Wang <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458913
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-06-25 13:37:15 +00:00
Darek Stojaczyk
29093c7f01 event/app: don't call start_fn twice when json config is used
When JSON config was used, app layer was calling the
app start callback twice - once from internally-sent
"start_subsystem_init" RPC, and once from the app layer
itself.

In case of JSON configs, the callback from within the
RPC was actually called prematurely, as the real RPC
server was still starting in the background at that
point. We still need to start the app from that RPC in
case of `--wait-for-listen` option, but for JSON configs
it doesn't make sense. Just ignore it now and rely on
json config load completion callback to start the app.

Fixes #816

Change-Id: Ib54d624f3167137216c910b2d947bbd1dc5023b1
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458351
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-06-24 15:54:49 +00:00
Darek Stojaczyk
a7d9fc4a4d event: fix segv on json config read failure
If reading the JSON config file has failed, we entered
spdk_app_json_config_load_done(-ERRNO) and tried to
close a client connection that was never initiated,
which resulted in NULL dereference.

To fix it, just check if client_conn != NULL before
attempting to close it.

Change-Id: I7340567c45e795f77110c2914e94ba83fa8d1bff
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458350
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-06-24 15:54:49 +00:00
Wojciech Malikowski
8233a5a8e1 event/subsystems/vmd: Added VMD subsystem
Added new VMD subsystem to enumerate
devices behind VMD when event framewrok
is used.

To enable VMD, user need to provide Enable
flag via config file.

Change-Id: I89bfe22b127c00d358dac7336ffb44b0c0f426ea
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458443
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-06-24 09:59:00 +00:00
Shuhei Matsumoto
1750a0859b dif: Process unaligned end of data buffer in spdk_dif_generate_stream()
NVMe/TCP target may split a whole data payload into multiple H2C
or C2H PDUs with any alignment. Hence to insert or strip DIF correctly
to the split H2C or C2H PDUs, we have to bring the interim guard
value of the last partial data block of the current H2C or C2H
PDU to the first partial data block of the next H2C or C2H PDU.

So we add last_guard to struct spdk_dif_ctx and use it in
spdk_dif_generate_stream().

API spdk_dif_generate_stream() is not changed and UT code should
pass without any change.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I12636c5ac7f619483402538faff4339a16c0e6b0
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457545
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>
2019-06-24 07:02:07 +00:00
Shuhei Matsumoto
f6a91b3b40 dif: Process partial data block properly in _dif_generate_split()
For NVMe/TCP target, data segments which correspond to H2C or C2H PDU
will have any alignment, and _dif_generate_split will have to process
partial data block, particularly the following types:
- start and end are both within a data block.
- start is within a data block, and end is at the end of a block

According to the refactoring done in the last patch, this patch
exposes offset_in_block, data_len, and guard as parameters of
_dif_generate_split() and make _dif_generate_split() process
the above two types of data block properly.

The next patch will utilize the updated _dif_generate_split in
spdk_dif_generate_stream().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I4211e65ead7fc256a40748412c670e46f83b1731
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457544
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>
2019-06-24 07:02:07 +00:00
Shuhei Matsumoto
27707953ec dif: Separate _dif_generate_split into three parts
For NVMe/TCP target, data segments which correspond to H2C or C2H PDU
will have any alignment, and _dif_generate_split will have to process
partial data data block, particularly the following types:
- start and end are both within a data block.
- start is within a data block, and end is at the end of a block

On the other hand, _dif_generate_split had assumed that passed
block is always a complete block.

To process the above types, separating guard computation, DIF generation,
and DIF copy into three parts will be helpful and is done in this
patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I0171d9021837b9a4b425370293cef45dbe7500e8
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458225
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>
2019-06-24 07:02:07 +00:00
Shuhei Matsumoto
f1344911ea dif: Minor cleanup of spdk_dif_set_md_interleave_iovs
Four variables head_unalign, tail_unalign, num_blocks, and offset_blocks
became unuseful by the last patch. Hence reduce them to buf_len and
buf_offset in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I04fc1e442be6569a96533cdfe36b27fcc78e98d4
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457876
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>
2019-06-24 07:02:07 +00:00
Shuhei Matsumoto
8b24fc4a31 dif: Process unaligned end of data segment in spdk_dif_set_md_interleave_iovs()
For NVMe/TCP target, data segments which correspond to H2C or C2H PDU
will have any alignment. spdk_dif_set_md_interleave_iovs() have allowed
reading data to have any alignment but had required data segment to
be a multiple of block size.

In other words, spdk_dif_set_md_interleave_iovs() had required that both
ctx->data_offset and (data_offset + data_len) must be a multiple of the
data block size.

This patch refines the algorithm to remove the latter requirement.

The update implies that spdk_dif_set_md_interleave_iovs support any
data buffer whose size is less than a single data block.

The update doesn't change parameters of spdk_dif_set_md_interleave_iovs
and existing UT should be passed.

This patch adds additional UT code to test these updates.

Change-Id: I88c7d2a80a8d92b54863b6ad1c3a9d2761a6195d
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457542
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>
2019-06-24 07:02:07 +00:00
Shuhei Matsumoto
2bb4fb4c8c dif: Factor out SGL append opeartion when splitting data buffer
The subsequent patches will refine spdk_dif_set_md_interleave_iovs
to change the data_len parameter to be the remaining length, and
to remove alignment constraint completely. This patch is a
preparation to subsequent patches.

This patch doesn't change any behavior.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I0e9be7e66d313f3ec2bd8c55cce8bb18e4fff892
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457721
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>
2019-06-24 07:02:07 +00:00
Changpeng Liu
5d718951a6 bdev: split requests first if the request has data buffer
There is one existing example usage case to describe the issue:
Users(e.g. Vhost-blk target with Windows Guest) call spdk_bdev_readv_blocks()
to submit a 128KiB length data READ request, and the data buffer
provides by vhost isn't aligned, but the backend block device
requires aligned data buffer, so existing function call trace:
spdk_bdev_readv_blocks()-->
    spdk_bdev_io_submit()-->
    spdk_bdev_io_get_buf()
spdk_bdev_io_get_buf() will allocate buffer from large data
buffer pool for 128KiB length, of course, it will return error
with existing logic.

So here, no matter what the data length is, we can go through
the split process first for both READ and WRITE.

However, there is one scenario that for iSCSI READ request,
the iSCSI layer will not allocate data buffer for the request,
so for this case if the IO boundary is required we should keep
the logic as before.

Change-Id: I67661f5fa4c3c7c561b45c86146759aa3477adbf
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453133
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-24 04:51:46 +00:00
JinYu
77290bfe6b nvme: fix the endless loop of aborting trackers
The completion cb of outstanding_tr may submit new requeset to
the outstanding_tr list of the qpair, it's an endless loop.
We only abort the remaining outstanding trackers.

Fix #819

Change-Id: I342f52f4d1836f8ef620ef9e3add0b1986727282
Signed-off-by: JinYu <jin.yu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457755
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-21 08:34:41 +00:00
paul luse
68fbb33b81 bdev/compress: add 2 recommended flags to the comp operation
Per docs.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I2b520ba9cce2e8914e5003095cdb0be61b417cb2
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458836
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-21 08:20:01 +00:00
paul luse
8d2455caa3 bdev/compress: always use QAT if available
The next patch in this series introduces and RPC that makes the
selection more flexible.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I55617d3c37b51cf9474c358cb92f5218397c0c58
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457157
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-21 07:53:39 +00:00
paul luse
5d55704d66 bdev/compress: adjust vol parms
There were some TODO items in here that were incorrect if using
an underlying block device that had a 4K block size. The values
here will set the compress vol LBA size to match that of the
underlying lvol but the backing IO unit size, the min size that
reduce will use to perform backing device IO is set to 4K as
smaller than this makes little sense given chunk size is currently
at 16K.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ic6a9421a25d947ae7d4dce190d6599eec1d4a05a
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458703
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-21 07:53:39 +00:00
paul luse
5cffa4a988 bdev/compress: check PMD shareable flag for transforms
Module only supports shareable transforms, also adjusted the number
to what we need, just 2.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ieb77b5f1221878ac7a4be5176ed459d5165f8430
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458698
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-21 07:53:39 +00:00
Maciej Szwed
f27cbce428 blobstore: Fix error path for snapshot creation
In _spdk_bs_snapshot_origblob_sync_cpl function on error
path we should not close snapshot as it will be closed during
volume closing when bs_dev is being destroyed.
This issue was found in unit test (see next patch in series).

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I51c38d1f1f97b134679251b43109b1265e565a17
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455215
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>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2019-06-19 08:39:00 +00:00
Shuhei Matsumoto
beefcd1ae5 iscsi: Fix the bug to add wrong size in _iscsi_sgl_append_with_md
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>
2019-06-19 07:38:46 +00:00
Konrad Sztyber
e2918289a1 lib/bdev: clear metadata when emulating write_zeroes
If bdev is configured to use separate buffers for metadata transfer,
but it doesn't support the write zeroes command, pass empty zeroed
buffer to make sure the metadata is cleared out as well.

Change-Id: If6f024266067e5764a28a276296f651d31da4792
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457628
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-19 03:53:02 +00:00
Tomasz Zawadzki
5468acd898 bdev: directly use spdk_bdev_desc_get_bdev() where needed
The function spdk_bdev_desc_get_bdev() was added,
but remained unused. Couple places done the exact same thing,
so now they just use it directly.

Change-Id: I018f57b7b4bcfe22ec6a97cf5261b9a257ba93de
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456957
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-19 03:49:53 +00:00
GangCao
c3d1e498d5 iscsi: update the error message for the login init
Change-Id: Ic6baf284753c625d9f1d3110149f67ce4b48c0e7
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458406
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-19 03:43:45 +00:00
Konrad Sztyber
6a75bb948e bdev/part: separate buffer metadata support
Allow requests using separate buffer for metadata IO if base bdev
supports it. Copy base bdev's metadata configuration (separate /
interleaved, size, DIF type and location).

Change-Id: I89996f89cad805e696cacf0bba486b4cc1f617e6
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458407
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-19 03:43:11 +00:00
Chunyang Hui
e3d21c7778 Opal: Optimize key creation and remove dev->dev_key
Change-Id: Iaf20c8ec0d208e03269406b62608d981d84cc48c
Signed-off-by: Chunyang Hui <chunyang.hui@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457775
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>
2019-06-19 00:28:57 +00:00
Maciej Szwed
622127d7e1 blobstore: Make possible to remove snapshot if there is only one clone
Starting with this patch it is possible to remove a
snapshot if there is only a one clone created from it.

In such case snapshot can be removed without any data
copying. This is achieved with following steps (case
with only one clone):
1. Open snapshot (Snapshot1) that shall be removed
2. Check if the Snapshot1 has no more than 1 clone (Clone1)
3. Remove Clone1 entry from Snapshot1
4. If the Snapshot1 has a parent snapshot (Snapshot2):
 4a. Add Clone1 entry to the Snapshot2 clones list
 4b. Remove Snapshot1 entry from Snapshot2 clones list
5. Open Clone1 blob
6. Freeze I/O operations on Clone1
7. Temporarily override md_ro flag for Snapshot1 and Clone1
   for MD modification
8. Merge Snapshot1 and Clone1 clusters maps into Clone1
   clusters map
9a. If Snapshot2 is present switch parent ID and backing
    bs_dev on Clone1
9b. If Snapshot2 is not present set parent ID to
    SPDK_BLOBID_INVALID and backing bs_dev to zeroes_dev
10. Sync MD on Clone1
11. Sync MD on Snapshot1
12. Restore MD flags for Clone1 and Snapshot1
13. Unfreeze I/O on Clone1
14. Close Clone1 blob
15. Remove Snapshot1

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I800724b981af894e01e1912d0077c5b34a2ae634
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/445576
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-18 13:19:32 +00:00
James Bergsten
8785d5052d nvme: spdk_nvme_ctrlr_alloc_io_qpair extensions
Adds fields to structure spdk_nvme_io_qpair_opts.

These fields allow specifying the locations of memory buffers used
for the submission and/or completion queues.

By default, vaddr is set to NULL meaning SPDK will allocate the memory to be used.

If vaddr is NULL then paddr must be set to 0.

If vaddr is non-NULL, and paddr is zero, SPDK derives the physical
address for the NVMe device, in this case the memory must be registered.

If a paddr value is non-zero, SPDK uses the vaddr and paddr as passed.

SPDK assumes that the memory passed is both virtually and physically
contiguous.

If these fields are used, SPDK will NOT impose any restriction
on the number of elements in the queues.

The buffer sizes are in number of bytes, and are used to confirm
that the buffers are large enough to contain the appropriate queue.

These fields are only used by PCIe attached NVMe devices.  They
are presently ignored for other transports.

Signed-off-by: James Bergsten <jamesx.bergsten@intel.com>
Change-Id: Ibfab3939eefe48109335f43a1167082dd4865e7c
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454074
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-18 12:19:41 +00:00
Evgeniy Kochetov
9e3d841d3e nvmf: Fix connect command SQ size validation for IO queues
SQSIZE parameter validation in Connect command was broken because QID
field in qpair was used before intialization.

Signed-off-by: Evgeniy Kochetov <evgeniik@mellanox.com>
Change-Id: I8a0b359937d661df3b9888e6084e7d0b4a9056ea
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455667
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-06-18 11:39:29 +00:00
Shuhei Matsumoto
94f67dd5ae dif: Change data_len of spdk_dif_set_md_interleave_iovs to be remaining length
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>
2019-06-18 04:25:33 +00:00
Shuhei Matsumoto
df2164f6f4 dif: Merge single and multiple iovec cases of spdk_dif_generate_stream
As same as spdk_dif_set_md_interleave_iovs, no noticeable performance
difference was observed even if dif_generate_stream and
dif_generate_stream_split are merged into the latter.

spdk_dif_generate_stream will be updated in subsequent patches anyway.
Hence merge them into dif_generate_stream_split.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I77b588527bc7533dc38a36e450972758ce57d6bb
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457760
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: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-18 04:25:33 +00:00
Shuhei Matsumoto
759a700f2a dif: Merge single and multiple iovecs cases of spdk_dif_set_md_interleave_iovs
Even if the code for single iovec case is removed, no performance
difference was observed when inserting/striping DIF for iSCSI target.

And the subsequent patches will add more complex operation and hence
simplifying the code before them will be valuable.

So this patch merges dif_set_md_interleave_iovs and
dif_set_md_interleave_iovs_split into the latter.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I784b9e04f0983ed91c7aa66bbc7ceaed4406e3ac
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457758
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: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-18 04:25:33 +00:00
paul luse
11bbb26e4f lib/reduce: use helper function to get correct length of logical map
When setting the offset into pmem for the chunk mamps, the wrong
value was used for the length of the logical map resulting in
map corruption after extended fio run.

Fixes issue #813

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Icb51cf8f38a04f05f69595ebd510ced7f1b608f3
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457818
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-06-18 04:06:41 +00:00
paul luse
d571336b4b lib/reduce: add debug helper function
Prints key info about a volume and its PMEM. As the metadata is
mapped, there's no real reason to dump all this to a file, it
can be accessed via gdb using the addresses printed out.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I2c7b8c32b6142ba0fded623a660b4d7d0c5b19bc
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458117
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-06-18 04:06:41 +00:00
paul luse
46523f33e0 log: passing user-defined log
Change-Id: I993e15a6e75029b0717960d5da31325e7f3522c1
Signed-off-by: zkhatami88 <z.khatami88@gmail.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456407
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-18 03:56:50 +00:00
Wojciech Malikowski
5089a9c5f9 lib/vhost: Fix unaligned pointer value error
Reported by clang:

rte_vhost_compat.c:114:36: error: taking address
of packed member 'payload' of class or structure
'vhost_user_msg' may result in an unaligned
pointer value.

To fix it, just remove the extra unaligned pointer
and inline all its accesses.

Change-Id: I7e4ab536b87ab02a4ea12c55d55a6e495c3091ca
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457559
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-06-17 07:18:48 +00:00
GangCao
f874737792 iscsi: set the rsph with correct error information
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>
2019-06-17 04:56:31 +00:00
Ziye Yang
ba3adc4367 iscsi: return the correct error code in spdk_iscsi_read_pdu
We shoud not always return SPDK_ISCSI_CONNECTION_FATAL
in spdk_iscsi_read_pdu function.

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

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

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I4c40fcb27052b55cb92e06273701a881def18e12
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457078
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-13 06:04:31 +00:00
Shuhei Matsumoto
c758dc088a nvmf: Reject bdev with separate metadata to attach to subsystem
NVMe bdev module support separate metadata now but NVMf subsystem
cannot process bdev with separate metadata yet.

Hence reject any bdev with separate metadata to be attached
explicitly by this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I793c6c5f61deb766d7bf427ff67ccc57a48974cf
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457167
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>
2019-06-13 00:48:11 +00:00
Changpeng Liu
a47e7de332 bdev: rename _spdk_bdev_io_split to spdk_bdev_io_split
_spdk_bdev_io_split() will be used to requests that have IO buffers.

Change-Id: I5ba0b83e47b84066e6c5032de2e02404155896d3
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457549
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-06-13 00:44:34 +00:00
Darek Stojaczyk
1a8ee925b0 rte_vhost: fix compilation against dpdk master
struct ether_addr was renamed to struct rte_ether_addr
in latest DPDK master, but our internal fork of rte_vhost
still used the old name, which can be now a non-defined type.

Together with the struct, the RTE_ETHER_ADDR_LEN define
was renamed as well, so we'll now check if it's defined and
we'll manually define struct ether_addr to keep the old
rte_vhost working.

Change-Id: I78b8104ed3bfe03397881a94f0f8bee14f9efae8
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457609
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>
2019-06-12 05:29:02 +00:00
Changpeng Liu
3ec061800f nvmf: add a persist through power loss configuration file when constructing NS
For reservation feature in NVMoF, we can't support the persist through
power loss feature, now we will add the configuration file parameter
with Namespace, after users set the configuration file parameter with
one NS, then the PTPL feature can be enabled.

Change-Id: Id72699093f7e68318b9529f7bacc5c9804f7f86b
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455905
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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-06-12 00:30:03 +00:00
Shuhei Matsumoto
37bdd0e87f scsi: Add data offset to DIF context separately from start block address
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>
2019-06-11 18:53:58 +00:00
Shuhei Matsumoto
73204fe2e5 dif: Add data offset to DIF context separately from start block address
Data offset are intended to correspond to DATAO in NVMe/TCP and
Buffer Offset in iSCSI.

Previously for iSCSI, buffer offset had been merged to start block
address, but passing buffer offset separately from start block address
clarifies the logic more.

On the other hand, for NVMe/TCP, passing DATAO separately from start
block address will be critically important because DATAO will bave any
alignment and will be necessary to use for not only reference tag
but also guard computation.

This patch adds data_offset to struct spdk_dif_ctx and adds it to the
parameters of spdk_dif_ctx_init(). ref_tag_offset is also added to struct
spdk_dif_ctx and it is computed by dividing data_offset by data_block_size
and is used to compute reference tag.

The next patch will use this change when getting DIF context in SCSI.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Id0e12ca9b1dc75d0589787520feb0c2ee0f844a5
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457540
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>
2019-06-11 18:53:58 +00:00
paul luse
12f7aeb4ce lib/reduce: avoid extra operation in write path
Change-Id: I92355d3deb25f818e6d4c7a72d2f4fd45e6879ac
Signed-off-by: paul luse <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457523
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-11 18:13:10 +00:00
Richael Zhuang
6708b70938 lib/ftl: fix the unclear PAGE_SIZE
In lib/ftl PAGE_SIZE is used in many places. But I think there's no relation with
the host memory PAGE_SIZE.
In most changes, PAGE_SIZE is replaced by FTL_BLOCK_SIZE for ftl block size.
In ftl/ftl-anm.c, PAGE_SIZE is replaced by 4096 for alignment.

Change-Id: I72e7c65c83b9fe1a4e50944dc5d90b9459b4e593
Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455347
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-11 18:12:27 +00:00
Alexey Marchuk
53777de855 rdma: Unset IBV_SEND_SIGNALED flag for RDMA_WRITE operations
Unsetting this flag will decrease the number of WRs retrieved during CQ polling and will decrease
the oeverall processing time. Since RDMA_WRITE operations are always paired with RDMA_SEND (response),
it is possible to track the number of outstanding WRs relying on the completed response WR.
Completed WRs of type RDMA_WR_TYPE_DATA are now always RDMA_READ operations.

The patch shows %2 better peformance for read operations on x86 machine. The performance was measured using perf with the following parameters:
-q 16 -o 4096 -w read -t 300 -c 2
with nvme null device, each measurement was done 4 times

avg IOPS (with patch): 865861.71
avg IOPS (master): 847958.77

avg latency (with patch): 18.46 [us]
avg latency (master): 18.85 [us]

Change-Id: Ifd3329fbd0e45dd5f27213b36b9444308660fc8b
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Evgenii Kochetov <evgeniik@mellanox.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456469
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-11 18:07:28 +00:00
Changpeng Liu
14f6d724ac scsi: add additional check for initiator port
Vhost-scsi target will not set task's initiator port parameter,
so reservation commands sent from Guest will cause segment fault.

Change-Id: Ifc175effded5371eca08d5bfe7e4aa977dd4b1c6
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457550
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>
2019-06-11 18:05:55 +00:00
Mateusz Kozlowski
8cdb3d330e bdev/ftl: Add driver specific data to get_bdevs rpc
Added basic configuration details (transport type and address,
parallel units, cache info) as well as most important OCSSD geometry
data to get_bdevs driver_specific section.

Signed-off-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Change-Id: I00c50706bd9203bcef1701be1b7d87e93c10e57f
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456790
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-11 06:25:36 +00:00
Wojciech Malikowski
675c4aa743 lib/ftl: Read partially lba map during relocation
Read requested range of lba map during relocation
instead whole lba map.

To read partial lba map range single move now has
three states: read, read_lba_map and write.

Free queue and write queue were merged to a single
move queue.

Change-Id: I86839f2286d42d4debf87cea40091370e5283b15
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454747
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-11 06:21:46 +00:00
Wojciech Malikowski
a1f1581968 lib/ftl: Remove FTL_IO_KEEP_ALIVE flag from ftl_io_flags
FTL_IO_KEEP_ALIVE flag is deprecated.

Change-Id: Id074f45a3e9ecb6d05c6a88a834476e2c19288a3
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454326
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-06-11 06:21:46 +00:00
Wojciech Malikowski
4769f058e0 lib/ftl: Stop using ftl_io for internal relocation logic
Added ftl_reloc_move structure to internally track
relocation requests. This patch remove unnecessary
dependency between relocation module and ftl_io.

Change-Id: I9dd1bca6039b7c8961cb22a9f85ea1c5737a0a6f
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454006
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-11 06:21:46 +00:00
Wojciech Malikowski
d23cc88d73 lib/ftl: Track cached lba map segments
Keep track of read lba map segments to avoid
unnecessary traffic in case ANM events.

Lba map is divided on 4KB segments which can
store 512 lba entries.

In case multipe read request on same segment
keep pending request list and process it in
read_lba_map() completion callback.

Change-Id: I2661bdb716ab7c975140e0b37aebcb17aa23901d
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453371
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-06-11 06:21:46 +00:00
Wojciech Malikowski
ef084d199e lib/vmd: Hooking devices behind VMD endpoint to PCI subsystem
Create PCI hook for each detected PCI device
behind VMD endpoint.

Change-Id: I0bec674b859b02e5338eb407dc6c5f83cf1e8978
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Signed-off-by: Orden Smith <orden.e.smith@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456632
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-11 04:35:31 +00:00
Wojciech Malikowski
4a3d5418c5 lib/vmd: Replace spdk_vmd_probe(bdf) with spdk_vmd_init()
spdk_vmd_init() will attach all VMD devices that were
unbinded from system. There is not need to specify VMD
bdf in VMD public interface since it can be controlled
by setup.sh script.

Change-Id: Ifc45c32dc7e11b59429a41ddfdd596db30e27731
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456631
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-06-11 04:35:31 +00:00
JinYu
8fc9ac7b0e nvmf: complete all I/Os before changing sgroup to PAUSED
For the nvme device, I/Os are completed asynchronously. So we
need to check the outstanding I/Os before putting IO channel
when we hot remove the device. We should be sure that all the
I/Os have been completed when we change the sgroup->state to
PAUSED, so that we can update the subsystem.

Fix #615 #755

Change-Id: I0f727a7bd0734fa9be1193e1f574892ab3e68b55
Signed-off-by: JinYu <jin.yu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452038
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-06-11 01:51:56 +00:00
Darek Stojaczyk
4fcec18d38 vhost: don't interrupt uninitialized virtqueues
rte_vhost_vring_call() from upstream DPDK can read some
unitialized memory and crash if it's called on invalid
queue ids. The implementation in our internal rte_vhost
fork ends up wiritng to a random descriptor number, which
doesn't cause any crashes but is a bug nevertheless.

To fix it, just check if the queue is initialized before
interrupting it during the session start. It's not a hot
I/O path and there's no performance impact.

Change-Id: I830c1be98ef00d4ece9a6bd88cf79b9dfe29d2a9
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457247
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-11 01:14:45 +00:00
Chunyang Hui
dd26583316 Opal: Add opal_create_key function
Change-Id: Id1705636e25fe3ad90ff60a57aca7b1e4c2ef687
Signed-off-by: Chunyang Hui <chunyang.hui@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453972
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>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2019-06-11 01:12:24 +00:00
Chunyang Hui
9f988238fc Opal: Refactor and clean functions
Delete opal_next, introduce opal_add_tokens.
Delete spdk_opal_cmd, seperate cmds to new APIs.

Change-Id: Ide56817eec7fde7b110818966ebf10e65a952fc9
Signed-off-by: Chunyang Hui <chunyang.hui@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454433
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-06-11 01:12:24 +00:00
yidong0635
4913ed4dc5 bdev: add uring in bdev Makefile
We had "./configure --with-uring" , but actually, it wasn't compiled.
we need add uring to Makefile that code will add this.
then we can continue to verify this module.

Change-Id: I8b98825f6795eb9f9e7b4947d1c7c3a44a6f0f64
Signed-off-by: yidong0635 <dongx.yi@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457081
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>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-06-11 00:26:48 +00:00
Shuhei Matsumoto
3cfb1fe8dd iscsi: Schedule the connection only after completing login processing
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>
2019-06-10 09:43:09 +00:00
wanghonghui
77509767c0 bdev/uring: adjust to the latest io_uring API
Upstream liburing rename the io_uring_get_completion to
io_uring_peek_ceq

Signed-off-by: Honghui Wang <wanghonghui@ucloud.cn>
Change-Id: I8f207b7b1255b44304f4eca4101b939847767179
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456959
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-07 18:43:07 +00:00
Changpeng Liu
a8c32ed5fe blob: return error for write_zeroes and unmap requests
Actually write/writev/write_zeroes/unmap are never be called, and we add
the error code here to keep it same style with snapshot bs_bdev.

Change-Id: I32ad051c1902bd7080b894e36f7c89f1c8d27434
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456924
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: Ben Walker <benjamin.walker@intel.com>
2019-06-07 18:37:53 +00:00
Mateusz Kozlowski
42fe2e9b24 lib/ftl: Add config to construct_ftl rpc for dirty shutdown restore
Gives the ability to change behavior of restore after dirty shutdown
without recompiling ftl library. User can define if partial recovery
or error should be returned after such a scenario.

Signed-off-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Change-Id: I6dda40df7b92d6a377957e4a70a3eab91a6ac4a9
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456185
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>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2019-06-07 18:26:57 +00:00
Mateusz Kozlowski
a9ce7b8551 lib/ftl: Add ability to ignore endmeta errors on restore
If a band wasn't closed during shutdown (ie. after dirty shutdown),
the start md contains valid data, however end md does not (or it may
not be written at all).
The config gives the user the ability to specify if encountering
this case should result in an error, or if ftl should pad the band
with data and recover from closed bands only.

Signed-off-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Change-Id: If02f7ca8bc90bb61698fb710fee2274af6af01e4
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455513
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-07 18:26:57 +00:00
Mateusz Kozlowski
9939830608 lib/ftl: Add padding when open band is found on restore
If an open band is found during recovery (after dirty shutdown)
ftl will attempt to pad it, instead of returning a recovery error.
Any previously written data on that band is lost, as the line is
treated as being in free state after the pad.

Signed-off-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Change-Id: Ie48fa9fa37a3853f41921b9417c69301cf47e673
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455512
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-06-07 18:26:57 +00:00
Mateusz Kozlowski
4214803c16 lib/ftl: Add public get chunk info admin command
The patch also changes, so the command calculates the needed
chunk offset based on PPA, instead of relying on the user to
provide one.

Signed-off-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Change-Id: Ic4eec1b86ded4eb71de860015403294ed0c8c266
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455973
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>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2019-06-07 18:26:57 +00:00
Mateusz Kozlowski
baa06190d8 lib/ftl: Add direct wptr and IO
Direct wptr allows for writing to band with externally
provided PPA, rather than one assigned by the wptr. This
can be useful when padding open bands during recovery or
bdev creation, as ftl can find partially written end meta
with no way to close the band with valid data, that would
conform to an already written CRC value.

This does mean that I/O sender is responsible for calculating
and obeying per-chunk write pointer arithmetics.

Signed-off-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Change-Id: Ifcbc4e8ffb69c829469a571bed8e27b148d7a651
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455511
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-07 18:26:57 +00:00
Mateusz Kozlowski
e49ae312b1 lib/ftl: Add ftl_io argument to internal I/O callbacks
Almost all I/O callbacks in ftl utilize data in ftl_io, which is
initialized as callback argument in ftl_io_init_internal. This patch
changes the behavior to always returning the ftl_io struct in addition
to an extra opaque buffer.

Signed-off-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Change-Id: I611ab1b33575f599798a2bb65c231a724c852c7f
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455831
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-07 18:26:57 +00:00
Vitaliy Mysak
7b7590f838 ocf: Improve handling of partial IOs
Improve handling of partial IOs for case when iovcnt == 1.
This case is pretty frqeuent because all data allocated by OCF
  have iovcnt == 1 (see ctx->data->alloc() or vbdev_ocf_ctx_data_alloc())

Change-Id: I8d38ca9e9d2bd3e6ce298bf788ce6ed782b56594
Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456202
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-06-07 18:18:42 +00:00
Vitaliy Mysak
2bfa860dfe ocf: fix offset check
This patch fixes submission of partial IOs in bottom adapter

Existing check (if offset > 0) was not sufficient to detect partial IOs
  because there could be an IO with offset = 0 but length < total size of iovs.
This patch changes the check, but also free operation on completion
  because now the old free does not cover all situations when we allocate iovs.

`Partial IOs` are the IOs handled by bottom adapter
  which specify only part of the internal iovs vector.
So their length is less that the length of internal iovs vector.
They exist because sometimes parts of single IO from top adapter
  need to be sent to different locations.
Also, in general, IOs initiated by OCF (such as cleaner IOs) are represented
  as single big iov that is submitted by parts in form of 'Partial IOs'.

Change-Id: I8ae47659fb34904c593a696d74d683a418ac9962
Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455821
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-06-07 18:18:42 +00:00
Vitaliy Mysak
9686948334 ocf: implement metadata probe
Implement metadata probe functionality to load cache state
  from disk.
During metadata probe, we inspect UUIDs of core devices
  and create vbdev configurations based on them.
  Then, to start vbdev, we use load path (loadq = true).

After this change persistent metadata is officially supported,
  we can save and restore cache state from persistant storage.

WriteBack mode is now safe to use in respect to unexpected shutdowns,
  because all information about dirty data is also restored during cache load.

Change-Id: I6cf86aabd68177b88638a68ea6a5b78a1068a4d0
Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455417
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-07 18:18:42 +00:00
Vitaliy Mysak
5983f92cfc ocf: Update ocf submodule to version OCF v19.3.2
This patch updates submodule and appropriate functions.
Cleaner poller is now registered only when needed.

Change-Id: Ic4ca7ce6f77b71ac12c19462f62ae7cd96c59006
Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455408
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>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2019-06-07 18:18:42 +00:00
Shuhei Matsumoto
3894a7bc68 dif: Rename parameters of dif_generate_stream to match related APIs
using data_offset and data_len is consistent with related APIs,
and is done in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ic9d216e25880f7b5ab33b764f45d332c090fa88c
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456291
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-06-07 05:11:00 +00:00
Shuhei Matsumoto
6d156d5b7d iscsi: Dump PDU contents to know what PDU was sent in illegal state
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>
2019-06-07 05:11:00 +00:00
Changpeng Liu
cf680fe47e vhost_blk: set the maximum supported data segment based on bdev
AIO backend requires aligned data buffers, and the maximum
IOVs supported in bdev module is defined to 32, there are
cases for Windows Guest which will send data segments more
than 32, SPDK can't process such cases, so here we can set
the 'seg_max' parameter based on bdev module capability.
Also set the maximum segment size for those requests.

Fix issue #625.

Change-Id: I0ff61e55872af17115c0b6b28425e70cb8769790
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452378
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-06-07 05:05:22 +00:00
Changpeng Liu
69db40f677 bdev/raid: add additional NULL check for data iovec
iSCSI application may set the data iovec to NULL for READ requests.

Change-Id: Ic6b73f62f75dc2d927c18219fa1c2cb242f0528e
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457079
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-07 05:05:22 +00:00
Wojciech Malikowski
95ace66f8d lib/ftl: Remove ftl_md struct from band
Keep lba map related fields in separate struct directly
in the band. Cleanup interfaces depended on ftl_md.

Lba map structure will be extended in next commit.

Change-Id: I1cfc2f2ff0c0e90bb63f39808780845673002e70
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453370
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-07 04:39:14 +00:00
Konrad Sztyber
d87493378d env: added spdk_mempool_obj_iter
As the name suggests, this function iterates through all elements of the
mempool invoking a callback function on each one. It's particularly
useful when deinitializing mempool that requires freeing resources tied
to each element (e.g. allocated through spdk_mempool_create_ctor).

Change-Id: I3da1fee527a36bf99f0b0e2dd3d6f9297422ff25
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455971
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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-06-07 04:39:14 +00:00
Konrad Sztyber
819545ae7e lib/ftl: split IOs based on the number of iovecs
Split the IO in case io->iov_cnt exceeds the FTL_IO_MAX_IOVEC. It allows
the user to pass any number of iovecs. Each IO request is now split if
necessary and submitted via ftl_io_call_foreach_child submitting each
child individually. Any resubmissions need to be handled on a child
level, as parent request doesn't track its children submission status.

Change-Id: If54249d54225b34191216a366c227f79215abc90
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455527
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-06-06 18:07:41 +00:00
Konrad Sztyber
8f9aed50c2 lib/ftl: added ftl_io_call_foreach_child
As the name suggests, the function calls a function passed as the
argument for all children IOs.

Change-Id: Idd7b6013e68fdd188db6e682bb9ba9ec2e6f52f1
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455526
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-06-06 18:07:41 +00:00
Wojciech Malikowski
2646670781 lib/ftl: Added assert checks to ftl_band_set_state()
Change-Id: I142ea5be2e5d03b29dc17896fe590a1af798b11f
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451873
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2019-06-06 11:54:24 +00:00
Wojciech Malikowski
fcd2364c6a lib/ftl: Metadata read/write interfaces refactor
Extended ftl_band_read_lba_map() interface to provide
range of lba map to read.

Added ftl_xfer_offset_from_ppa() function for
calculating offset of read portion of lba map
based on ppa address from IO. This offset is
used for coping read lba map portion  to internal
ftl buffer.

Change-Id: I1c72a18c79eda8c33cd0b20ea36a5d9521a09d06
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449435
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-06 07:26:35 +00:00
Shuhei Matsumoto
2761079168 iscsi: Remove SPDK_SUCCESS and use 0 instead
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>
2019-06-06 02:08:15 +00:00
Shuhei Matsumoto
872d8d8ea7 iscsi: correct data digest computation for extended LBA payload
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>
2019-06-06 02:08:15 +00:00
Shuhei Matsumoto
a7d832f28c iscsi: Correct iovec increment when data digest is enabled
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>
2019-06-06 02:08:15 +00:00
Shuhei Matsumoto
4fa7987047 dif: Compute CRC-32C for extended LBA payload
Data digest computation should take extended LBA payload but
could not do yet.

This patch adds an new API spdk_dif_update_crc32c() to compute
CRC-32C value for extended LBA payload.

In the next patch, spdk_dif_update_crc32c will be used in iSCSI
target first.

Change-Id: I327f384bb7dfd8b68279b0acec0ee78a40264a26
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456171
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>
2019-06-06 02:08:15 +00:00
Shuhei Matsumoto
85e6f154b8 iscsi: Get DIF context once when allocating data buffer
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>
2019-06-06 02:08:15 +00:00
Shuhei Matsumoto
1204ff34e0 iscsi: Update _pdu only when completing read in spdk_iscsi_read_pdu
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>
2019-06-06 02:08:15 +00:00
GangCao
2882b9895a iscsi: return the proper error to append the connection
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>
2019-06-06 01:44:33 +00:00
GangCao
9aed5fa5b6 iscsi: update the version error message
Change-Id: I3a2488cdd81812f1fce136b97e49eee18b49fbc1
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456915
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>
2019-06-06 00:59:57 +00:00
Ziye Yang
679257db88 nvme/tcp: Properly deal with supporting single r2t
According to the TP 8000 spec in Page 26:
Maximum Number of Outstanding R2T (MAXR2T): Specifies the maximum
number of outstanding R2T PDUs for a command at any point in time
on the connection.

This patch makes the current host driver implementation support one r2t.
We cleanup the code to do the right advertising to the target in the
icreq and avoid attempts to deal with multiple rt2s.

Reported-by: Or Gerlitz <ogerlitz@mellanox.com>

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: If06ad2e8bde31c2fd7e1c3739f651fb64040e3a9
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455750
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: Or Gerlitz <gerlitz.or@gmail.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-06-06 00:58:58 +00:00
paul luse
83afe68690 dpdk: build and link QAT for both crypto and compression
In prep for full QAT compression support later in this patch
series. dpdkbuild/Makefile slightly refactored for readability,
x86 crypto check removed as it pre-dated checks we now have in
configure.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Iaaaf51b9eb5e18840f47d2d4f431c5a6e8c420ee
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456408
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-06-05 19:07:32 +00:00
Li Feng
02363ccb3b lib/iscsi: fix iscsi connection schedule
If the qualified core wasn't found, then we should compare
spdk_env_get_core_count() with i, instead of lcore.

Signed-off-by: Li Feng <fengli@smartx.com>
Change-Id: Ie92f56712b7f0e51636008fe12fff5584b6be8ab
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456415
Reviewed-by: wuzhouhui <wuzhouhui14@mails.ucas.ac.cn>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-05 17:39:12 +00:00
GangCao
3a0886c408 iscsi: correct the error detail
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>
2019-06-05 16:48:48 +00:00
paul luse
d5d7c57043 bvdev/compress: move comp transform structs to static globals
Code cleanup.

Change-Id: I9f96a889ed39afbd14a42b50e2537b1c4844f514
Signed-off-by: paul luse <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456517
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>
2019-06-05 16:48:36 +00:00
paul luse
5ef2b14e3c bdev/compress: rename function to avoid collision with bdev layer
Makes debug easier...

Change-Id: I3b975e0a494c3920387b2d1921ebf8089b935bf5
Signed-off-by: paul luse <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456512
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-06-05 16:48:36 +00:00
Ziye Yang
0bb626672b nvmf/tcp: Support single r2t usage
According to the TP 8000 spec in Page 26:
Maximum Number of Outstanding R2T (MAXR2T): Specifies the maximum
number of outstanding R2T PDUs for a command at any point in time
on the connection.

Note that by the spec, the target may only support single r2t
(which is the minimum possible), it doesn't have to use multiple r2ts
even if the initiator supports that. So remove the maxr2t and
pending_r2t variable in the tcp qpair structure.

In the original design, we think that maxr2t is the maximal active
r2t numbers for each connection. So if the initiator sends out maxr2t=16,
it means that all the commands of a qpair can use such number of R2T pdus.
So we need to wait for the available R2Ts for the request when the maxr2t
reaches the maximal value. But it is the wrong understanding of the spec.

In fact, each command has its own number of maximal r2t numbers, then we
do not need to use the wait method for R2T method anymore. So we remove
the state TCP_REQUEST_STATE_DATA_PENDING_FOR_R2T. Futhermore, we adjust
the related SPDK_TPOINT_ID definition.

In current patch, the target will support one active R2T for each
write NVMe command. Thus, we remove the function spdk_nvmf_tcp_handle_queued_r2t_req.

Reported-by: Or Gerlitz <ogerlitz@mellanox.com>

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I7547b8facbc39139b4584637ccc51ba8b33ca285
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455763
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Or Gerlitz <gerlitz.or@gmail.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-05 16:46:55 +00:00
Ziye Yang
fe2dddbbbc nvme/tcp: Correct nvme_tcp_qpair_disconnect behavior
The current nvme_tcp_qpair_disconnect behaviour
is not exactly correct, we do not re-initialize
the state of some data structures of the tqpair.
And this caused the coredump.

Purpose: Fixes #808.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I4d2cad8fc0712dbebfc2f3e52373cbe3b9908bf7
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456755
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-06-05 16:13:55 +00:00
Wojciech Malikowski
f97809e3cb lib/vmd: Moved MAX_VMD_TARGET definition to public header
MAX_VMD_TARGET defines size of array that need to be passed
to spdk_vmd_pci_device_list()

Change-Id: Ib2a33fe50072036e6a8f1709ac4e3ee82c1bb3f1
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456480
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-05 15:19:51 +00:00
Wojciech Malikowski
d3a0531bc1 lib/vmd: Removed typedefs from structures definitions
Removed typedefs and unused structures.

Change-Id: I711094097520333cbeda2f26a1a7d403750070b1
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456479
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-06-05 15:19:51 +00:00
Wojciech Malikowski
f7e68be171 lib/ftl: Minor cleanup in error path from nvme layer
Change-Id: If64d721fac28683b9b385238ae1c63aad77c0914
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451869
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-05 06:50:03 +00:00
Nikos Dragazis
c8202a4d79 vhost: fix vhost memory registration in case of vvu transport
The memory API has been refactored. It is not possible anymore to
register a memory region more than once. This has been introduced in
this patch: https://review.gerrithub.io/426085

In case of vhost with vvu transport, it often happens that two
consequtive vhost memory regions are mapped to virtual addresses that
lie within the same 2MB address range. This means that the vhost memory
regions may not be 2MB-aligned in the process virtual address space. As
a result, the `FLOOR_2MB()` of those addresses gives the same address.
Thus, we end up trying to register the same 2MB memory range twice.

This issue does not appear in case of AF_UNIX transport. Vhost memory
regions in case of AF_UNIX transport are hugepage backed. Therefore, the
mmapped virtual addresses of those memory regions are always
2MB-aligned. On the contrary, in case of vvu transport, the vhost memory
regions are segments of the PCI memory address space of the
virtio-vhost-user PCI device. This MMIO space is mapped in its entirety
by the DPDK vfio interface along with the other PCI BARs.  Ultimately,
the vhost memory regions correspond to offsets in this mmapped PCI
memory region and thus there is no warranty that the mmapped virtual
addresses are 2MB-aligned.

This issue is fixed by skipping the already-registered 2MB memory
regions.

Change-Id: I62c9c257e6f172c894cd3454d2cbeee1986e6189
Signed-off-by: Nikos Dragazis <ndragazis@arrikto.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/441057
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-05 06:43:01 +00:00
Wojciech Malikowski
122a64a359 lib/vmd: Removed SUPPORT_ALL_SSDS define
SUPPORT_ALL_SSDS define is not needed.

Change-Id: I9f81dfa0da10c4c83bbc6e051cd83ac6318651b3
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456478
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>
2019-06-05 05:33:35 +00:00
Wojciech Malikowski
2f4e74fe95 lib/vmd: Remove not needed NULL ptr checks
Some existing NULL ptr checks was never hit so
there should be removed.

Change-Id: I80f4e1f063564f2a6915d0a1c548bcf22c4b3075
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456477
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>
2019-06-05 05:33:35 +00:00
Wojciech Malikowski
4d117a8e9a lib/vmd: Replace printf() usages with SPDK_*_LOG
Removed all printf() usages and replaced it with
SPDK log macros.

Change-Id: Ibe536a9bb696ebf3ad7dd1f402b050eca0dfd375
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456476
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-05 05:33:35 +00:00
Wojciech Malikowski
7a9ef7d2f6 lib/vmd: Fixed scan-build issue in vmd_pcibus_remove_device()
Added assertion checking if next element on list
is valid.

Change-Id: I9f4d969dc84e5fbee9d72d764f57fbd9480ab197
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456774
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-05 05:33:35 +00:00
Shuhei Matsumoto
57fe0394a3 iscsi: Use 0 instead of SPDK_SUCCESS in spdk_iscsi_read_pdu to match caller
spdk_iscsi_read_pdu has been used only in a place,
iscsi_conn_handle_incoming_pdus. iscsi_conn_handle_incoming_pdus
classifies return code of spdk_iscsi_read_pdu to
SPDK_ISCSI_CONNECTION_FATAL, 0, or 1.

Using 0 instead of SPDK_SUCCESS in spdk_iscsi_read_pdu matches
iscsi_conn_handle_incoming_pdus and is done in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I231c2e70a094c26af2c8eb60d77b92d880674901
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456770
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: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-05 05:31:22 +00:00
Shuhei Matsumoto
0f5314eb05 iscsi: Consolidate error paths in spdk_iscsi_read_pdu
spdk_iscsi_read_pdu() returns three return values,
SPDK_ISCSI_CONNECTION_FATAL, 0, or 1.

Consolidating error paths clarifies the logic.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I66a734f37bfd3bbd0ae0974813086b24cb3cd432
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456769
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: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-05 05:31:22 +00:00
Shuhei Matsumoto
1554a344c9 env: Add free_space parameter to spdk_ring_enqueue
DPDK rte_ring_enqueue_bulk() has free_space parameter to return
the amount of space in the ring after enqueue operation has finished.
This parameter can be used to wait when the ring is almost full and
wake up when there is enough space available in the ring.

Hence we add free_space to spdk_ring_enqueue() and spdk_ring_enqueue()
passes it to rte_ring_enqueue_bulk() simply.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I9b9d6a5a097cf6dc4b97dfda7442f2c4b0aed4d3
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456734
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-05 05:23:58 +00:00
Ziye Yang
31607f3f9e nvme/tcp: fix the user iov length caculation in nvme_tcp_build_sgl_request
The length should be no larger than the remaining_size.
For example, The remaining_size(firstly, assigned by payload_size) is 128KB,
and user's sgl length is 1MB. Since we already split the I/O, so we should
not use the original length(1MB), but use the remaining_size.

Fix issue reported by: https://github.com/spdk/spdk/issues/808

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I0a7d0f2282c8ad0e253d8de7091b6c5b87018e9a
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456760
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>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-06-05 01:46:52 +00:00
Ziye Yang
5391b29c79 nvme/tcp: Fix the issue of handling send pdu failure
Previously, if the return value of nvme_tcp_qpair_process_send_queue
is not zero, we directly return but not continue receiving the pdu.
But this is wrong, we should only handle the case when the
return value is negative.

Reported-by: Or Gerlitz <ogerlitz@mellanox.com>

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I83453733f5a3e3350a0461b4cb0bc409fde32fea
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455899
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>
2019-06-05 01:44:49 +00:00
Seth Howell
d7ead05419 lib/ftl: fix NPA in ftl_band_reloc_free
Stumbled on this one trying to fix new scan-build errors for clang 8 on
fedora 30. scan-build fails because there are paths where this can
result in a null pointer access.

Change-Id: I408376e7eab79ab6d99c35cc662f5737e3518e71
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456671
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-06-05 00:07:18 +00:00
GangCao
9a73633190 iscsi: add a cleanup utility function
Added a utility function for the cleanup related operations.

Change-Id: I4e49dd9c2da899a5bda289bc36778b636af9c5df
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456599
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-06-04 23:51:15 +00:00
Tomasz Zawadzki
e5b7f59d9c bdev: directly use spdk_bdev_io_get_io_channel() where needed
The function spdk_bdev_io_get_io_channel() was added,
but remained unused. Couple places done the exact same thing,
so now they just use it directly.

Change-Id: Ifa332ce3a489256ccf2f5d0dd9c74a3215c544ce
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456435
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-06-04 00:08:53 +00:00
Tomasz Zawadzki
6b395277b2 bdev: directly use spdk_bdev_io_get_thread() where needed
The function spdk_bdev_io_get_thread() was added,
but remained unused. Couple places done the exact same thing,
so now they just use it directly.

Change-Id: Ia25abf57eb88c8df47c83e4edd761a9e02cc1618
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456436
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-06-04 00:08:05 +00:00
Konrad Sztyber
c92720211d lib/ftl: decreased the size of the metadata buffer
The metadata buffer was allocated in multiples of blocks (as well as
aligned to a block). It's not necessary and is a waste of space.

Change-Id: Icb13c664e82b23ea09bec16fa3c18fa98b722d57
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455922
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-06-04 00:07:02 +00:00
Konrad Sztyber
e1dbe1c84c lib/ftl: fixed metadata pointer arithmetic
The current location of the metadata pointer should be calculated based
on the metadata size, not block size.

Change-Id: I90177557cf4e194cd77adfbfe1c5a6e0e6df7967
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455921
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-06-04 00:07:02 +00:00
Jim Harris
6550abbac1 nvme: prefetch stailq before freeing pcie request
We will need to put the recently completed nvme_request
object on the qpair's STAILQ.  We don't reference any
real data from the nvme_request in the completion path
since we've already stashed the cb_fn and cb_arg in
the nvme_tracker.  But we will need to reference the
STAILQ_ENTRY to put it back in the qpair's STAILQ, so
prefetch that cacheline.

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

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456673
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-06-04 00:01:35 +00:00
Jim Harris
b3d884b700 nvme: assign qpair when req is allocated
There's no need to set this every time we allocate
a request.

While here, fix a typo near where we needed to modify
the unit test to remove the qpair assertion.

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

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456270
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-06-04 00:01:35 +00:00
Changpeng Liu
4f95ec427c scsi: add a helper function to check the LUN holds a reservation or not
Change-Id: I8cf71783ad4af4f7bdef823018f907933b793c9d
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455765
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-06-03 23:59:49 +00:00
Konrad Sztyber
d69fe7b7b9 bdev/nvme: separate metadata buffer support
Handle IOs with metadata being transferred in a separate buffer if the
device underneath supports it.

Change-Id: I38887a24d2aad51f674a840367b5dcdeda2d5a8b
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451467
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-06-03 23:35:42 +00:00
Konrad Sztyber
8ba138e56e bdev/nvme: store bdev/bdev_io in separate variables
Change-Id: I6eb3ae54fc419f65e5bc718cc78150c99fea296b
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454742
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: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-06-03 23:35:42 +00:00
Konrad Sztyber
58663640d2 lib/bdev: separate metadata buffer IO functions
This patch adds *_with_md family of functions allowing for IO with
metadata being transferred in a separate buffer.

Change-Id: I842d5a00a532cf5d0b0f0738535ea46903674140
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451465
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-03 23:35:42 +00:00
Wojciech Malikowski
617a004fb9 lib/vmd: Merge vmd.c and vmd_pci.c into one file
There is no need to keep this functionality in separate
files.

Change-Id: Ie998324cbcfcdc384f912fe36124b082774c0dc8
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456475
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-03 23:34:05 +00:00
Nikos Dragazis
5f4e42b80b vhost: abstract vring call mechanism as it is transport-specific
vring notification mechanism is transport-specific.  At present, vhost
dataplane code in `lib/vhost/vhost.c` triggers guest notifications with
`eventfd_write()` system call. But this is an AF_UNIX specific
notification mechanism. This patch replaces `eventfd_write()` with the
existing generic `rte_vhost_vring_call()` function that is part of
DPDK's librte_vhost public API.

`rte_vhost_vring_call()` takes a vring_idx as an argument to associate
the `struct spdk_vhost_virtqueue` instance with the relevant `struct
vhost_virtqueue` instance. We introduce a new `vring_idx` field in
`struct spdk_vhost_virtqueue` to enable this association. This field is
initialized in `start_device()`. In addition, a stub for
`rte_vhost_vring_call()` is added in the vhost unit test file.

SPDK's internal `rte_vhost` copy will not be updated in order to support
the virtio-vhost-user transport. However, an `rte_vhost_vring_call()`
function is introduced in SPDK's `rte_vhost` in order to have a solid
API. This function is just a wrapper of `eventfd_write()`.

Change-Id: Ic93e25cd3f06e92f04766521bc850f1ee80b8ec8
Signed-off-by: Nikos Dragazis <ndragazis@arrikto.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454373
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-03 20:14:08 +00:00
lorneli
a5dfbc4daf nvme: zero request->submit_tick in allocation
Request may be submitted several times via nvme_qpair_submit_request
function, such as request in queued_req queue being re-submitted.

With enabling timeout feature, nvme_qpair_submit_request compares
request->submit_tick to zero to check if this is the first submission
for this request. If true, record submit_tick for this reuqest.

So request->submit_tick needs to be set zero in allocation.

Change-Id: Ie3f420aa337802c5ad3962c3fdcd680dec1ccdcb
Signed-off-by: lorneli <lorneli@163.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456328
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-06-03 19:15:13 +00:00
Wojciech Malikowski
d6d710212e lib/ftl: Removed not needed assertion from ftl_submit_write()
This assert is not needed anymore.

Change-Id: I7bc85c980c2e120b105b35763b9bea5960564acc
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456590
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-03 10:46:27 +00:00
Konrad Sztyber
1d97387549 lib/ftl: use pre-allocated iov buffer
Keep an array of iovecs tied to each IO. Internal IOs can have
iov_cnt > 1 without having to allocate additional memory. User's iovec
can now be modified too (e.g. when splitting the request).

Change-Id: Iec73c6dad59acdc331a1461fd7feac085138a8de
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455525
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-06-03 04:39:37 +00:00
Konrad Sztyber
feb2c6be42 lib/ftl: keep resubmitted writes on a queue
Replaced single IO pointer with a queue. This allows multiple requests
to be queued when the writes cannot be scheduled.

Change-Id: I0cde50e7378108a6aab4ef6fe601cb854244f5d5
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455524
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-03 04:39:37 +00:00
Konrad Sztyber
8e6a5601e4 lib/ftl: allocate ftl_io inside ftl_io_user_init
On the user IO path, the flow always follows the same procedure:
allocate ftl_io and initialize it using ftl_io_user_init. There's no
point in separating these two actions.

Change-Id: I578347ccc7c85e5945368dd6bf76c58985af3939
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455523
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-06-03 04:39:37 +00:00
Konrad Sztyber
cee780d504 lib/ftl: added device pointer to ftl_io_channel
Change-Id: I3dbbaf11e4b1472983a7c98e9ddde53a0525b4fc
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455522
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
2019-06-03 04:39:37 +00:00