Commit Graph

403 Commits

Author SHA1 Message Date
Dariusz Stojaczyk
d63013de11 rte_vhost: make vtpci macros lowercase
In preparation to replace them with
standard functions. As these macros
are used to assign values as well,
changing them to functions is done
in a separate patch as a part of
reworking vtpci init/deinit.

Change-Id: I4f6398342b06dc9036afece3f902506e9b72a301
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/381310
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-10-05 19:24:00 -04:00
Dariusz Stojaczyk
283189d370 rte_virtio: don't negotiate IOMMU_PLATFORM feature
We don't support it. It's not
negotiated by SPDK vhost so the
code worked so far.

Change-Id: Ibc515dcc1ebffc6936ee7f5465c4c73001e9b1ed
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/381274
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-10-05 19:24:00 -04:00
Dariusz Stojaczyk
2b756a2bff rte_virtio: fix access to unaligned struct
Change-Id: I8eaf5477d6d0e6f939ae9ad4db976f47cc60f0e2
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/381513
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-10-05 19:15:12 -04:00
Tomasz Zawadzki
5b17046d11 lvol: disable spdk_lvol_resize
Functionality of resizing logical volumes is currently
a work in progress, thus it is disabled in this patch.

It is no longer possible to use RPC and lib functionality.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I518e7196096f52e3ad9e91d658e1bb6c3301b688
Reviewed-on: https://review.gerrithub.io/380916
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-05 16:51:20 -04:00
Tomasz Zawadzki
d4dc859947 lvol: Add size info to get_lvol_stores RPC
Currently there is no way to know total space availible on lvol store or
how much is left after creating lvol bdevs.
Four new fields should were added to get_lvol_stores:
- total number of blocks
- number of free blocks left
- block size (currently always 4096, but should be known to user)
- cluster size

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I93dec2d4b2843f0ee51dc9883c8451cf55353f7b
Reviewed-on: https://review.gerrithub.io/381131
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Piotr Pelpliński <piotr.pelplinski@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-05 16:49:56 -04:00
Tomasz Zawadzki
9f6f73d420 lvol: allow to configure cluster size of lvol store
New optional parameter -c or --cluster_sz in construct_lvol_store() RPC,
as well as in vbdev_lvol and lvol lib API.

This parameter allows to configure cluster size of blobstore that lvol store
is build upon.

When this parameter is not specified, default of 1GiB is used.

spdk_lvs_opts struct was created to facilitate any future options when
creating lvol store.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ibfe8765ede3e78ff19c36f46043e4cec2e5c9f97
Reviewed-on: https://review.gerrithub.io/379356
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Piotr Pelpliński <piotr.pelplinski@intel.com>
2017-10-02 13:45:12 -04:00
Dariusz Stojaczyk
4790c4033f rte_virtio: removed vtpci->reset callback
It's not used anywhere. There's already a
vtpci->set_status(RESET) equivalent that
does the same.

Change-Id: I0f04ba094848806c647ede4be2ef77b423ead288
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/379337
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2017-10-02 13:38:43 -04:00
Dariusz Stojaczyk
893c1f7e25 rte_virtio: create call/kick fds on queue setup
This makes us open only as many descriptors as we need.

Change-Id: I2dbce218efdd37f015a0d4b250be9539373c6028
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/379336
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
2017-10-02 13:38:43 -04:00
Jim Harris
3adb4053af bdev: use spdk_vbdev_unregister when unregistering partitions
Also add a unit test that reproduces the original issue and passes
with the one line fix.

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

Reviewed-on: https://review.gerrithub.io/380703
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2017-10-01 21:57:00 -04:00
Jim Harris
5fb8722899 bdev: add callback to free part_base
This puts responsibility on the caller to free the buffer
and do any other cleanup associated with the partition base
(for example, GPT buffer).

