Commit Graph

1479 Commits

Author SHA1 Message Date
Tomasz Kulasek
50d13ab3e0 lib/nvme: remove device name parameter from nvme cuse
This patch removes posibility to set cuse device path. Instead
"/dev/spdk/nvme*" path is used.

Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/474598 (master)
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>

(cherry picked from commit b7b45bc7bc)
Change-Id: I7c3087772a3661eebe03fce21356c35cc8204b49
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478352
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-12-23 08:04:56 +00:00
Ben Walker
1b0b8d04f8 env: Check supported iommu address width before using iova-mode=va
DPDK by default guesses that it should be using iova-mode=va
so that it can support running as an unprivileged user. However,
some systems (especially virtual machines) don't have an IOMMU capable
of handling the full virtual address space and DPDK doesn't
currently catch that. Add a check in SPDK and force iova-mode=pa
here.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475149 (master)

(cherry picked from commit 97b0f7733f)
Change-Id: Ib3a5691a584190feaab4b9064b5a500e361328f2
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478349
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-12-23 08:04:56 +00:00
Jim Harris
1cbc41021c thread: return int from spdk_thread_seng_msg
This at least allows the caller to know there was a
problem, and that the messages wasn't actually sent.

SPDK by default creates huge rings so this problem
should never occur, but out-of-tree use cases may
send messages much more often and require at least
a notification when it fails.

While here, change the thread check to an assert.
There's no need to work around someone calling
this function with a null thread parameter.

Fixes issue #811.

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

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472438 (master)

(cherry picked from commit 4036f95bf8)
Change-Id: Ie6d432d616be45c7a4232aff1548cef198702bc0
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478442
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-12-23 08:04:56 +00:00
Tomasz Zawadzki
e660235c9d SPDK 19.10
Change-Id: Ib2ae8d8d95152dac0c8a9180e3f479fef5d882e0
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472777
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-10-31 21:33:05 +00:00
Ben Walker
0680344863 nvme: Document new cuse functions
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472834 (master)

(cherry picked from commit 368de579b6)
Change-Id: I2644d7909899fd7aa4e9690eec0fe20de5f17289
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472964
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-10-31 19:26:02 +00:00
Ben Walker
5a472f2779 nvme/cuse: Poll the io_msg queue when the admin queue is polled
Users already have to poll the admin queue, so embed the io_msg
queue polling there to simplify the API.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472833 (master)

(cherry picked from commit 11739f3cb1)
Change-Id: I4d4d3be100be0798bee4096e0bbda96e20d2405e
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472963
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-10-31 19:26:02 +00:00
Seth Howell
ec6de131f7 nvme: don't disconnect qpairs from admin thread.
Disconnecting qpairs from the admin thread during a reset led to an
inevitable race with the data thread. QP related memory is freed during
the disconnect and cannot be touched from the other threads.

The only way to fix this is to force the qpair disconnect onto the
data thread.

This requires a small change in the way that resets are handled for
pcie. Please see the code in reset.c for that change.

fixes: bb01a089

Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472749 (master)

(cherry picked from commit 13f30a254e)
Change-Id: I8a39e444c7cbbe85fafca42ffd040e929721ce95
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472960
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Seth Howell <seth.howell@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-10-31 19:26:02 +00:00
Tomasz Kulasek
74906b01b6 lib/nvme: add RPC for interacting with CUSE devices
Added RPC commands to register/unregister CUSE devices
to NVMe controllers:

 - bdev_nvme_cuse_register
 - bdev_nvme_cuse_unregister

Additionally two RPC now return CUSE device names:

 - bdev_get_bdevs for namespaces
 - bdev_nvme_get_controllers for controllers


Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I69c4bf41ec8f78a7522894268a67dd733881712f
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472211
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-10-24 23:43:59 +00:00
Tomasz Kulasek
805d994281 lib/nvme: add NVMe character device
NVMe character device implementation. This patch adds implementation
of IO producer using CUSE library. It allows to create nvme device
nodes in linux kernel for controller as well as for namespace and
process ioctl requests as usual from linux environment.

