Commit Graph

3782 Commits

Author SHA1 Message Date
Daniel Verkamp
ac1818748c astyle: change "add-braces" to "j" for compatibility
Older astyle releases called this option "add-brackets" ("add-braces"
was added in astyle 3.0), so for compatibility with both, use the short
option name (-j), which is the same in both.

Change-Id: If6ee3065281219d84549f93588079bf0f1f947a2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/391477
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-13 21:23:27 -05:00
GangCao
9bbf06a652 bdevperf: only count successful IOs in completed IOs
Change-Id: I5a51d03c2cb4f2538b2b3567741c524991af46fc
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/391597
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-12-13 21:22:25 -05:00
Dariusz Stojaczyk
ec6a1afbdb util: add a helper function for parsing capacities (1K, 128M, 2G)
Also used it in parsing `-m` SPDK app param,
meaning that it can now accept numbers
followed by a binary prefix - like 512M or 2G.

Change-Id: If458dc08429237f2cb3f3f661bcaf382468df0f0
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/391670
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-12-13 21:19:53 -05:00
Jim Harris
e0e8f53cc0 blob: remove md_channel
Remove the metadata channel, and instead use the same
channel for metadata and data operations on the metadata
thread.

This prepares for future changes which will allow
for metadata operations on any thread - not just the
thread where spdk_bs_load() or spdk_bs_init() was
called.

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

Reviewed-on: https://review.gerrithub.io/391311
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-12-13 13:06:16 -05:00
Jim Harris
d52dbda288 blob: rename bs_md functions
As part of clarifying the API and preparing for some
future changes, rename the following functions:

spdk_bs_md_create_blob => spdk_bs_create_blob
spdk_bs_md_open_blob => spdk_bs_open_blob
spdk_bs_md_delete_blob => spdk_bs_delete_blob
spdk_bs_md_iter_first => spdk_bs_iter_first
spdk_bs_md_iter_next => spdk_bs_iter_next

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

Reviewed-on: https://review.gerrithub.io/391031
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-12-13 13:06:16 -05:00
Jim Harris
7932847300 blob: remove spdk_bs_io_flush_channel
This function was a nop and is not needed.

lvol was calling this function when an lvol bdev
gets a FLUSH I/O, but that is not needed either.  So
lvol will now report it does not support flush.

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

Reviewed-on: https://review.gerrithub.io/391023
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-12-13 13:06:16 -05:00
GangCao
4c4619323d Perf: only count into inflight IO when successfully sending
There is a case in high queue depth situation and the IO may be
failed due to no memory. Our perf tool did not recognize this
and always count the IO in the inflight IOs. Thus in the completion,
it waits more than actual IOs to return and the Perf is hanging.

Change-Id: Ie5472e260c75c5abd80c06eb6c613dc7d1761c78
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/391582
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-12-13 12:21:52 -05:00
Pawel Kaminski
56905c3877 test/lvol: Replace stop/start vhost with add/delete bdev
Change-Id: Ic960f2fe6966ae6eeb027a7c6a1d6929c741080d
Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-on: https://review.gerrithub.io/388642
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-12-13 11:26:54 -05:00
Jim Harris
8b76ace55f blob: remove spdk_bs_[un]register_md_thread from public API
The implementations in blobstore.c still remain for now, but
those will be removed after some upcoming changes which will
eliminate a global md thread and instead allow caller to
specify an I/O channel for each blobstore level API call.

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

Reviewed-on: https://review.gerrithub.io/391020
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-12-12 18:36:18 -05:00
Jim Harris
2c3591f183 blob: rename spdk blob metadata functions
spdk_bs_md_resize_blob => spdk_blob_resize
spdk_bs_md_sync_blob => spdk_blob_sync_md
spdk_bs_md_get_xattr_value => spdk_blob_get_xattr_value
spdK_bs_md_get_xattr_names => spdk_blob_get_xattr_names
spdk_blob_md_set_xattr => spdk_blob_set_xattr
spdk_blob_md_remove_xattr => spdk_blob_remove_xattr
spdk_bs_md_close_blob => spdk_blob_close

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

Reviewed-on: https://review.gerrithub.io/391006
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-12-12 18:36:18 -05:00
Daniel Verkamp
c2009e9e85 scsi: remove spdk_scsi_dev_print() function
Replace the single call to spdk_scsi_dev_print() with a reimplementation
using public SCSI API functions, and also using the SPDK logging
framework instead of printf().

