Commit Graph

492 Commits

Author SHA1 Message Date
Maciej Szwed
0c06e1ea89 lvol: show total accessible clusters in lvol store
Show total accessible clusters when listing lvol stores
instead of total blocks. This is more readable for user.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I22a14f626816769cf2f494ae30cfd8ee63897771
Reviewed-on: https://review.gerrithub.io/385634
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-11-10 17:24:31 -05:00
Maciej Szwed
ed56bffbcb bdev/lvol: correct messages displayed on screen during tasting
During tasting, if bdev is already claimed, we send errors on screen.
This is expected behavior so we should send only debug logs.

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

Reviewed-on: https://review.gerrithub.io/384229
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Piotr Pelpliński <piotr.pelplinski@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-11-09 11:32:27 -05:00
Jim Harris
32bff28a25 nvme: use spdk_pci_device_claim() in nvme_pcie_ctrlr_construct
spdk_pci_device_claim() can be used to ensure only one process
at a time uses any given PCI device.  Previously this was only
used in the bdev_nvme driver - other apps like nvme/perf do
not use spdk_pci_device_claim() and could effectively rip out
the device from a running bdev-based app like the NVMe-oF target.

So instead of modifying all of the nvme apps, put this logic into
the core nvme driver instead so that all applications get the
benefit transparently.  Save the fd when the controller is constructed
and then close it when the controller is destructed to handle the
detach (including hotplug) cases.

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

Reviewed-on: https://review.gerrithub.io/385524
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-11-03 18:48:33 -04:00
Jim Harris
3178ad6476 env: return fd from spdk_pci_device_claim()
This allows users of this interface to then close the fd
when they want to release the claim.

This prepares for calling spdk_pci_device_claim() in the
nvme driver to cover not just the bdev_nvme driver but all
of our nvme example and test applications as well.  We'll
want the fd returned so that we can properly close it during
detach (including hotplug) use cases.

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

Reviewed-on: https://review.gerrithub.io/385523
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-11-03 18:48:33 -04:00
Isaac Otsiabah
ce18c1f121 RPC: Add rpc support to update firmware.
Modified the above files to add rpc support to update NVMe firmware. Currently,
the path parameter must be local to the RPC Server.

Change-Id: I2b14e37792a2f0a5759e8b13e21137e7f346e58e
Signed-off-by: Isaac Otsiabah <iotsiabah@us.fujitsu.com>
Reviewed-on: https://review.gerrithub.io/369083
Reviewed-by: Paul von Stamwitz <pvonstamwitz@us.fujitsu.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-10-31 12:49:31 -04:00
Daniel Verkamp
872fdc8e41 bdev/virtio: check if unmap is supported via VPD page
As part of the SCSI target scan, request the Block Thin Provisioning VPD
page to determine if the target device supports Unmap, and report it via
the io_type_supported bdev callback.

Change-Id: Id2fdaf3a2cae72e6356a862d40ff772f9d12d144
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/384131
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
2017-10-30 12:17:50 -04:00
Daniel Verkamp
5304beccd3 bdev/virtio: move scan results into a structure
This prepares for adding more steps to the scanning phase.  Each step
will put its results into the scan info struct, and the final
alloc_virtio_disk() call will copy the info to the allocated disk at the
end of each target scan.

Change-Id: I836ada42e25c817bb1998328cb592acac25be08d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/384130
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
2017-10-30 12:17:50 -04:00
Piotr Pelplinski
511adde02f lvol: add lvs name in rpc calls
Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: Ic6770371d9d62cbdd40ae0612eb4f7dceccd507f
Reviewed-on: https://review.gerrithub.io/383771
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
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-10-27 13:10:21 -04:00
Piotr Pelplinski
e5b0dd6ead pmem: bdev names for pmem bdevs
Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: Ifbb02f99cd2e5752b2bc9091733b87ddadec11a4

Reviewed-on: https://review.gerrithub.io/383895
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-27 13:10:07 -04:00
Dariusz Stojaczyk
5447fb12a9 bdev_virtio: fix scan inquiry alloc_len
Some devices expect alloc_len
to be the same as payload len.

Kernel vhost-scsi reports:
Expected Transfer Length: 256 does
not match SCSI CDB Length: 255 for
SAM Opcode: 0x12.

