Commit Graph

6891 Commits

Author SHA1 Message Date
Changpeng Liu
72b9af55fa blobfs: make cache_free_buffers() used for file deletion and blobfs unload
When there is no free cache buffers, we need to free some cache buffers
based on very simple algorithm for now, when deleting a file or unload
the blobfs, there must no dirty caches, there is no cache buffers after
calling spdk_tree_free_buffers(), so we will create another cache free
buffers function which only used in file read/write path.

When testing blobfs with db_bench, there maybe multiple threads will
call alloc_cache_memory_buffer() at same time, and spdk_fs_delete_file_async()
maybe called at same time, and it may release file->tree and file structure
without holding g_caches_lock, so here we will change the
alloc_cache_memory_buffer() to hold the g_caches_lock while releasing
the file cache buffers.

Fix issue #1133.

Change-Id: I115ff97113915630f539c3458c57116d9ff16179
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/668
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-02-14 09:37:45 +00:00
Changpeng Liu
2505b93862 blobfs: remove _file_read() function
_file_read() is only be called in spdk_file_read() API, and we only
need to count the children IOs sent to the backend, and skip the IOs
which hit the cache buffer.

Change-Id: I36e4a464e5810beaf30f1b580dc15ea3d3a68582
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/667
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-02-14 09:37:45 +00:00
Changpeng Liu
19d5c3ed8e rocksdb: free existing channel when allocating a new channel
ASAN will report memory leak if we didn't free the old thread context,
it's related with Rocksdb version, I didn't get this issue with Rocksdb
v5.6, but Rocksdb v5.14 and v5.18 will complain the memory leak.

Change-Id: I116cad6c1bc723a60284a5c7cf1e78d10efa9ddd
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/666
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>
2020-02-14 09:37:45 +00:00
Darek Stojaczyk
8e7d6e1b0c app: added --json-ignore-init-errors
If set, SPDK will continue loading the JSON config even if
some commands caused an error. This can be useful when loading
RPC config from spdk_tgt into e.g. bdevperf, which supports
only a subset of RPC commands and would usually fail with
"Method not found" message.

Resolves #840

Change-Id: I070fea862fd99e5882d870e11e6a28dc9d0c8ba6
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/620
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>
2020-02-13 09:53:02 +00:00
Shuhei Matsumoto
abb942bda1 lib/event: Voluntary thread termination by spdk_thread_exit()
In the reactor main loop, _spdk_reactor_run(), check if both
spdk_thread_is_exited() and spdk_thread_is_idle() return true,
and if they are true, then remove it from the queue and call
spdk_thread_destroy() to delete it.

By previous patches, the exited thread does not accept any
new message or poller, all pending messages are processed, and
all unregistering pollers are completed. Hence we only need to
have very simple check in the reactor main loop.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ib678245de98a5c050843e6435026bdcf8b6c75c7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/507
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-02-13 09:51:15 +00:00
Shuhei Matsumoto
e038e096e3 lib/thread: Fail spdk_thread_exit() if thread has active I/O channel
This is a preparation to support voluntary thread termination by
calling spdk_thread_exit().

The comment in the header file has already said that all associated
I/O channels must be released before calling spdk_thread_exit().
This patch actually checks if it is satisfied in spdk_thread_exit().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I56ac50b561c6ca91d3dc2d60c21c8d91d38f081b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/823
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-02-13 09:51:15 +00:00
Shuhei Matsumoto
648d6cd5dd lib/thread: Fail spdk_thread_exit() if thread has any registered poller
This is a preparation to support voluntary thread termination by
calling spdk_thread_exit().

Change spdk_thread_exit() to return -EBUSY if the thread has any
registered poller. We enforce all pollers including paused poller
are unresitered before the thread is marked as exited.

By this change, a bug was found in reactor_perf test tool. Fix it
by adding spdk_poller_unregister() and add the g_ prefix to avoid
future potential errors.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: If7f40357c9a6f4101b3998ea0da3cc46cc435031
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/487
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-02-13 09:51:15 +00:00
Shuhei Matsumoto
70ec72871e lib/thread: Fail spdk_thread_exit() if thread is already exiting
This is a preparation to support voluntary thread termination by
calling spdk_thread_exit().

Change spdk_thread_exit() to return -EINVAL if the thread is already
marked as exited.  This will be helpful to detect wrong call sequence
of voluntary thread termination.

Besides, update reactor shutdown and unit test framework shutdown
to incorporate this change accordingly.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2296c61e273bf4d9580656dcbc2da0e8a8f3bcf7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/671
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-02-13 09:51:15 +00:00
Shuhei Matsumoto
1e98e82051 lib/thread: Stop new poller and reap unregistering poller after thread is marked as exited
This is a preparation to support voluntary thread termination by
calling spdk_thread_exit().

One of the subsequent patches will allow thread to exit only if
all of its pollers are being unregistered.  After the thread is
marked as exited, only unregistering pollers will remain if the
exited thread does not accept registering new poller.

Hence in this patch, we change spdk_poller_register() to fail if the
current thread is marked as exited first.

Then, in subsequent patches, if we remove break from poller
processing in spdk_thread_poll(), poller unregistration of the exited
thread will complete, and we will be able to support voluntary thread
termination easily by checking only the thread is exited and idle.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5b843a07049ef01a5ff402eb521e294182ce2ae2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/822
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-02-13 09:51:15 +00:00
Shuhei Matsumoto
13595495a1 lib/thread: Stop new I/O channel after thread is marked as exited
This is a preparation to support voluntary thread termination by
calling spdk_thread_exit().

By the last patch, the asynchronous release of I/O channel will
complete even after spdk_thread_exit() because pending messages will
be reaped.

Then this patch stops new allocation of I/O channel after
spdk_thread_exit().

Hence we will be able to release all I/O channels for exiting
thread within finite time.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I48a45bcba7c4b2c62d8c9d398ac35a584b533627
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/821
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-02-13 09:51:15 +00:00
Shuhei Matsumoto
d7393e2e4f lib/thread: Stop and reap pending messages after thread is marked as exited
This is a preparation to support voluntary thread termination by
calling spdk_thread_exit().

Previously, the exiting thread had discarded all pending mesasges.

We change this to stop accepting any new message in spdk_thread_send_msg()
and reap pending messages in _spdk_msg_queue_run_batch().

Add unit test case for the new behavior. Adding g_ prefix to global
variables for clarification is done together.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ida78e7bb1b86357602aea6938dd514897b67edd6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/482
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2020-02-13 09:51:15 +00:00
Shuhei Matsumoto
644e6420d1 lib/thread: Add API to check if the thread is marked as exited
Add spdk_thread_is_exited() to check if the thread is marked as
exited.  This API will be used by reactor to destroy the thread
which exited voluntarily.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2086984b7813e8a1f401852fde7ab263bcf8ef60
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/481
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: Aleksey Marchuk <alexeymar@mellanox.com>
2020-02-13 09:51:15 +00:00
Shuhei Matsumoto
2be78638d4 lib/thread: Rename timer_poller by timed_poller
Rename all variables and comments related with timed poller from
timer_poller to timed_poller.

This patch was originally to count poller and add the current
value to thread_get_stats RPC. This will be realized to add
thread_get_pollers RPC instead but renaming will be valuable itself.
So keep only renaming in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I73880b8df6ed35391383e0890f76b4e509690e06
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/479
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2020-02-13 09:51:15 +00:00
GangCao
9e33ad7562 Bdev: add the ZCopy operation for IO stats
To track the ZCopy IO stats like IOs and Bytes read and written.

Change-Id: Iab2c4d8397aee5d746db9491bd4e8ac4eea69529
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/539
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>
2020-02-12 12:08:28 +00:00
Ben Walker
7dbe0e7c61 nvme: Remove nvme_transport_get_ctrlr_registers
Wasn't used.

Change-Id: I9812e24540f6d86f47d39091ea5fd9b7880b4413
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/735
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-02-12 12:07:16 +00:00
Ben Walker
486471b1fb nvme: Remove DECLARE_TRANSPORT
We only have the generic transport wrapper now.

Change-Id: Ib1487e9c7b7ba3b573f5ea47597ad6eac1c5407e
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/734
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-02-12 12:07:16 +00:00
Ben Walker
54a022dda2 nvme: Don't DECLARE_TRANSPORT(rdma)
With the transport plugin system, this is no longer necessary.

Change-Id: Ia73878599658db84150603223ac811cb5a34ffba
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/713
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-02-12 12:07:16 +00:00
Ben Walker
f5bc2cbe86 nvme: No longer DECLARE_TRANSPORT(tcp)
With the transport plugin system, this isn't used anymore.

Change-Id: Ib81c73f262d44edb6c937ca0056ac027b1e1ca75
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/712
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-02-12 12:07:16 +00:00
Ben Walker
0b262fdfd2 nvme: Don't DECLARE_TRANSPORT(pcie)
All of the code now goes through the transport plugin system,
so this isn't necessary.

While doing this, caught a bug that the get_registers function
wasn't being set for the PCIe transport.

Change-Id: If19a933e0c6f656bc55232b15d59052e22af3ee9
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/711
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-02-12 12:07:16 +00:00
Ben Walker
516afb9aa3 nvmf: Allow fabrics get/set on ASQ and ACQ
This is meaningless for network devices, but will be useful
when emulating the more complete register state of local devices.

Change-Id: I37052e514101c298a1f66cc72135a8c3dd669003
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/420
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-02-12 12:07:04 +00:00
Ben Walker
84479ab6e3 nvmf: Allow fabrics commands to get and set aqa
This doesn't do anything for a network fabric, but it doesn't
hurt to allow these commands to set the emulated register
values for AQA. This will be more useful when emulating a
physical NVMe device.

Change-Id: I2891d7a07a5dceff50c6d66a8ce0b6b7c22a79f8
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/419
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-02-12 12:07:04 +00:00
Ben Walker
50132e4810 nvmf: Move custom admin command handler implementation to nvmf_tgt
The custom command handlers are registered by outside software.
Move the implementation from lib/nvmf to the nvmf_tgt application
to match the intended usage.

Change-Id: Iedb7ae5356f195dfb5bb465975808c8749d16f32
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/416
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-02-12 12:07:04 +00:00
Ben Walker
40ef8b34b7 nvmf: Don't typedef enum in nvmf_cmd.h
This isn't SPDK's coding style.

Change-Id: Ifedfd7823b45302d40031589f39bfa60e0f4dfbb
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/414
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-02-12 12:07:04 +00:00
Ben Walker
ab945f32e4 nvmf: Move spdk_internal/nvmf.h to spdk/nvmf_cmd.h
This is a public header that needs to be accessible to
code outside of the SPDK project. The spdk_internal/
directory does not end up getting packaged - it's just for
headers used by multiple libraries within SPDK.

Change-Id: I14e1ab4fda4b0ee779203d190a266240b10be6ae
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/413
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-02-12 12:07:04 +00:00
Ben Walker
cc353f0e27 nvmf: Add a public nvmf_transport.h
This defines the official interface that NVMe-oF target
transports may use. For now, all code is just copied
from elsewhere. Eventually we'll want to add doxygen
comments.

Change-Id: I0cd9368607544be18c7c49188d071e38ceb59b8f
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/412
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jacek Kalwas <jacek.kalwas@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-02-12 12:07:04 +00:00
Wojciech Malikowski
fc2dbeaa78 lib/ftl: Init/fini context moved from dev structure to init module
init_ctx and fini_ctx from dev structyre was redundant to initialization
module context. This patch merge those structures and keep initialization
and deinitialization context private for init module.

Change-Id: Ic94bc813112b265642933bc8183acb1961a0c01a
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/549
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-02-10 10:40:26 +00:00
Alexey Marchuk
2f551f09ce rdma: remove assert if ibv_query_qp fails
ibv_query_qp can return nonzero value if e.g. we received
IBV_EVENT_DEVICE_FATAL. Remove assertion not to break SPDK
in debug mode

Change-Id: I00b3bef448a69e2f43ee90e5466b2d78b55d8a08
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/659
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>
2020-02-10 10:25:00 +00:00
Alexey Marchuk
804b066929 rdma: Correct handling of RDMA_CM_EVENT_DEVICE_REMOVAL
This event can occur for either qpair or listening device. The
current implementation assumes that every event refers to a qpair
which is wrong. Fix: check if the event refers to a device and
disconnect all qpairs associated with the device and stop all
listeners.

Update spdk_nvmf_process_cm_event - break iteration if
rdma_get_cm_event returns a nonzero value to reduce the
indentation depth

Fixes #1184

Change-Id: I8c4244d030109ab33223057513674af69dcf2be2
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/574
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-02-10 10:25:00 +00:00
Wojciech Malikowski
c4bda88b25 lib/ftl: Change ftl_wptr_ready() return value from int to bool
ftl_wptr_ready() return value is true or false so
it should return bool instead int.

Change-Id: I653e4ee1271d54f2e8c7b6fa0144a468faec4607
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/555
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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-02-10 10:24:38 +00:00
Wojciech Malikowski
149511c1a0 lib/ftl: Set zone state to "full" when all writes to it are completed
Zone state should be changed to "full" when zone is
fully written.

Change-Id: Ib9ad29d1a0e788fba8a7eae881e07d384fa90548
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/554
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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-02-10 10:24:38 +00:00
Wojciech Malikowski
97f3ad2d8b lib/ftl: Change _ZONE_STATE_CLOSED to _ZONE_STATE_FULL
Ftl should operate on SPDK_BDEV_ZONE_STATE_FULL instead
SPDK_BDEV_ZONE_STATE_CLOSED.