Both devices (controller and namespaces) are exposed as character
devices.

To compile NVMe CUSE module use "./configure --with-nvme-cuse".

Names for created CUSE devices can be retrieved using
spdk_nvme_cuse_get_ctrlr_name() and spdk_nvme_cuse_get_ns_name().


Signed-off-by: Jim Harris <james.r.harris@intel.com>
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I0fc9a9a1ef3c9c2b3112d07c2b4b1f8d49665ee1
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466917
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-10-24 23:43:59 +00:00
Maciej Szwed
72e079a880 lib/nvme: implement external IO processing
This patch allows to send IO requests from external module to the nvme
device.

External module should call nvme_io_msg_ctrlr_start() to start IO message
producer on the controller and enable sending messages.

nvme_io_msg_send() is used to send IO to NVMe driver thread context,
where passed function will be called. Allowing the external module to
issue IO as needed.

NVMe driver users should poll spdk_nvme_io_msg_process() to move forward,
sending IO from external module and process their completions.

Change-Id: Ie59abac69870c4e4daa50120c747f3b620395921
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471386
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-10-24 23:43:59 +00:00
Michael Haeuptle
53b92a6c18 nvme: allow setting of completion queue CDW0
This change allows setting of the NVMe completion queue
CDW0 in spdk_bdev_io_complete_nvme_status.

Before that change, handling of vendor specific NVMe IO
commands was limited since there wasn't a way to return
command specific info back to the initiator.

Change-Id: I250d5df3bd1e62ddb89a011503d42bd4c8390f9b
Signed-off-by: Michael Haeuptle <michael.haeuptle@hpe.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470678
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-10-24 18:02:38 +00:00
Seth Howell
5215fad6ef nvme: Add an API for updating a controller trid.
This can be useful when trying to perform multipath failover at the
application level. However, the controller must be in the failed state
before calling this function.

Change-Id: I5403c0036fed5dd3600ee20592925297494ba8aa
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470699
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-10-24 17:36:31 +00:00
Seth Howell
7d3771f93c nvme_ctrlr: add get/set for ctrlr->is_failed.
These will be useful helper functions for the trid modification code
that gets introduced later.

Change-Id: Ief73e3045710bf35c511794c19b4dfefb93018f1
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471780
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-10-24 17:36:31 +00:00
Seth Howell
e45b619c3d nvme: add function to reconnect qpairs.
While it is unlikely that a single qpair will be failed, it is important
to make it possible to reconnect a single qpair.

This function is also handy at the application layer when going through
a reconnect workflow. If we get -ENXIO from a qpair when we poll, we
will turn around and call this function. If we get -ENXIO from this
function, then we know the whole controller is failed and we need to do
a reset.

Change-Id: I6a8ea0ce27fce2f5fc0a5b3db05834acd68e6a39
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471417
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-10-24 17:36:31 +00:00
Chunyang Hui
ac4949807b Opal: Add async function for revert TPer
Some nvme drives might take 6-7mins for
this operation. Thus, introduce async function
to avoid waiting.

Change-Id: Id48478aec653d3fb75a3c5ce75d4997284ed016c
Signed-off-by: Chunyang Hui <chunyang.hui@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468916
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-10-24 17:09:57 +00:00
Konrad Sztyber
6d2ba25561 lib/vmd: LED management support
This patch adds support for LED management of the devices behind VMD.
It's possible to set four different states: off, on (fault), 1Hz
blinking (rebuild), and 4Hz blinking (identification).

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

Change-Id: I02abcd9fc98ba912ca4d7936be22e9d5b4950ea2
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470648
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
2019-10-24 17:04:04 +00:00
Seth Howell
ae3a9b8f08 nvme_qpair: return -ENXIO when the qpair is failed.
This will be the canonical way of informing the user that we have lost
the qpair connection somehow.

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