Change-Id: Ifa455f9e6a4a07a35d5dec311a61e9a8afaa0227
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/391320
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-12-12 18:04:20 -05:00
Jim Harris
474fcf64b2 test: remove all uses of strcpy in the code
Then also add a check in check_format.sh and fail if
a new instance is found again.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ia35c343e1b7bb44b3b5f4f8484adb9e0d5702d67
Reviewed-on: https://review.gerrithub.io/390916
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-12-12 17:34:45 -05:00
Cunyin Chang
dbe275e35a doc: Fix typo in NVMe-oF set up guide
Change-Id: I755c90b773a6a91274d7d8a2266661b8eb9a1c90
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/390545
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-12-12 17:06:36 -05:00
Dariusz Stojaczyk
4910c0af95 vhost: use vdev->path where possible
We used to sprintf the path from
directory and socket name, while
the complete path was already held
in vdev->path.

Change-Id: I27bc71be52a805b39e083eb4f76947587c36a4ad
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/390411
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@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-12-12 15:42:03 -05:00
Daniel Verkamp
fe7e5d84f6 trace: replace DPDK call with SPDK env.h wrapper
Remove the DPDK dependency from the trace library.

Change-Id: Id03387042b036142a9b3a0a81276d6ddf5295802
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/391315
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-12-12 15:37:05 -05:00
Ben Walker
33376dd136 nvmf: Add subsystem iterators
Add functions to iterate the list of subsystems for a given
target.

Change-Id: Id3831f656033092224168b353788ae87238bf800
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/388294
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>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-12 15:01:17 -05:00
Ben Walker
8b79ef3372 nvmf: Remove poll group from controller
Now rely entirely on the user to create and poll
the poll groups.

Change-Id: I66baaa2d0f493390a055a32e6c902f5e2f574534
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/385954
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>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-12 15:01:17 -05:00
Daniel Verkamp
2302dc6cdc nbd: add NBD subsystem to apps
Enable the NBD subsystem and RPC methods in the iSCSI target, NVMe-oF
target, vhost target, and bdev_svc test app.

Change-Id: I1c2e53a4c031ae6d4dc0a8e698bbfa085db33154
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/391014
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-12 13:36:22 -05:00
Ziye Yang
d3e600066e bdevperf: change the type of time_in_sec to int.
Since we use time_in_sec to judge < 0 case

Change-Id: I8283c8209359acfe1b1d5db8a9d4315e5722c5c6
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/391154
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-12-12 13:35:46 -05:00
Seth Howell
afec8f1476 setup.sh: updated to support older linux kernel
When looking up nvme devices by name in older linux kernel versions, setup.sh
was throwing errors while trying to follow a symlink on
/sys/block/. This patch adds a fallback to the proper location of this
symlink in those versions of the kernel.

Change-Id: I13b5c1ce6f7505251789b64c740aba04d67f39a9
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/391019
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-12-12 12:53:33 -05:00
Changpeng Liu
ea11d68481 bdev/aio: make calloc with the right usage
Change-Id: I5c6fd2f398035da1eac789dbeae1f0228d98be17
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/391335
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-12 12:52:31 -05:00
Shuhei Matsumoto
11774a35a8 iscsi: Stale pointer when deleting PG and then IG
This bug is detected by test/iscsi_tgt/rpc_config

Due to the PG-IG map tree, IG-map is added to PG-map.
When PG was deleted first, PG-map was not deleted but PG was
deleted because PG-map has IG-maps.

PG-IG map tree was designed such that when PG was deleted first,
delete all IG-maps belonging to the PG-map, the PG-map, and then
PG.

By this change stale pointer which will cause memory leak is
removed.

Change-Id: I15c2ef48bad34608e53d0b44459c90a0cffda24d
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/391321
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-12-12 12:46:14 -05:00
Dariusz Stojaczyk
ded506f742 bdev/virtio: isolate vdev-management from target scan
Most importantly, the controlq and io_device
are now created at the time of creating the
device, not after the scan has finished. This
allows us to possibly scan the same device
multiple times.

Change-Id: Ic1de27f917204559be5c761315a3ebfe159b1c22
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/390112
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-12-11 19:46:01 -05:00
Dariusz Stojaczyk
fcf3af24ff bdev/virtio: reuse io_channels for the target scan
Rather than acquiring an exclusive virtqueue
for the target scan, (re)use an existing one
from io_channel on the scanning thread.

The goal is to be able to rescan the virtio
device in runtime (hot-attach/detach).

Now that scan can be done on existing queues,
it is no longer guaranteed that rings have
enough space to enqueue all requests. This
will be fixed in subsequent patches.

Change-Id: I0a39460c0ddb52592ae6828e5a7f51056ada2696
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/390111
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-12-11 19:46:01 -05:00
Dariusz Stojaczyk
527cd3ed83 bdev/virtio: cleanup virtio device management
The virtio device can now be
removed with a single call.

Change-Id: I221d2c0578eeddb3de9c2a31eefc0f64fda38939
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/390110
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-12-11 19:46:01 -05:00
Ziye Yang
e78188042c iscsi: Use spdk_mempool for session and pdu related pool
Purpose: To remove the dpdk dependency for iSCSI.