Change-Id: I9ede78e3a1097490c1eb924f9e009fa166a7f3d6
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/553
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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-02-10 10:24:38 +00:00
Wojciech Malikowski
38d3138ee5 lib/ftl: Remove thread checks for zone reset operation
Since zone reset is private for core thread it will be
always issued from core thread.

Change-Id: Ice03d339cb59548690ccf8f48d7c1606ee408a59
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/552
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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-02-10 10:24:38 +00:00
Wojciech Malikowski
b75b3553aa lib/ftl: Move zone reset logic from band to core
Sine core module is responsible for handling IO it
should also handling zone reset logic.

Change-Id: Id8be4bb221cc85f207d44bd45761a72e263ea5ce
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/551
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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-02-10 10:24:38 +00:00
Sylvain Didelot
1fd3d8e994 lib/trace: Don't initialize traces if requested num entries is 0
Context:
Every-time the SPDK starts, it creates a large file under
/dev/shm (130 MB in my setup) which is never removed when
the application terminates.

The number of trace entries can be tuned using the SPDK runtime
option 'num_entries'. A value of 0 for this option considerably
reduces the size of the trace file (few MBs) but it is still
created.

This patch adds a special case in the code when num_entries=0:
the trace system would not be initialized, and the trace file
would not be created in this case.

The rest of the code properly handle the case where the trace
system is never initialized.

Signed-off-by: Sylvain Didelot <sdidelot@ddn.com>
Change-Id: If54a548de4a2ce2def8e57d527d0dc20bc55fe4d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/606
Reviewed-by: Jim Harris <james.r.harris@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>
2020-02-10 10:23:53 +00:00
Darek Stojaczyk
3ac9ba25f3 env_dpdk: fix potential null dereference
Change-Id: Iff5cfa780506191b3a7fb218c6b5948df2ac16a4
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/523
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>
2020-02-06 09:45:42 +00:00
Tomasz Zawadzki
16cc6464db lib/log: do not put trailing whitespace in fdump
fdump puts out buffer in following format:
"00000000  76 61 6c 00                                        val.            "

Each buffer is displayed with hex values up to maximum, then
followed up with a value. This is done to keep starting value
with the same alignment between each consecutive line.
Value contents should end at its length instead of
adding trailing whitespace.

After this patch, output is changed to:
"00000000  76 61 6c 00                                        val."

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I26b327e83f296ba3865f1a337f4a70764a80e2b0
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/483706
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>
2020-02-04 20:08:02 +00:00
Jesse Grodman
62deaa8315 thread: don't log an error when returning null in spdk_get_thread
the purpose of this commit is to avoid an entry into the error log in
the case that a thread does not exist, since there is no separate
function to check if a thread exists

Signed-off-by: Jesse Grodman <jgrodman@gmail.com>
Change-Id: Iec79b87e11e411bde59004baae1dc996864cec4d
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481576
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>
2020-02-04 19:28:43 +00:00
Wojciech Malikowski
b9d8382154 lib/ftl: Prevent from sending writes on resetting zone
When reset operation is ongoing mark zone as busy
to avoid write operation on it.

This path fixes issue #1171.

Change-Id: I30097e1db1bfbbabebd7e6adeab6e8810dc8b2b1
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/483264
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-02-04 19:01:48 +00:00
Jacek Kalwas
e1d1695cef nvmf: check if listener already exists in subsystem earlier
It fixes memory leak e.g. when add_listener rpc called twice with the
same trid on the same subsystem (ref = 2). In such case kill or
remove_listener decrements ref only once.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: Ib19f2e50838feff1c9108957ee82a42da66e54a2
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482446
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-02-04 18:27:46 +00:00
Alexey Marchuk
f1539c2820 nvme/rdma: Use transport_retry_count from controller opts
This allows to configure desired retry_count instead of using
hard coded value

Change-Id: I25c9601997ace916dfb735469a4b443c0cd2a96b
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482499
Reviewed-by: Seth Howell <seth.howell@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-02-04 18:19:20 +00:00
Alexey Marchuk
9727aa281f tcp: refactor of header/data digest support check
Some functions performed incorrect header/data digest
support check, align it with NVMEoF spec. Use a table
to check if PDU supports digest depending on its type.

Change-Id: I6170dd19ace017f37fda0a923f604732799460b9
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/483375
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-02-04 18:18:49 +00:00
Shuhei Matsumoto
6146c67856 lib/thread: Assert if spdk_poller_unregister() is called on wrong thread
Bdevperf tool had not called spdk_poller_unregister() called on the
same thread that called spdk_poller_register(). But it had not caused
any issue because spdk_poller_unregister() simply set the state to
unregistered. This design flaw has been fixed recently.

However the new pause feature has been added to poller and this
design flaw might cause any unexpected behavior if paused poller is
unregistered.

We do not know any other case such that spdk_poller_unregister()
is not called on the same thread that called spdk_poller_register(),
but we have no way to know it even if it exists. Hence let's add
assert for such cases.

Parsing poller lists managed by thread may be another option but
spdk_poller_unregister() is performance critical. So we do not check
list.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I9d91daaeb81fa33d5f042dbe7ddbd8ab6ea98d55
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479391
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2020-02-04 18:11:18 +00:00
Shuhei Matsumoto
655e8e16e3 lib/thread: Assert if spdk_put_io_channel() is called on the wrong thread
spdk_put_io_channel() was designed to be called on the same thread
that called spdk_get_io_channel(). spdk_put_io_channel() sends a
message to its own thread, to allow the context to unwind before
releasing the resources. This had the side effect to allow an
incorrect thread to call spdk_put_io_channel(). This patch will fix
that.

Bdevperf tool had a design flaw that needed the side effect, but
it was fixed recently.  We do not know if we have any other case.

Hence add assert to spdk_put_io_channel() to find other case.

We found that unit test for blobstore had called
spdk_put_io_channel() and fix it together in this patch.

Besides, correct the comment for spdk_put_io_channel() in
include/spdk/thread.h not to create any other case in future.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I6ec7bf074818abef43b23ca40bc9385adac70a75
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479390
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2020-02-04 18:11:18 +00:00
Wojciech Malikowski
05e4366519 lib/ftl: Remove read thread support
There is no need to support read operations on separate thread.

Change-Id: I10b595b8eeaf5fd0182f05913fdd5baa4b84961f
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471910
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2020-02-04 18:10:01 +00:00
Wojciech Malikowski
49d0baee65 lib/ftl: Check snprintf() return code
Change-Id: I711afcaabc079bc132cfdf2572683d0f0adff994
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481790
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: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2020-02-04 18:10:01 +00:00
Wojciech Malikowski
8c403acdb4 lib/ftl: Rename lba map memory pools
"ocssd" pool name is no longer valid.

Change-Id: Ie9671d9598633ebf165570419a9bbe89e539b04e
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481789
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: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2020-02-04 18:10:01 +00:00
Wojciech Malikowski
82b7b4aad5 lib/ftl: Media management events
Adding support for handling media management events.

Change-Id: I1b87143ddd360e314385e8dc70359aeb0d526b5a
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481691
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: 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: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2020-02-04 18:10:01 +00:00
Wojciech Malikowski
4d122a3559 lib/ftl: Add support for spdk_bdev_open_ext()
In order to handle media management events spdk_bdev_open_ext()
should be used instead spdk_bdev_open(). Move this call to ftl lib
to keep media management events internal to the library.

Change-Id: If4c9382cc89fc537667923f00d3dae5df0ace248
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481503
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: 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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2020-02-04 18:10:01 +00:00
Konrad Sztyber
ce6171d465 lib/vmd: detach devices during shutdown
Added spdk_vmd_fini(), which detaches all PCI devices acquired by the
VMD subsystem.

Fixes #1148

Change-Id: I43218ef5f9a764546b655c28688897fb91b779cb
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482852
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
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: Jim Harris <james.r.harris@intel.com>
2020-02-04 16:50:25 +00:00
Jacek Kalwas
aaa9630aeb nvmf/ctrlr: introduce request exec backdoor
It allows to property set (e.g. cc) when subsystem and qpair are not
active.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I0b0d150fbdac5bdf0d20762337f0a811f4d6d243
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481494
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-02-04 15:16:12 +00:00
Jacek Kalwas
fcca8ea6a9 nvmf/ctrlr: introduce ctrlr connect backdoor
This internal interface allows to create nvmf ctrlr and connect io
qpairs on add listener rpc request (i.e. when subsystem is stopped
and listener is not yet on subsystem's list).

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I998cb72ed773094faacc6668cf069ba9e2a6bf50
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481409
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-02-04 15:16:12 +00:00
Jacek Kalwas
489815dcf5 nvmf/ctrlr: introduce utils used during ctrlr connection
Had to remove one part of a unit test because the null
checking is moved to a different function.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I0a95d0a9a9a5708416fdc7efefb36e17b1ffe010
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/480008
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Seth Howell <seth.howell@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
2020-02-04 15:16:12 +00:00
Alexey Marchuk
3424def90a nvme: Fix potential use of non-initialized variable
trstring variable in spdk_nvme_trid_populate_transport is not
initialized, that can lead to snprintf() writes some garbage to
trid->trstring if the user passes SPDK_NVME_TRANSPORT_CUSTOM trtype
Add return statement and assert to CUSTOM/default switch

Change-Id: I6c6c37f9aa74d61b346f7be27fb890c7a34e9229
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/483469
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Seth Howell <seth.howell@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-02-04 09:49:25 +00:00
Mike Carlin
06fc4cadbe util/base64: Extend b64 decode to calculate exact len
When attempting to decode a base64 string, while there is a way to
calculate the maximum possible decode length, there isn't a way to
calculate the exact decode length without duplicating some base64
specific logic located in spdk_base64_decode. With this change, the
spdk_base64_decode function can now optionally calculate the exact
decode length without actually performing the decode by passing NULL
in as the dst argument.

Change-Id: Ice83db979f86a6fe9f39d236d3083102ca37ec68
Signed-off-by: Mike Carlin <mikefcarlin@protonmail.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479479
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2020-02-03 11:39:49 +00:00
Tomasz Kulasek
e69baea132 lib/nvme: fix wrong status argument in spdk_nvme_ctrlr_format
For nvme_ctrlr_cmd_format command status should be used as
nvme_completion_poll_cb callback argument instead of pointer to
local variable.

Change-Id: Id65cb395d137c4e907c1ef019b131e8822ddfe34
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/483513
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
2020-02-03 11:39:05 +00:00
Tomasz Zawadzki
29bd502046 lib/blob: add invalid flag for extent table
With recent changes to extent on-disk metadata format,
new format (Extent Pages) is not backwards compatible.
Meanwhile old format (Extent RLE) is backwards
compatible with older SPDK applications.

Summing up:
Blobstore created pre SPDK 20.01 can only use Extent RLE.
Blobstore created starting with SPDK 20.01 can use both,
Extent Pages and Extent RLE specified by use_extent_table opts.

When use_extent_table is set to true, invalid flag for it is set.
SPDK application pre 20.01, will not load such blob.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: If14ebd03f19eb581d71dcb46191e099336655189
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/483220
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-31 09:28:56 +00:00
Ben Walker
d0f4a51fdc sock/posix: Block recursive calls to spdk_sock_flush
Don't allow calling spdk_sock_flush while the socket is
closed.

Change-Id: I9020a49ab8906b0f343e3f48f8b96bd38308ab17
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/483148
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-30 10:22:20 +00:00
Seth Howell
f4a63bb8b3 env_dpdk: keep a memmap refcount of physical addresses
This allows us to avoid trying to map the same physical address to the
IOMMU in physical mode while still making sure that we don't
accidentally unmap that physical address before we are done referencing
it.

Change-Id: I947408411538b921bdc5a89ce8d5e40fd826e971
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/483133
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>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-29 14:15:21 +00:00
Seth Howell
f0ca01e102 lib/nvmf: properly validate fuse command fields.
The fuse command value is a two byte value, but we were only checking to
see if the fuse value was equal to SPDK_NVME_CMD_FUSE_FIRST or
SPDK_NVME_CMD_FUSE_SECOND in spdk_nvmf_ctrlr_process_io_fused_cmd. If a
haywire initiator sent a command with a fused value equal to
SPDK_NVME_CMD_FUSE_MASK, that would result in us skipping all checks and
dereferencing a null pointer in
spdk_nvmf_bdev_ctrlr_compare_and_write_cmd.

To fix this, add an extra condition to validate the cuse field.

Change-Id: I1ec4169ff5637562effd694f7046c6e3389627f1
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/483123
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
2020-01-29 14:15:00 +00:00
Tomasz Zawadzki
bba0f040cf lib/blob: fix uninitialized variable for non-debug builds
This was observed after running nighly tests on previous patch.
As part of it, autopackage.sh compiles SPDK
without debug flag set. Exposing the uninitialized var here.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Iedb1641f3c0d4a21f293c81cd4fcf35c6d1c7ae5
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482893
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2020-01-28 09:15:23 +00:00
Tomasz Zawadzki
12d1404125 lib/blob: set default use_extent_table to true
Extent table and extent page descriptors are now
set to be default way clusters are serialized on disk.

With this patch UT are ran with and without
extent table.

Changed two asserts in test, since amount is dependent on
which type of serialization is used.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ica58fce6a4effd014d7dd40ee26edd0fa3196d0f
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481901
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2020-01-28 09:15:23 +00:00
Tomasz Zawadzki
5d5053373f lib/blob: fix inserting extent pages
ctx->extent_page signifies if page was allocated
for insertion.

1) It is possible for a thread to claim extent page
on its own thread, and put it in ctx->extent_page.
If conflicting thread allocates another ctx->extent_page,
then it should be freed. This does not mean failure
to insert cluster. As different threads could have
been trying to allocate different clusters,
so condition on line 6716 does not cover it.
If so then it shouldn't be an issue to release
the claimed ctx->extent_page and proceed with updating the
extent page which originally won the race.
NOTE: if clusters were conflicting, then extent_page is
freed in _spdk_blob_insert_cluster_cpl().

