Commit Graph

55 Commits

Author SHA1 Message Date
Seth Howell
a3f72b2e5a lib: net, notify, nvme, rocksdb remove spdk_ prefix.
remove only the spdk_ prefix from static functions in
the above libraries.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: I59ce032c3312fa73f30c133fd62e603c1eee2859
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2365
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-05-21 09:19:00 +00:00
Changpeng Liu
68d3bb2de4 nvme: save separate metadata size to nvme request
Previously the SPDK NVMe driver always set PSDT to 01b for hardware SGLs
which is aligned to the Linux NVMe driver, for this case the metadata length
is not required when filling the NVMe command fields.  There is no alignment
nor granularity requirement for Data Blocks for PSDT 01b case.  And if the
drive reported that it needs dword alignment with SGL, for this case, when
using spearate metadata, it needs a length parameter to fill the SGL descriptor.

Change-Id: I56ffaada775fe66de7637dae15b509ee9556e80a
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1351
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: Aleksey Marchuk <alexeymar@mellanox.com>
2020-04-02 07:02:38 +00:00
Changpeng Liu
4f7fa18d69 nvme: export internal security send/receive APIs as public APIs
There are synchronous security send/receive APIs defined in nvme.h,
however, we still need the asynchronous APIs so that we can make the
OPAL library can be used in asynchronous way. As the asynchronous APIs
are already defined in nvme_ctrlr_cmd.c, so just export them to public
APIs.

Change-Id: I5646f342a4bf70faad37daa956476f05a1327bcc
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/675
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-02-26 09:22:15 +00:00
Jim Harris
a828415390 nvme: add spdk_nvme_ctrlr_cmd_get_log_page_ext()
This new function allows specifying some of the extra
cdw10, cdw11 and cdw14 bits added in the more recent
versions of the NVMe specification.

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

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479737
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
2020-01-10 08:46:33 +00:00
Changpeng Liu
0c9057f031 nvme: replace cdw11 with specific union strucutre
Change-Id: I1152b5d6d5f8e3c2f96dcca1353d85a410924fb4
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475467
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-12-06 14:43:41 +00:00
Changpeng Liu
1fea1fccf5 nvme: replace cdw10 with specific union command
Change-Id: Ibdbc6d0356749795db26f58aa5c5e68739d5df5e
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475465
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
2019-12-06 14:43:41 +00:00
Jim Harris
ef1f844395 nvme: add qpair parameter to nvme_complete_request
In some cases we have the qpair already when calling
this function.  So pass the qpair to avoid having
to get it from the request.  This shows about a 3%
performance improvement for high IOPs single core
tests.

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

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455286
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>
2019-05-22 14:51:01 +00:00
James Bergsten
fb7dbc1c27 nvme: nvme_ctrlr_cmd_sanitize
Add support for NVMe Sanitize command.

Signed-off-by: James Bergsten <jamesx.bergsten@intel.com>
Change-Id: I679a4199822733345a3dae29002a81be44b53a53
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452919
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-05-09 22:58:20 +00:00
James Bergsten
2d4f7e20a6 nvme: add spdk_nvme_ctrlr_cmd_io_raw_no_payload_build
Send the given NVM I/O command, I/O buffers, lists and all to
the NVMe controller.

This is a low level interface for submitting I/O commands directly.

This can only be used on PCIe controllers and qpairs.

This function allows a caller to submit an I/O request that is
COMPLETELY pre-defined, right down to the "physical" memory buffers.
It is intended for testing hardware, specifying exact buffer location,
alignment, and offset.  It also allows for specific choice of PRP
and SGLs.

The driver sets the CID.  EVERYTHING else is assumed set by the caller.
Needless to say, this is potentially extremely dangerous for both the host
(accidental/malicionus storage usage/corruption), and the device.
Thus its intent is for very specific hardware testing and environment
reproduction.

