Commit Graph

10125 Commits

Author SHA1 Message Date
Konrad Sztyber
4f011ef7c3 examples/lsvmd: list VMD devices
This example application only enumerated VMD devices but didn't do
anything else.  Now it goes over all PCI devices and prints those behind
the VMD.

Change-Id: I6134088e820a90c203200294540cb8174b1a492e
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471480
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
2019-10-24 17:04:04 +00:00
Konrad Sztyber
6caed6bac8 env: add spdk_pci_device_get_type
The function allows the user to get string representation of the type of
a PCI device.

Change-Id: I02abcd9fc98ba912ca4d7936be22e9d5b4950ea2
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470648
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
2019-10-24 17:04:04 +00:00
Liang Yan
f554735911 test/nvme: Add nvme startup tool.
The startup tool is used to verify nvme device startup
time.

Change-Id: I2bee729c154175e1bda94c8e410d997bdc9a6eff
Signed-off-by: Liang Yan <liang.z.yan@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470001
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-10-23 17:03:56 +00:00
paul luse
ebacdcd923 lib/bdev: don't issue a split IO if there are no IOVs
When splitting bdev's, if we run out of child IOVs, we have to
make sure that we end block aligned. That may require us to
shorten or eliminate one or more child IOVs to be picked up
on the next split.  If we eliminate enough such that there
are no IOVs for this split IO, just continue and the next
split completion will kick off another split to pick up
the remaining data to be transferred.

Fixes issue #981

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: If2bfbe5f0862295e1d74cbea00692890a2178967
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471313
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>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
2019-10-23 17:03:50 +00:00
Jim Harris
f1d72e1006 dpdk: update to include eal startup patches
We recently had two patches merged to DPDK master
to improve rte_eal_init() execution time especially
in secondary processes.  These will be merged in
the DPDK 19.11 release.  Include them in our submodule
so that SPDK users can leverage them now rather than
waiting for DPDK 19.11.

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

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472106
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>
2019-10-23 17:03:41 +00:00
Karol Latecki
9d9059a796 doc: add 19.07 NVMe-oF TCP performance report
Change-Id: I14ec96465d7f2a9e0ff30620f99969a01574c037
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472141
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Seth Howell <seth.howell@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-10-23 16:59:33 +00:00
Karol Latecki
47b1d911c6 doc: add 19.07 Vhost performance report
Change-Id: I0d47123e4e7e1c2712044bd44e35e0141fdc47fa
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472140
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Seth Howell <seth.howell@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-10-23 16:59:33 +00:00
Seth Howell
ae3a9b8f08 nvme_qpair: return -ENXIO when the qpair is failed.
This will be the canonical way of informing the user that we have lost
the qpair connection somehow.

Also update all of the functions that will return -ENXIO to the user.

Change-Id: Ic6c7c2d0e07e9d3e857a3476bb6b91fb4b6454fa
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471416
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: Jim Harris <james.r.harris@intel.com>
2019-10-22 21:14:22 +00:00
Seth Howell
81b20a4d96 nvme_ctrlr: Allow resets from failed state
Failed is not a final state for either fabric or pcie controllers. We
have historically not allowed resets in the failed state, but we should.

Instead of checking for the failed state, we should check for the
removed state. If the controller is removed, then we cannot even attempt
a reset.

Change-Id: I2c1a3d85db84f84cd1895cbfaf16575c8b496155
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471415
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: Ben Walker <benjamin.walker@intel.com>
2019-10-22 21:14:22 +00:00
Seth Howell
3e1569e875 nvme_ctrlr: combine spdk_nvme_ctrlr_reset functions
We no longer need the private function with a public wrapper.

Change-Id: I0d24dfb282461174729d3eb649c78ac27e42fc8d
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471552
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>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
2019-10-22 21:14:22 +00:00
Seth Howell
0a42e658b5 nvme_rdma: let UL know when we fail qpairs.
Also, adds a field to the generic qpair for future use in other
transports.

Change-Id: Ie5a66e7f5ebfec1131155fc07e3c671be814fb9b
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471414
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: Jim Harris <james.r.harris@intel.com>
2019-10-22 21:14:22 +00:00
Seth Howell
552898ec17 nvme_qpair: fail the ctrlr only for errors on admin qpair.
We shouldn't always fail the whole controller if we get a failure on an
individual qpair.