2) At this point of _spdk_blob_insert_cluster_msg()
we already verified that there already is
extent page allocated at "*extent_page".
In such case ctx->extent_page will be 0,
and should not be used.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Id5b57c88248890eee60d2e7dbecbd984c98b561b
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482867
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-01-28 09:15:23 +00:00
Tomasz Zawadzki
1dd8c57ab8 lib/blob: fix clearing cluser array on EP load
sz is set to number of clusters that should be have been
in particular unallocated EP (remaining_clusters_in_et
up to SPDK_EXTENTS_PER_EP).

The cluster array should be set to 0 only in region
between original size (cluster_array_size) and new
total size (active.num_clusters).
It was incorrectly using sz in the memset.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ic43e89c17d53e9529e3ed0349aeb4fb7dc6593f2
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482858
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-01-28 09:15:23 +00:00
Tomasz Zawadzki
8b6df6fbab lib/blob: count clusters starting from 0 when parsing EP
Previously part of function assumed that cluster count
1)means number of clusters in EP and another 2) that it is
following the active.num_clusters (akin to extent_rle).

This was incosistent and showed when using multiple
extent pages to serialize metadata.
This patch changes it to only go with 1), so it is clear
that it means number clusters within particular EP.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I155104cabc127ed47df04434032fb01e08948e13
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482848
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2020-01-28 09:15:23 +00:00
Tomasz Zawadzki
dd0a320cf9 lib/blob: Always persist at least single extent table desc
Following changes are done in this patch:
1) _spdk_blob_serialize_extent_table now persists
at least single extent page. When num_extent_pages == 0.
2) Minimum valid size of ET descriptor is even without
extent_pages. This is a case when there are no EP,
but we still want to persist num_clusters in ET.
3) Taking above points, redone the loop for serializing
extent pages.
4) Make sure to mark blob dirty if any new extent pages
were allocted.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I81dc6cf2de2722bb49927ed42f4b9f31292f78c5
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482847
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2020-01-28 09:15:23 +00:00
Tomasz Zawadzki
c177a3c841 lib/blob: remove assumption of empty cluster array with multiple EP
Changed assert checking if cluster array is allocated
when loading extent pages. This is true only for
the first extent page being loaded, of course after that
the cluster array can be already allocated.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I0f96294ede5a12ffd6bca73cbeadba8d94a35bac
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482857
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2020-01-28 09:15:23 +00:00
Tomasz Zawadzki
42109157f4 lib/blob: add starting cluster index to extent page
Size of a blob (thus size of clusters array in mutable data)
is known from extent table descriptor.
Extent pages were read sequentially in order they were
placed in extent table. This meant that cluster
array could have been filled up from beginning to end.
Yet reading extent pages in any other order,
would result in incorrect placement of clusters.

This patch adds first cluster index that is contained within
each extent page. This will allow to read/write
multiple extent pages in parallel, since
we will know where in clusters array to put the cluster idxs.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ib6b9332111cd93f990d057dc60624152907dd87f
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482701
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-28 09:15:23 +00:00
Alexey Marchuk
8818ace2f4 nvme: Don't use stack variable to track request completion
A pointer to a stack variable is passed as an argument to
nvme_completion_poll_cb function, later this variable is used
to track completion in the spdk_nvme_wait_for_completion() function.
If normal scenario a request submitted to the admin queue will be completed
within the function which submitted the request.
spdk_nvme_wait_for_completion() calls nvme_transport_qpair_process_completions
which may return an error to the caller, the caller may exit from the
function which submitted the request and the pointer to the stack variable
will no longer be valid. Thereby the request may not be completed at that time
and completed later (e.g. when the controller/qpair are destroyed)
and that will lead to call to nvme_completion_poll_cb with the pointer
to invalid stack variable.
Fix - Dynamically allocate status structure to track the completion;
Add a new field to nvme_completion_poll_status structure to track status
objects that need to be freed in a completion callback

Fixes #1125

Change-Id: Ie0cd8316e1284d42a67439b056c48ab89f23e0d0
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481530
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
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>
2020-01-27 22:48:18 +00:00
Tomasz Zawadzki
78257ab613 lib/blob: rename num_clusters_in_et to remaining_clusters_in_et
This is more adequate name, since this value if first read from
Extent Table descriptor. Then decreased when iterating over entries in
extent table and extent pages are read.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ib188c524b8488b38d4de063a9970dcfdf49c9acd
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482600
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-27 18:06:43 +00:00
Tomasz Zawadzki
b5380c370d lib/blob: replay the clusters from Extent Pages
When replaying md chain for a blob, extent table
descriptor can be read. When it is present, all allocated pages
it points to are now being put into extent_pages array in ctx.
If multiple extent table descriptors are in single md chain,
the array is expanded accordingly.

After replaying single md chain is done, replay extent pages
starting from last one. Replaying extent pages, is similar to
extent_rle in that each allocated cluster is claimed and
number of free clusters in blobstore decreased.

When all extent pages are read, return to
_spdk_bs_load_replay_md_cpl() for continuing replaying
next valid md chain.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I4573226aff7d7b1bcdfd188518235c8d4b68a4c3
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481621
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-27 18:06:43 +00:00
Tomasz Zawadzki
5dc88c6ccb lib/blob: _spdk_bs_load_replay_md_parse_page() now takes only load ctx
_spdk_bs_load_replay_md_parse_page() is only used in
replay path during blobstore load.

Next patch will expand the load ctx with array of
extent pages to be read. It is filled out when reading
in-chain metadata of extent table descriptors.

Passing the load ctx here will make it simpler to
fill out the array when processing extent table.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: If96e6670560c8c4a3610f33ece14c354d7d5da39
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482412
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-01-27 18:06:43 +00:00
Tomasz Zawadzki
b5e993483f lib/blob: read extents during blob load
When EXTENT_TABLE descriptor is found when parsing metadata
that means there can be extent pages to read.

If extent page was not allocated, number of clusters can be
increased depending on the num_clusters_in_et.
Unallocated extent page contains either SPDK_EXTENTS_PER_EP
or remainder of num_clusters_in_et worth of clusters.
Depending which is less.

Added decreasing fo num_clusters_in_et to parsing
extent pages as well.

While here, remove ctx->seq = seq assignment as that is
done at beginning of blob load.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I57f54634b908ffb406f3e91e15841b7f36fd6de6
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476429
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-27 18:06:43 +00:00
Tomasz Zawadzki
d1f863ca57 lib/blob: write out extent pages before persisting metadata
Add new serialization of changed extent pages before persisting md.

Iterate over active extent pages (not array !). When they are
allocated but not yet present on disk - write them out.
All extent pages in clean mutable data are assumed to be written out
already.

So there are two cases here:
1) Active mutable array is larger than clean
	All allocated extent pages should be written out.
2) Cluster allocation created new extent page
	Blob has to be thin provisioned and persist was called
	as part of cluster allocation. New extent page needs to be
	written out and EXTENT_TABLE allocated.

Iteration is done over num_extent_pages instead of extent_pages_array_size,
to prevent writting out too many extent pages when size of blob was
made smaller. The two values come back in sync at the end of persist
either way.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I780819fd7f3c44e4cf5d71c188c642536d3cc320
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479851
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2020-01-27 18:06:43 +00:00
Tomasz Zawadzki
2bccb7c9b4 lib/blob: use use_extent_table instead of NULL from extent_page
Right now output from _spdk_bs_cluster_to_extent_page()
is used to determine whether the exten_table is used at all.
If NULL pointer was returned this meant that extent table
was not allocated, even if the code might suggest just
checking if we overran the array.

To make it more obvious, the _spdk_bs_cluster_to_extent_page()
now only asserts the extent_table_id.

blob->use_extent_table is now always used to determine the
serialization path.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I9d2630645213539bae5cd1d72e5f9b878f53c2bc
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482599
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-27 18:06:43 +00:00
Tomasz Zawadzki
95b478cc70 lib/blob: update single EXTENT_PAGE in place
This patch add single EXTENT_PAGE updates on cluster allocations.

There are three possible outcomes after inserting a cluster:
1) blob uses EXTENT_RLE
	Proceed to usual sync_md.

2) blob uses EXTENT_TABLE and extent page was not yet written out
	Update the active mutable data to contain the claimed md page,
	write out the EXTENT_PAGE and sync_md to update EXTENT_TABLE.

3) blob uses EXTENT_TABLE and extent page was previously written out
	Only serialize that single EXTENT_PAGE and write out the updated
	cluster map for it.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ia057b074ad1466c0e1eb9c186d09d6e944d93d03
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470015
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-27 18:06:43 +00:00
Tomasz Zawadzki
e1ce55158a lib/blob: require SPDK_EXTENTS_PER_EP to be power of 2
Force number of Extents to fit into Extent Page to
be power of 2, in order to simplify calculations
on cluster allocations.

At this time SPDK_BS_PAGE_SIZE is 4k, which would
results in SPDK_EXTENTS_PER_EP to be 512.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I7e09d92b00dfe5c12d7dd10ac0fc5a9a10d526ac
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472041
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2020-01-27 18:06:43 +00:00
Tomasz Zawadzki
f4e58993f7 lib/blob: add EXTENT descriptor to blobs
Similar to EXTENT_RLE, this descriptor holds LBA of clusters.
Difference is that EXTENT is kept in separate md pages,
and only single EXTENT will be updated on cluster allocation.

This patch adds the EXTENT processing, which is not used
until following patch.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ifbac23db7ca3e7c8c91cee01018f20071f0d5160
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470014
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2020-01-27 18:06:43 +00:00
Tomasz Zawadzki
0dfe80c82a lib/blob: claim and insert extent pages
Added claiming the extent page.
Which is then followed by updates in updates
of mutable data on md thread.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: If511564f812685381c48924310105a4cb6f63cd1
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479850
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-27 18:06:43 +00:00
Tomasz Zawadzki
cb44fa06f9 lib/blob: add _spdk_bs_claim/release_md_page()
Functions to claim and release md pages were added.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I1c8ddc13c8a5806fb874e5c34dae2a327e1ff248
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482011
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-27 18:06:43 +00:00
Tomasz Zawadzki
1b23560fcd lib/blob: add _spdk_bs_cluster_to_extent_page() for easy conversion
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I3e49c398d9bdf9f4eacba65061cc7fe4b300fb56
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479963
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-27 18:06:43 +00:00
Tomasz Zawadzki
59f7f3f736 lib/blob: change extent pages array size on blob resize
With this patch extent pages array will change it size accordingly
to size of the blob. Similar to clusters, only resizing up
is done on blob resize. Shrinking is done on persisting the blob.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Id7f7c81efbd96af414fce9fc4045cbb476cc93a6
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479962
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2020-01-27 18:06:43 +00:00
Tomasz Zawadzki
eebbd951cf lib/blob: pass Extent Page offset on cluster allocation
Extent Pages claim and insertion can be asynchronous
when cluster allocation happens due to writing to a new cluster.

In such case lowest free cluster and lowest free md page
is claimed, and message is passed to md_thread.
Where inserting both into the arrays and md_sycn happens.

This patch adds parameters to pass the Extent Page offset
in such case.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I46d8ace9cd5abc0bfe48174c2f2ec218145b9c75
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479849
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-27 18:06:43 +00:00
Tomasz Zawadzki
f60b4a7e28 lib/blob: add EXTENT_TABLE descriptor to blobs
Added new descriptor SPDK_MD_DESCRIPTOR_TYPE_EXTENT_TABLE.

Extent Table will hold md page offsets for new Extent Page descriptor.
Entries in Extent Table are run-length encoded 0's as unallocated
Extent Page descriptors.

Additionally total number of clusters is persisted in each Extent
Table descriptor. This is because there is no guarantee that
last Extent Page of a blob will be allocated.
Even if number of Extents per Extent Page is always the same,
Extent Page can hold less Extents than that.

This patch does not add more metadata on disk right now.
Only added descriptor parsing/serialization and applicable fields
to store it in run time.

Following patches are going to implement TODO's added in this patch.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Iac5d8f00ddfc655c507bc26d69d7adf8495074e9
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466920
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-27 18:06:43 +00:00
Tomasz Zawadzki
2f8bdb3c82 lib/blob: remove _spdk_blob_serialize_extent_rle() goto
Lets get it removed ! :)

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I91b994a883a642d87ecc8c152c801b8a7676f33a
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482010
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-27 18:06:43 +00:00
Tomasz Zawadzki
3dadb79e37 lib/blob: add EXTENT_RLE descriptor description
Since further patches will be adding new descriptors
that are related to cluster layout throughout the blobstore,
add description for existing descriptor too.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I722eb633445685789d5185ed59dfc910f76b109f
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481724
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-01-27 18:06:43 +00:00
Tomasz Zawadzki
c33840b7e6 lib/blob: add option to enable extent pages
This is an additional option that can be passed when creating
a blob.

When opts->enable_extent_pages is set to false (current default),
only EXTENT_RLE should be persisted on sync.
During blob load, when EXTENT_RLE is present in md,
blob->extent_rle_found is set to true.