Change-Id: I01ef910496d2029ba755dd6d0c06d61c248b8dfe
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/390938
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-11 19:42:21 -05:00
Daniel Verkamp
f566060ab4 nbd: clean up log messages
Reduce the log level of the disconnection message to INFO (this is a
normal occurrence when a connection is shut down), reword the message
for clarity, add a newline, and convert the error number to a string.

Also replace the printf() in spdk_nbd_start() with a SPDK log message.

Change-Id: I35e493100e63f84a9b7257c6f84dad77e9a0d335
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/391025
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-12-11 18:01:43 -05:00
Jim Harris
b9b0fee224 blob: decouple spdk_blob from its actual data
Moving forward, the spdk_blob returned to users will
actually be an I/O channel - not the blob structure
itself.  So rename the existing spdk_blob to spdk_blob_data.
spdk_blob_data will continue to contain global state for
the blob.  In the future spdk_blob will point to an
I/O channel for the blob - for now it effectively still
points to the spdk_blob_data, but by changing the
structure names here it will reduce the code churn in
future patches.

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

Reviewed-on: https://review.gerrithub.io/390900
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-12-11 15:33:35 -05:00
Jim Harris
99a1020f0a blob: move data_ro check into rw_iov function
This keeps the top level functions as simple pass-throughs
which will simplify some future commits.

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

Reviewed-on: https://review.gerrithub.io/390899
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-12-11 15:33:35 -05:00
Ziye Yang
c127a23690 env: add spdk_mempool_create_ctor
Change-Id: I8b70d25d1b245bdb3f6fcd79599a2907a6d5bddc
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/391143
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-12-11 14:59:12 -05:00
Ziye Yang
2a4d18e391 env: Add spdk_mempool_get_name
Purpose: To get the name of a mempool

Change-Id: Ic23f93a03db9bcef54808dfd350b1403a47c21d7
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/390937
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-12-11 14:59:12 -05:00
Felipe Franciosi
edd03d6ce1 bdev: Enumerate virtio-scsi devices from 0
Starting with a8c375ad, virtio-scsi devices are enumerated from 1. This
is a change in previous behaviour where devices were enumerated from 0.
This commit restore the behaviour of the last stable SPDK release.

Change-Id: Ia8e7dc13e0831e603af831eeab67796025fce417
Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
Reviewed-on: https://review.gerrithub.io/391085
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>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-11 14:58:47 -05:00
Ben Walker
3ef479ab16 bdev: Correctly defer completion of resets until channels are unlocked
Change-Id: I23f71ff38b805723d74aca639489e0079ecdb993
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/390341
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-12-11 14:58:17 -05:00
Shuhei Matsumoto
e9dff43982 env: Check return value of rte_mempool_get in spdk_mempool_get
According to the rte_mempool.h, the retrieved pointer will be
valid when rte_mempool_get() returns 0.

Change-Id: Iac8a62f9dd39cd7b70478009503f17d78375a124
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/391161
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-12-11 14:53:28 -05:00
Cunyin Chang
d1bb67a34d bdev/aio: make sure the aio backend support the lun reset command.
This patch do not actually reset the aio controller, but make sure all
the IOs inflight return back to client before we return success status of
lun reset command.

Change-Id: I473b5f8d795cdc2a32b69cfffcce5a2925a252f6
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/386837
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-11 11:43:59 -05:00
Dariusz Stojaczyk
479134e9d4 vtophys: remap vfio dma memory when necessary
VFIO requires at least one IOMMU group to be added to the
VFIO container to be able to perform any IOMMU operations
on that container. [1] Without any groups added, VFIO_IOMMU_MAP_DMA
would always respond with errno 22 (Invalid argument).

Also, if the last IOMMU group is removed from the container
(device hotremove), all the IOMMU mappings are lost.

In both cases we need to remap vfio memory as soon as the
first IOMMU group is attached. The attach is done inside
DPDK during device attach and we can't hook into it directly.
Instead, this patch hooks into our PCI init/fini callbacks.
There's now a PCI device ref counter in our vfio manager and
a history of all registered memory pages. When the refcount
is increased from 0 to 1, the vtophys will remap all vfio
dma memory.

[1] https://www.kernel.org/doc/Documentation/vfio.txt
"On its own, the container provides little functionality,
with all but a couple version and extension query interfaces
locked away. The user needs to add a group into the container
for the next level of functionality.  [...] With a group
(or groups) attached to a container, the remaining ioctls
become available, enabling access to the VFIO IOMMU
interfaces."

Change-Id: I744e07043dbe7ffd433fc95d604dad39647675f4
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/390655
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-11 11:38:38 -05:00
Daniel Verkamp
9daf838db0 test/iscsi: only run NVMe-oF test when enabled
Check the SPDK_TEST_NVMF flag before running the iscsi_tgt + NVMe-oF
host test.