While here, also clean up a bunch of places where on
various failures during initialization, it would just
free the buffer instead of calling spdk_bdev_part_base_free().
The latter is required to make sure the bdev descriptor
gets closed as well.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ic000339459eca4a4a1d103da2e1f3feffe7e764f
Reviewed-on: https://review.gerrithub.io/378653
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2017-10-01 21:57:00 -04:00
Jim Harris
94bc8cfdba bdev: add ENOMEM handling
At very high queue depths, bdev modules may not have enough
internal resources to track all of the incoming I/O.  For example,
we allocate a finite number of nvme_request objects per allocated
queue pair.  Currently if these resources are exhausted, the
bdev module will return failure (with no indication why) which
gets propagated all the way back to the application.

So instead, add SPDK_BDEV_IO_STATUS_NOMEM to allow bdev modules
to indicate this type of failure.  Also add handling for this
status type in the generic bdev layer, involving queuing these
I/O for later retry after other I/O on the failing channel have
completed.

This does place an expectation on the bdev module that these
internal resources are allocated per io_channel.  Otherwise we
cannot guarantee forward progress solely on reception of
completions.  For example, without this guarantee, a bdev
module could theoretically return ENOMEM even if there were
no I/O oustanding for that io_channel.  nvme, aio, rbd,
virtio and null drivers comply with this expectation already.
malloc only complies though when not using copy offload.

This patch will fix malloc w/ copy engine to at least
return ENOMEM when no copy descriptors are available.  If the
condition above occurs, I/O waiting for resources will get
failed as part of a subsequent reset which matches the
behavior it has today.

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

Reviewed-on: https://review.gerrithub.io/378853
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2017-10-01 21:57:00 -04:00
Piotr Pelplinski
fca11f1519 bdev_pmem: initial implementation of persistent memory bdev
Use SPDK bdev subsystem to allow basic IO to pmem pool
using pmemblk_* calls.

New pmem bdev can be constructed using RPC call
construct_pmem_bdev PMEM_FILE

Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: If5ca94161fe53644b8fccd3b77de5479da1b2e55
Reviewed-on: https://review.gerrithub.io/376973
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-29 14:04:32 -04:00
Dariusz Stojaczyk
5accfd577c rte_virtio: added virtio_dev_deinit
virtio_dev can now be freed via virtio_dev_deinit.

While here, also rename virtio_init_device to
virtio_dev_init for name consistency.

This patch also adds some error-checking.

Change-Id: Ic1222756b8686fbd8a14d8631f25525249529e1d
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/379335
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-29 13:02:09 -04:00
Dariusz Stojaczyk
fad291df7b rte_virtio: save mem-mapped PCI resource regions
Added virtio_hw->pci_bar[6] to store information
about mapped memory regions. They have to be
stored to make it possible to unmap them.

The unmapping itself is done in a separate
patch.

Change-Id: I5dcffd0674e855a02086b3d8e4adc5fac451229a
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/380779
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-29 13:02:09 -04:00
Dariusz Stojaczyk
b9ebf948ba rte_virtio: removed virtio_user_dev->max_queues
Generic virtio_dev has the same field already.

The field was previously used to store vhost-user
GET_QUEUE_NUM response, that will be later assigned
to virtio_dev->max_queues via virtio_user_read_dev_config.

This patch removes virtio_user_dev->max_queues
with entire virtio_user_read_dev_config functionality
for virtio_user.

Change-Id: I508f728215a95cf977d6b0b20350fcf2ae11fe3a
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/379155
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-29 13:02:09 -04:00
Dariusz Stojaczyk
3c6f063845 rte_virtio: convert to spdk pci_virtio layer
Replaced direct DPDK calls with SPDK env/pci
equivalents. This patch also makes the PCI scan
happen only conditionally when user has
configured proper field in the bdev_virtio config
file.

Change-Id: Ib6ad81d0b421b20ad0cd9d02cb40b2213af823e6
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/379489
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-09-29 13:02:09 -04:00
Dariusz Stojaczyk
af330105a2 bdev: removed unused err-check in bdev_put_io()
The same condition is already checked
in spdk_bdev_free_io().

Change-Id: I31f937036d3835e2d16633c6338ebca1a2237de9
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/379722
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-29 11:45:13 -04:00
Dariusz Stojaczyk
04124278b9 bdev: assert against bdev_io buffer overflow
Also updated docs.