Change-Id: Id0c90af83e5231593a895be66e7a7de48939e240
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471660
Tested-by: 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>
2019-10-22 21:14:22 +00:00
Seth Howell
6b314fb5dc nvme_rdma: properly separate alloc_reqs and register_reqs.
The way these two functions were separated previously represented a
pretty sserious bug when doing a controller reset.

If there were any outstanding requests in the rqpair, they would get
overwritten during the call to nvme_rdma_qpair_register_reqs and the
application would never get a completion for the higher level requests.
The only thing that we need to do in this function is assign the proper
lkeys.

Change-Id: I304c70646daf9b563cd00badba7141e5e8653aad
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471659
Tested-by: 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>
2019-10-22 21:14:22 +00:00
Seth Howell
4c1a18c41d nvme_qpair: fix check_enabled.
check_enabled had a couple bugs in it that made it unfriendly for enabling
I/O qpairs after a reset.
1. It was calling nvme_qpair_abort_queued_requests before setting the
enabled flag to true. For applications that submit new I/O in the
completion callback for old I/O, this means you enter an infinite loop
of submitting requests, and then immediately completing them. SO
instead, wait for the qpair to reset, then just submit those requests to
the lower layer.
2. It didn't check whether we were already in the middle of calling it,
so we could reenter function calls like
nvme_qpair_abort_queued_requests.

Also, now that we have a coherent state machine for qpairs, we can limit
the enabling to a specific state in that state machine.

Change-Id: Ie0b74819a6b16839965bced47c33dec967f725a8
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470256
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.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>
2019-10-22 21:14:22 +00:00
Seth Howell
a1ce725c0a nvme_fabric: enable the discovery_ctrlr admin queue
As the todo states later on in the function, the discovery controller
should really be initialized through traditional methods, but it was
hacked in. For now, enable the admin qpair to get past the non-standard
nature of this controller.

Change-Id: I2cbf1cd47d7249ae3d12bcfc2e8d21e8fb98df7e
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471779
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.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>
2019-10-22 21:14:22 +00:00
Seth Howell
6035f73d7b nvme_fabrics: move ctrlr_scan to common code.
This function is identical between the two transports.

Change-Id: If50b781259f224eb2c21de7da14564e6ce487650
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471778
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-10-22 21:14:22 +00:00
Seth Howell
08d4d977e8 nvme: combine qpair->is_connecting and is_enabled
These will form the base of a little state machine for managing the nvme
qpair structure.

Change-Id: If6f6df38cc17221ac8fcb7d8c0d7e2e808897a99
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470534
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-10-22 21:14:22 +00:00
Seth Howell
5cd7634939 nvme_ctrlr: enable the admin qpair before init.
The driver has historically waited until we have to do a listen
before enabling the admin qpair. That is a very PCIe-centric mindset.
For fabric controllers, a lot of the early initialization operations such
as get_cc and set_cc are handled through the admin qpair so it should be
enabled before we begin the initialization process.

As a side effect of this cahnge, the internal API
nvme_ctrlr_enable_admin_qpair has been removed. It would have turned
into a one-liner.

Change-Id: Icd162657d01a85c227a3f20c295d0208e07ce44d
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471743
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
2019-10-22 21:14:22 +00:00
Seth Howell
fa9f668a8b nvme: call the generic qpair_connect fn from all transports.
This wasn't being done in the previous case which meant that I/O qpairs
were not being moved to the connecting state when connecting for the
first time. However, to prepare the way for a coherent state machine for
nvme qpairs, we need to ensure that all qpairs go through the same
states.

Change-Id: I3cfe799a003acd926b24c107ab1461a96239c1bb
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471753
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-10-22 21:14:22 +00:00
Seth Howell
c2df8f6d84 nvme: unify ctrlr_scan function between rdma & tcp
These functions are functionally equivalent. Just unify the way they
wait for completions so that they are completely identical and we can
merge them into a common function.

Change-Id: Id5d734b6ae613b3ac828d89853d986cdadfb211a
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471936
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
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>
2019-10-22 21:14:22 +00:00
Anil Veerabhadrappa
a6f667af1d nvmf/fc: initialize 'adrfam' and 'trsvcid' in fc transport id
Signed-off-by: Anil Veerabhadrappa <anil.veerabhadrappa@broadcom.com>
Change-Id: I28476ec019f8e9ae98b9925e030f3c09ccfd726c
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471950
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>
2019-10-22 17:23:23 +00:00
Karol Latecki
2f05fbb6d1 spdkcli: fix pylint warnings
Fix Python code for warning produced by pylint.

