Commit Graph

1223 Commits

Author SHA1 Message Date
Changpeng Liu
62bb65289d nvme: change retry count can be configured via bdev nvme driver
Also eliminate 'spdk_nvme_retry_count' finally.

Change-Id: I2f3e390e4b8a49208a11b54bb82c4891cf3e1845
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/464473
Reviewed-by: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-08-09 00:44:50 +00:00
Ben Walker
39e850d17b iscsi: Remove cpumask from portals
Connections will soon be assigned to poll groups, which will be
dynamically moved between CPU cores based on load. It no longer makes
sense to restrict certain portal groups to specific cpu cores in this
model.

Change-Id: Iee983d75febc9797aa60021c5bc0680335e895cd
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463358
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-08-08 05:35:01 +00:00
Shuhei Matsumoto
cf95d4a24f sock: Fix return value of spdk_sock_group_poll to return number of events
spdk_sock_group_poll() and spdk_sock_group_poll_count() had returned
0 on success. The implementation didn't match the specification
described in the header file, and couldn't be used to collect stats
correctly because 0 means idle.

This patch fixes the return value of spdk_sock_group_poll() and
spdk_sock_group_poll_count() to return number of events and
the callers not to overwrite the return value by 0.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I7e2a17187fc74ea44d3acf2f35d63f5e5a254eda
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463710
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-08-02 00:19:43 +00:00
Anil Veerabhadrappa
ed56a3d482 NVMe-oF Target: Add FC transport.
- New files and updates to existing SPDK files to add the NVMf-FC transport.
  - Depends on an existing low level driver library. This driver is not part of SPDK repository.
  - Makefile updates to build FC transport (using CONFIG_FC)
  - Update configure script for FC build.
  - New FC unit test for FC-LS commands.
  - Update unittest.sh to run FC unit test (when built).

Signed-off-by: John Barnard <john.barnard@broadcom.com>
Signed-off-by: Anil Veerabhadrappa <anil.veerabhadrappa@broadcom.com>
Change-Id: If31d4d25feab76c2dbe90a7faf71d465c2c3a354
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450077
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-07-26 22:17:17 +00:00
paul luse
ca1a3bf18e bdev/compress: use base bdev alias as base for comp_bdev name
If available, if not use the bdev unique name. This results in
a much friendlier comp_bdev naem for the user.  For example,
now it would look something like this: COMP_lvs0/lvs as opposed
to like this COMP_0b149b31-b66b-4cf7-ab39-a55b50788cd1

Change-Id: I319a141221ed8880edcec930ca5be9f256b105e0
Signed-off-by: paul luse <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463246
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>
2019-07-26 19:47:33 +00:00
Darek Stojaczyk
ba3db1d2ea ut/nvme: silence scan-build warnings about null dereference
nvme_ut.c:755:2: warning: Dereference of null pointer
        TAILQ_REMOVE(&probe_ctx.init_ctrlrs, dummy, tailq);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/jenkins/workspace/Other/unittest_autotests/spdk/include/spdk/queue.h:62:6:
note: expanded from macro 'TAILQ_REMOVE'
        if (((elm)->field.tqe_next) != NULL)

Change-Id: I8ee6a476f2658668304e182a6c8cff4d79ae2f40
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463257
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@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>
2019-07-26 17:47:34 +00:00
Darek Stojaczyk
b701087f87 ut/bdev: silence scan-build warnings about garbage value comparison
bdev_ut.c:1300:17: warning: The left operand of '!=' is a garbage value
        CU_ASSERT(desc != NULL);
                  ~~~~ ^

Change-Id: Ie87cd4d7218a380e61616a83f3a9bceccc0798cb
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463258
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@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>
2019-07-26 17:47:34 +00:00
Darek Stojaczyk
26f6c2a03d ut/bdev: silence scan-build warnings about histogram memory leaks
bdev_ut.c:1863:2: warning: Potential leak of memory pointed to by
'histogram'
        poll_threads();
        ^~~~~~~~~~~~~~

We used to free g_histogram instead of histogram. Those
should be the same thing, but scan-build gets confused.

Change the code to free histogram - this should also make
it slightly easier to read.