Change-Id: I0d545c98f188edefc089fb79e2879d5d307726f5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/391027
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-11 11:20:17 -05:00
Daniel Verkamp
59970a89be astyle: enforce braces around single-line statements
Require braces around all conditional statements, e.g.:

    if (cond)
        statement();

becomes:

    if (cond) {
        statement();
    }

This is the style used through most of the SPDK code, but several
exceptions crept in over time.  Add the astyle option to make sure we
are consistent.

Change-Id: I5a71980147fe8dfb471ff42e8bc06db2124a1a7f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/390914
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@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>
2017-12-11 11:19:32 -05:00
Daniel Verkamp
6bf92c33e5 nbd: move initialization out of kernel thread
Send all of the initialization ioctls from the SPDK thread running
spdk_nbd_start(), rather than in the pthread spawned to handle the
blocking NBD_DO_IT ioctl.

This allows the parameter to the pthread to be a single value (dev_fd),
rather than a pointer to the whole spdk_nbd_disk, which fixes a race on
shutdown where the main thread is freeing the spdk_nbd_disk while the
kernel thread is accessing nbd->dev_fd to send the cleanup ioctls.

Change-Id: Ibe5ca4abac97ac567b294da1f8a92f12eece45b8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/391021
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-12-11 11:11:25 -05:00
Cunyin Chang
fcccf16767 nvmf: close all the bdevs when delete subsystems.
Change-Id: Ie3c7c8d960b0074b86e983e0e8bf04de2d99f61f
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/390365
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-12-08 17:14:40 -05:00
Pawel Niedzwiecki
30dbca865b test/vhost: test for the vhost-blk readonly feature.
Change-Id: I5dde0555bd7d0e03dea3779dfd59c13ece92696a
Signed-off-by: Pawel Niedzwiecki <pawelx.niedzwiecki@intel.com>
Reviewed-on: https://review.gerrithub.io/382835
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-12-08 14:08:58 -05:00
Ziye Yang
e4c4fec260 bdevperf: add the shutdown callback function.
We also caculate the time for still dumping the
performance data.

Change-Id: I59b736268ca57a366666a4bf55458ec3f279f4e7
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.gerrithub.io/390702
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-12-08 14:08:43 -05:00
Daniel Verkamp
bedc405f35 nvmf: add duplicate QID check in I/O Connect
Disallow multiple I/O queues for the same controller with the same queue
ID.  NVMe-oF 1.0 ECN 001 specifies that this condition should return a
status value of Command Sequence Error.

Change-Id: I41126ddec388a985c403025e099ab15da5d3987c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/390662
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-12-08 14:08:19 -05:00
Daniel Verkamp
fab9349fdc ut/nvmf/ctrlr: add Connect command unit tests
Change-Id: I4d3cced91e804fbbb96a15a09b575ff85960ddef
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/390661
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-12-08 14:08:19 -05:00
Daniel Verkamp
2d630f9b75 ut/nvmf/ctrlr: replace stubs with mock.h macros
Change-Id: Ifd00dd647002ea226df826c558232d97d366ab81
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/390660
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-12-08 14:08:19 -05:00
Cunyin Chang
f991ac6d90 Changelog: Add section about hotplug of vfio-attached device.
Change-Id: I0a6cd8a1ac4648b06ad057912cafcf97a54bb377
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/390700
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-12-08 14:07:40 -05:00
Ziye Yang
b8a5cb99af nvme_rdma: Add rdma_cm_event_str
To make the error message more clear.

Change-Id: I95a9a3e06f4473da30d022134a8da764f165a070
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.gerrithub.io/388880
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-12-08 14:07:00 -05:00
Chen Wang
1594b13993 test/vhost: Fix the lvol bdev name
The lvol bdev which used to create nested lvol store
should be $lb_name.

Change-Id: Ic8d68f8d18bcb0c1d4bca0b4612a4a07ed8b974d
Signed-off-by: Chen Wang <chenx.wang@intel.com>
Reviewed-on: https://review.gerrithub.io/390350
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-08 14:06:19 -05:00
Daniel Verkamp
93b71b9091 test/config: install libasan in vm_setup script
This is necessary for SPDK_RUN_ASAN to function properly.

Change-Id: I22f4e8dde225967a3db3718270c2626f178af319
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/390858
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-12-08 12:32:56 -05:00
Xiaodong Liu
1170628e4f nbd: add get_nbd_disks RPC
At present, get_nbd_disks RPC can receive info
about SPDK exported nbd devices and corresponding
bdev names.

Change-Id: I04390c7faa6f698a703a599a152cff65fc8be546
Signed-off-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/390610
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-12-08 12:32:05 -05:00