- C1801: Do not use `len(SEQUENCE)` to determine
	if a sequence is empty (len-as-condition)
- W0611: Unused import * (unused-import)
- C0411: standard import should be placed before X
	(wrong-import-order)
- C0411: third party import X should be placed before X
	(wrong-import-order)
- C0412: Imports from package X are not grouped
	(ungrouped-imports)
- W0212: Access to a protected member _exit of a
	client class (protected-access)

Change-Id: I2c0e8379f962eb2957b428617836867b2e725aeb
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471482
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>
2019-10-22 17:23:00 +00:00
Marcin Dziegielewski
c4b94d878b lib/bdev/ocf: remove unused code related to polling utils
After switch all management operations to asynhronus way, utlis connected
with polling are no longer needed, this patch removes that code.

Signed-off-by: Marcin Dziegielewski <marcin.dziegielewski@intel.com>
Change-Id: Ia30e733c51089b1659f79c99d8cd711945a98fa0
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470353
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: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
2019-10-22 17:22:41 +00:00
Marcin Dziegielewski
c74b4b32ba lib/bdev/ocf: use asynhronous management API from OCF instead of polling
New version of OCF library provided full asynhronus management API,
therefore this patch changes all uses of polling in management
operations in vbdev to asynhronous way.

Change-Id: I7bf76fa2919fac4a068ef5c39f5b667b2be68ff7
Signed-off-by: Marcin Dziegielewski <marcin.dziegielewski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470352
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-10-22 17:22:41 +00:00
Marcin Dziegielewski
59a296465d lib/bdev/ocf: error handling in register path
This patch introduces error handling in register path, in case of
error in the middle of chain we will call vbdev_ocf_mngt_stop with
appropriate rollback path.

Signed-off-by: Marcin Dziegielewski <marcin.dziegielewski@intel.com>
Change-Id: I78e5796b7eda2fe0848d5533cdea283b17397b61
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468472
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2019-10-22 17:22:41 +00:00
Marcin Dziegielewski
790669cc46 lib/bdev/ocf: increase capabilites of vbdev_ocf_mngt_stop function
In current code there is no possibility to clean up vbdev in case
of error during management path. This patch introduces new version of
vbdev_ocf_mngt_stop function, now developer can pass handle to
path with rollback functions and therefore clean up not full initialised
vbdev instance. Changes in this path also allows to pass status explicitly
to vbdev_ocf_mngt_stop function.

Signed-off-by: Marcin Dziegielewski <marcin.dziegielewski@intel.com>
Change-Id: Ie9684981e48d24b3e55e4b1ab828dc8c01baa838
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468471
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>
2019-10-22 17:22:41 +00:00
Marcin Dziegielewski
20894340f2 lib/bdev/ocf: update of ocf library to version 19.06
This path updates ocf library to version 19.06 and also introduces
all necessary changes required to integrate ocf bdev adapter with
new version of ocf.

Summary of changes introduces with new OCF in ocf bdev:
- ocf_env.h increased limit for memory operations, changed behaviour
of strncpy to less restrictive, both changes are required to run new OCF
- ctx.c changed functions to new from new OCF
- added new cache mode "write only"
- added missed cache modes wa and wi to RPC scripts
- rewritten spdk_rpc_bdev_ocf_get_stats function to use asynhronus
ocf_mngt_cache_read_lock
- used new asynhronus ocf_mngt_cache_flush instead of waiting for request
- removed no longer valid filed - cfg->device.min_free_ram
- changed expected result in metadata_probe_cb

Signed-off-by: Marcin Dziegielewski <marcin.dziegielewski@intel.com>
Change-Id: I83e4335e16600e4d22e6bb517931102de42d39e9
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468132
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-10-22 17:22:41 +00:00
Shuhei Matsumoto
43f695d939 lib/iscsi: Move PDU header handling before data buffer allocation
To use zero copy bdev I/O APIs for write I/O, we have to allocate
iSCSI task before allocating data buffer because allocating data
buffer will be changed to spdk_bdev_zcopy_start() call and the
allocated iSCSI task will be passed to the call.