When opts->enable_extent_pages is set to true,
only EXTENT_TABLE and EXTENT_PAGES should be persisted on sync.
During blob load, when EXTENT_TABLE is present in md,
blob->extent_table_found is set to true.

It is possible to find neither EXTENT_* descriptor when loading a blob.
This means that blob length is 0 and EXTENT_RLE was supposed to be used.
Yet none were persisted due to lack of clusters.
In such case blob->use_extent_table is set to true after finishing
blob load.

When parsing metadata ends, if extent_table_found is set - then
support for extent_table is enabled. All other cases disable it.

At this time path for Extent Pages is not implemented, so it should
not be used.
Later in the series, it will become the default path for serialization.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I2146da6130a0645e686ab02a3b5d2d86a7d35a1f
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479853
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-27 18:06:43 +00:00
Ben Walker
f84c916c41 nvmf/tcp: Correctly kick the recv state machine when a request is freed
When a command arrives and no requests are available, the socket
recv state machine sits in the RECV_STATE_AWAIT_REQ state until another
network event occurs. If this I/O was the last one sent, this leaves the
target hung. To fix this, when a request is completed, kick the state
machine to make forward progress.

In practice, this can only occur once the pdu send acknowledgements are
asynchronous relative to arriving commands. That only begins happening
with the use of MSG_ZEROCOPY. When MSG_ZEROCOPY is turned on, it's
possible receive the next PDU in a chain for a command prior to seeing
the acknowledgement that the response that triggered that PDU actually
sent.

Change-Id: I556f31ad56970d36aa3538cfde375d35f3d4e551
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/480002
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>
2020-01-27 17:42:24 +00:00
Ben Walker
48a547fd82 nvmf/tcp: Wait for R2T send ack before processing H2C
Previously, the R2T was sent and if an H2C arrived prior
to seeing the R2T ack, it was processed anyway. Serialize
this process.

In practice, if the H2C arrives with a correctly functioning
initiator, that means the R2T already made it to the initiator.
But because the PDU hasn't been released yet, immediately processing the
PDU requires an extra PDU associated with the request. Basically, making
this change halves the worst-case number of PDUs required per
connection.

In the current sock layer implementations, it's not actually possible
for the R2T send ack to occur after that H2C arrives. But with the
upcoming addition of MSG_ZEROCOPY and other sock implementations, it's
best to fix this now.

Change-Id: Ifefaf48fcf2ff1dcc75e1686bbb9229b7ae3c219
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479906
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-27 17:42:24 +00:00
Ben Walker
033ef363a9 nvmf/tcp: Inline spdk_nvmf_tcp_pdu_set_buf_from_req
This function was only called from one spot.

Change-Id: I856f564d3ef6c6157be7a32a2cd812c702516a8d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482003
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-27 17:42:24 +00:00
Ben Walker
fdfb7908b5 nvmf/tcp: Rename next_expected_r2t_offset to h2c_offset
This seems like a more descriptive name

Change-Id: Ia616865b3fb36d8f9ccc5fb2ca6185bdd8543cf8
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482002
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
2020-01-27 17:42:24 +00:00
Ben Walker
a2adca79d9 nvmf/tcp: Set up math to always use 1 R2T per nvme command
With our target design, there's no advantage to sending
multiple R2T PDUs per nvme command. This patch starts by
setting up the math so that at most 1 R2T PDU is required
per request. This can be guaranteed because the maximum
data transfer size (MDTS) is pre-negotiated in NVMe-oF
to a reasonable size at start up.

It then proceeds to simplify all of the logic around mapping
requests to PDUs. It turns out that the mapping is now always
1:1. There are two additional cases where there is no request
object at all but a PDU is still needed - the connection response
and termination request. Put an extra PDU on the queue object
for that purpose.

This is a major simplification.

Change-Id: I8d41f9bf95e70c354ece8fb786793624bec757ea
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479905
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
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: Alexey Marchuk <alexeymar@mellanox.com>
2020-01-27 17:42:24 +00:00
Ben Walker
399529aaa1 nvmf/tcp: Set max h2c size equal to max I/O size
We can always accept up to the maximum I/O size in an H2C,
so eliminate the #define.

Change-Id: I349dab5f9b6ec482a7c580b1396e03c8d30a250b
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482278
Community-CI: 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: Alexey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-27 17:42:24 +00:00
Ben Walker
4dba507224 nvmf/tcp: Simplify qpair resource initialization
The resources allocated to a queue pair do not need to be directly
correlated to the queue size requested by the initiator in NVMe-oF, as
long as enough resources are present. The RDMA transport, for instance,
does complex pooling of the resources behind the scenes when using a
shared receive queue.

Simplify the resource allocation for a TCP qpair to just always allocate
the max allowed queue size right away. This is a configurable parameter,
so system administrators can adjust for their needs. The initiator may
then request a queue size less than or equal to that, which will only be
enforced by queue depth counting and not impact the actual number of
resources allocated on the target.

This change relies on the MaxC2HSize being equal to the Maximum Data
Transfer Size (MDTS) reported. That is the default configuration, but
MDTS is configurable. Changing the MDTS with this patch to a value
larger than 128k will cause the target to break. This is addressed in
the next patch in this series.

Change-Id: Ibd4723785c6a4d8d444f9b7bbfa89f98de2320f5
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479733
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
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: Alexey Marchuk <alexeymar@mellanox.com>
2020-01-27 17:42:24 +00:00
Ben Walker
444cf90c72 nvmf/tcp: Change qpair's state_cntr array to uint32_t
These values do not need to be negative.

Change-Id: Id9f798cf1c9da354448f9c6fbb90e599f877bb32
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482277
Community-CI: 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: Alexey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-27 17:42:24 +00:00
Ben Walker
5a7b33ec67 nvmf/tcp: In _pdu_write_done, free pdu before calling user callback
By releasing the just-completed PDU prior to calling the callback,
for flows that immediately submit another PDU inside the callback,
the just-released PDU can be immediately reused. This reduces the number
of PDUs required in the pool to continue forward progress to half of the
previous value, while also making it more CPU cache friendly.

Change-Id: I8031b8f9f57ac05f261d96433d9899fe5e31d318
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479904
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Or Gerlitz <gerlitz.or@gmail.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-27 17:42:24 +00:00
Jim Harris
dc3717296e bdev: handle unlock v. lock race
When we unlock a range, we remove the range from the
locked bdev list before doing the for_each_channel
iteration to remove the range from each channel.

But at the same time, right after removing from the
locked list, a new lock on that range could start.
In that case, we also do a for_each_channel to add
the range to each channel, and that will race with
the for_each_channel remove.  When the lock start
wins, it finds the range already in the channel,
but doesn't set the owner_range which results in
a seg fault when the for_each_channel completes.

The fix is actually rather simple.  We just add the
locked_ctx to the comparison when checking if the
range is already in the channel.  If the locked_ctx
matches, then we know it was added as part of
initializing a new channel.  If it doesn't, then
we create a new range object pointing to the new
locked_ctx.  The first one will get removed when
the remove for_each_channel catches up.

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

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482620
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-01-27 17:39:52 +00:00
Jim Harris
da11a46466 bdev: start lock process on original channel
If a locking operation has to wait because of an
existing lock, we queue the lock context.  When the
existing lock finishes unlocking, we restart the
queued lock context.  But we have to make sure
we restart the lock context on the same thread it
was originally submitted, since it has a channel
associated with it.

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

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482463
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-27 17:39:52 +00:00
Maciej Szwed
a83644fe2b bdev: Lock LBA range for fused command execution
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I577f961484b2ebf350f4f795eda1a018c5f0fd7a

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481710
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-27 17:39:52 +00:00
Tomasz Kulasek
9a80e954f7 lib/nvmf: report support for fused compare and write
Change-Id: Ib073719a59972240a68b1a4ad4951820c7ea5323
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476136
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-27 17:39:52 +00:00
Maciej Szwed
ff8a425182 nvmf: Return ACWU and NACWU values in indentify structures
For ACWU we always set value 1 because bdev holds
information specific for namespace only. This value
actually does not matter because we also set NACWU
which makes ACWU irrelevant. We set ACWU because
NVMe specs requires ACWU != 0 if fused commands
are supported.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: Ida4357026d3b32677fc824b3cd878e7ad8ef2680

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477915
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-27 17:39:52 +00:00
Maciej Szwed
c13733915b bdev: Add spdk_bdev_get_acwu function
This function is required for NVMf implementation
for compare and write fused command.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: If41611f5c0b8e4ed8eec66f09858c724f1800d59

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477914
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-27 17:39:52 +00:00
Maciej Szwed
71beb568d6 nvmf: Add call support for compare and write cmd in spdk_nvmf_ctrlr_process_io_cmd
Add call for spdk_nvmf_bdev_ctrlr_compare_and_write_cmd
function in spdk_nvmf_ctrlr_process_io_cmd function
when fused command is discovered.

This patch also removes redundant defines for fused flags.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I61971a56577ab32b52e1fde1e572f718a9a2d9aa
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476621
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-27 17:39:52 +00:00
Maciej Szwed
87be077d0b nvmf: Add spdk_nvmf_ctrlr_process_io_fused_cmd
Move fused cmd related code from spdk_nvmf_ctrlr_process_io_cmd
to separate function.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: Ic662a968b054f05db7f6e1cf4fa9aa13f6fb7c40

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481942
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-27 17:39:52 +00:00
Maciej Szwed
941d9e7aa8 nvmf: Add support for compare op command
This patch introduces new spdk_nvmf_bdev_ctrlr_compare_cmd
function which implements support for compare operation.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: Iadf402a6441a78ea0e6468f1066c6b0e10e63b9b

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477782
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-27 17:39:52 +00:00
Maciej Szwed
05e7f56c3a nvmf: Add spdk_nvmf_bdev_ctrlr_compare_and_write_cmd function
This patch introduces new function that is a part of
upcoming support for fused commands.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I019c587bee7fd0f745ec17c141baf4cb7bf86645

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476611
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-27 17:39:52 +00:00
Tomasz Kulasek
67c9c1c5d8 lib/nvmf: add fused operations
Change-Id: If3162a5683d1c57011f9a66cbcfe47ba161734bf
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476138
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-27 17:39:52 +00:00
Maciej Szwed
adf90938b1 bdev: Add spdk_bdev_io_get_nvme_fused_status function
Added new function for getting NVMe specific return code
for fused commands. Also changed one of the return codes
in fused commands so that we could distinguish error
cases.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I86417ea4f5b8f3e6496162be3d6c6128076e35d4

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481666
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-27 17:39:52 +00:00
zhangjf
2a00a12892 vhost_blk: need init task when resubmit the blk request
Change-Id: I10fca86be6a2834fe3238d8881a4645ac810a201
Signed-off-by: zhangjf <zjfhappy@126.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482346
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-24 08:07:13 +00:00
Seth Howell
85fcc49fd4 nvmf/rdma: fix call to spdk_nvmf_rdma_listen
This change fixes a merge incompatibility between commits
50cb6a04ac and
708ed4fb6e.

Change-Id: I5bc71a3c214667f01de66857cf61b9eb25f6cf6b
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482586
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>
2020-01-23 16:38:46 +00:00
Seth Howell
ca693eaba8 lib/nvme: fix cm event handling during rdma qpair shutdown.
In the event that we have more than one event outstanding for a qpair
at the time of destruction, we need to ack all of the events, Luckily
the synchronization is already there in the form of the ctrlr lock.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: Ib297598f2e28d9b9bd83e904f950795a61fa883a
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479171
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-01-23 15:14:55 +00:00
Seth Howell
50cb6a04ac lib/nvmf: handle RDMA_CM_EVENT_ADDR_CHANGE
This allows features like transparent failover on
target RNICs.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: Iab494ad3e9e4efea4db9cbb30bc18ea5b584f345
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478879
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: <jacek.kalwas@intel.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-01-23 15:14:55 +00:00
paul luse
82a4c84fec lib/bdev: Add support for new per bdev_io auxiliary buffer.
A new API was added `spdk_bdev_io_get_aux_buf` allowing the caller to request
an auxiliary buffer for its own private use. The API is used in the same manner that
`spdk_bdev_io_get_buf` is used and the length of the buffer is always the same as the
bdev_io primary buffer.  'spdk_bdev_io_put_aux_buf' is called to free the
auxiliary buffer.

The initial use case is crypto, in the next patch in series it is used. No UT were
added as the logic isn't that complicated and it is fully tested with each run
of crypto.

Fixed a comment typo also (not mine for once).