Change-Id: I499290c207b77be6757441da002f9fcc9eebcecd
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/383779
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>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-27 13:07:25 -04:00
Dariusz Stojaczyk
cfa668375b bdev_virtio: retry sending scan requests
Scan requests will be re-sent
if non-critical failure has
happened.

This is actually required, as
some Virtio SCSI devices require
a dummy request to clear it's
POWER ON OCCURED unit attention
status after Virtio device init.
The very first request might fail
with asc = 0x29 (POWER ON, RESET,
OR BUS RESET OCCURED), but
subsequent requests will be
processed correctly.

Change-Id: I809bfe7952062995078f33dccb92192d722e6574
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/383689
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-10-27 13:07:25 -04:00
Tomasz Zawadzki
fde584034d lvol: give EEXIST error code on lvs name conflict
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I1df83cbd6414a1bb8f54328c735950b9476e323b
Reviewed-on: https://review.gerrithub.io/384105
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Piotr Pelpliński <piotr.pelplinski@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-27 13:07:09 -04:00
Tomasz Zawadzki
6c54c13cd4 event/subsystem/bdev: asynchronous SPDK finish
First this change moves spdk_subsystem_fini() to trigger on
spdk_app_stop(). This ensures that spdk_subsystem_fini() is called
before reactors are stopped in spdk_reactors_stop().

Finish paths for subsystems, bdevs and copy engine is now
asynchronous.
Each of those three mentioned have to make sure they are
asynchronous as well.

Only bdev that currently has requirement for asynchronous finish
are logical volume.
Thus the change in vbdev_lvol.c making it move to next bdev module
only after all lvol stores were unloaded.

Fio_plugin finish of bdev and copy_engine was removed for now.
Next patch in series adds it back with async support.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I80ee2d084f3d82c50bf1329e08996604ae61b1b3
Reviewed-on: https://review.gerrithub.io/381536
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-10-27 13:03:55 -04:00
Dariusz Stojaczyk
071cc42c7b bdev_virtio: remove internal README.md
The *TODO* section was outdated. Most of
this README's contents have been already
moved to doc/virtio.md and doc/bdev.md.

Change-Id: I2f2108afdc543276c9f08ae053ccebdbd6b1a229
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/384054
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-10-27 11:02:48 -04:00
Tomasz Zawadzki
9583e73901 lvol: remove lvs from global list after callback
Inserting into g_spdk_lvol_pairs list is done in vbdev_lvs_create_cb,
at that point it is known that it can be used. Meanwhile removing
was done at start of _vbdev_lvs_remove, to prevent possibility to
access it when waiting for destruct callback to complete.

This made checking if the g_spdk_lvol_pairs list is empty unreliable
to detect if all lvs were destroyed - they could still be being
processed and callback not yet called.

This patch removes lvs from global list only after the callback of
_vbdev_lvs_remove is called.

It will be used in future patch during asynchronous
finish of vbdev module to determine when all lvs were removed.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I638fe63a80b3cf00e9773f5a8c7be315d2c05555
Reviewed-on: https://review.gerrithub.io/382986
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-10-26 17:23:58 -04:00
Tomasz Zawadzki
2196023bc7 lvol: consolidate vbdev_lvs_unload and vbdev_lvs_destruct
To avoid code duplication those two functions were merged.
New _vbdev_lvs_remove function deals with differences by
additional argument "destroy".

No functional difference should be observed after this patch.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I09067646ec9b9656f361077c54906a618e4e0c48
Reviewed-on: https://review.gerrithub.io/383908
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-10-26 17:23:58 -04:00
Tomasz Zawadzki
ebf0312eef lvol: Add vbdev_lvs_destruct() and change unload behaviour [3/3]
This patch adds new API to remove logical volume store
from device it is on. It is only used from RPC, when
user explicitly requests. It allows to use the device to
use as any other bdev.

vbdev_lvs_unload() is now only called from hotremove and
during application shutdown. Which makes it possible to
load it again during application start up.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: If6452ecc3fff99237d1704ff7cd8de4d7133221d
Reviewed-on: https://review.gerrithub.io/382021
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-10-26 17:23:58 -04:00
Maciej Szwed
2baeea7dd4 bdev: add callback to spdk bdev unregister and bdev destruct
Currently deleting bdev does not support asynchronous delete
operations. Because of that results are returned before device
is actually deleted and some operation can be peformed on that
device after removal of this device started.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I305c302d8abd5d7c2c0f947fca70c58396872132
Reviewed-on: https://review.gerrithub.io/383732
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-10-26 17:23:58 -04:00
Dariusz Stojaczyk
a17d431612 bdev_virtio: fix setting name for modern pci devices
It used to be NULL.