One critical change is that we have to read all data for the
current PDU even if handling the PDU is rejected. For that purpose,
use is_rejected flag and do not call iscsi_pdu_payload_handle()
is is_rejected is true. If iscsi_pdu_hdr_handle() returns negative,
close the connection, so return the state machine immediately.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ice77b7266af8ac392d9094478523e6e6fe6d131a
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470413
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
2019-10-22 17:20:51 +00:00
Shuhei Matsumoto
c92ff6bf91 lib/iscsi: Insert _pdu_payload_ into name of PDU payload handlers
Insert _pdu_payload_ into iscsi_op_login(), iscsi_op_text(),
iscsi_op_scsi_read(), iscsi_op_scsi_write(), iscsi_op_scsi(),
iscsi_op_nopout(), and iscsi_op_data() to clarify that they
handle PDU payload.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Id28ea90948118321c7889084149083bcc6bbd27c
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471562
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-10-22 17:20:51 +00:00
Shuhei Matsumoto
8f9b34dd74 lib/iscsi: Separate PDU header and payload handling
Extract PDU header handling from PDU payload handling for all PDU
types, and then group them into a new function iscsi_pdu_hdr_handle().
Then the original iscsi_execute() is renamed to iscsi_pdu_payload_handle().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I1fb1937cfaf502797f2c4edb3aeeb97d4697c7d4
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471015
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-10-22 17:20:51 +00:00
Shuhei Matsumoto
50bd0364d6 lib/iscsi: Separate PDU header and payload handing for SCSI Data-Out
To use zero copy bdev I/O APIs, we have to allocate iSCSI task
before allocating data buffer.

Hence we separate PDU header and payload handling for SCSI Data-Out,
and include iSCSI task allocation into PDU header handling.

Factor out PDU header handling in iscsi_op_data() into iscsi_pdu_hdr_op_data().
spdk_nvmf_tcp_h2c_data_hdr_handle() and spdk_nvmf_tcp_h2c_data_payload_handle()
in lib/nvmf/tcp.c are used as a reference implementation.

Use pdu->task to pass the task allocated by iscsi_pdu_hdr_op_data() into
iscsi_op_data().

In iscsi_op_data(), if it sees pdu->is_rejected is true or pdu->task
is NULL, do nothing. Besides, check LUN hot plug again to separate
PDU header handling and PDU payload handling.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5074e945254081960744577e4ed8e0170793e5e0
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470291
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
2019-10-22 17:20:51 +00:00
Shuhei Matsumoto
6e7473f724 lib/scsi: Free bdev_io just after getting completion from bdev for management I/O
This is for management I/O and from the same idea as the last patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Iae11de7848b38b9db1a699d80f595000a6ab2a47
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471696
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
2019-10-22 17:20:51 +00:00
Shuhei Matsumoto
7a9ecf8284 lib/scsi: Free bdev_io just after getting completion from bdev for non-read I/O
Previously, for iSCSI target, freeing bdev_io of SCSI task was deferred
until the reference count of the SCSI task becomes zero.

But this will cause the use-after-free issue when doing LUN hotplug during
large write I/O workload.

The scenario is the following:

- Large iSCSI write I/O is split into multiple I/Os, the first I/O is from immediate,
  and subsetquent I/Os are from R2T.

1. The first I/O allocates iSCSI task as primary, and is submitted to  the bdev layer.
   The first I/O is pending in the bdev layer.
2. The second I/O allocates iSCSI task as secondary (secondary is associated with
   primary by incrementing reference count).
3. Before submitting the second I/O to the bdev layer, LUN hotplug is started.
   LUN hotplug waits for getting completion of the first write I/O from the bdev layer.
4. The bdev layer completes the first I/O. The primary iSCSI task is tried to free,
   but reference count is still one, and is not done yet.
5. LUN hotplug detects completion of the first write I/O, and returns
   LUN I/O channel to the bdev layer.
6. The second I/O is tried to submit to the bdev layer, but LUN is already removed,
   and so free the secondary iSCSI task.
7. Then the reference count of the primary iSCSI task becomes zero,
   and its bdev_io is freed. However, LUN I/O channel is already freed and freeing
   bdev_io fails.

This issue is caused by separating iSCSI task allocation and submission.

For write I/O, we don't have to keep bdev_io after getting completion
of it from the bdev layer.

This applies to other non-read I/O types.

So for non-read I/O, free bdev_io after getting SCSI status in
bdev_scsi_task_complete_cmd(), and for read I/O, set bdev_io to
task as same as before.