Signed-off-by: paul luse <paul.e.luse@intel.com>
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ib1939fcbc8e5db36fd909ef26771a725a551e8e6
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478383
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
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>
2020-01-23 02:36:51 +00:00
Ziye Yang
74ce72edca lib/iscsi: Using async writev for ISCSI_OP_LOGOUT_RSP PDU
Change-Id: I9d6d547645930c5075dca7d1e8c566634cda8e73
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482028
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-23 02:29:58 +00:00
Ziye Yang
16d5a6155a lib/iscsi: Using async writev for ISCSI_OP_LOGIN_RSP PDU
Change-Id: Ia69c996c731dfd89702bbb28468d8798c391034d
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481922
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-23 02:29:58 +00:00
Ziye Yang
67067ea4de lib/iscsi: Add a helper function iscsi_conn_params_update
Purpose: To reduce the duplicated code.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I6f6e79af602281ed50fa0fde7651238065c9bd31
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482291
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-23 02:29:58 +00:00
Ziye Yang
b03612bf4d lib/iscsi: Using async writev for ISCSI_OP_TEXT_RSP PDU
To avoid partial write issue of this PDU.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Id9b22da844c75ae53c6881850d192b40ac4098ac
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481948
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-23 02:29:58 +00:00
Ziye Yang
e199f1a5b4 lib/iscsi: adjust the location of spdk_iscsi_param_free in two functions.
Purpose: To prepare for the further patch submission.
Since we do not need to keep this variable too late.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Ibaa100925e1ea317253d4fe7e560917e063fcf6b
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482290
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-23 02:29:58 +00:00
Ziye Yang
d8d1168c06 lib/iscsi: Add real callback for DATAIN PDU complete
Since only after DATAIN pdu sending out, we can have
free slot to handle queued data in tasks.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I49a52597e8660453ea90c5960d020eb53f81265d
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482048
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
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: Jim Harris <james.r.harris@intel.com>
2020-01-23 02:29:58 +00:00
Ziye Yang
098d32273a lib/iscsi: Add two parameters in spdk_iscsi_conn_write_pdu
This is prepared for the further call back usage.

Change-Id: Iccf304c87e67debfb4e7c330acc9cc233cc3ec48
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481917
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
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: Jim Harris <james.r.harris@intel.com>
2020-01-23 02:29:58 +00:00
Ziye Yang
d648dde682 lib/iscsi: Use asychronized writev for sending data on sockets
This patch eliminates the flushing logic and simplies
the writev logic. And this patch can also improve the performance.

We support async write for PDUs other than login response, logout response,
and text response in this patch. We will support async write also for them
later in this patch series.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I243f598f297d594da0bb18466bc47dab918ed3ee
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481686
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-23 02:29:58 +00:00
Ziye Yang
377a016f69 lib/iscsi: add the conn in spdk_iscsi_pdu
Purpose: Prepare for the async writev usage for spdk
iSCSI target application.

Change-Id: Iff0e932159b0ad80be32aed3fc543b67d8fb8f51
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481644
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-23 02:29:58 +00:00
Changpeng Liu
5e8a3a77b6 vhost: make SPDK internal vhost library can work compatible with live recovery
We will not enable the live recovery feature for SPDK internal vhost library,
so we unmask the protocol flag for internal vhost library.

For the purpose to make it can be compiled with latest DPDK version, some
mandatory APIs are required, so add them here.

Change-Id: I34fab7ed90c86a0fb612852a47f6cadeb8a072f3
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482069
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-22 13:54:19 +00:00
Jan Kryl
2167c68d18 lib/nvmf: nvmf target stops to listen when subsystem is destroyed
There is a spdk_nvmf_tgt_listen() which opens a port for specified
transport (trid) which opens possibility to accept new connections
from initiators. However there is no counterpart of this function
(i.e. spdk_nvmf_tgt_stop_listen()), which would stop listening.
Instead the current code relies on spdk_nvmf_subsystem_destroy()
to stop the listener, which seems to be wrong.

Fixes #1129

Change-Id: I6e73d8c234dc451f0fee8394132eae34cd4f4756
Signed-off-by: Jan Kryl <jan.kryl@mayadata.io>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479873
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-22 13:53:34 +00:00
Or Gerlitz
8e8a5f7c28 nvme/tcp: Use writev_async for sending data on sockets
Amortize the writev syscall cost by using the writev_async socket API.

This allows the socket layer to batch writes into one system call
and also apply further optimizations such as posix's MSG_ZEROCOPY
when they are available. As part of doing so we remove the error
return in the socket layer writev_async implementation for sockets
that don't have a poll group.

Doing so eliminates the send queue processing.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Change-Id: I5432ae322afaff7b96c22269fc06b75f9ae60b81
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475420
Reviewed-by: Ben Walker <benjamin.walker@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>
2020-01-22 13:53:09 +00:00
Or Gerlitz
e61b0904a8 sock/posix: Add flush
Initiator drivers (e.g nvme/tcp) don't use poll groups but rather directly
poll the qpair. In this case we want to allow the polling function (e.g
_qpair_process_completions()) to flush async writes pending on the socket.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Change-Id: Ibd8c73691213d58e287b7110d0f5a381a89a64d0
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475419
Reviewed-by: Ben Walker <benjamin.walker@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>
2020-01-22 13:53:09 +00:00
Tomasz Zawadzki
1fdee03c3c lib/blob: split loading next md_chain to separate function
Replaying md through _spdk_bs_load_replay_md_cpl() starts with
md page 0 in search of first valid md page starting a chain
for particular blob.
When it is found, next pages read are from the current pages
`next` page - next in chain.
After whole chain is read, it goes back to first page in chain
and starts search for next valid chain from there.

This patch adds separation between reading particular chain,
and moving to the next one.
Moving on to the next one happens in _spdk_bs_load_replay_md_chain_cpl().

Further in the series, extent pages will be added in the metadata.
Those are not within any particular blobs chain of metadata,
but spread out over the md region.

It is not enough to read all md and read extent pages.
In case of power failure, only extent pages known to be valid
are the ones which are pointed to by some valid md chain.

In futher patches, a step will be added after reading particular
valid md chain to go read extent pages pointed by it.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I6e7cd64af66ce5db0abd2ad5962d604ac2b30994
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481900
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-01-22 13:52:49 +00:00
Tomasz Zawadzki
bb25821c7e lib/blob: move finishing unload to _spdk_bs_unload_finish()
Moved finishing of unloading to separate function,
which is now called on every failure and success when unloading
the blobstore.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I34539b78c5cc63a6fe5891014cba89b9eb62d4df
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482009
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-01-22 13:52:49 +00:00
Tomasz Zawadzki
f7bd1e1eb9 lib/blob: check bserrno on each step of bs_load
Before this change it was possible to fail at
writing out some of used md pages.
bserrno output of those was not verified.

This patch adds it at every step.

With that two function don't need (and never needed)
to pass the bserrno:
_spdk_bs_load_write_used_md()
spdk_bs_load_complete()

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I1a61763f03665ba1b00e5949ef0cf37eefaaf08f
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482008
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-01-22 13:52:49 +00:00
Tomasz Zawadzki
cf5df9b41d lib/blob: remove seq argument from _spdk_bs_load_ctx_fail()
This is simplification of load path.
seq is save in ctx already, no need to pass it to the function.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ief0ddc1826c461adbad71ba1a3897c510ec2a971
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482007
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-22 13:52:49 +00:00
Seth Howell
9436ab59ba nvme/rdma: inline buffers for all host to ctrlr ops
Not inlining all host to controller operations breaks the target within
the context of fused commands. This issue was discovered when enabling
the compare-and-write fused command. Only the write command buffer was
being inlined which caused the write to jump the compare in the
transport specific state machine on the target side before our fused
command checks in the generic code.

Change-Id: I9e52ae6160e01ffd36d20429ffc8459491c729ef
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482001
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-22 13:41:47 +00:00
Changpeng Liu
2a8281fdfd thread: free message event after executing the callback successfully
We should check the thread's state at the end of message callback, or
we may leak the message memory in case the thread was set to exit state.

Change-Id: Ifb67c3b5c39440c411eca1d045c11e8aa6c514cc
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482206
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-22 01:25:03 +00:00
Jacek Kalwas
de4bf95443 lib/nvmf: put explicit transport name on dump
Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: Ie37c1d713f0e1b0767c4b40c1055b86d9de220af
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481954
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Seth Howell <seth.howell@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-21 23:16:57 +00:00
Jacek Kalwas
0651753ce8 lib/nvmf: introduce function to get transport name
Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: Ide89666bfd856d42ca5cb535e8a29716f787ea3f
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481953
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Seth Howell <seth.howell@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-21 23:16:57 +00:00
Jacek Kalwas
7a35a678b8 lib/nvme: extend trtype to str with CUSTOM
Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I519bb6bf0e930e0cd977ef4b5133bbdd7ca8af86
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481952
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Seth Howell <seth.howell@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-21 23:16:57 +00:00
Jim Harris
eaa984801e bdev: break spdk_bdev_io_get_buf into multiple functions
This will allow for some reuse in future patches adding
support to get auxiliary buffers from the bdev memory
pools.

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

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482022
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-20 10:02:45 +00:00
Jim Harris
03171deee8 bdev: add bdev_io_get_buf_complete helper function
This will be helpful in future patches where auxiliary
buffer support is added, and we have a different
type of callback to invoke.

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

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482021
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-20 10:02:45 +00:00
Tomasz Zawadzki
7167f8d334 lib/blob: save sequence immidietly on bs_load/unload
Assigning seq to ctx was done very late in the process.
To keep future functions lean and without the seq,
it is assigned immidietly after starting.

Only functions in load path that require separate
seq argument are those passed directly to read/write
device operations.
Rest of them can just use spdk_bs_load_ctx.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I2bd610dc4c7b4a7b0c3de92391922475c514326a
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481899
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-20 10:02:00 +00:00
Tomasz Zawadzki
bbbe586b28 lib/blob: make passing ctx more explicit
No functional change is done in this patch.

Most of the functions already translate cb_arg to ctx and
use it, but then just pass cb_arg.
This will make it clear that it is ctx that is passed around.

Along with simplifying some of changes in next patch,
where arguments of functions will be cut down just to
the ctx.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: If7d8ed38dc92175d867a2231ab2ebd4f2499efcd
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482006
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-20 10:02:00 +00:00
Tomasz Zawadzki
994d4c38ba lib/blob: move generation of metadata into separate function
This patch creates new _spdk_blob_persist_generate_new_md()
function that is responsible for generation of new metadata
from current state of blob.

Functionality so far is unchanged.

This is preparation for later in the series where new
extent pages will be written out to disk before metadata pages.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I84158cb8316a881a6170ac37e151a60aaa9d7369
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479848
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-20 10:02:00 +00:00
paul luse
ca667d064f lib/blob: read clear_method from per blob metadata
On blob load, read in the saved clear_method option. If
BLOB_CLEAR_WITH_DEFAULT was passed in, use the setting stored
in metadata previously.  If something other than the default was
specified, ignore stored value and used what was passed in. If
ignoring a stored value, print a warning.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ia0c81fa0adc175dfaeb74c06e1ac91dc6b27e9ab
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472209
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-20 09:57:16 +00:00
paul luse
ea69d6d6cc lib/blob: store clear_method in per blob metadata
Accept a clear method option on blob create by adding clear_method
to the opts structure passed in to _spdk_bs_create_blob(). Store
these 2 bits in md_ro_flags so that earlier versions without an
understanding of these bits can not alter metadata.

The new metadata values will be used later in the series.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I5440645ca20b426778d13b2e544b65dc2b3b83c7
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472204
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-20 09:57:16 +00:00
paul luse
d68459fcb3 lib/bdev: Add comment to bdev_io_put_buf() when unsetting bounce buffer
To clarify what seems like it might be unintentional.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Id14b49e8b7bc2372ecb8dd7579e6797a395c2cf2
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477363
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
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>
2020-01-20 09:57:16 +00:00
Michael Haeuptle
e93902a03d lib/nvmf: custom admin cmd handler oacs support
This commit sets the optional admin command flags
in the identify structure based on whether handlers
for these optional admin commands are specified.

Change-Id: If4aa36a414b0811dafaadbc1094e6c2628d21b39
Signed-off-by: Michael Haeuptle <michael.haeuptle@hpe.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479446
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>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-20 09:56:35 +00:00
Michael Haeuptle
3fa2205647 lib/nvmf: custom admin cmd handler
This commit provides the capability to install a
    custom admin command handler for NVMF.
    It can be used to implement or replace NVMe admin commands that
    are currently not handled by the NVMF subsystem.

    The handler implementation is pretty generic and the handler function
    has to figure out what to do with the command based on the bdevs
    that are configured for the subsystem.
    In cases where admin commands need to be forwarded to an NVMe bdev,
    the commit provides functions that allow access to the underlying bdev.

    There is an example handler in lib/nvmf/custom_cmd_hdlr.c.

Change-Id: I4f9d538c53669c176a836e8bdd379db0070a87dc
Signed-off-by: Michael Haeuptle <michael.haeuptle@hpe.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479167
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>
Reviewed-by: <jacek.kalwas@intel.com>
2020-01-20 09:56:35 +00:00
Tomasz Zawadzki
3219bc9a80 lib/blob: separate blob load md parsing from loading back_bs_dev
In current version, immidietly following parsing all
metadata pages an action is taken inform of loading the back_bs_dev.

Patches later in the series will add more metadata in form of
extent pages, which have to be read separetly from usual
blob metadata pages.

This patch add separation between the two steps,
so later a device read can be put between.

Additionally, _spdk_blob_load_final() when no snapshot was present
passed bserrno which was always 0. This patch just sets 0 directly
there as no errors occured at that point.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I4a77527f90bb1de12f972591067b7a50926f39c9
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476427
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: Paul Luse <paul.e.luse@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-17 10:00:19 +00:00
Ben Walker
63a60a0c4c nvmf/tcp: Fix r2t completion callback
This was calling a callback for another function which
attempted to release the request. The code only worked because
in the r2t case the cb_arg was set to NULL, and that makes
the request free function do nothing.

Change-Id: Id9ec30ceb0eaa41deb67aa995da5d6f786d9b9f0
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479903
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Or Gerlitz <gerlitz.or@gmail.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-17 09:00:08 +00:00
Ben Walker
2112c8bf3a nvmf/tcp: Remove pdu ref count
This wasn't actually used. Every PDU only had a single reference.