Fixes: a85a4452
("bdev_virtio/rpc: add construct_virtio_user_scsi_bdev")

Change-Id: I490b41571e5667cf95b59b2e316006d1ef7381e8
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/383892
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-26 15:09:57 -04:00
Pawel Wodkowski
a85a4452f3 bdev_virtio/rpc: add construct_virtio_user_scsi_bdev
Change-Id: I2a351442ead0874d98bdfb23079a723d7665dbb1
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/381186
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-10-25 18:31:56 -04:00
Daniel Verkamp
d822c2055e rte_virtio: check payload size in vhost_user_read
Make sure the recv() can't write beyond the end of the msg buffer.

Change-Id: Ibc4bb51ac3a1c2a027a458d59356b7a5496eca7e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/383646
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
2017-10-25 18:30:18 -04:00
Daniel Verkamp
22077b210b rte_virtio: use size_t/ssize_t in vhost_user_read
Use the correct size types (rather than int) for values passed to and
returned from recv().

Change-Id: I2d38eed63e2d9c9f056d1053e156088fd361c88b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/383645
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
2017-10-25 18:30:18 -04:00
Jim Harris
e6d053e78a lvol: add lvol unique name
Add a name to each lvol which is persisted as a blob
xattr.  lvol names must be unique within its
lvolstore.

While here, fix a few lvol_ut issues that were caught
as part of testing the lvol unique names.  Also fix
a couple of tests that registered the wrong string
name with CUnit.

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

Reviewed-on: https://review.gerrithub.io/383567
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-25 12:10:38 -04:00
Jim Harris
c6f1d12930 lvol: move name to old_name
There are some upcoming changes which will deprecate
the old lvsuuid_blobid name in favor of an
lvs_name/lvol_name name where these names are
user-specified.

In preparation for this change, rename the previous
lvol->name to lvol->old_name.  This will allow us
to add a new lvol->name but keep the original
old_name during the transition.

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

Reviewed-on: https://review.gerrithub.io/383534
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-25 12:10:38 -04:00
Jim Harris
08ac0074ce lvol: add unique lvolstore name
Each lvolstore now has a unique name which is persisted to
metadata.  Eventually this will provide a friendlier
way to reference logical volumes, in the form
lvolstore_name/lvol_name.

This patch only covers the unique lvolstore name.  An
lvolstore may not be created nor loaded if its name
conflicts with an already loaded blobstore.

Currently there is no way to rename an lvolstore to
resolve a conflict.  This will be coming in the future.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I842f13b79776e5b8f81e56de10778c35328e8cd3
Reviewed-on: https://review.gerrithub.io/383533
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-25 12:10:38 -04:00
Daniel Verkamp
e50cc5fd45 scripts/check_format: check trailing whitespace
Fix up the two existing instances of trailing whitespace in text files,
and add a check to enforce that no new trailing whitespace is added.

Change-Id: I2197bed69bb356142aa6d2e4e8261c7434dd358b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/383291
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-10-24 17:35:23 -04:00
Daniel Verkamp
ba90c8876e rte_virtio: use spdk/stdinc.h
Replace POSIX and standard C #includes with the central SPDK stdinc.h
and remove the rte_virtio exclusion from header checking in
scripts/check_format.sh

Change-Id: Ie53d11de7cd9a51c59957e3c500bd8b9b4c4bc5e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/383003
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-10-24 17:19:44 -04:00
Daniel Verkamp
94678ad9ee rte_virtio: reformat with check_format.sh
Remove the exclusion of the rte_virtio code from scripts/check_format.sh
since we will be maintaining this code going forward (unlike rte_vhost,
which we intend to keep up to date with upstream DPDK).

Change-Id: I30c186e566ca777dff552a36af53443d197a8824
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/383002
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-10-24 17:19:44 -04:00
Daniel Verkamp
e36d36e4f9 bdev: fix write zeroes fallback error path
If an I/O fails during the write zeroes fallback to write on a split
I/O, the previous code would call spdk_bdev_io_complete() again on the
same I/O, causing infinite recursion.