The next patch will do the same for management task.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I530fb491514880ce41858e1bea55d422d606dfc4
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471695
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
2019-10-22 17:20:51 +00:00
Shuhei Matsumoto
c53e1e0d84 lib/iscsi: Rename PDU handling for SNACK Request
Rename iscsi_op_snack() to iscsi_pdu_hdr_op_snack() because SNACK
Request PDU has only header and doesn't have PDU payload handling.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I4d236c7963588729c32566e2be80db899edd2828
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471012
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-10-22 17:20:51 +00:00
Shuhei Matsumoto
83249da4a8 lib/iscsi: Rename PDU handling for Logout Request
Rename iscsi_op_logout() to iscsi_pdu_hdr_op_logout() because
Logout Request PDU has only header and doesn't have PDU payload
handling.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Id788e5da56ee51b311cff2ec448c5cf0492ace13
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471009
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-10-22 17:20:51 +00:00
Shuhei Matsumoto
1f5156b1b6 lib/iscsi: Rename PDU handling for Task Management Request
Rename iscsi_op_task() to iscsi_pdu_hdr_op_task() because Task
Management Request PDU has only header and doesn't have PDU
payload handling.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I66f842aecd2c1031a6bb0be4921e0f16930117aa
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471010
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-10-22 17:20:51 +00:00
Shuhei Matsumoto
902b467aad lib/iscsi: Separate PDU header and payload handling for NOP-Out
As same as SCSI Command Request and SCSI Data-Out, separate PDU
header handling and payload handling into different functions.

In iscsi_op_nopout(), if it sees pdu->is_rejected is true, do nothing.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: If50cd64bacf18c014e2aa232fd84357b877d9821
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471011
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-10-22 17:20:51 +00:00
Shuhei Matsumoto
cbdd8335fa lib/iscsi: Separate PDU header and payload handling for Login Request
Separate PDU header and payload handling for Login Request PDU.
This will clarify the header handling and payload handling.

Especially store the allocated and initialized response PDU to
the current connection and refer it later. This idea is as same as
iSCSI task and will work because login processing is synchronous
and only once per connection.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I7e0eb413ee5f759724a685b83a742515a3546780
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471472
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-10-22 17:20:51 +00:00
Shuhei Matsumoto
19687a5525 lib/iscsi: Get connection ID closer to location to use for login
cid had been got in iscsi_op_login_rsp_init() but it was not
intuitive. Get cid in iscsi_op_login() and pass it simply to
iscsi_op_login_phase_none().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ief7b865784aa72f7872b6e4a98809dbab49807de
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471471
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-10-22 17:20:51 +00:00
Shuhei Matsumoto
7015e6b5d5 lib/iscsi: Use rsp_pdu->data_buf_len in iscsi_op_login_rsp_handle()
Use rsp_pdu->data_buf_len in iscsi_op_login_rsp_handle() and its
calling functions.

This makes the code a little clearer.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I89aa7155e97c1b770b333f7f12e84e13811af953
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471470
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-10-22 17:20:51 +00:00
Shuhei Matsumoto
49f0d6192a lib/iscsi: Use rsp_pdu->data_buf_len in iscsi_op_login_phase_none()
Use rsp_pdu->data_buf_len in iscsi_op_login_phase_none() and its
calling functions.

This makes the code a little clearer.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Id9c1f01bdfa95e8a2e9f6512777341334cb621e0
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471469
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-10-22 17:20:51 +00:00
Shuhei Matsumoto
2d1e009679 lib/iscsi: Store and use rsp_pdu->data_buf_len for login
A local variable alloc_len had been used to hold the data buffer
length of the response PDU. But it's more intuitive to use
rsp_pdu->data_buf_len instead.

The subsequent two patches will replace related functions accordingly.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I48f96a542d6c177ba1d8409ff0230fa61c11e154
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471468
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2019-10-22 17:20:51 +00:00
Shuhei Matsumoto
71f8a7d742 lib/iscsi: Separate initializing login response and getting incoming login params
Including getting incoming login parameters into iscsi_op_login_rsp_init()
was not so intuitive.

Initializing login response done in iscsi_op_login_rsp_init() can be
done before reading data segment but getting incoming login parameters
can be done only after reading data segment.

As a preparation to separate PDU header and payload handling for
Login Request PDU, extract getting incoming login parameters from
iscsi_op_login_rsp_init() into an new function
iscsi_op_login_store_incoming_params().

Besides, refine a few pointer and return code handling to make the
code a little clearer.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I6b677bf6e93b830e6e6fead24c8b78d9d9bc1df4
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471467
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2019-10-22 17:20:51 +00:00
Shuhei Matsumoto
a82748513a lib/iscsi: Set pdu->data_segment_len immediately after reading PDU BHS
Previously, pdu->data_segment_len had been set after reading all
data segment to the allocate data buffer pdu->data_bur together with
pdu->data and pdu->data_from_mempool.