Change-Id: I8adaa7edeca5fe175aa853c156df741170d76c10
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479902
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-17 09:00:08 +00:00
Alexey Marchuk
52f1e4b029 nvme: Update spdk_nvme_wait_for_completion_robust_lock error handling
Update error handling of spdk_nvme_wait_for_completion_robust_lock to
differentiate cases when request is completed (possibly with error)
or polling was aborted by transport/device error
The function returns 0 on success, -ECANCELED if transport/device
error occurred and -EIO if the request is completed with error

Change-Id: Ibf7f3c330317af0d8f27ba9cd10d8b773f6a796b
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481529
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-17 08:59:46 +00:00
Alexey Marchuk
9ad2046ae1 nvme: Update spdk_nvme_wait_for_completion_timeout error handling
Update error handling of spdk_nvme_wait_for_completion_timeout to
differentiate cases when request is completed (possibly with error)
or polling was aborted by timeout or transport/device error
The function returns 0 on success, -ECANCELED if transport/device
error occurred or operation timed out and -EIO if the
request is completed with error

Change-Id: I314f40d1acaa6cfa9b88e5417b1ee2c9801bbbd6
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481528
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-17 08:59:46 +00:00
Wojciech Malikowski
39965ab048 lib/ftl: Change "lbk" name to "block"
"lbk" name is more OCSSD specific so in
generic FTL "block" name is more suitable.

Change-Id: I792780297b792bf5e02f13cc20346da56b032918
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472284
Community-CI: 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>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-17 08:59:08 +00:00
Wojciech Malikowski
777ce6d83c lib/ftl: Replace some fileds in ftl_zone with spdk_bdev_zone_info
ftl_zone had reduntant fields to spdk_bdev_zone_info.

Change-Id: I5ec5bbc74912f286d798027afed06d0cd1917cc2
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471909
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: 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>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2020-01-17 08:59:08 +00:00
Wojciech Malikowski
55342d972b lib/ftl: Zone append support
Zone append command allow to write to the
zone with queue depth greater than one.
Append location is read during write
completion callback.

Change-Id: Ie08ce8d31d5d0fb521cdc2b95f3e29b92e02e63f
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471627
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
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: Konrad Sztyber <konrad.sztyber@intel.com>
2020-01-17 08:59:08 +00:00
Wojciech Malikowski
b48113b296 lib/ftl: Update lba map during write completion
Lba map could be updated during write
completion. This change is needed to have
common io path when append support will
be added.

Change-Id: I942bfd8b54dc6b40136ca53434f0ef8e3c415c5b
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471637
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: 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>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2020-01-17 08:59:08 +00:00
Wojciech Malikowski
d6234332fb lib/ftl: Represent ftl_addr just with the offset value
This patch removes parallel unit and zone id fields
from ftl_addr struct.

Change-Id: Ica42208eafdbbecab60430708197f5f3ba6167d6
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468701
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: Konrad Sztyber <konrad.sztyber@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-17 08:59:08 +00:00
Tomasz Kulasek
66585bd4be lib/nvme: fix cuse return status code
For admin as well as for IO operations the ioctl should return
NVMe status code.

Change-Id: Icf8efde674b847fb03e5532f47c00b1c2cdcf328
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477492
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
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: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
2020-01-16 09:20:20 +00:00
Jacek Kalwas
a71e30dee8 nvmf/ctrlr: improve property set cc checking
AMS, MPS, CSS fields are explicitly checked now.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: Ib3872b53fc49f1320aa30c73eac026d1acb9eace
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479836
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-16 09:20:02 +00:00
Jacek Kalwas
f80fe5c4a5 nvmf/ctrlr: property set returns false when cc.en transition from 1 to 0
Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: Ia1be6028a5c0037e27c8c0feea0a717d423dabeb
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479830
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-16 09:20:02 +00:00
Jacek Kalwas
708ed4fb6e nvmf: pass listen done cb to transport specific code
This would allow to respond for add listener rpc request even
when there are async calls in transport specific function.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I94a9f45b7ba9e8d46a60ae3785953cea12554732
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479511
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Anil Veerabhadrappa <anil.veerabhadrappa@broadcom.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-16 09:18:38 +00:00
Jacek Kalwas
7cd56fb3ed nvmf: align tcp and rdma listen calls
Make common code as part of successful return.
In rdma check if already listening first.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: Ib0c87ac11db7daff00dc4042c9e0ab20eb7ffd0f
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478721
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-16 09:18:38 +00:00
Ziye Yang
d1a8a7bee1 sock: Add a priority parameter in SPDK_NET_IMPL_REGISTER
Purpose: Prepare for setting priorities for different
kernel based sock implementations.

The g_net_impls list is maintained in decreasing order
according to the priority of each sock implementation.

For examaple, if there are 3 sock implementations, i.e.,
posix (priority = 0), vpp (priority = 1), sock_ut (priority =2),
then the list will be maintained as:
sock_ut -> vpp -> posix.

Then if users use spdk_sock_open/listen with impl_name as NULL,
then the order to try is: sock_ut, vpp, then posix

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I43899de5bac14751ab060a11eb814cd7a0a83cc6
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479488
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>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-16 09:11:32 +00:00
Ziye Yang
0bfaaace8f sock: Add impl_name parameter in spdk_sock_listen/connect.
Purpose: With this patch,

(1)We can support using different sock implementations in
one application together.

(2)For one IP address managed by kernel, we can use different method
to listen/connect, e.g., posix, or uring. With this patch, we can
designate the specified sock implementation if impl_name is not NULL
and valid. Otherwise, spdk_sock_listen/connect will try to use the sock
implementations in the list by order if impl_name is NULL.

Without this patch, the app will always use the same type of sock implementation
if the order is fixed. For example, if we have posix and uring together,
the first one will always be uring.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Ic49563f5025085471d356798e522ff7ab748f586
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478140
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
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>
2020-01-16 09:11:32 +00:00
Seth Howell
738b9569f0 lib/nvme: remove extra function calls in tcp transport.
Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: I031cb5263598d09fb4956873c35d74ec3173fe63
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478875
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-16 09:10:38 +00:00
Seth Howell
b2225ff593 lib/nvme: remove extra transport functions.
Now that we have a more flexible function table strategy for
transports, we can get rid of some of the wrapping we were doing
to match the macro definitions exactly.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: I12c868babfa7bd27dc8ed5e86d35e179f8ec984f
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478874
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-16 09:10:38 +00:00
Seth Howell
f6cf92a31f lib/nvme: make transport.c use fn tables.
Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: Ida58785784b4ed50393e1d43a9cd902de74a2eaa
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478873
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-16 09:10:38 +00:00
Seth Howell
bf6b1122dc lib/nvme: split out function to get ops.
Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: I7664e6ca16f323fd7032b2c8afd6b9467897a014
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478872
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-16 09:10:38 +00:00
Seth Howell
e4eef6975c lib/nvme: add function tables for all transports.
Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: I4e7af1c42a19346f4abcb17910a41f8104a2de1b
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478871
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-16 09:10:38 +00:00
Seth Howell
b2e55c2454 lib/nvme: add functions for registering new transports
Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: I7f04968957fbc80ca8ed3ddd96e13bb9cb855813
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478866
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-16 09:10:38 +00:00
Seth Howell
017a8f885f lib/nvme: add objects for transport registration.
Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: I33d0a23b646a06acbf219ff283f094197af6b1fc
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478865
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-16 09:10:38 +00:00
Seth Howell
771d759312 lib/nvme: add spdk_nvme_transport_available_by_name
This new api function will enable us to work with custom transports.

This is needed to enable properly parsing and comparing custom transport
IDs that may all resolve to the same enum value.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: I26aa3cb8f76f8273f564799d9b2af8041ea0d219
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478752
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-16 09:10:38 +00:00
Seth Howell
f038354efa lib/nvmf: enable pluggable NVMe-oF transports.
Change-Id: If1fd7d6c2385f42ca32dea0f8ecb528a60778d40
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477504
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-16 09:10:38 +00:00
Seth Howell
b397546e9d lib/nvmf: get_transport now takes a string.
This function previously accepted a trtype enum, but needs to be able
to accept a string to support custom transports.

Change-Id: I931aed30ca3be65468552ffa1bb1ef3f91275fda
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479601
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>
2020-01-16 09:10:38 +00:00
Seth Howell
5b3e6cd137 lib/nvmf: opts_init and transport_create use string now.
This will help enable pluggable NVMe-oF transports.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: I1947cc2e6e4ff078609f8bdbbdfefc5b110674c2
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478753
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>
Reviewed-by: Anil Veerabhadrappa <anil.veerabhadrappa@broadcom.com>
2020-01-16 09:10:38 +00:00
Seth Howell
d4ea320bb5 lib/nvme: add trstring comparison to trid comparison.
Multiple custom transport types could share the same trtype variable. Add this additional check to compare them.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: Ief93d0d82aee754c9235cbab3c55827e57869fe9
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478748
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.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>
2020-01-16 09:10:38 +00:00
Seth Howell
a050dcf21d lib/nvmf: add a default value to trtype enum.
For custom transports, we should use a range outside the spec value
to identify them.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: I82b29c349e143b8906f79ce2de818def116a3fe4
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478747
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.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>
2020-01-16 09:10:38 +00:00
Seth Howell
7ed0904b9b lib/nvme: update trid struct with trstring.
The trtype should be stored as both an enum and string. This is intended to
help pave the way for pluggable NVMe-oF transports.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: I6af658d7a17c405e191ff401b80ab704c65497e7
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478744
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: Alexey Marchuk <alexeymar@mellanox.com>
2020-01-16 09:10:38 +00:00
Maciej Szwed
32a961fc5d bdev: Add check for atomic compare and write unit
Compare and write fused operation num_blocks should
not exceed value of 'atomic compare and write unit'.
In case of NVMe native support we should read this
value from 'namespace atomic compare and write unit'
if set in namespace identify data, otherwise from
'atomic and write unit' field in controller identify
data. If bdev does not support this natively we should
set this value to 1.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: Ib1ea02dbf9d1eed476d9dd0114ea96b1376e0c45
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477911
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-15 12:25:26 +00:00
Wojciech Malikowski
843f296e2e lib/ftl: Replace Open Channel dependencies with zone bdev API
This patch replaces NVMe Open Channel API usage
inside FTL library with corresponding zone bdev
API calls. This include following calls:
 - spdk_nvme_ctrlr_cmd_get_log_page -> spdk_bdev_get_zone_info
 - spdk_nvme_ocssd_ns_cmd_vector_reset -> spdk_bdev_zone_management
 - spdk_nvme_ns_cmd_read -> spdk_bdev_read_blocks
 - spdk_nvme_ns_cmd_write_with_md -> spdk_bdev_write_blocks

Change-Id: I1b5a6863d9ce72f4af1cfbb0e449fc1a5b638144
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479702
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2020-01-15 12:24:44 +00:00
Tomasz Zawadzki
1437b25472 lib/blob: make sizes of pages array consistent
Just to make all sizes consistent and less error prone.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Id0a21bbd45954a0f2317e0eefd3725f1542ef04f
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479961
Reviewed-by: Paul Luse <paul.e.luse@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>
2020-01-14 17:13:15 +00:00
Tomasz Zawadzki
eba7f9f5ea lib/blob: make sizes of cluster array consistent
Fixed size of check in _spdk_bs_snapshot_newblob_open_cpl().

Rest are just to make all consistent and more error prone.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I5a23a7795f1e598c1cfd6d17ce37b367f2f34df8
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479960
Reviewed-by: Paul Luse <paul.e.luse@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>
2020-01-14 17:13:15 +00:00
Tomasz Zawadzki
4b8db27b2a lib/blob: add _spdk_bs_md_page_to_lba() function internal to blobstore
The _spdk_bs_page_to_lba() [without 'md'] is only for translating the
pages on the blobstore to lba they are at. Those pages start at
the begining of the device and cover all of it. Thus simple
math is enough to translate those.
It is used to calculate lba_count for set of pages as well.

Meanwhile there are 'md_pages' which are the same pages as for
the above, but their count start at bs->md_start.
Which is right after super_block and couple pages for bit masks.

This patch creates new _spdk_bs_md_page_to_lba() that is more
explicit in what page number is passed. Hopefully avoiding
confusion when reading which page number refers to which
'type' of page.

Exception to the that is _spdk_bs_dump_read_md_page(), where
blobstore is not actually loaded (md_start from super block
is not copied to bs structure).

Additionaly providing assert to catch errors on debug builds.
Making the check in _spdk_blob_load_cpl() for max_md_lba obsolete.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I66bbca55b5ca3d6794c462d50177e6037ddbefa6
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479017
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-14 17:13:15 +00:00
Maciej Szwed
91dac0f4d0 bdev: Add num_retries field in bdev_io
Added new field in bdev_io structure for tracking
number of IO retries. It will be used in future patches.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I8e002e93f54c9ce39c7af0dd3a1960e6aea93580

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479828
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-14 07:51:45 +00:00
Jim Harris
ae43c81a30 bdev: add spdk_bdev_comparev_and_writev_blocks
We will only support a vectored variant of
compare-and-write for now.

This does no locking for now.  Ii will be added
in a separate patch.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I5bd075c912de60090e19cf8fced19c4879fcc900
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475941
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-14 07:51:45 +00:00
Michael Haeuptle
d9afeb150e lib/nvmf: preparation for custom admin cmd handler
This commit exposes some internal functions and enums
in preparation for the custom admin cmd handler functionality.