Change-Id: Ifaad1c2d9c7f9cc1a106f6edf3d22b54e42fe867
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463256
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@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>
2019-07-26 17:47:34 +00:00
Tomasz Zawadzki
99b25f1c98 ut/cunit: added missing semicolon on CU_ASSERT macros
This was inconsistent on all CU_ASSERT macros,
so now it is fixed.

Change-Id: I6d20f98528c4041baf02cb419ab9644a45b807c4
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459760
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-24 18:21:22 +00:00
Changpeng Liu
3fe300609e nvmf: check HOSTNQN access right for discovery service
Initiator can use `nvme discover` command to display all
the subsystem's information, because we don't check
the allowed HOSTNQN for Discovery service, so here
adding this feature so that only return the log pages
to the allowed hosts.

Fix issue #576.

Change-Id: I51e6770bd67ea0b41caf9de3a8899923377e6255
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/462440
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: yidong0635 <dongx.yi@intel.com>
2019-07-24 11:25:59 +00:00
Darek Stojaczyk
34cdf61f80 ut/nvme: add missing probe_ctx.init_ctrlrs tailq initialization
Detected by scanbuild, but it's actually a programming
error. It could make the failed test segfault instead
of cleanly printing the total number of failures.

Change-Id: I12f4bc2b1ccd2034251c1840381875d51708c6fb
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/462871
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: yidong0635 <dongx.yi@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-07-23 22:56:23 +00:00
Darek Stojaczyk
bc6a51aaff ut/ftl_reloc: silence scan-build errors
Scan-build thinks we do TAILQ_REMOVE on an element that's
not in the tailq. Add fatal asserts to prove it wrong.

Change-Id: Ie5d999c2772d42e471cd4c9a11a6f3d2125cb0bc
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/462870
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: yidong0635 <dongx.yi@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-23 22:56:23 +00:00
yidong0635
3e19963297 nvme_qpair_ut: Fix scanbuild warning about using freed memory.
Issue reports:
spdk/test/common/lib/test_env.c:103:2: warning: Use of memory after it is freed
        HANDLE_RETURN_MOCK(spdk_zmalloc);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
spdk/include/spdk_internal/mock.h:106:3: note: expanded from macro 'HANDLE_RETURN_MOCK'
                return ut_ ## fn; \
                ^~~~~~~~~~~~~~~~
1 warning generated.

Here includes test_env.c. That spdk_zmalloc will call HANDLE_RETURN_MOCK ,that leads
requesting memory in functions which call spdk_zmalloc(including nvme_qpair_init/
spdk_nvme_qpair_add_cmd_error_injection) failed.

Change-Id: I6c14dfd2fc7b7078a18a46ef8ff830f85940487e
Signed-off-by: yidong0635 <dongx.yi@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/462822
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-23 04:50:29 +00:00
Mateusz Kozlowski
a3c78e150b lib/ftl: Remove separate dma_buf allocation in band
Since 4k alignment is no longer required for I/O buffers, the
band doesn't need a separate lba map and dma buffer and can use the
same memory location.

Signed-off-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Change-Id: Iea127e8c2f39e6de5d57258098b2dc6be56f439f
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/462042
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-23 04:00:05 +00:00
yidong0635
e3b90fe2d5 bdev: Fix warning about potenial memory leak about histogram.
Pointer passthrough g_histogram and histogram implicitly ,but the checker
still complains about this, change to spdk_histogram_data_free(histogram)
directly, no need any assert any more.

bdev_ut.c:1486:2: warning: Potential leak of memory pointed to by 'histogram'
        poll_threads();
        ^~~~~~~~~~~~~~
1 warning generated.