Change-Id: Ic6c7c2d0e07e9d3e857a3476bb6b91fb4b6454fa
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471416
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-10-22 21:14:22 +00:00
Shuhei Matsumoto
1dc9a7627f lib/scsi: Check pending tasks for the SCSI device only from the specific initiator
Refine the public helper function spdk_scsi_dev_has_pending_tasks to
be able to check tasks only from the specific initiator.

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

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

Fixes #985

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I50afb940de7174360c8a30479450850002a3e525
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471337
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-10-18 17:30:13 +00:00
Jan Kryl
0a04c076ea nvmf: Add context parameter to new_qpair() callback
It can be useful for passing additional information about nvmf
target to a handler for new nvmf connections. Context can be
stored in globals as it is currently done in nvmf code. However
in case of multiple targets or languages where accessing global
state is challenging (i.e. Rust), this becomes inconvenient.

Change-Id: Ia6a2fdba4601531822b3e5fda7ac5ab89d46f6c5
Signed-off-by: Jan Kryl <jan.kryl@mayadata.io>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469263
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Seth Howell <seth.howell@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Sasha Kotchubievsky <sashakot@mellanox.com>
2019-10-17 16:29:36 +00:00
Anil Veerabhadrappa
5e25bbdd49 nvmf/fc: Add listen address support in FC transport
Enables access control to allow subsystem access on one or more FC ports.

If a subsystem definition does not have a single valid "Listen" directive,
then the subsystem will allow dynamic listen address binding. For such
subsystems,
   * When a FC port comes online, FC transport will add port's address
to subsystem's listen list.
   * When a FC port goes offline, FC transport will remove port's address
from subsystem's listen list.

If subsystem definition has 1 or more valid "Listen" directives then FC ports
coming online or going offline will not affect subsystem's listen address
whitelist.

Signed-off-by: Anil Veerabhadrappa <anil.veerabhadrappa@broadcom.com>
Change-Id: Ic7fed76e4bf8d1df0aeeae1d4fa5e6d207afccf3
Signed-off-by: Anil Veerabhadrappa <anil.veerabhadrappa@broadcom.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471025
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-10-17 16:29:04 +00:00
Anil Veerabhadrappa
ca080c1309 nvmf: fix a typo in api documentation
Signed-off-by: Anil Veerabhadrappa <anil.veerabhadrappa@broadcom.com>
Change-Id: If35b8795df191c3f5a5c888c68b58249835aeeb0
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471431
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
2019-10-17 16:25:17 +00:00
Ben Walker
9a650e34ad thread: Add doxygen headers for spdk_thread and spdk_poller
They now show up as hyperlinks when referred to in the documentation.

Change-Id: Iff85b050a78de82ad84d82d32f7e80177e9a9b35
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470526
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-10-16 15:54:44 +00:00
Ben Walker
7756ba14e4 sock/posix: Store pointer to group in sock
It was previously impossible to get back to the group
from the socket. This will be needed later.

Change-Id: I7b72c1b3bb9f5f4fda7e94475636e103df409316
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470522
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-10-15 16:35:09 +00:00
Ben Walker
a0889ece60 sock: Add a function to check if a socket is connected
This is useful for detecting sockets that have been disconnected
by the other end without reading data.

Change-Id: Ieb6529984d282d48373766d9f5555cf11720f19b
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470513
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-10-15 16:35:09 +00:00
Xiaodong Liu
4c10e0bbca blobfs/fuse: put FUSE code in module blobfs_bdev
FUSE operations in blobfs_fuse.c are extracted from
test/blobfs/fuse/fuse.c to blobfs_fuse.c in module blobfs_bdev.
And it is extended to create one new thread dedicatedly for one
FUSE mountpoint to handle FUSE requests by blobfs sync API.

spdk_blobfs_bdev_mount is implemented as the export API. So
related code can be utilized by other modules/apps.

Now test/blobfs/fuse/fuse.c is much simplified with function
spdk_blobfs_bdev_mount.