Signed-off-by: James Bergsten <jamesx.bergsten@intel.com>
Change-Id: I595fe02fe0dfa9c3ceba1ac116b6900357b02d2c
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451994
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>
2019-05-01 17:47:27 +00:00
Ben Walker
d02950e6f5 nvme: Cache the cb_fn and cb_arg in the tracker
This avoids a data dependent load to find which
callback to call in the completion path.

Change-Id: Ifa20790a7af3332a74bc45037e589668744af797
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450558
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-04-10 21:29:03 +00:00
Chunyang Hui
19feb4e181 nvme: add security receive and security send wrapper
Change-Id: Id25040d62f89d4e8f2268bb3383c5665c0508f5a
Signed-off-by: Chunyang Hui <chunyang.hui@intel.com>
Reviewed-on: https://review.gerrithub.io/c/438776
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
2019-01-07 05:51:07 +00:00
Chunyang Hui
99ca58e082 NVMe: Add support for security send/receive command
Change-Id: I61f6a8fac4938d6af3ac6c84bcf11f99036ed856
Signed-off-by: Chunyang Hui <chunyang.hui@intel.com>
Reviewed-on: https://review.gerrithub.io/426657
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2018-09-29 03:13:55 +00:00
Jakub Radtke
b3497d5da7 nvme: add Get/Set Feature wrappers with NSID
Some features are per namespace and require a namespace ID; the existing
get/set feature functions do not allow passing NSID, so add new API
functions that do:
* spdk_nvme_ctrlr_cmd_get_feature_ns
* spdk_nvme_ctrlr_cmd_set_feature_ns

Change-Id: Ia7dc96e57badf1a56489785fb288493592b58b80
Signed-off-by: Jakub Radtke <jakub.radtke@intel.com>
Reviewed-on: https://review.gerrithub.io/414706
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-06-12 17:59:33 +00:00
Jim Harris
d76cd984aa nvme: optimize nvme_allocate_request memsets
The memset was zeroing a lot of bytes that get
initialized either later in this function or elsewhere
in the submission code path.  Eliminating these
extra memsets saves a few nanoseconds of CPU overhead
in the NVMe submission path.

Note: one use of the cpl data member depended on
the nvme_allocate_request memset.  Since this use
case is not in the primary I/O path, just memset it
in that specific location before using it.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ife483a4d9c24c033cc7d26d94ec1700905a936f4
Reviewed-on: https://review.gerrithub.io/413153
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>
2018-06-01 21:01:42 +00:00
Daniel Verkamp
caf85d8f23 nvme: add macros to populate nvme_payload
The definitions of these macros will change in an upcoming patch that
modifies the way nvme_payload is laid out.

Change-Id: Ic6edc18928542b07be7519a72bdbf6babbeb0131
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/413174
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-06-01 21:01:42 +00:00
Changpeng Liu
65e56caa17 nvme: wrapper request completion callback into a function
When IO is finished SPDK will trigger callback at controller layer,
while here, wrapper the completion callback into a function so
that we can add error injection at this function in following patch.

Change-Id: I7b7a6d278d87fd09a05f51f688398fdf2e9c4e05
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/411630
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>
2018-05-24 18:03:25 +00:00
Changpeng Liu
2d192cf8fb nvme: use AER configuation structure when starting controller
Change-Id: I79dad84d1dc58e61eb36b461b41fbd7ee73631fc
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/406899
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>
2018-04-10 15:43:38 -04:00
Daniel Verkamp
3d57e4a8f4 nvme: unify Identify command helpers
Convert nvme_ctrlr_cmd_identify_controller() and
nvme_ctrlr_cmd_identify_namespace() into a single function,
nvme_ctrlr_cmd_identify(), with generic parameters that should be
suitable for all current callers as well as future users.

These functions were internal-only, so there is no public API change.