Change-Id: I2e53c31b2c9c575d8adea23ed92f113e69f324ed
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/380490
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-28 17:08:34 -04:00
Dariusz Stojaczyk
b5c0a51ec7 bdev_virtio: added UNMAP support
Current UNMAP implementation supports only
up to 2^32-1 unmapped blocks per request.

Change-Id: Ib473831fa32aaba465f76694afad71137288a73a
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/377688
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-28 17:08:34 -04:00
Dariusz Stojaczyk
bf5a7293d0 bdev_virtio: moved virtio_req init to separate function
This is required for upcoming UNMAP implementation.

Change-Id: I81fb744e0813121cebd64aa60a03a80bfbecc94d
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/377421
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-28 17:08:34 -04:00
Dariusz Stojaczyk
3595fc5f40 bdev: allow allocating custom-length buffers for bdev_io
This is required for upcoming UNMAP
implementation in bdev_virtio.

While here, also added documentation for
spdk_bdev_io_get_buf().

Change-Id: Ia769ee9b8b132f31208ae66598b29a1c9ed37312
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/379721
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-28 17:08:34 -04:00
Daniel Verkamp
d565f549b9 bdev/nvme: support large (> 2TB) unmap requests
spdk_bdev_unmap_blocks() accepts a 64-bit number of blocks, which can
exceed the NVMe Dataset Management range's 32-bit number of blocks,
which can represent up to 2 TB with 512-byte blocks.

We can support up to 0.5 PB unmap requests by using the maximum number
of descriptors in a single Dataset Management command, which should be
sufficient for now.

Change-Id: I0a4ee77a9be148355991e1a081007ffa020a3ee5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/379202
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2017-09-28 14:17:15 -04:00
Maciej Szwed
99ba2b25e6 lvol: hotremove support
This patch adds hotremove support of lvol base bdev

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I04dc7a0cc73fd6959824873f354d5c7db8c09a9b
Reviewed-on: https://review.gerrithub.io/379348
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-09-28 12:46:18 -04:00
Maciej Szwed
4338d3c9a7 blob_bdev: hotremove support
This is in preparation for enabling hot remove of logical volumes when
their underlying blobstore device is hot-removed.


Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I310a3f64f0de5d628609c20a1a3b4d38df0755aa
Reviewed-on: https://review.gerrithub.io/377041
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-28 12:46:18 -04:00
Tomasz Zawadzki
b51b8b4f9c lvol: fix incorrect assumption of 1MiB cluster_size
Previously incorrectly it was assumed that cluster size
was always to be 1MiB. For most evident example of this
please see spdk_lvol_create() sz > free_clusters comparison.

This is now fixed and lvol->sz was changed to lvol->cluster_num.
It was done to increase readability - only dealing with
number of clusters when creating or resizing lvol.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: If8cdbad18978319e57b6952dbf5a55d56785f108
Reviewed-on: https://review.gerrithub.io/380467
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-27 17:27:13 -04:00
Dariusz Stojaczyk
e2e6fd3744 bdev: set bdev_io->iovs for all direct IO types
This patch allows unmap bdev_io to
be used with spdk_bdev_io_get_buf.

bdev_io->iovs/iovcnt has been zeroed-out for other
I/O types to overwrite any previous values/pointers.

Change-Id: I570a4d82d9e4db6630a6831b1aab3259fb46cdd8
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/377687
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-27 16:10:26 -04:00
Tomasz Zawadzki
9a58c40eba blobstore: always destroy bs_dev during spdk_bs_init()
Now bs_dev is destroyed only in two instances:
- within spdk_bs_init() on failure path
- vbdev_lvs_create() if spdk_lvs_init() errors out,
before even calling spdk_bs_init()

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I7b8af39fbe83907b0c47797f0f55ca3b941729d9
Reviewed-on: https://review.gerrithub.io/379848
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-09-27 13:18:18 -04:00
Daniel Verkamp
52207d7800 bdev: fix double semicolon typo
Change-Id: Ic094c34f1dc9063f12df80d77b2c70ebae9a4977
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/380066
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-26 20:02:48 -04:00
GangCao
4f1ba029b3 bdev/nvme: handle the case for no valid ns when creating bdev
Change-Id: I46d564523ea20bc7c79a3896dfb024d3d5172a93
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/379911
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-26 17:44:32 -04:00
Dariusz Stojaczyk
abb59fea38 bdev_virtio: send IO to proper target
Until now we queued all IO to hardcoded
SCSI target 0.