Fix this by restoring the original user callback before completing the
I/O, as well as using _spdk_bdev_io_complete() rather than
spdk_bdev_io_complete() to avoid double-counting the statistics.

This also preserves the original bdev_io->status code set by the module,
rather than always setting it to SPDK_BDEV_IO_STATUS_FAILED.

Change-Id: Ib71fa6e54eed3d5823652971f7c439e0ff236fc1
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/383506
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
2017-10-24 13:51:20 -04:00
Maciej Szwed
199e73908d lvol: Lvol store tasting
This patch introduces lvol store and lvols parameters saving
on persistent memories and loading it from saved data on app start.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: Ia63f0cf3d6365d59f31c5f0a1724636bfe73b5b8
Reviewed-on: https://review.gerrithub.io/375764
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-10-24 13:36:51 -04:00
Daniel Verkamp
f26983fa07 rte_virtio: move pci_dump_json_config out of #ifdef
pci_dump_json_config() is used for both legacy and modern PCI virtio
devices, so move it out of the #ifdef PCI_LEGACY_SUPPORT so it is
available when building against older DPDK versions.

Change-Id: I986f9e6a81abda64d77f954b15807d06e35d1748
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/383487
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
2017-10-23 15:35:14 -04:00
Dariusz Stojaczyk
fb99e9e644 rte_virtio: disable legacy PCI for dpdk < 17.05-rc4
17.05-rc4 is the version e.g.
rte_pci_ioport_read function was
introduced in. The bdev_virtio
module previously did not compile
with older DPDK versions.

Change-Id: Ib96d5d7934166acc552515b02bfba25b71929438
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382829
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-23 12:33:58 -04:00
Seth Howell
3fd7f28dc9 bdev: add fallback from write_zeroes to writev
if write_zeroes is not supported by the block device, we can get the
same behavior by simply writing a buffer full of zeroes to the blocks
we want to erase. I also incorporate splitting into the bdev layer to
accomodate large i/o.

Change-Id: I8fa1bfaaf22d7bfc6e3afb6e89d22fa9f7767e55
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/373829
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-10-23 11:50:16 -04:00
Maciej Szwed
63fce5595b lvol: add reference counter for open lvols
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I3a86f28056e67b3c237441fb1048ca6ccd081ae7

Reviewed-on: https://review.gerrithub.io/383252
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-10-20 16:06:53 -04:00
Maciej Szwed
94cf9837aa lvol: support callbacks in lvol close/destroy functions
Close and destroy lvol functions should support callback
functions so that they can be processed sequentially
and also give user result.

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

Reviewed-on: https://review.gerrithub.io/383230
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-20 14:26:01 -04:00
Dariusz Stojaczyk
7dee96ce24 bdev_virtio: added --without-virtio configure flag
SPDK can now be compiled without
the virtio driver.

Change-Id: I92999c871d28875d519749a73a7f2230c3881fbe
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382828
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-10-19 19:06:12 -04:00
Pawel Wodkowski
17a302a138 bdev_virtio/rpc: implement dump json config RPC
Change-Id: Ieb0e69743da893659538c37c37d6ee8802080b86
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/381986
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-10-19 19:05:01 -04:00
Jim Harris
f97c8b3142 lvol: add spdk_lvs_opts_init()
Some future patches will require specifying an lvol_store
name when calling spdk_lvs_init().  This means that passing
NULL for spdk_lvs_opts will no longer be an option.  So
add an spdk_lvs_opts_init() (similar to spdk_bs_opts_init)
which will initialize a default value for the cluster size.

While here, prepend an underscore to spdk_setup_lvs_opts, since
this function is not part of the public SPDK API.

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

Reviewed-on: https://review.gerrithub.io/383030
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-19 13:23:58 -04:00
Dariusz Stojaczyk
97a3b814e0 rte_virtio: fix vdev->max_queues
We interpeted max request queue
count as number of all queues.
It did not take into account
eventq and controlq.

This patch also fixes overall
max_queues negotiation for
modern PCI devices.

Fixes 8b0a4a3 ("bdev_virtio: implement multiqueue")