Change-Id: I609c1c92643ad03b8e3c62cd8434882e7942efa4
Signed-off-by: yidong0635 <dongx.yi@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/462789
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-23 03:50:05 +00:00
yidong0635
2ab927030d bdev/vbdev_lvol: Fix scanbuild error about Null poniter parameter.
Issue reorts:
vbdev_lvol_ut.c:97:7: warning: Null pointer passed as an argument to a 'nonnull' parameter
                if (strncmp(alias, tmp->alias, SPDK_LVOL_NAME_MAX) == 0) {
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Change-Id: I0cc95c735ea7486263842f91a5866710f9ff61a5
Signed-off-by: yidong0635 <dongx.yi@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/462598
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-23 00:17:25 +00:00
yidong0635
a1de2fe007 compress: Clear some simple scanbuild errors.
On Fedora30, GCC9+ reports errors:
Issues report:
vbdev_compress.c:482:17: warning: Assigned value is garbage or undefined
        comp_op->m_src = src_mbufs[0];
                       ^ ~~~~~~~~~~~~
vbdev_compress.c:502:17: warning: Assigned value is garbage or undefined
        comp_op->m_dst = dst_mbufs[0];
                       ^ ~~~~~~~~~~~~
vbdev_compress.c:491:3: warning: 1st function call argument is an uninitialized value
                rte_pktmbuf_attach_extbuf(dst_mbufs[iov_index],

compress_ut.c:826:2: warning: Attempt to free released memory
        free(g_mbuf_mp);
        ^~~~~~~~~~~~~~~
Should remove free(g_mbuf_mp), for pointer exchange.

Change-Id: I1a48b7c309a4e2aa0aa513f9be44ae3504d9e385
Signed-off-by: yidong0635 <dongx.yi@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/462574
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-22 14:10:32 +00:00
Changpeng Liu
e27421b344 nvme: fix req leaks
There are many req leaks when a controller failure
occurs during submitting IO. It must free all of
the children before freeing the parent req.

If a part of the child req has been sent to the back end
and a part of the child req fails, removes the failed req
from the parent req and the parent req must be retained,
freeing the parent req after all of the submitted reqs return.

Change-Id: Ieb5423fd19c9bb0420f154b3cfc17918c2b80748
Signed-off-by: Huiming Xie <xiehuiming@huawei.com>
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461734
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-22 04:15:34 +00:00
Changpeng Liu
c4f7c1bc2a nvme: put child I/O helper functions in nvme_internal.h
Existing children split functions defined in nvme_ns_cmd.c can
also be used in nvme_qpair.c to free children requests with error
paths.

Change-Id: I640b32884424709da67ee89ff780c2de45acc54c
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461372
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-22 04:15:13 +00:00
Pawel Kaminski
a15dcb0bf0 jsonrpc: always allocate response for request
We already have send buffer allocated. This will greatly improving code
as we guarantee by design that there is always JSON write context
object.

Change-Id: Id487c01448e1a65d9d4ef76d40a2a9f178b2f570
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459341
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-19 20:56:54 +00:00
Ziye Yang
6ad6a1131b nvmf/tcp: Add a feature to allow set the sock priority of the connection.
This priority is used to differentiate the sock priority on the TCP connections
between  NVMe-oF TCP target and other TCP based applications.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I6ee294e647420b56d1d91a07c2e37bf34ce24e03
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461801
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-19 06:30:19 +00:00
Darek Stojaczyk
fa3e0a68c1 ut: move all spdk_env_* mocks to test_env.c
Cleanup.

Change-Id: If6c24ef6fcea5531007e6d4f10ee896939ffaa12
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460906
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-18 04:21:08 +00:00
Ziye Yang
ecb4ea90ce sock: Add the socket priority setting function.
Purpose: This API can be used to set the socket
with different priority.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I9df1122bf6ae640eba731e635a1784f4e9da4104
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461738
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-18 04:09:37 +00:00
Changpeng Liu
23fcc697e5 UT/nvmf: use /tmp directory as the reservation persist file
Existing code using /var/log directory can't work with non-root
users, so change to /tmp directory instead.

Fix issue #859.

Change-Id: I270a41d29ad5bafa522540e8bbbcfe83536823ae
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461774
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
2019-07-17 01:15:36 +00:00
Darek Stojaczyk
966cf5b525 ut/ftl: switch to spdk_*malloc().
spdk_dma_*malloc() is about to be deprecated.

Change-Id: Ia42621f3b51d276a1a13960e1f35274bdff79007
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459562
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: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2019-07-16 10:51:47 +00:00
Darek Stojaczyk
4617707d07 reduce: switch to spdk_*malloc()
spdk_dma_*malloc() is about to be deprecated.

Change-Id: I140e10b2fd07efb48e664cfa00e1d60f604abd21
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449797
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-16 10:51:47 +00:00
Darek Stojaczyk
67066ade3c ut/nvme: switch to spdk_*malloc().
spdk_dma_*malloc() is about to be deprecated.

Change-Id: I305914637ce6ad5d95cce9eb2cf4049e67969a1c
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459561
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-16 10:51:47 +00:00
James Bergsten
5acf617c6e nvme: add functions to pretty-print commands and completions
This change attempts to address the Trello request to decode I/O errors in
NVMe hello_world example.

See https://trello.com/c/MzJJw7hM/2-decode-io-errors-in-nvme-helloworld-example

As part of this change, spdk_nvme_cpl_get_status_string was declared
in nvme.h, and spdk_nvme_qpair_print_command and
spdk_nvme_qpair_print_completion were renamed and added to nvme.h,
allowing all three to used "externally."

To test the failing paths, two compile time defines were added to force a
write or read error (bad LBA) respectively.

As the example does a read after write, if the write fails, the example fails.

Signed-off-by: James Bergsten <jamesx.bergsten@intel.com>
Change-Id: Ib94b4a02495eb40966e3f49517a5bdf64485538a
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457076
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-15 07:47:03 +00:00
Tomasz Zawadzki
6ced601526 lib/blob: only validate blobid of first page during bs_load
Blob id only is matched to the very first page of md for
that particular blob.

During loading blobstore, we shouldn't verify
further pages in chain against the blobid.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ifc7863ddcb403aedc264c14e6b4c3915bd30dc41
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460607
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2019-07-15 04:22:23 +00:00
Konrad Sztyber
0f0af48009 lib/ftl: keep reloc traffic out of non-volatile cache
Moving data from one band to the other doesn't need to be stored on the
non-volatile cache. Not only does it add unnecessary traffic to the
cache (wearing it out and reducing its throughput), but it requires us
to synchronize it with user writes to the same LBAs.

To avoid all that, this patch adds the FTL_IO_BYPASS_CACHE flag to all
writes coming from the reloc module. However, to be sure that the moved
data is stored on disk and can be restored in case of power loss, we
need to make sure that each free band have all of its data moved to a
closed band before it can be erased. It's done by keeping track of the
number of outstanding IOs moving data from particular band
(num_reloc_blocks), as well as the number of open bands that contains
data from this band (num_reloc_bands). Only when both of these are at
zero and the band has zero valid blocks it can be erased.

Change-Id: I7c106011ffc9685eb8e5ff497919237a305e4478
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458101
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-12 12:39:38 +00:00
Changpeng Liu
5f5a5d4a58 UT/nvmf: add set/get features with persistent reservation tests
Change-Id: I2f2f948fc41c5dd0ccb49f469e052a5bf3173d6c
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456447
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-12 02:09:20 +00:00
Changpeng Liu
3cd328d4c0 UT/nvmf: add PTPL feature with REGISTER/ACQUIRE/RELEASE unit tests
Change-Id: I76ee75cc43151087bd2a2ec8e6b008cfed8c3848
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456174
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-12 02:09:20 +00:00
Ben Walker
88da8a91f9 nvmf: spdk_nvmf_subsystem_remove_ns is no longer asynchronous
Now that the resume path can correctly handle the case where a namespace
was removed and a new one added with the same nsid, this no longer needs
to be asynchronous.

Change-Id: I693045e66a7d4e75255b526d8f5ca5ef8695533e
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459606
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-11 11:19:53 +00:00
Shuhei Matsumoto
7e70c3d18f dif: Add spdk_dix_remap_ref_tag to remap ref. tag for separate metadata payload
When using stacked virtual bdev (e.g. split virtual bdev), block
address space will be remapped during I/O processing and so reference
tag will have to be remapped accordingly.

This patch adds an API, spdk_dif_remap_ref_tag to satisfy the case.

UT code is added together in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I55cc45c475d4e86e736f5712baf02fcabfde3c82
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461104
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-11 11:14:22 +00:00
Shuhei Matsumoto
f4a62a3993 dif: Add spdk_dif_remap_ref_tag to remap ref. tag for extended LBA payload
When using stacked virtual bdev (e.g. split virtual bdev), block
address space will be remapped during I/O processing and so reference
tag will have to be remapped accordingly.

The use case is explained in detail as follows:

- Format a single NVMe SSD with DIF enabled.
- Create a NVMe bdev on the NVMe SSD with DIF enabled.
- Create four split vbdevs on the NVMe bdev.
- Add the split vbdevs to a NVMe-oF target.
- Application is aware of block address space of the split vbdevs.
- Application submits read/write I/O to the NVMe-oF target.

Case 1:
- Configure NVMe-oF target to DIF pass-through.

Case 2:
- Configure NVMe-oF target to DIF insert/strip

For the case 1,
- Application inserts DIF for write I/O and verifies DIF for read I/O.
- The split vbdevs remaps reference tags of DIF both for read and write
  I/O because application expects reference tags are based on the
  block address space of split vbdevs.
- The NVMe bdev processs read/write I/Os without remapping reference tags
  because reference tags are already based on the block address space
  of the NVMe bdev.

For the case 2,
- NVMe-oF target inserts DIF for write I/O, and verifies and strips
  DIF or read I/O.
- The split vbdevs remaps reference tags of DIF both for read and write
  I/O because NVMe-oF target expects reference tags are based on the
  block address space of split vbdevs.
- The NVMe bdev processs read/write I/Os without remapping reference tags
  because reference tags are already based on the block address space
  of the NVMe bdev.

This patch adds two APIs, spdk_dif_ctx_set_remapped_init_ref_tag
and spdk_dif_remap_ref_tag to satisfy the use case.

UT code is added together in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ib3101129225b334d2f578eab75197790b1818770
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461103
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-07-11 11:14:22 +00:00
Tomasz Zawadzki
69a8877e82 lib/blob: do not allow xattr to exceed maximum descriptor length
Length of xattr descriptor is equal to length of xattr struct,
xattr name and the len of stored value.

There is no limit to how much can be stored in memory for xattr.
On disk xattr size is limited to single page and within that to
max descriptors that can fit in it.
This size is known at compile time.

Before this patch it was possible to add xattr exceeding
what was possible to be written to disk. This caused issues
when serializing the metadata during spdk_blob_sync_md()
or spdk_blob_close(). Making those fail without specific info
to the user and not actually writting such descriptor.

Since maximum length of xattr descriptor is known at compile time,
this patch compares against this value when setting the xattr.
It will immediately report back to user with error, and will
not store xattr in memory (thus not serialize it).

This patch should not affect any backward compatibility for blobs.
Too large xattrs weren't written to disk before,
API for blobstore stays the same - only reporting ENOMEM
when it should.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I6f4af4d079e47f084e20d7a4969d9a78ec1f8610
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460450
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-11 10:05:41 +00:00
Shuhei Matsumoto
2c9b0af271 nvmf/tcp: Get DIF context when handling capsule command header
When handling the capsule command header, call spdk_nvmf_request_get_dif_ctx
by passing the NVMf request and the reference to the DIF context, and set
the flag dif_insert_or_strip of the NVMf/TCP request to true.

spdk_nvmf_request_get_dif_ctx returns false immediately when the
corresponding NVMf controller disables DIF insert/strip.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I16f6b322f2692d5f9653d011a490e7929ec37365
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458928
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-11 05:30:28 +00:00
Shuhei Matsumoto
1c7f92f075 nvmf: Hide DIF setting of the backend bdev if DIF insert/strip is enabled
When the NVMf controller's flag dif_insert_or_strip is enabled, DIF is
inserted for write I/O and stripped for read I/O, and the corresponding
NVMe-oF initiator should not be aware of the DIF setting of the
backend bdev.

Hence this patch hides the DIF setting of the backend bdev
when the flag dif_insert_or_strip is enabled.

Change-Id: I3c14880c2e94cba7f76b1bca78afb36bfe884e26
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456731
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-11 05:30:28 +00:00
Shuhei Matsumoto
4ff3665ce9 nvmf: Check DIF insert/strip setting of NVMf controller when getting DIF context
The first idea was that the caller of spdk_nvmf_request_get_dif_ctx()
should check if the current transport enables DIF insert/strip before
calling spdk_nvmf_request_get_dif_ctx().

But NVMf controller knows if DIF/insert/strip is enabled now by the
previous patch. Hence spdk_nvmf_request_get_dif_ctx() checks if the NVMf
controller enables DIF insert/strip at its head.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I78253d356b694800c3a9a9608514df58e0c631a6
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461314
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-11 05:30:28 +00:00
Ziye Yang
960460f0d1 nvmf: add spdk_nvmf_transport_get_optimal_poll_group
Add the optimal poll group get function.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Ia9e57c6924a6563d79269cf535814883e83698cd
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454549
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: Changpeng Liu <changpeng.liu@intel.com>
2019-07-10 02:30:41 +00:00
Shuhei Matsumoto
ddb680ebab nvmf: Add helper function to get DIF context from NVMf request
Add a helper function to get DIF context when the passed NVMf request
is for I/O queue, NVMe read, write, or compare command, and its NSID
is valid.

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

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ic435886ca936a211f34278b813f547ffa43b9000
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458712
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2019-07-10 00:43:02 +00:00
Shuhei Matsumoto
824bf66302 nvmf: Use STUB in UT for ctrlr_bdev.c
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2a28254546fcb4b3744f3ca5b0420e600275abc9
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458707
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-10 00:43:02 +00:00
paul luse
06f6c90626 bdev/crypto: add IO queueing for out of mem condition via bdev layer
Also made on the prints a DEBUG message instead and noticed the really
name that was being registered by this component so updated it to
make it look like the rest of SPDK.

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

Change-Id: I5f46d49a6d1e6e49aab93ca7cd654469a3a08659
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455912
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-07-08 08:21:03 +00:00
Shuhei Matsumoto
ced3e20709 nvme/tcp: Support extended LBA payload in nvme_tcp_build_iovs
When pdu->dif_ctx is not NULL, call spdk_dif_set_md_interleave_iovs
in nvme_tcp_build_iovs and nvme_tcp_build_payload_iovs to create
special SGL for the data segment to leave a space of metadata for
each block.

Add UT to verify if the update works correctly.

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

Change-Id: Ie802cb4b7c541089579ecc2a630fc1e34004da55
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458923
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-08 03:33:07 +00:00
Shuhei Matsumoto
a7a32ea052 nvme/tcp: Support unaligned extended LBA payload in nvme_tcp_pdu_set_data_buf
When DIF is inserted or stripped, nvme_tcp_pdu_set_data_buf must
shift the range of the buffer from LBA based to extended LBA based
because the extended LBA based range must be passed to create a special
temporary iovec array to leave a space of metadata for each block then.

This patch do the following:
- Add a pointer to the current DIF context to struct nvme_tcp_pdu.
  This pointer is set when DIF is inserted or stripped to the current
  NVMf request.
- When the pointer to the current DIF context in the PDU is set, get
  the extended LBA based offset and length by calling
  spdk_dif_get_range_with_md() and use them in nvme_tcp_pdu_set_data_buf().
- Original data length is set in the PDU and original data offset is
  set in the current DIF context in nvme_tcp_pdu_set_data_buf().
- Add UT code.

Change-Id: Ic1f4fd326b5b3e3d4c74677592bda34d6949a11e
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458920
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
2019-07-08 03:33:07 +00:00
Hailiang Wang
b8bbf63925 test/ctrlr_ut: fix a warning of ctrlr_ut garbage value
Compilation Warning on fedora30.
ctrlr_ut.c:1146:12: warning: Assigned value is garbage or undefined
        event.raw = rsp.nvme_cpl.cdw0;
                  ^ ~~~~~~~~~~~~~~~~~
This is related to issue #822.

Change-Id: I58be6df56d309e257105b1d3c96247665c3e31a0
Signed-off-by: Hailiang Wang <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459714
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: yidong0635 <dongx.yi@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2019-07-05 12:13:03 +00:00
paul luse
f499ef7191 ut/compress: misc unit test fixes
Required due to recent changes to functional code, unclear how
the UT passed without these.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I3ea4401ee1842ef577793338f1567d20d73ad8bc
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459868
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-07-05 11:56:03 +00:00
JinYu
b7a2058a4b unit/nvme: Add unit test for the tcp sgl
It seems that autotest doesn't cover the function
nvme_tcp_build_sgl_request(), So add the unit test.

Change-Id: I2e243910cb38ffc49bdd6048b365dc7fa60892c2
Signed-off-by: JinYu <jin.yu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456728
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-07-05 03:49:24 +00:00