Change-Id: Iefa16977fabbae2008c8f65fe1b69d650b6fd18d
Signed-off-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469347
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-10-15 16:25:09 +00:00
Chunyang Hui
b60a249bea bdev/part: add API to get name of bdev_part_base
Change-Id: I1545f5aaab67c3a56d37c712cafc932c089a0477
Signed-off-by: Chunyang Hui <chunyang.hui@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468909
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2019-10-09 14:39:19 +00:00
fanyang
bb9d17a5c3 lib/log: passing va_list to user-provided log call
va_list is not passed in logfunc, so the user-provided log call can't
get the arguments corresponding to the format string.

This patch fixes it and replaces log func pointer in spdk_app_opts
with logfunc.

Change-Id: I7f7806f47c4fd8f36f3234aa5a8c877db0fc7140
Signed-off-by: Yang Fan <fanyang@smartx.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469828
Reviewed-by: Feng,Li <fengli@smartx.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-10-09 14:35:51 +00:00
Xiaodong Liu
6433c1037d blobfs: add blobfs_create RPC as mkfs
Following test/blobfs/mkfs case, add it as one RPC
method to let build a new blobfs on given block
device.

Change-Id: I0ffbb1add95dfbc8655e0238ed6f3cd519dd945b
Signed-off-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466485
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-10-09 05:02:00 +00:00
Xiaodong Liu
3ce759a1d5 blobfs: add blobfs_detect RPC
Add module blobfs_bdev as a general module to simplify
the operations of blobfs on bdev. Then its functions
can be utilized by other libraries or apps.

blobfs_detect can be used to detect whether there is
one blobfs on given bdev.

Change-Id: Ib425574816061dc945fb652b539f791a44097a43
Signed-off-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466486
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-10-09 05:02:00 +00:00
Ben Walker
8efa583f13 test: Add a mock for writev
This is useful for testing partial sends in the socket layer.

Change-Id: Ib5bb62d641ad8d6a23a662261f7c72f5ba55c813
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470520
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-10-08 15:48:29 +00:00
Seth Howell
fcaabb48fa queue_extras: use SPDK_CONTAINEROF
A couple of the functions inside of the queue_extras file were relying
on an undefined __containerof function. Replace that with
SPDK_CONTAINEROF. Then add an extra check so that when someone includes
this file on FreeBSD, it doesn't throw compiler warnings for the
redefinitions (see our cpp headers test for example).

The argument order for both functions is the same, namely pointer, type,
member.

Change-Id: I1bd0497ee14df8b37f4de1046e271e5fe144ca82
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470191
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
2019-10-07 15:06:01 +00:00
Evgeniy Kochetov
9522ed36f8 bdev: Add resize event
This patch adds RESIZE event to block device API.

Signed-off-by: Evgeniy Kochetov <evgeniik@mellanox.com>
Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Change-Id: Ic9fe359d19544fa0a48eed91216b858097e82995
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468543
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-10-02 22:30:29 +00:00
Wojciech Malikowski
45b5808eba lib/bdev: Added spdk_bdev_zone_append()
spdk_bdev_zone_append() allows writing to
open zone from multiple threads or from
single thread with queue depth greater than
one. Zone first logical address and number of
blocks to be written are provided by user.
Logical block address of written data is
returned in completion callback.

Change-Id: I4da994d72b7e0fe6621962e3b0f2380940ec3b45
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461614
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-10-01 14:48:54 +00:00
Maciej Wawryk
a10d0ce79c RPC: rename context_switch_monitor to framework_monitor_context_switch
Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: I6de7bf824b5f57e535168afaafca55f4c758fc94
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468667
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-09-30 21:13:41 +00:00
Benjamin Saunders
6bcd3588d1 nvme: add support for write uncorrectable command
Change-Id: I9fb7a998f7c13ce53cba630a895e8e11cf5f4a1c
Signed-off-by: Benjamin Saunders <bsaunders@google.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467559
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>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-09-26 18:42:57 +00:00
Wojciech Malikowski
a9e6fadf3e lib/bdev: Added spdk_bdev_io_get_append_location()
spdk_bdev_io_get_append_location() will be
used during zone append command to retrieve
location of data write.