Change-Id: I834cb973772ca5946ac26d18bd3eeb2783f48ea9
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382816
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-10-19 13:00:51 -04:00
Dariusz Stojaczyk
770dcb0006 rte_virtio: fix setting NEXT flag for the last chain descriptor
It was wrongly assumed that
each READ will contain at least
one iovec. This could potentially
corrupt the desc array.

Change-Id: I48ca7efbe4bea897e0ad16184452bddcf3daf49b
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/383009
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-10-19 10:56:21 -04:00
Dariusz Stojaczyk
a922e9f302 bdev_virtio: add xmit_pkt error handling for target scan
Only the initial xmit_pkt is checked
against an error, the subsequent
xmits are just asserted. As scan
messages are sent 1-by-1 if the first
request (containing 3 iovectors) has
been enqueued successfully so should
the next ones.

Change-Id: Ie102256a42ef1c67132d606af90ab96771adba10
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382784
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-10-19 10:56:21 -04:00
Dariusz Stojaczyk
f35ca8f7df bdev_virtio: properly handle full-queue scenario
In case of not enough free descriptors
the bdev_virtio will fail the I/O with
NOMEM status.

Change-Id: I1cb0cd5453ff70468898bc8e414b53b9c64dbe50
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382783
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-10-19 10:56:21 -04:00
Dariusz Stojaczyk
c6ba3fe473 bdev_virtio: set unique name for the bdevs
Previously all bdevs were using
hardcoded name Virtio0.

Change-Id: Ib990027a0edd4e200aa4b6f4689ccb9e0824a9c3
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382926
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-19 00:34:12 -04:00
Dariusz Stojaczyk
08fcc22f42 bdev/gpt: check against get_io_channel failure
Added an additional error check.

Change-Id: I5b662cdf23fba21cd59fe416829f1c71b9499ca6
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382928
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-10-19 00:33:06 -04:00
Dariusz Stojaczyk
3070826140 bdev_virtio: explicitly return -1 on channel creation failure
This doesn't change any behavior
as queue_idx was always either
0 or -1, but makes it clear that
this function always returns
-1 on error. This is required
by current io_channel implementation.

Change-Id: I2b613ab9ff1e48d5b4aee0cd499bbc0a04cb765c
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382927
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-10-19 00:33:06 -04:00
Cunyin Chang
23ec116cbb bdev/virtio: Fix the compile bug.
Change-Id: I790b5cc9147182e106ac6d1fbd66ab95c4beec01
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/383038
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-10-19 00:02:09 -04:00
Daniel Verkamp
8eef5183d3 bdev: remove spdk_bdev_poller_start() lcore option
Always start bdev pollers on the calling core.

This removes the lcore concept from the bdev poller abstraction and
simplifies the job of spdk_bdev_initialize() callers providing their own
poller and event implementations.

All callers except the NVMe bdev hotplug poller already used the current
core as the parameter.  The NVMe HotplugPollCore option was undocumented
and unused in any of the tests or example configuration files, so it
should be safe to remove.

Change-Id: I93b466e1e58901b8785c40cbe296fa46c157850f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382857
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-10-18 20:28:29 -04:00
Dariusz Stojaczyk
19ddb108de bdev_virtio: implement controlq and RESETs
A single thread that initialized
bdev_virtio subsystem will be used
to poll control queues for all
virtio devices.

Every io_channel will put it's e.g.
RESET requests to the controlq MP-SC
spdk_ring. The controlq poller will
dequeue these requests and put them
into the virtio queue. The same
poller will then poll for completions
and send them to proper threads
that submitted given requests.

Change-Id: I90ae7c5d76dc89cc52ff69cf2a60e27a9314557c
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382201
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-10-18 13:08:45 -04:00
Dariusz Stojaczyk
eba48d825c rte_virtio: add missing if() brackets
Some error messages were printed
outside of the error-checking
if() condition.

Fixes: bd273d4 ("rte_vhost: replace strerror() with spdk_strerror_r()")

Change-Id: Icf965ae56ffc2e0970572308b38607ac63cdb1f2
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382943
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-10-18 13:00:34 -04:00
Dariusz Stojaczyk
ab8a0460a9 bdev: clear bdev_io->iov for unmap
Values from previous bdev_ios
were reused and were taken into
account e.g. in bdev_io_get_buf()
to check if a buffer is already
assigned.

Change-Id: I239aaf83a4ce8a9342c1820e3ac9e9ccf6a28336
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382959
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-10-18 12:48:37 -04:00