Change-Id: I3dbb3e6b00308b67ba1f161f8a6b11b6333fca57
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/404733
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-03-27 02:43:46 -04:00
Daniel Verkamp
c937fab3cb nvme: use uint32_t consistently for NSID values
A few places were accidentally storing namespace IDs in uint16_t.

Change-Id: Iae9d709fb20bc1ac0a584ccd9683b721ce5de961
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/403886
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>
2018-03-16 14:15:08 -04: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
Changpeng Liu
7e3a11f98b nvme: add doorbell buffer config support
NVMe specification 1.3 added a new Admin command: Doorbell buffer config,
which is used to enhance the performance of host software running in
Virtual Machine, and the Doorbell buffer config feature is only used
for emulated NVMe controllers. There are two buffers: "shadow doorbell"
and "eventidx", host software running in VM will update appropriate
entry in the Shadow doorbell buffer instead of controller's doorbell
registers.

Change-Id: I639ddb5b9a0ca0305bf84035ca2a5e215be06b46
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/383042
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-06 17:25:54 -05:00
Daniel Verkamp
8acc4ae5da nvme: add controller option to specify host ID
A random host ID is generated per SPDK application startup if the user
doesn't specify a host ID during controller startup.

This also changes the default host NQN for NVMe-oF connections to a
random UUID NQN based on the host ID.

Change-Id: Ib0f70dd63e53087716842b412a1f134a9991d4da
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/380528
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2017-09-29 11:43:25 -04:00
Young Tack Jin
ef1437b313 nvme: support meta data on vendor specific commands
spdk_nvme_ctrlr_cmd_io_raw_with_md() will be verified
on Cosmos+ OpenSSD as soon as it will support meta data.

Change-Id: Ib5f3f1f1eba66d0147a566804395bfa5ec959c2f
Signed-off-by: Young Tack Jin <youngtack.jin@circuitblvd.com>
Reviewed-on: https://review.gerrithub.io/377428
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-12 16:14:11 -04:00
Konstantin Vyshetsky
305088e594 nvme: Obtain number of queues controller allocated via "Get Features/Number of Queues"
Certain vendors do not report correct number of queues allocated in "Set Features/Number of Queues" completion CDW0 per spec.
As a work around, issue "Get Features/Number of Queues" and rely on the value provided there.

Change-Id: Ib9cc4dcf1bdb732413becc751883a7311c6f672f
Signed-off-by: Konstantin Vyshetsky <kon.vyshetsky@stellus.com>
Reviewed-on: https://review.gerrithub.io/375234
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-08-23 12:14:43 -04:00
Daniel Verkamp
cd13f280f4 nvme: track qpair within nvme_request
Change-Id: Ia40a1e79db6327c4693731e9bb7a57810795429d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-04-12 21:05:23 -07:00
Ben Walker
193f4f8392 nvme: Queue aborts beyond the abort command limit
Queue aborts that would exceed the abort command limit
in software as a convenience for the user.

Change-Id: I8c1f0380984cc6c0cdb453db961939a7f571b336
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-04-12 13:11:01 -07:00
Ben Walker
ee460db71f nvme: Don't pass admin qpair through timeout callback
Instead, pass NULL when an ADMIN command times out.
We don't expose the admin queue to the user.

Change-Id: If0768d329a689f6f7c3734c9d419e680d7378ed1
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-04-12 13:11:01 -07:00
Isaac Otsiabah
687e93c4a5 nvme: export abort command as public API 2017-02-27 10:44:17 -07:00
Daniel Verkamp
d24ea9009a nvme: add offset to spdk_nvme_ctrlr_cmd_get_log_page()
Change-Id: I1af4950995062f892062f29db85da2a8dd793d85
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-15 11:16:14 -07:00
GangCao
6bdcf5abe8 nvme: use nvme_robust_mutex related operations
Change-Id: I35416506dbafe5e9d21861e207e295e114bdb3db
Signed-off-by: GangCao <gang.cao@intel.com>
2016-12-07 13:46:03 -07:00
Daniel Verkamp
da92639400 nvme: set NUMDU in Get Log Page command
NUMDU was added with NVMe 1.2.1 and allows a larger log page size to be
described.