Change-Id: I1f46ae9d2f745aa53264c1a01da3f7cef4f38c72
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469164
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2019-09-26 16:17:34 +00:00
Wojciech Malikowski
2b16dcc740 lib/bdev: Added spdk_bdev_zone_management()
spdk_bdev_zone_management() allows to perform
management action on a zone. Zone is specified
by start logical block address. Available zone
actions: open, close, reset and finish.

Change-Id: Ie7eaed3e2cc7b9b49dd51ee2d6c28b4ef2f23eb9
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460647
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-09-24 16:39:27 +00:00
Wojciech Malikowski
02cabd9eb8 lib/bdev: Added spdk_bdev_get_zone_info() command
spdk_bdev_get_zone_info() is used for retriving
information about zones inside zoned namespace.

Change-Id: I8f931505245e984c0b1ee35ed6592c978ee47544
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460643
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-09-24 16:39:27 +00:00
Wojciech Malikowski
aa35048d15 lib/bdev: Zoned bdev public header
Added new public header for zoned bdev. Zoned bdev is an
extension of the bdev interface. Generic concept comes
from ATA/SCSI and is also being worked as an NVMe TP.

Zoned device logical blocks space is divided into fixed-sized
zones. Each zone is described by its start logical block address
and capacity. Writes to a single zone need to be sequential.
After zone is fully written it need to be reset to write to it
again. Such writing schema could be very beneficial in terms of
write amplification factor for NAND based devices.
SPDK Flash Translation Layer library will be consuming this
interface in the future.

Extending SPDK bdev interface will allow to use existing bdev
infrastructure for this new type of devices.

Zoned device have several properties defined in spdk_bdev
structure:
 - zone_size: default size of each zone
 - max_open_zone: maximum number of open zones
 - optimal_open_zones: optimal number of open zones to get
		       best performance on writes

Single zone properties are defined in spdk_bdev_zone_info
structure:
 - start_lba: first logical block of z zone
 - write_pointer: logical block address in the zone at
		  which next write shall occur.
 - capacity: maximum number of logical blocks that may
	     be written in the zone when zone is empty.
 - state: zone state

Several zone states are defined: Empty, Open, Full, Closed,
Read Only and Offline.

To change zone state zone actions are defined: Close, Finish,
Open and Reset.

Change-Id: I5fcc22d548c15743329344cae96f5ff73e268504
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460642
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
2019-09-24 16:39:27 +00:00
Wojciech Malikowski
9b3ae37f33 lib/bdev: Added spdk_bdev_is_zoned() to bdev interface
This patch is entry point for extending bdev
interface to support devices with zoned namespace
semantics.

spdk_bdev_is_zoned() will allow user to check if
bdev is zoned bdev.

Change-Id: Id9ea9898d406d1d942bf3081b00ebcb574ac2b5e
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460641
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
2019-09-24 16:39:27 +00:00
Seth Howell
a52cb577b7 lib/nvmf: add helper functions for future RPCs.
Functions added in this patch:
spdk_nvmf_tgt_get_name - get human readable name from target.
spdk_nvmf_get_first_tgt - start iterating over global list of targets
spdk_nvmf_get_next_tgt - get next target in iteration

These functions will facilitate the following RPC

nvmf_get_targets - get the names of all active NVMe-oF targets.

In this series, I will also add two more RPCs, nvmf_create_target, and
nvmf_destroy_target, as wrappers around the create and destroy
functions. Since all of these changes are pretty minor and closely
related, I will just do one big changelog entry at the end.

Change-Id: Ia9f1248fbf9726fa3889998a169211fb25e724f2
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468386
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-09-24 16:35:42 +00:00
Wojciech Malikowski
18ed0c7f6b lib/bdev: spdk_bdev_get_write_unit_size() interface
Added write_unit_size field to bdev structure.
It describes required number of logical blocks
for write operation. For legacy bdevs this value
will be equal to logical block size.
For bdevs working on top of Open Channel/Zoned
Namespace SSDs or RAID 5 volumes write size unit
could be greater than logical block size and
upper layer should perform write operations
with size of multiple of write unit size.