But we don't have any ordering constraint to do that and the value of
pdu->data_segment_len has been fixed when reading all PDU BHS.

Hence move setting pdu->data_segment_len up to immediately after
reading PDU Basic Header Segment to pdu->bhs in iscsi_read_pdu().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: If6f690623687ee974c5a1d73814e8675bb7077c8
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471852
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-10-22 17:20:51 +00:00
Marcin Dziegielewski
1b6d1c80f9 lib/bdev/ocf: fix potential issue around base->management_channel
This patch improves management of base->management_channel in code and
fixes potential issue described below. In situation when we want to create
configuration like this:

$rpc_py bdev_ocf_create C1 wt Malloc NonExisting
$rpc_py bdev_ocf_create C2 wt Malloc Core

In current code on C1 vbdev creation we are creating not fully
initialized vbdev_ocf_base for cache (without management channel).

On C2 creation, because in vbdev_ocf_volume_open we are looking for
right base by name, we can grab cache base from C1 and then, there is
possibility, to hit segmentation fault due to uninitialized
mangament_channel.

This patch moves initialisation of managemnet channel to attach
base function and thanks to that we have guarrnte that each copy of
cache base (we have copy in each parent in case of multicore cache)
are valid.

Signed-off-by: Marcin Dziegielewski <marcin.dziegielewski@intel.com>
Change-Id: Iab1ced3a4bf8ba0fec947bbf77b55dc3620a58a7
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468131
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: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
2019-10-18 17:31:39 +00:00
Hailiang Wang
9d660f187a lib/iscsi: add checking total_ahs_len in iscsi_reject
Fix static analyzer error by ensuring 4 * total_ahs_len is
not larger than ISCSI_AHS_LEN.

When ./configure -enable-werror --enable-ubsan --enable-asan,
iscsi target reports heap-buffer-overflow error
when I feeding unexpeted pdu opcode.

Change-Id: Ib8053e1a19b5e49385642106eb79c458d35ab3c6
Signed-off-by: Hailiang Wang <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471489
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Liang Yan <liang.z.yan@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-10-18 17:31:01 +00:00
Shuhei Matsumoto
1dc9a7627f lib/scsi: Check pending tasks for the SCSI device only from the specific initiator
Refine the public helper function spdk_scsi_dev_has_pending_tasks to
be able to check tasks only from the specific initiator.

Then use the function in iSCSI target to fix the issue.

Besides add UT code to test the updated spdk_scsi_dev_has_pending_tasks().
Automated multi hosts test is much better but some UT code will be of any
help to mitigate the risk of degradation.

Fixes #985

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I50afb940de7174360c8a30479450850002a3e525
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471337
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-10-18 17:30:13 +00:00
Shuhei Matsumoto
f9583f2c0d lib/scsi: Check pending tasks for the LUN only from the specific initiator
Refine helper functions spdk_scsi_lun_has_pending_mgmt_tasks() and
spdk_scsi_lun_has_pending_tasks() to be able to check tasks only from the
specific initiator.

SCSI port is used by passing the pointer and so simple pointer
comparison is appropriate in the functions.

Add UT code to test the updated functions.

The next patch will change spdk_scsi_dev_has_pending_tasks() to
get not only SCSI device but also initiator port and make iSCSI
target use the function to fix the issue.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I89c33e05bc6ab21baa6cbebf60950039a3dcecd0
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471336
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-10-18 17:30:13 +00:00
Shuhei Matsumoto
4787395283 lib/scsi: Change current function to check pending tasks to private
When closing iSCSI connection, if we check pending tasks, we must
check tasks only from the corresponding initiator.

We have to add new API to do that.

On the other hand, during IO submission or LUN hotplug, we must check
all tasks.

The latter case is done only in SCSI LUN, and the function is not
necessary to be public.

As a preparation, change scsi_lun_has_pending_tasks/_mgmt_tasks
from public to private.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2d7d77109ed317435b6768fffb0bf4e21dd60f9f
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471335
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-10-18 17:30:13 +00:00
Alexey Marchuk
562178af9c rdma: Add tests for spdk_nvmf_rdma_request_parse_sgl with metadata
Change-Id: I9a974f1d9fdba0ee1fda03277b41231f98912d75
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Evgenii Kochetov <evgeniik@mellanox.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470476
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-10-18 17:28:52 +00:00