Change-Id: Iefb229899725f53f26e927c4fb23e8d1d613c187
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/379840
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-26 15:53:29 -04:00
Dariusz Stojaczyk
65b6d8f495 bdev_virtio: call bdev_module_init_done only once
bdev_module_init_done could be called
multiple times when more than device
is available.

Change-Id: I17ee63a818945359648953c4f8f67678d10e8907
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/379864
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-26 14:28:24 -04:00
Dariusz Stojaczyk
c8f052836d bdev_virtio: added virtio_driver struct
Added new struct virtio_driver together
with it's global instance. The struct should
keep all bdev_virtio related information.

Change-Id: If78967c68c4131c89cd86cb4b46f5f0194bca323
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/379863
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-26 14:28:24 -04:00
Dariusz Stojaczyk
5bea1429e9 rte_virtio: use spdk_pci_device where possible
A mid-step towards porting virtio_pci to
use SPDK env/pci layer. See the next patch
for details.

Change-Id: Ia7cb417415bce686c3a888f949853834ddf6c7a6
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/379488
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-26 14:28:24 -04:00
Dariusz Stojaczyk
b697382f65 rte_virtio: automatically memmap PCI resources
SPDK env/pci layer does not provide equivalent
call to actually map all pci resources. This
patch will smooth future transition of rte_virtio
to SPDK.

Change-Id: I7a67c46a99824be83875385703dd6bbf0ec9645e
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/380001
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-26 14:28:24 -04:00
Dariusz Stojaczyk
14f7a8eec6 gpt: fixed error-handling for vbdev_gpt_read_gpt
Fixed memleak on vbdev_gpt_read_gpt failure.
gpt_base->ch was never freed.

Change-Id: I97f6e433b26ab95253eac4753b68083f3433547b
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/377913
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-25 16:53:52 -04:00
Daniel Verkamp
3d8e44e908 bdev/null: add Write Zeroes support
Change-Id: Iad98baef576fe3d843967d0c02e9922dfc347830
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/378675
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-25 16:31:49 -04:00
Jim Harris
a0d7056f11 copy: return 0 on success and appropriate errno on failure
This code was still using an old paradigm of returning the
number of bytes associated with a successful submission.
Just return 0 on success instead - if caller needs the
number of bytes for some reason they have the information
to get it.

While here, return an appropriate negated errno where possible -
we especially want ENOMEM returned when an ioat channel runs out
of descriptors.

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

Reviewed-on: https://review.gerrithub.io/378858
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-25 13:56:29 -04:00
Jim Harris
49cf3861d1 bdev/nvme: clean up submit_request return codes
Some of the internal functions used to return the
number of bytes associated with a successfully submitted
IO, but that was changed a while ago to just return 0
for success.

So change some of the callers of these functions to
just look for != 0 for failure rather than < 0.  This
preps for some upcoming ENOMEM handling changes.

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

Reviewed-on: https://review.gerrithub.io/378856
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-09-25 13:56:29 -04:00
Jim Harris
d5b441e0dd bdev: clean up spdk_bdev_io_complete a bit
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I374910a7d5ecf0125228d0c99ab523804956ca78

Reviewed-on: https://review.gerrithub.io/378852
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-25 13:56:29 -04:00
Jim Harris
b4ffeaec7a bdev: fail IO submitted while reset in progress
This patch introduces per-channel flags to keep state of information
needed in the primary I/O path.  Setting/clearing of these flags
should only done through an spdk_for_each_channel() call.  Currently
there is only a RESET_IN_PROGRESS flag defined but more may be added
in the future.

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