Change-Id: I55eb6687912a7d0d1157874b2778e7d6c2d44e37
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463802
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
2019-09-20 20:19:40 +00:00
Changpeng Liu
acb9849c05 nvme: add arbitration configuration options to NVMe driver
Weighted Round Robin can be enabled for users, and users
can allocate different priority IO queues for different
purpose.  For now we will enable this feature in the
NVMe driver first, following patches will enable this
feature in bdev layer.

Change-Id: I0f799236ca04eb85ef3c9f972ed63ff2718563ba
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466852
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-09-20 02:04:06 +00:00
Darek Stojaczyk
c049304a95 env: add spdk_pci_device_unclaim()
spdk_pci_device_claim() could create a file on the
filesystem that couldn't be deleted programatically.
It could only be overwritten - e.g. by another spdk
instance - but this didn't really work if that
another instance had less privileges and hence no
access to the previous file.

This is exactly the case we're seeing on our CI when
running SPDK as non-root. In general it's a good idea
not to leave any leftover files, so now we'll delete
the pci claim file when the spdk process exits.

spdk_pci_device_claim() used to return a file descriptor
that could be simply closed to "un-claim" the device.
It'll now return only a return code. The fd will be
stored inside spdk_pci_device and will be closed either
when user calls the newly introduced spdk_pci_device_unclaim(),
or when the device is detached.

We'll still need to clean up those files somewhere in
our test scripts (probably ./setup.sh cleanup) to
clean up after crashed processes or so - but we don't
necessarily want to run such scripts inside the autotest
whenever a non-root spdk is about to be started.

Change-Id: I797e079417bb56491013cc5b92f0f0d14f451d18
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467107
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-09-18 20:34:39 +00:00
Xiaodong Liu
3cba062b86 blob_bdev: add spdk_bdev_create_bs_dev_from_desc
New interface for create spdk_bs_dev from bdev desc.
This change, together with spdk_bdev_open_ext, can
remove the race condition where user gets the bdev
structure, but bdev is removed after getting that
structure and before spdk_bdev_create_bs_dev function
is called.

Change-Id: Ia80c3527ff91b45f97f44d295a5cb6d83f5ee0e4
Signed-off-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468412
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2019-09-18 02:59:59 +00:00
Ben Walker
ec77c2a8bb util: Fix LTO compilation with FMV
Function multiversioning conflicts with LTO when applied
to a function defined in a header file included from
multiple compilation units.

Change-Id: I65bed3903a717b7e982ab185c314d2118ae0e795
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465972
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
2019-09-11 16:30:38 +00:00
Changpeng Liu
6ad44e8be6 nvme: add weighted round robin supported flags
Change-Id: I4b303e7096dfdd29ef5d39f30223d03c32d20ae1
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466679
Reviewed-by: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-09-09 01:55:18 +00:00
Richael Zhuang
d40944a256 util: Solve "invalid target attribute" building error
When building SPDK on aarch64, met error about invalid target attribute 'bmi',
'arch=core2' and 'arch=atom'.

Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Change-Id: I369e61005e6550045e24d84147a71b5dd25c4a52
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466848
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-08-30 19:56:15 +00:00
Darek Stojaczyk
9554bd7326 bdev/crypto: silence scan-build null dereference false positive
Scan build is really pessimistic and assumes that
mempool functions can dequeue NULL buffers even if they
return success. This is obviously a false possitive, but
the mempool dequeue is done in a DPDK inline function
that we can't decorate with usual assert(buf != NULL).
Instead, under #ifdef __clang_analyzer__ we'll now
preinitialize the dequeued buffer array with some dummy
objects.

Change-Id: I070cfbfd39b6a66d25cd5f9a7c0dfbfadc4cb92a
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463232
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-08-30 17:17:58 +00:00