Change-Id: I1a4ac42393c1a21175b3564980d56b6e7a6ae80d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-07 13:36:24 -07:00
Daniel Verkamp
c655efd6a9 nvme: move create and delete I/O queue commands to PCIe
These are specific to local NVMe PCIe devices, so move them out of the
generic NVMe code into the PCIe transport.

Change-Id: Iea2056a4c438b7d3a303b4b5e977ce7aa9e58c05
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-18 10:14:00 -07:00
Tsuyoshi Uchida
0af0aa4b2e nvme: change a return value of nvme_ctrlr_cmd_format (#45) 2016-10-13 17:26:33 +00:00
Daniel Verkamp
5e9d859327 nvme: alloc buffer internally for non-I/O requests
Rather than forcing the NVMe library user to pass a specially-allocated
block of memory (e.g. rte_malloc() in the case of the default
nvme_impl.h), just make the NVMe library allocate a suitable buffer
itself and copy to/from the user buffer as needed.

The fast path I/O functions still require special rte_malloc()
allocations, since we don't want to add an allocation and copy to the
I/O critical path.

Change-Id: I7fe88c0ba60c859a33bbe95b7713f423c6bf1ea8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-13 12:47:46 -07:00
Ben Walker
888014289c nvme: No longer abstract away pthread calls
pthreads are widely supported and are available on any
platform we currently foresee porting to. Use that API
instead of attempting to abstract it away to simplify
the code.

Change-Id: I822f9c10910020719e94cce6fca4e1600a2d9f2a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-08-19 10:53:06 -07:00
Daniel Verkamp
77cb78fadf nvme: add enumeration of Identify command types
Change-Id: I2f8dc3de48c2e5dc06ccc9d007373e361bffcf63
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-19 13:31:06 -07:00
Minfei Huang
f0b20026d7 nvme: Return negative errno for failure (#24)
The conventional rule for returning errno is negative, hence there is no
need to modify caller's code to adjust this NVMe library.

Signed-off-by: Minfei Huang <mnghuan@gmail.com>
Signed-off-by: Minfei Huang <minfei.hmf@alibaba-inc.com>
2016-06-14 15:19:10 -07:00
Cunyin Chang
f2168e1d73 nvme: Add firmware upgrade interface and unit test suite
Change-Id: If66e5f97f6793df0388629fab7c3d0e9f9d5eb67
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-05-11 10:18:33 -07:00
Cunyin Chang
eae688576a spdk: Add nvme format interface and unit tests.
Change-Id: Ie0506debf547a5fc011e116421387a5adb7abf0e
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-03-17 13:37:20 -07:00
Daniel Verkamp
eb555b139e nvme: add return code to nvme_qpair_submit_request
If the controller is failed, attempting to submit additional I/O is
futile - it will be immediately failed using the completion callback,
which can result in infinite recursion if the application code resubmits
I/Os on failure.

Instead, provide a way for request submission to indicate failure, and
use it to exit early if the controller is failed; this can only happen
when a reset failed (timed out).

If a request is submitted directly by the user when the controller has
failed, we can return an error code directly.  For the case where I/O
was queued and is being resubmitted after a reset, we still need to call
the completion handler via _nvme_fail_request_ctrlr_failed().

Change-Id: I9e144328d524b25db2acf48e923b584746e8d0b6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-16 12:16:47 -07:00
Daniel Verkamp
3272320c73 nvme: make I/O queue allocation explicit
The previous method for registering I/O queues did not allow the user
to specify queue priority for weighted round robin arbitration, and it
limited the application to one queue per controller per thread.

Change the API to require explicit allocation of each queue for each
controller using the new function spdk_nvme_ctrlr_alloc_io_qpair().

Each function that submits a command on an I/O queue now takes an
explicit qpair parameter rather than implicitly using the thread-local
queue.

This also allows the application to allocate different numbers of
threads per controller; previously, the number of queues was capped at
the smallest value supported by any attached controller.

Weighted round robin arbitration is not supported yet; additional
changes to the controller startup process are required to enable
alternate arbitration methods.

Change-Id: Ia33be1050a6953bc5a3cca9284aefcd95b01116e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-14 16:00:54 -07:00
Daniel Verkamp
cc0b900e29 nvme: don't set interrupt vector in create_io_cq
nvme_ctrlr_cmd_create_io_cq() was using the queue ID as the
IV (Interrupt Vector) field in the Create I/O Completion Queue command.

Since the SPDK NVMe driver does not enable interrupts, this is
misleading at best.

Change-Id: I3ea53701fdb9f21d9dc8d8fe20ccf2833b76cfbf
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-14 08:04:44 -07:00
Cunyin Chang
9841610855 spdk: Add namespace management interface and unit tests.
Change-Id: I9d203bf7532d50b1f8c8ca50c50df09ded8b5256
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-03-04 09:52:30 +08:00
Daniel Verkamp
df26ab0583 nvme: add priority field to qpair
Set up the infrastructure for creating I/O submission queues with
variable queue priority (QPRIO in Create I/O SQ command).

Currently, this is unused, since we always use the default arbitration
method (round robin), but it will allow reinitializing submission queues
with the correct priority once weighted round robin is supported.

Change-Id: I425003879e624cfcc9687bdc495b5c1726b5a8af
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-01 14:42:03 -07:00
Daniel Verkamp
89bf6d5ce1 nvme: add error checking for internal ctrlr_cmds
Many of the internal controller initialization functions did not check
for allocation failure; add return codes and check them where
applicable.

Change-Id: Id1b33bb06fca84035369d8b7ecd4c36b8ba7134c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-01 14:42:03 -07:00
Daniel Verkamp
6eb18e2f3d nvme: rename nvme_qpair to spdk_nvme_qpair
Prepare for qpair to be exposed as part of the public API.

Change-Id: Ia63e863e95554adceeade20c829f12fe346375d5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-29 10:11:35 -07:00
Daniel Verkamp
6ce73aa6e7 nvme: add spdk_ prefix
Shorten commonly-used names:
controller -> ctrlr
namespace -> ns

Change-Id: I64f0ce7c65385bab0283f8a8341a3447792b3312
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-10 11:27:45 -07:00
Daniel Verkamp
ad35d6cd86 nvme_spec: add spdk_ prefixes
Use shorter names for commonly-used objects:
namespace -> ns
controller -> ctrlr
command -> cmd
completion -> cpl

Change-Id: I97d192546b35a6aeb76ad3a709f65631502cde71
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-09 11:06:48 -07:00
Daniel Verkamp
c02b179490 Remove year from copyright headers.
Also add a space between Copyright and (c).

The copyright year can be determined using git metadata.

Also remove the duplicated "All rights reserved." - every instance of
this line already has a corresponding "All rights reserved" immediately
below it, except for examples/ioat/kperf/kmod/dma_perf.c, where I have
added it manually.

Performed using this command:

git ls-files | xargs sed -i -e 's/Copyright(c) \(.*\) Intel Corporation. All rights reserved./Copyright (c) Intel Corporation./'

Change-Id: I3779f404966800709024eb1eb66a50068af2716c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-01-28 08:54:18 -07:00
Daniel Verkamp
407a57165d nvme: combine various payload types into a struct
This cleans up the I/O splitting code somewhat.

It also moves the SGL payload function pointers up into the hot cache
section of struct nvme_request without pushing the other important
members past the cacheline boundary (because payload is now a union).

Change-Id: I14a5c24f579d57bb84d845147d03aa53bb4bb209
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-01-27 16:52:53 -07:00