Reviewed-on: https://review.gerrithub.io/377828
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-25 13:56:29 -04:00
Daniel Verkamp
263ed2ae21 nvme_spec: remove SGL Sub Type Invalid status code
This was removed in NVMe 1.2.1 ECN 002.

Change-Id: Icacd53c1f33043cf1c9f30bff1fb9dce1efa69b3
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/378681
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-22 17:11:53 -04:00
Tomasz Zawadzki
dd9fdb0c55 lvol: remove page_size field from lvol store struct
It does not seem nessecary to include it, when this it used just once
in lvol disk creation.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I42ead55329f0ac7e55bb73702d071f118a5c7931
Reviewed-on: https://review.gerrithub.io/379678
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-22 15:53:06 -04:00
Tomasz Zawadzki
4912114819 lvol: split spdk_lvol_store_req structure into four separate
To increase readability, union in spdk_lvol_store_req is now split
into four separate structures.

As well spdk_bdev from lvs_basic/spdk_lvs_req was removed as it was
not needed.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I65c5155f3d15151a97cf8f8e425b26aa1966b677
Reviewed-on: https://review.gerrithub.io/379169
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-22 15:53:06 -04:00
Maciej Szwed
f76ec3b495 lvol: fix memory leaks
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: Ife45dc8e27d767b9f09b67e7fae3b94837a14491

Reviewed-on: https://review.gerrithub.io/379458
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-09-22 15:50:37 -04:00
Daniel Verkamp
48d643b829 bdev/virtio: simplify READ/WRITE 10/16 logic
Now that the bdev_io read and write branches of the union have been
unified, the virtio-scsi bdev I/O code can be simplified a little bit.

Change-Id: Iadbe55862770a1b0e7f854b724a70d94c704218e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/379696
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-22 15:39:15 -04:00
Jim Harris
1f935c7a9b bdev: properly handle aborted resets
Previously, we naively assumed that a completed
reset was the reset in progress, and would
unilaterally set reset_in_progres to false.

So change reset_in_progress to a bdev_io pointer
instead.  If this is not NULL, a reset is not in
progress.  Then when a reset completes, we only
set the reset_in_progress pointer to NULL if we
are completing the reset that is in progress.

We also were not aborting queued resets when
destroying a channel so that is fixed here too.

The added unit test covers both fixes above - it will
submit two resets on a different channels, then destroy
the second channel.  This will abort the second reset
and check that the bdev still sees the first reset as in
progress.

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

Reviewed-on: https://review.gerrithub.io/378199
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-22 15:38:44 -04:00
Jim Harris
ab29d2ce5d bdev: improve handling of channel deletion with queued resets
Upper layers are not supposed to put an I/O channel if there
are still I/O outstanding.  This should apply to resets as well.

To better detect this case, do not remove the reset from
the channel's queued_reset list until it is ready to be
submitted to the bdev module.  This ensures:

1) We can detect if a channel is put with a reset outstanding.
2) We do not access freed memory, when the channel is destroyed
   before the reset message can submit the reset I/O.
3) Abort the queued reset if a channel is destroyed.

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

Reviewed-on: https://review.gerrithub.io/378198
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-22 15:38:44 -04:00
Jim Harris
c2510e75a2 bdev: add spdk_bdev_io_submit_reset
This provides an alternate path for submitting
resets to a bdev module, in preparation for some
future patches where we will want to avoid
reset-specific checks in the main I/O submission
path.

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

Reviewed-on: https://review.gerrithub.io/378670
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-22 15:38:44 -04:00
Jim Harris
81939c44f1 bdev: rename need_buf_tailq_t to bdev_io_tailq_t
We will use this typedef for some additional use
cases where are not specific to the need_buf
functionality.

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

Reviewed-on: https://review.gerrithub.io/378197
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-09-22 15:38:44 -04:00
Dariusz Stojaczyk
dcb7db965d bdev: unify all direct bdev_io I/O types
Since all direct bdev_io types have the same layout,
there is no need to keep them differentiated.

Change-Id: If8bb85e43c9922c0ebfc39837e3a45006e508b56
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/377686
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-09-22 13:44:25 -04:00