Signed-off-by: Michael Haeuptle <michael.haeuptle@hpe.com>
Change-Id: Iec15c1f3d9cba5db267f6e43f3d929cf382ca8f4
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476800
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-14 07:51:18 +00:00
Jim Harris
2a2b7296ee bdev: do not allow overlapped locked ranges
We can't allow overlapped locked ranges - otherwise
two different channels could be deadlocked.

So add a pending_locked_ranges to the bdev.  When we
start a lock operation, check if the new range overlaps
one that's already locked.  If so, put it on the pending
list.  When an unlock operation completes, we will
check if any pending ranges can now be locked.

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

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478537
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2020-01-14 07:50:26 +00:00
Jim Harris
ebd1a4f76c bdev: inherit locked ranges for new channels
Keep a mutex protected list of the active locked ranges
in the bdev itself.  This is only accessed when a new
channel is created, so that it can be populated with
the currently locked ranges.

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

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477871
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-14 07:50:26 +00:00
Jim Harris
b90b7ce477 bdev: queue new IO that overlap a locked region
Add an io_locked TAILQ to each channel, which hold
IO that will write to a currently locked region.

Also add a new step to the locking process per channel.
Each channel needs to wait until all existing outstanding
writes to the newly locked range have been completed.

Only the channel that locked an LBA range may submit
write I/O to it.  It must use the same cb_arg for the
write I/O as the cb_arg used when locking the LBA range.
This ensures that only the specific I/O operations needing
the lock will bypass the lock.

When a range is unlocked, we will just blindly try to
resubmit all IO in the io_locked tailq.  This could be
made more efficient in the future, but we don't expect
this path to occur very often, so going for simplicity
in the first pass.

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

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478226
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-01-14 07:50:26 +00:00
Jim Harris
d84a88c1a0 bdev: add base infrastructure for locked lba ranges
This adds new internal APIs bdev_lock_lba_range and
bdev_unlock_lba_range.  To start, these APIs will
manage dissemination of lock/unlock requests to all
existing channels for a given bdev.  This does not
yet interact at all with any I/O sent to the channel.

Future patches will check new I/O to see if they
are trying to write to a range that is locked.  Future
patches will also ensure we do not have overlapping
ranges active at once.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I6d5b1cc84b41a7adc2a3c5791c766bb77376581f
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478225
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-01-14 07:50:26 +00:00
Jim Harris
b87080efa2 bdev: add lba_range and overlapping checks
This will be used by upcoming patches for implementing
LBA range locks.

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

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478224
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
2020-01-14 07:50:26 +00:00
Changpeng Liu
f508f50a5e vhost: disable Waddress-of-packed-member for internal vhost library
When using internal vhost library, there is a warning information:
taking address of packed member of class or structure may result in
an unaligned pointer value [-Werror,-Waddress-of-packed-member].

DPDK disable this check by default, so we will do it same for
internal vhost library.

Change-Id: I6fb12d5f5339ccb03bb85196f9c100d0521e4620
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479501
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2020-01-13 12:43:16 +00:00
Changpeng Liu
2020418f2b vhost_nvme: fix one compilation issue
Commit 1a1cbdf30 changed the struct spdk_vhost_dev to have static
cpumask variable which broke the complilation.  This patch will
fix that.

Change-Id: I8d0ef90f491e4fc4f0fae6faff2909fd3bd68053
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479500
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-13 12:43:16 +00:00
Kozlowski Mateusz
db126b3ee1 lib/app: Change signal handler to use spdk_thread_send_critical_msg
Fixes deadlock when closing application with SIGTERM during call of
spdk_thread_send_msg.

Fixes #1105

Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
Change-Id: If191550f9681a30674fc9c0704289fcdb70b33cb
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478291
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-13 12:42:49 +00:00
Kozlowski Mateusz
907efcd7da lib/thread: Add spdk_thread_send_critical_msg function
The patch adds new interface for issuing messages during interrupts,
such as signal handlers. Without this, it'd be possible to deadlock
the application, as two different messages could be trying to enqueue to
the same ring, in the same call stack.

Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
Change-Id: I917aa41b7f3415af7c7a7d5fa91b964d727609b6
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478290
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-13 12:42:37 +00:00
Jim Harris
a828415390 nvme: add spdk_nvme_ctrlr_cmd_get_log_page_ext()
This new function allows specifying some of the extra
cdw10, cdw11 and cdw14 bits added in the more recent
versions of the NVMe specification.

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

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479737
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>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
2020-01-10 08:46:33 +00:00
Changpeng Liu
5e35808033 virtio_user: use correct #ifndef for the internal vhost.h header
Change-Id: I4a3f53ef76ea909abee6a523a3f86a01813444f2
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478413
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-10 08:45:45 +00:00
Changpeng Liu
b6cab776f3 virtio_user: remove unused included header file
Change-Id: I905f02008326ea81b747df4559f82ea3def33b3e
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478412
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-10 08:45:45 +00:00
Changpeng Liu
060d9b85bf virtio: remove unnecessary included header file
SPDK virtio library was first developed based DPDK virtio_net library, since
we will maintain this library in SPDK now, so we will remove the direct call
to DPDK library here.

Change-Id: I6a9121a13fcac0ba49563956cf347fb9ad0f9845
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478410
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-10 08:45:45 +00:00
Changpeng Liu
10b84535f8 virtio_user: add missed socket protocol debug messages
We do sent the two missed socket messages when running virtio_user.

Change-Id: Ie19fccf6414c2aa42b70fecb6ba02b2a1ee46dd5
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478408
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>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2020-01-10 08:45:45 +00:00
Wojciech Malikowski
0637e2d9be lib/ftl: Rename ftl_dev_num_bands() to ftl_get_num_bands()
This patch is part of name refactoring associated
with moving FTL to work with zone bdev API.

Change-Id: Ia4c6ec7b245600bca895f7802fb7f68c8d0400e4
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479845
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
2020-01-10 08:42:51 +00:00
Wojciech Malikowski
2c2a005695 lib/ftl: Rename ftl_dev_num_punits() to ftl_get_num_punits()
This patch is part of name refactoring associated
with moving FTL to work with zone bdev API.

Change-Id: I9e0a569e9dfd0e8b8236c0840ce10b92362c4996
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479844
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
2020-01-10 08:42:51 +00:00
Wojciech Malikowski
3ff9d6e45b lib/ftl: Rename ftl_dev_lbks_in_zone() to ftl_get_num_blocks_in_zone()
This patch is part of name refactoring associated
with moving FTL to work with zone bdev API.

Change-Id: I09f671a9c6539cc259c297514b24978587c9b392
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479673
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
2020-01-10 08:42:51 +00:00
Wojciech Malikowski
3725b4484a lib/ftl: Rename ftl_num_band_lbks() to ftl_get_num_blocks_in_band()
This patch is part of name refactoring associated
with moving FTL to work with zone bdev API.

Change-Id: I09781323b2ee25dbcee61eecf95ce7eca703ab93
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479672
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
2020-01-10 08:42:51 +00:00
Wojciech Malikowski
2ff623b504 bdev/ftl: spdk_ftl_module_(init|fini) are not longer needed
There is no need for spdk_ftl_module_(init|fini)
after ANM functionality was removed from FTL lib.

Change-Id: Id8d05aed8620217869c56fca35b490bc9c716541
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472335
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2020-01-10 08:42:51 +00:00
Wojciech Malikowski
988759501d lib/ftl: ANM logic removal
ANM logic should be moved to ocssd bdev.
This patch temporarily disables ANM handling
by FTL library. New ANM handling mechanism will
be introduced in future patches.

Change-Id: I7d0261ee4e42496f60b82fbf6b39d9f84690024f
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468784
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2020-01-10 08:42:51 +00:00
Wojciech Malikowski
1735a0acd3 lib/ftl: Remove position from ftl zone structure
There is no need of tracking position of zone inside
band.

Change-Id: I1488f23ccfd1f7eee1bd85fdb7ef8ace08ffca40
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468347
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>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
2020-01-10 08:42:51 +00:00
Wojciech Malikowski
04f754d419 lib/ftl: Remove ftl_punit structure from device
ftl_punit is not needed anymore.

Change-Id: I90f22b980f8e0436e8c899941dddb20b13167766
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468346
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>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
2020-01-10 08:42:51 +00:00
Wojciech Malikowski
7ef136d3f4 lib/ftl: Remove punit from ftl_zone struct
Parallel unit is not needed anymore in ftl_zone
structure.

Change-Id: Ie8d78e3ccf64db84aff19ad2ce11e662d4f3f724
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468345
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-10 08:42:51 +00:00
Wojciech Malikowski
aea8e78df2 lib/ftl: Consume whole underlying OCSSD device
Moving to zoned bdev API will not allow to setup
physical range of underlying device so we need to
remove such capabilities from ftl device.

Change-Id: Ia807a11e992a221fce906d4ab122a6c3b1391280
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467949
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2020-01-10 08:42:51 +00:00
Wojciech Malikowski
52a9661d94 bdev/ftl: Remove punit parameter from ftl bdev configuration
FTL library is consuming whole OCSSD device
so punit parameter is not needed for bdev ftl
configuration.

Change-Id: I56f62ea6d09b3157b70c02ccfffcd3cb07ba4597
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467950
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
2020-01-10 08:42:51 +00:00
Wojciech Malikowski
e47e16d3a4 lib/ftl: Replace ftl_ppa struct with ftl_addr
FTL working on top of zoned bdev doesn't need
physical page address (PPA) anymore.
ftl_ppa was replaced with ftl_addr which represents
zoned device addressing schema.

Change-Id: Ied5750a7ab2f4ce42067ff3e69c1f26f85f5022a
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467633
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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
2020-01-10 08:42:51 +00:00
Wojciech Malikowski
748785c2a9 lib/ftl: Change ftl_ppa fields to be zone specific
Remove some Open Channel dependencies from ftl_ppa struct.

Change-Id: Ic088b84c56a928906c6c01c6ef74e69be6d0107f
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479549
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-10 08:42:51 +00:00
Wojciech Malikowski
7083fa3e35 lib/ftl: Remove group from ftl physical address
ftl_ppa address do not need to expose group
information when FTL will move to zones API.

Change-Id: Iece1b32f9bcd8985260668c953089eb9951f13cc
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467603
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
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: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2020-01-10 08:42:51 +00:00
Ben Walker
d31eb732af nvmf/tcp: Allocate pdu pool out of hugepages
It is faster for the kernel to pin memory in hugepages, so allocate
the pdu pool from hugepages. This will help more
with upcoming changes to leverage MSG_ZEROCOPY.

Change-Id: I9ce581acca9c6edb71bd8119258966e3b405db77
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475801
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
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: Or Gerlitz <gerlitz.or@gmail.com>
2020-01-08 15:47:08 +00:00
Ben Walker
053fa66b10 nvmf/tcp: Minimize the places where the tqpair state changes
All transitions to the EXITING state go through the disconnect function
now

Change-Id: Ia55816351b2998bfef26130b6ffdc4a1010567a1
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470533
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-08 15:47:08 +00:00
Ben Walker
04a4aab2e0 nvmf/tcp: Simplify handling of spdk_nvmf_tcp_pdu_get failures
This function can't actually return NULL. It aborts if we get
our math wrong.

Change-Id: Iaf77112addc3c14c70755a56043c5dba3427890d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478911
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-08 15:47:08 +00:00
dongx.yi
f7e8827aa6 nvmf/tcp: Using spdk_min instead of multi-lines codes.
We can use spdk_min to get the copy_len in spdk_nvmf_tcp_send_c2h_term_req.
It confirms copy_len it's not larger than SPDK_NVME_TCP_TERM_REQ_ERROR_DATA_MAX_SIZE

Signed-off-by: dongx.yi <dongx.yi@intel.com>
Change-Id: Id343928e1911e4ab77fca7463f3f0cc55889db30
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479118
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
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>
2020-01-08 09:12:20 +00:00
Maciej Szwed
f76713837e nvme: Add spdk_nvme_ns_supports_compare function
This function returns information if compare
operation is supported by device.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I321e9bf6d146ac8d14ea4549cb4380735b30be6f

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477925
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: 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>
2020-01-07 12:31:32 +00:00
Maciej Szwed
b95de9a3ca nvme: Add SPDK_NVME_NS_COMPARE_SUPPORTED flag
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I24d09cbe21cd2694b4c3433a365dffe75cda2fa8

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477924
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: 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>
2020-01-07 12:31:32 +00:00
Maciej Szwed
f8d024b8c1 bdev: Add support for compare operations
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I45b99abe1ed760aa59785e5c4b4f71917e1f92c3
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477458
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: 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>
2020-01-07 12:31:32 +00:00
Maciej Szwed
c7092e2b3a nvme: Add spdk_nvme_ns_cmd_comparev_with_md function
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I7eb89412673e01d9c84cb258f5152a31253d7a7f

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477025
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2020-01-07 12:31:32 +00:00
Maciej Szwed
334aeff9e1 nvme: Don't ring a doorbell for first of fused commands
This patch adds first_fused_submitted field in spdk_nvme_qpair
structure which is used for postponing ringing a doorbell for
fused commands.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: Ibfc43931891ebaadbafa4895c05af9f228440210

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477024
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: 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>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2020-01-07 12:31:32 +00:00
Tomasz Kulasek
1c5d980300 lib/nvme: add hw support for fused operations
Change-Id: I2a184a2d60f18439947afa2d4855d51b92ed282e
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/476137
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2020-01-07 12:31:32 +00:00
Seth Howell
8209c8cfa0 lib/nvmf: rdma qpairs now store device, not port.
The only reason the qpair ever uses the port is to get to
the device attributes so skip the middle man.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: Ib14a97ceaa0c49176027d6c35c5cb2787a845cc1
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478961
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-07 12:21:36 +00:00
dongx.yi
f591667964 virtio: Close fds when abnormal return.
Here should add close(kickfd) and close(callfd) when abnornal
return of failed to send VHOST_USER_SET_VRING_ENABLE.
Do this as the same with upper abnormal return.

Signed-off-by: dongx.yi <dongx.yi@intel.com>
Change-Id: Ic61fc3f398f582f64da6b3f6ca7e237a3d411a8f
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479123
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
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>
2020-01-07 12:21:20 +00:00
Jacek Kalwas
2eda83904b nvmf/ctrlr: abort cmd for set features with save bit set
Features are not saveable by the controller as indicated
by ONCS field of the Identify Controller data.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I7e5bc2c701f5857e2c1481e8370b070089f88111
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479128
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-07 12:21:03 +00:00
GangCao
be4a5602ce blobfs: write IO directly if it is lba aligned
UT also added for the block aligned write and verification
of the written data.

Change-Id: I8751f437c71dd7f3a4556fee420460d6dffdd4e5
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478424
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-07 12:19:14 +00:00
Jacek Kalwas
5df1966375 nvmf/ctrlr: improve debug info
It is useful to have sct and sc on request completion explicitly.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: If429123589694ba36111330699fee22238f8a557
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478602
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>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-07 12:18:14 +00:00
dongx.yi
3cf37bbfbc vhost: Inline the calculation of vhost session memory region.
There are for loops to do these calculations for vhost session memory region.
we can inline these for both in vhost_session_mem_register and
vhost_session_mem_unregister.

It not only removed the duplicated codes but also reduced the stack consumption.

Signed-off-by: dongx.yi <dongx.yi@intel.com>
Change-Id: Idb9f5ea13e09aef6b24fa27a2bb809b15ece50e2
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478820
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: 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>
2020-01-07 12:17:55 +00:00
Vitaliy Mysak
1a5d78e32e iscsi: replace fprintf by SPDK_LOG
Replace usage of fprintf(err, *MSG*) by SPDK_ERRLOG(*MSG*)
since in SPDK we always prefer later

Change-Id: I3e2b5c12caa572b32236f5ede01b754b2e1e2a53
Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478940
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-07 12:17:19 +00:00
Tomasz Zawadzki
20c74e0c71 lib/blob: do not zero out cluster map for snapshot blob
Always when creating a snapshot, new blob is created.
That blob is explcitly set as thin provisioned with size of
the original blob in _spdk_bs_snapshot_origblob_open_cpl().

Thus it should always contain empty cluster map,
as API user has to interaction with it yet.

As sanity check for debug builds, verification if all clusters
are 0's is added.

This empty cluster map is later swapped into the original blob
in _spdk_bs_snapshot_swap_cluster_maps().

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I4b935c0cf08917e9ad7b9bbedac4781890626eec
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478974
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-07 12:16:43 +00:00
Tomasz Zawadzki
44502e4293 lib/blob: simplify loading snapshot completion
Refactor blob loading when snapshot is present.
All paths now go through _spdk_blob_load_final().

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ifc927de6800501cdf62dba8d73e950af2a46d568
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479143
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-07 12:16:43 +00:00
Tomasz Zawadzki
42432d49dd lib/blob: all error paths on blob load use _spdk_blob_load_final()
Since all error paths for blob load are now the same,
they can go through common function to handle
freeing and calling the original cb.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ib3afc7e62b6f9c872bb1d5f72ef61170aee966d7
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479142
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-07 12:16:43 +00:00
Tomasz Zawadzki
e7b3be98a6 lib/blob: always pass cb_arg on blob load failure
Originally the code was suposed to determine if
loading the blob succeeded, based on passing the
cb_arg.
This breaks the logic of always getting the cb_arg in
cb_fn, and basing the success on bserrno.

In order to fix this, cb_fn always gets the passed
cb_arg. Meanwhile the cb_fn (_spdk_bs_open_blob_cpl(),
now checks the bserrno to determine failure.

In addition since _spdk_bs_open_blob() was the original
caller allocating the blob structure,
the  _spdk_bs_open_blob_cpl() is now responsible for freeing it.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ic7eb09f05e04b08dc54fc43243fd576f493cbeb2
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479141
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-07 12:16:43 +00:00
Tomasz Zawadzki
3225f86bc2 lib/blob: save the sequence much earlier into blob load
The sequence was saved into the load context much later
into the loading, instead of right when ctx is allocated.

This will come in handy in later patches that refer to
sequence earlier (in error paths).

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ibe513dbd919f36874fcde763fc96d46973b60446
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479140
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-07 12:16:43 +00:00
Ben Walker
dd7cd80c6d env/dpdk: Detect DPDK's iova mode
Match DPDK's iova assignment strategy so there are never
any conflicts.

Change-Id: I3863487f9bd247c40edbf0d0d3a8c880bdad1708
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477362
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-07 12:14:56 +00:00
Shuhei Matsumoto
25c5e3f59d lib/event: Rename context switch monitoring APIs to be concise
spdk_reactor_enable_framework_monitor_context_switch and
spdk_reactor_framework_monitor_context_switch_enabled had been
a little long and not easy to get the meaning.

spdk_framework_enable_context_switch_monitor and
spdk_framework_context_switch_monitor_enabled will be a little
more concise, and hence change the names accordingly.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5f1d50e8b62846cbd0f91b94f94cbaf16fefa39b
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478538
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2020-01-03 08:33:25 +00:00
Shuhei Matsumoto
abbd6ed864 lib/event: Make spdk_reactor_get public in SPDK internal
Following the last patch, this is also a preparation to add
reactor_get_stats RPC.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I18c260bb10bdf1c7aa5e00aa81a171f2ff50c7d5
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478026
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-01-03 08:33:25 +00:00
Shuhei Matsumoto
653dbcb185 lib/event: Make reactor structure public in SPDK internal
Following the last patch, this is also a preparation to add
reactor_get_stats RPC.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ia6dc29f591f7112512be8a67b180b056150f467b
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478025
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2020-01-03 08:33:25 +00:00
Shuhei Matsumoto
60eb6da8b7 lib/event: Add spdk_for_each_reactor to process event for each reactor
This API will be used in the upcoming reactor_get_stats RPC first.
This API is not public but internal in SPDK. Add necessary unit test
together.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I761ffe3c8d6d8da4594c0d728b479f9f40275fc9
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478024
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
2020-01-03 08:33:25 +00:00
Shuhei Matsumoto
16ea979d71 lib/event: Check if reactor scheduled thread to the correct core
Add check if reactor scheduled the thread to one of the allowed
cores correctly to _schedule_thread().

This check will be useful in the next patch and may be helpful
when we schedule SPDK thread dynamically.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ibea8e8315187ae8a3a421007d8865bbee2d7e037
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478156
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2020-01-03 08:33:25 +00:00
Shuhei Matsumoto
040339550c lib/event: Use local cpuset instance in spdk_app_start()
Following the recent effort, use local instance of cpuset instead
of using cpuset pointer and allocating dynamically to it in
spdk_app_start().  This change will avoid potential out of memory
failure for application startup too.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I22b529da13e893db16296167f2d8d4c296dec31f
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478580
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-03 08:32:38 +00:00
Shuhei Matsumoto
87a4630b96 lib/vhost: Allocate cpumask statically for poll group assignment
Following the recent effort and the last patch, allocate g_tmp_cpuset
statically in lib/vhost/vhost.c.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5ed6179f9d5942cd868be008c3be6c35d755b455
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478579
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-03 08:32:38 +00:00
Shuhei Matsumoto
1a1cbdf303 lib/vhost: Allocate cpumask statically for struct spdk_vhost_dev
Following the recent effort, allocate struct spdk_cpuset statically
for struct spdk_vhost_dev. In vhost_dev_register(), a dynamically
allocated  cpumask had been set to spdk_vhost_dev, but change it
to spdk_cpuset_copy().  So use local cpuset instance in vhost_dev_register()
accordingly.

To reduce the size of patch, this patch doesn't include the change
for g_tmp_cpuset. This will be done by the next patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ic97753d1f470cbfd9ae7fc7f2af8ced5a31c8477
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478578
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2020-01-03 08:32:38 +00:00
Jacek Kalwas
5b87daa92f nvmf/tcp: remove redundant memset
Minor optimisation done by code analysis, both cmd and dif are
overridden in TCP_REQUEST_STATE_NEW.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I6bae4ddae175035d029c0693f7e4351b95a296ab
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478604
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-01-03 08:31:52 +00:00
GangCao
66af6221a0 bdev: check whether memory allocated already
In the case of bdev initialization, the memory could
not be allocated. When cleaning up, it needs to check
whether the memory pointer is valid or not before
touching the address of the pointer.

This is to fix below issue:
https://github.com/spdk/spdk/issues/1126

Change-Id: Iec0e2c5a40ad153a96fb939414a15ac3b9112a01
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478849
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: <box.b.chen@intel.com>
Reviewed-by: yidong0635 <dongx.yi@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-12-30 11:49:54 +00:00
Jin Yu
cb8621eb95 nvmf: add keep alive cmd in discovery subsystem
The discovery target support the keep alive timeout so
it should also support the keep alive cmd.

Change-Id: I08bd3312c17962c97c96fdd1469246fe97d5e8e7
Signed-off-by: Jin Yu <jin.yu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478016
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: yidong0635 <dongx.yi@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: GangCao <gang.cao@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2019-12-30 11:48:44 +00:00
Jin Yu
b8d72590b3 vhost: spdk live recovery from crash or killing
This patch is for the vhost-blk live recovery feature
which can make spdk recover from crash or killing.
The relate rte_xx functions are in the the shared memory
protocol patches which have been merged in DPDK 19.11.

Change-Id: Ia0ac99f8ba0bd66dc9f525f2c72bd1de141ec596
Signed-off-by: Li Lin <lilin24@baidu.com>
Signed-off-by: Ni Xun <nixun@baidu.com>
Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
Signed-off-by: Jin Yu <jin.yu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471235
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2019-12-30 11:46:24 +00:00
Jin Yu
f29d20a21e vhost: add a protocol_features parameter in vdev
Add the protocol_features in vdev. There are two features
would be used in vhost device one is the virtio_features
the other is the vhost-user protocol_features. For different
vhost device, the supported features are different so we can
separate them.
Another reason is that I tested the VHOST_USER_PROTOCOL_F_
INFLIGHT_SHMFD in vhost-scsi with QEMU(version:4.0) and found
that Qemu can not boot up. After investigating found that inflight
flag is negotiated but the Qemu doesn't support this feature
and in DPDK function it is handled as an error and disconnect
with Qemu. It's a bug in DPDK and will fix it.

Change-Id: I72e418cb1885bf7dcbd0285d9cec1ad6af0665de
Signed-off-by: Jin Yu <jin.yu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478814
Community-CI: 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: GangCao <gang.cao@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-12-30 11:46:24 +00:00
Anil Veerabhadrappa
d48776401c nvmf/fc: fix FC compilation error
Recent effort to unify NVMe NQN length macro replaced
'FCNVME_ASSOC_HOSTNQN_LEN' with 'SPDK_NVME_NQN_FIELD_SIZE' in
include/spdk/nvmf_fc_spec.h. This change updates the downstream files
which are also affected by the change.

Signed-off-by: Anil Veerabhadrappa <anil.veerabhadrappa@broadcom.com>
Change-Id: I44e1de50067e11fabacbb69cf1c42331f3339bc8
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478769
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2019-12-30 11:45:24 +00:00
Jim Harris
58938d09bf env_dpdk: fix DPDK 18.05 legacy-mem check
In this case, we want to add --legacy-mem if it was
not already specified.  This means we need to check
if strstr() returned NULL.

Reported-by: Alok Kataria <alok.kataria@nutanix.com>
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ib99dd015ce6e3ee824e4b543a8379d7291e2671e

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478634
Reviewed-by: <alok.kataria@nutanix.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
2019-12-30 11:44:54 +00:00
Ziye Yang
7961de4341 lib/ioat: Fix the error message when enabling ioat during application shutdown.
The printed error message could be the folowing example.

Device 0000:00:04.0 is still attached at shutdown!
Device 0000:00:04.1 is still attached at shutdown!
Device 0000:00:04.2 is still attached at shutdown!
Device 0000:00:04.3 is still attached at shutdown!
Device 0000:00:04.4 is still attached at shutdown!
Device 0000:00:04.5 is still attached at shutdown!
Device 0000:00:04.6 is still attached at shutdown!
Device 0000:00:04.7 is still attached at shutdown!
Device 0000:80:04.0 is still attached at shutdown!
Device 0000:80:04.1 is still attached at shutdown!
Device 0000:80:04.2 is still attached at shutdown!
Device 0000:80:04.3 is still attached at shutdown!
Device 0000:80:04.4 is still attached at shutdown!
Device 0000:80:04.5 is still attached at shutdown!
Device 0000:80:04.6 is still attached at shutdown!
Device 0000:80:04.7 is still attached at shutdown!

I think this issue exists a long time in our CI pool.
And the root cause is: "spdk_pci_device_detach" function
is not called in "ioat_channel_destruct".

This patch should solve this issue.

Change-Id: I47b3f1104a407c5b8390c9389c2f231ae018d16a
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478837
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>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-12-30 03:09:01 +00:00