Commit Graph

471 Commits

Author SHA1 Message Date
GangCao
619ab1a700 nvme: no need to send abort notification for died application
Change-Id: I7005159b2c4cc71c249cfdc4adbf8500f006fb1c
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/365646
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-06-20 15:43:21 -04:00
Daniel Verkamp
65ff7a63d2 nvme: special case TRID comparison for PCIe
PCIe transport IDs are a non-standard extension to the NVMe-oF transport
address, and they only use the transport type and address fields of the
structure.  Add a special case so that the rest of the fields are
ignored for PCIe addresses.  All other transport types are NVMe-oF
addresses and should compare all fields.

Change-Id: I45ed143ea1712d17c6de8082677deeefd395c8a2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/365916
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-06-16 20:46:26 -04:00
Daniel Verkamp
149b2754e6 nvme_spec.h: update to NVMe 1.3
Sync the spec header with the major changes for NVMe 1.3.

Some of the added fields may have been added in previous
versions of the spec.

Change-Id: Ia50a52f5192cf450bb5cc2d18fcc1f92ebce7f77
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/362046
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-15 13:45:12 -04:00
Jim Harris
302828bb5b nvme: free req_buf after deleting queues
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I941a4cb5563cebb2e68b48d3a74b4b73af0e9657
Reviewed-on: https://review.gerrithub.io/365662
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-06-15 13:37:50 -04:00
Daniel Verkamp
ad20a6ddc2 nvme/rdma: check discovery log page RECFMT
Change-Id: I1e272c63a5d863c92f1aa8299a9d98dcb72d0b13
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/365082
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>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
2017-06-14 13:55:07 -04:00
Ben Walker
89ad3f3d6b nvme: Abort outstanding commands when qpair is deleted
These commands should be treated as aborted by spec,
so correctly deliver abort notifications when a
qpair is deleted.

Change-Id: I8af47a3f42f5695ef8e1a70813662e69102720b2
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/364681
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-06-09 13:49:13 -04:00
Ziye Yang
fb7ad4ac66 nvme_rdma: Support getting all log page entries
Preivously, we can only get part of the log page
entries due to the limitation of buffer. With this
patch, we can get all.

Change-Id: I81b8afc73c108dac65d1ff5fe8d03bda41fa29a1
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/363323
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-06-08 15:44:46 -04:00
Changpeng Liu
b6a9493bb1 nvme: enable CMB for submission queue by default
Also provide an option in perf tool let users to
disable it.

Change-Id: If4952513d77cecaa4f9403fbea811d86916ee87c
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/363311
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-06-05 13:03:48 -04:00
John Meneghini
8a44220b1a env: Rename spdk_malloc/zmalloc/realloc/free to spdk_dma_(func)
- rename spdk_malloc_socket to spdk_dma_malloc_socket
  - rename spdk_malloc to spdk_dma_malloc
  - rename spdk_zmalloc to spdk_dma_zmalloc
  - rename spdk_realloc to spdk_dma_realloc
  - rename spdk_free to spdk_dma_free

Change-Id: I52a11b7a4243281f9c56f503e826fd7c4a1fd883
Signed-off-by: John Meneghini <johnm@netapp.com>
Reviewed-on: https://review.gerrithub.io/362604
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-05-31 15:30:27 -04:00
Daniel Verkamp
a02c0062bd nvme/host: use spec-compliant PSDT value 01b
Resolves GitHub issue #165.

Change-Id: If214bdfbe5b92faf2a6611d25e36c3c8876e3190
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/362239
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-05-23 17:10:50 -04:00
GangCao
afbb5ceec2 nvme: remove NVME_IO_TRACKERS to use hardware and user specified size
Change-Id: Ie6946343314a62e4416d8cd7dadd98c20a1c1e3a
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/361700
Tested-by: <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-05-23 16:01:52 -04:00
Daniel Verkamp
5f3841f0e3 nvmf: allow NQN to be 223 bytes + null terminator
An ECN to the NVMe 1.3 specification has clarified that the NQN may
contain 223 bytes before the null terminator.  Make all of our NQN
length checks consistently enforce this behavior.

Change-Id: Iebfd57d11abea64964c7a6ad9d886e40efa243c3
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-05-18 14:36:39 -07:00
GangCao
b347d551e8 nvme: detach the pci device with calling process's own devhandle
Change-Id: I2693b4bd29e0500379d5e399723aec7e44bffca3
Signed-off-by: GangCao <gang.cao@intel.com>
2017-05-16 10:35:29 -07:00
Paul Luse
bf31637789 nvme: add timeout value to multi-process driver init
Unit tests will be added as part of a separate patch updating all UT for
nvme.c.  Global used for timeout value so it can be easily overwritten
by the upcoming unit tests for this function.

Change-Id: I7fc15aab91601ac57c94cae266b212c0998d2495
Signed-off-by: paul luse <paul.e.luse@intel.com>
2017-05-12 07:53:48 -07:00
Ben Walker
b961d9cc12 include: Move the remainder of the code base to stdinc.h
Change-Id: I6a142feeaad3117bd3c75e7c5cb7231a1cfa78ae
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-05-08 13:20:36 -07:00
Jim Harris
13f8cf1536 nvme: add NVME_QUIRK_DELAY_AFTER_QUEUE_ALLOC
The VirtualBox emulated NVMe device will intermittently
hang on the first read/write command after an I/O
qpair has been allocated.  The frequency of the hang
diminishes if a delay is added after allocating the I/O
qpair - until it disappears completely with a 100us delay.
So add a quirk to insert this delay.

Note - the 100us delay was tested by running
the hello_world example app 50000 times.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I237e31b1b8a1a1e28262851ae0a21cd7345f0f1a
2017-05-01 10:22:18 -07:00
Daniel Verkamp
50cc397d6f nvme: simplify nvme_ctrlr_destruct qpair loop
Fixes a scan-build warning about using qpairs after they have been
freed.

Change-Id: I263eabd6b784acf540c66136965f7705ef110a78
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-04-26 06:40:17 -07:00
Daniel Verkamp
5639b965ac scripts/check_format.sh: catch misaligned comments
Fix up the existing comment blocks misaligned in the first column.

Also add line numbers to the comment checks.

Change-Id: I9d28c365271df36e7013d74cbb02d0023ab4f581
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-04-26 06:39:58 -07:00
Ziye Yang
e02d0bbd5f nvme: add the '=' separator support in spdk_nvme_transport_id_parse
Thus, we can support both ':' and '='.

Change-Id: I4400ba770912a2b20e49432c2e6e2a1bd45c28ed
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-04-21 09:38:45 -07:00
Jim Harris
b5b9410da3 nvme: remove DELAY_BEFORE_ENABLE quirk and always wait 100us
A 100us is so small that applying the quirk to the specific
SSDs that require the delay is more trouble than it is worth.
So remove the quirk and always wait 100us before re-enabling
the NVMe SSD during initialization.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Id6a8cc6e35d103fffdf135580301fc3e5b27e722
2017-04-17 11:56:36 -07:00
Jim Harris
fd5d6901f2 nvme: use spdk_likely/unlikely macros in I/O path
Also avoid an spdk_get_ticks() call in the default
case where a timeout_cb_fn is not defined.

On my Intel(R) Xeon(R) E5-2699 v3 system with an
Intel(R) P3700 SSD, these modifications reduce software
overhead per I/O by 3-5% (as measured by the SPDK
overhead tool).

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I5bb5a87747b15d9e27655fabcd2bc1a40b0b990e
2017-04-17 11:56:36 -07:00
Daniel Verkamp
5742e9b9e7 nvme: allocate requests on a per-queue basis
Change-Id: I7bec816e518a0a6f2e9fb719128c83d4b908d46c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-04-12 21:05:24 -07: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
Ben Walker
b9feeb03c1 nvme: Call the timeout callback only a single time
For each command that times out, call the timeout
callback one time if the user registered one.

Change-Id: Iaad39a886468e89bef63fe292c5cad1dce97a57c
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-04-12 13:11:01 -07:00
Ben Walker
36a793ad63 nvme: Add a quirk to delay before enabling
It has been discovered that some devices require
a very small delay before writing CC.EN to 1 after
CSTS.RDY goes to 0.

Change-Id: I73d31726d17ebf5bbec7ee528e2f98fcd05234dd
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-04-03 11:18:15 -07:00
Ben Walker
652d48d5f5 nvme: Fix up long lines in nvme_quirks.c
This isn't the indentation pattern I would have chosen, but
it's a complicated negotiation between what I want and what
astyle will let me get away with.

Change-Id: I4909587823931842ac3f227134e1d05e7d80da74
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-04-03 11:18:15 -07:00
Ben Walker
f190418231 nvme: Simplify latency page quirk
Any Intel device reporting device ID 0x0953 needs this quirk.

Change-Id: I690b01ecf05105df00ec8cf6f2da7f7c0a601aa8
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-04-03 11:18:15 -07:00
Ben Walker
2efe9aa7bf nvme: Add all known DIDs for striping quirk
Update the list to include all new DIDs.

Change-Id: Ib00da939587010d44c097da07ec0625890e4c8cc
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-04-03 11:18:15 -07:00
Ben Walker
2e82b58684 nvme: Release lock before calling remove_cb
This prevents a deadlock if the user immediately
calls spdk_nvme_detach.

Change-Id: I79f28abe163cbbf184bea907692c44aa4e1c8893
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-29 21:07:21 -07:00
Cunyin Chang
1bbb43c544 nvme: Replace some strcpy with snprintf
Change-Id: If80ae64fa672ae6b847ad985be6862e5d2b3729b
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2017-03-23 15:26:07 -07:00
Daniel Verkamp
2563429809 nvme: convert uevent failure message to TRACELOG
The message about the uevent socket is not a fatal error; it just means
that hotplug monitoring will not work.

Change-Id: I29f6a253e96a86420c0fde9e19135f9f1d229bb9
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-21 15:39:21 -07:00
Jim Harris
e2b330e989 nvme: correctly handle valid PRPs with non-block size first/last elements
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I801547126987b1a2c5e8e95d468c30e508a1c3b0
2017-03-21 08:03:29 -07:00
Cunyin Chang
b7349216b9 nvme: optimization for nvme probe and detachment.
remove the unnecessary rte_eal_pci_probe_one() in function
spdk_pci_device_detach(), this could cause error message when we
terminate the application, it will also not make sense try to probe one
device after we detach it, we could call spdk_pci_nvme_device_attach()
instead of spdk_pci_nvme_enumerate() when we have one given device address,
dpdk will try to scan the device and add it back to pci device list then.

Change-Id: I35f5bb412249bb20da57394f0531c10a49691906
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2017-03-15 09:00:25 -07:00
Daniel Verkamp
83e556534b nvme/rdma: eliminate bounce buffer copy
Register all spdk_malloc() memory regions as ibv_mr in a spdk_mem_map
so we can look up the RDMA key for the user's buffer and pass it in the SGL
directly, rather than copying through a pre-registered bounce buffer.

Change-Id: I7340bc2020b5256750c95dbd24ba67961404e5e7
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-10 11:39:28 -07:00
Changpeng Liu
8482b47d53 nvme: initialize namespace capability flags with correct order
The extended LBA format flag should be initialized after namespace
capability flag.

Change-Id: Iad479b454bb4e31120c17d40ae23937a099c6f8f
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2017-03-10 11:39:09 -07:00
Ben Walker
ac9b92c853 nvme/rdma: Consolidate send_cq and recv_cq
The send completions must be processed prior to the
recv completions. However, if the completion queues
are separate this leaves a small window where
a send+recv completion arrive between polling
the send_cq and the recv_cq, resulting in the code
seeing the recv completion prior to the send
completion.

By combining the completion queues, this eliminates
any potential gap. The send completion will always
be processed before the recv completion.

Change-Id: I06bfef6af48559d0b9e00524ebc10f1a102e7387
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-09 15:08:18 -07:00
Daniel Verkamp
b55d837e7b nvme: only include x86intrin.h for x86 platforms
The actual uses of intrinsics are already guarded by feature-specific
ifdefs in nvme_pcie_copy_command(), but the header itself should also
only be included when it will actually be needed.

Change-Id: Ife65d6432b8dfd9d9db80fe4e385ab76491874c0
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-07 12:44:10 -07:00
Daniel Verkamp
cb0538aefb nvme: clamp io_queue_size to valid range
I/O queues must have at least 2 entries.

Change-Id: Ib11b08fab4b518501f8ce80d6b73d9e33c9777a6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-06 15:30:04 -07:00
Jim Harris
37ccb50c50 nvme: allow for deletion of I/O qpairs during their completion context
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ibc6566e9248cd7004aa5d4374f32b519062ed6d9
2017-03-06 14:01:25 -07:00
Daniel Verkamp
6a03451228 nvme/rdma: use spdk_malloc() for DMA data buffers
These allocations need to be from memory registered with the SPDK env
library to allow future work on automatic ibverbs memory registration.

Change-Id: I6ec6999ecd6d6bf6ba4ab159630f7d01f3d46154
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-03 10:23:20 -07:00
Daniel Verkamp
b9ca539390 nvme: add transport ID comparison function
Change-Id: I4ab7cbad1c31ac57347bb470f3f545d3ca81de43
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-01 14:35:18 -07:00
Daniel Verkamp
a3a3d7dddf nvme: export transport ID trtype and adrfam parsers
Change-Id: I8d417c5baa68832c568c3df0927d84e2f44bb887
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-01 14:35:18 -07:00
Isaac Otsiabah
687e93c4a5 nvme: export abort command as public API 2017-02-27 10:44:17 -07:00
Daniel Verkamp
b6d6cd8e81 nvme: pass command ID to timeout callback
This can be used for issuing an abort for the timed-out command.

Change-Id: I3c5727fdddc156cd7c8f99afbc3e6da8e73bba56
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-23 17:49:01 -07:00
Ziye Yang
27cf11d04e nvme,rdma: optimize nvme_rdma_post_recv
Move the ibv_recv_wr initialization in
nvme_rdma_alloc_rsps. Thus we can save some
CPU times

Change-Id: Id449b2684290431f8b3ba97ec4058171d34038bf
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-02-22 19:15:41 -07:00
Ziye Yang
b89e758c8d nvme.rdma: move ibv_send_wr init while allocate rdma reqs
We do not need to set it for submission since the contents
are same

Change-Id: I345094e2e8a858b318be73d28f09393566587d95
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-02-22 19:14:54 -07:00
Daniel Verkamp
5f2f2052c0 nvme: reorder spdk_nvme_timeout_cb arguments
Move cb_arg to the first argument to match the other NVMe callback
function signatures.

Change-Id: I4e699c8071dcb7ba4ce3cdb82ee985600208204c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-22 17:55:43 -07:00
Ben Walker
08c69c9cc5 nvme: Handle failing MMIO reads while resetting
This has been reported for a number of different device
types. We suspect these devices are technically out of
spec, but they work with most other available NVMe
drivers on accident.

Change-Id: I529cfc03fc314cbab2a1cd40620bf1dd5b54182d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-02-21 14:20:41 -07:00
Daniel Verkamp
59fc5ba613 nvme: fix extended LBA block size calculations
For namespaces with end-to-end protection information, metadata size
of exactly 8 bytes, and extended LBA configured, the NVMe driver would
calculate the size of the data block incorrectly.  The NVMe spec has a
special provision for this specific case (8-byte metadata only) and
PRACT = 1 that requires that the host does not send the metadata as part
of the host memory buffer.

To fix this, clean up the calculation of the per-block data transfer
size by adding a new extended_lba_size field in the namespace, which
represents the total size of data to be transferred per block based on
the namespace's configured metadata size and whether it transfers
metadata as part of the data buffer.  Then add the special case for
PRACT = 1 and PI configured and extended LBA in the R/W helper
functions.

Change-Id: I0b383a58c773cac06e6c018858b57129064c6059
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-10 10:24:26 -07:00
Daniel Verkamp
84d904841f util: move common helper functions to util.h
These were repeated a few different places, so pull them into a common
header file.

Change-Id: Id807fa2cfec0de2e0363aeb081510fb801781985
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-10 09:38:52 -07:00
Daniel Verkamp
ff0047816d nvme: track submit time instead of timeout time
This removes one addition from the submission path (negligible, but a
nice side effect), but also opens up the possibility of reporting the
total time an I/O took - since we are always tracking the submission
time anyway, there is no extra cost to report it in the completion
callback.

Change-Id: I7129e7c09d20da8082042a7622d045846461dd9c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-08 09:23:58 -07:00
Daniel Verkamp
d57f3db1b5 nvme: clarify nvme_ctrlr_set_state debug prints
For infinite timeout states, instead of printing UINT64_MAX as a
decimal number, interpret it as "no timeout" instead.

Change-Id: I579f5857f96286734940ab5f493261e60354c4fe
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-31 18:06:09 -07:00
Daniel Verkamp
018e6afff2 nvme: remove ctrlr_get_pci_id transport callback
The PCIe transport initializes the quirks directly, so the generic hook
to get PCI ID is no longer necessary.  This path was dead code.

Change-Id: I25bdaa598db53e4312a264d9d8356d1b416696e5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-31 14:50:40 -07:00
Daniel Verkamp
a384110d7a nvme: move nvme_qpair_fail() call to generic code
The logic to fail queue pairs when the controller is failed should be
handled in the generic code, not in the individual transports.

This also allows nvme_qpair_fail() to be private to nvme_qpair.c.

Change-Id: I6194576dceb35073b9af8847e59314900028637c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-31 14:50:40 -07:00
Ben Walker
eb2ec1b07b nvme/rdma: Reap multiple completions per poll
This is more CPU efficient than only grabbing one
completion per call to ibv_poll_cq.

Change-Id: I0c70d33639f0f345482d9e7c810f9c6723937058
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-01-30 14:16:05 -07:00
Daniel Verkamp
b809cdd3ab env: add spdk_mempool_create() socket_id parameter
Change-Id: I8ab0bb2c6e1fdf1681fbd049a096c1768e54dc27
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-30 13:05:30 -07:00
Ziye Yang
47ae3957eb nvme/rdma: Invoke rdma_ack_cm_event in exceptional cases
In our previous code, we did not ack the event in
exceptional cases when we get a event via rdma_get_cm_event.
Thus, the code may block with in this statement:
rdma_destroy_id(rqpair->cm_id);
in some exceptiaonal cases. And this patch will solve this
issue.

Change-Id: Iddb6fb5356a5ee0ed04e261a040ba53042fca302
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-01-26 10:48:23 -07:00
Cunyin Chang
5f3e922a6a nvme: Fail the qpair if it is marked as failure when process the completion queue.
This make sure the qpair failure could be started from upper level application.

Change-Id: I7e04fe36929cc634ddf0078db96fbc40afb38f8c
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2017-01-25 16:31:52 -07:00
Ben Walker
d77c030172 nvmf: NVMe-oF 1.1 adds cntlid to RDMA private data
Change-Id: I44ec5264fc93fa85706750cb23bbd0ed0587db81
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-01-23 16:46:55 -07:00
Cunyin Chang
2d5087b305 nvme: Add assert for g_thread_mmio_ctrlr in sigbus error handler function.
The g_thread_mmio_ctrlr should be not NULL pointer when it enter the
handler function.

Change-Id: I45dba601c672b16e2c6feafd9059bafde0d8f1b4
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2017-01-23 16:10:09 -07:00
HaoZhiZhang
49daf72e0e nvme: support extended LBA without protection information (#101)
If namespace is formatted with per lba metadata feature and also disable end-to-end protection
feature, host couldn't use per extended-lba metadata area.

Signed-off-by: Zhihao Zhang <thomas.zzh@alibaba-inc.com>
2017-01-23 11:20:04 -07:00
Daniel Verkamp
d63a30e39d nvme/pcie: return 1 when PCI address doesn't match
If the user asked for a specific PCI address in spdk_nvme_probe(), we
need to return 1, not 0, for the other PCI addresses that don't match
when enumerating.  0 means to attach the PCI driver, whereas 1 means to
continue enumerating.

With the previous behavior of returning 0, all NVMe devices would be
attached to the DPDK PCI driver, even if the user did not request for
them to be probed, and further calls to spdk_nvme_probe() would not find
any devices.

Change-Id: Ifbbcd7d1abe8ab535b6957855172e66a3e69fbe4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-20 17:07:30 -07:00
Daniel Verkamp
be8a9d6966 nvme: add transport ID string parsing function
Change-Id: I33c15c8a56c25667567b373d21a117cca1f756c7
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-19 14:05:57 -07:00
Ziye Yang
0a573526b6 nvme/pcie: Add the support to probe nvme by pci_addr
Currently we use the pci functions provided by DPDK,
it identifies the device by class id related
info but not by pci bdf info, so we can add the filering
by pci_addr in pcie_nvme_enum_cb function.

Change-Id: I5942e98853f00fc10fa6aae5c113517653d1b357
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-01-18 15:30:45 -07:00
Jim Harris
86e8a920bf nvme: split non-compliant SGLs into multiple requests
Since nvme_ns_cmd.c now walks the SGL, some of the test code
needs to also be updated to initialize and return correct values
such as ctrlr->flags and sge_length.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I521213695def35d0897aabf57a0638a6c347632e
2017-01-17 07:51:09 -07:00
Ziye Yang
d61ddd3c93 nvme/rdma: Support directly connect via trid
Preivously, we only supports probe the NVMf target
via discovery info, now we can support to directly
to connect it.

Change-Id: I08ce1d95de6744286357e68b48c97b773b902ac8
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-01-13 10:57:03 -07:00
Ziye Yang
90f13aa634 nvme/rdma: Support sgl for readv/writev functions
(1) Add nvme_rdma_build_sgl_request function
(2) Merge nvme_rdma_pre/post_copy_mem to nvme_rdma_copy_mem

Change-Id: I86abab821b32b4da0aa9489a6b9f7dc430333159
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-01-11 12:36:52 -07:00
Daniel Verkamp
f80c0f4fdd nvme: remove transport ctrlr_attach callback
Now that the hotplug code is isolated in nvme_pcie.c, it can call the
PCIe transport attach function directly.

Change-Id: I2df3b9168473b537cc9b13367e06d3d3b6fa22be
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-09 11:36:27 -07:00
Daniel Verkamp
df8129fb39 nvme: move num_entries to transport-specific qpairs
The spdk_nvme_qpair::num_entries value is never used in the common code,
so move it to the individual transport qpairs to make it clear that it
is a transport-specific implementation detail.

Change-Id: I5c8f0de4fcd808912ba6d248cf5cee816079fd32
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-05 15:49:09 -07:00
Daniel Verkamp
f1a9afa9fc assert.h: split UNREACHABLE into internal header
The definition of SPDK_UNREACHABLE uses the build-time DEBUG definition,
which is not available in the public API.

Change-Id: I1862c99fa5c85ccd3483f94e9c35de531da57f3c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-05 11:57:18 -07:00
Ben Walker
c2d38ee8da nvme/rdma: Improve error message when polling fails
Change-Id: Ia75d62669f3c1f923031f6a33e4797cc56ac1141
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-01-05 09:24:02 -07:00
Ben Walker
d9a3a8e50c nvme/rdma: nvme_rdma_recv now takes the response index
Instead of passing the work completion, just pass the
response index. This keeps the work completions localized
to the polling function.

Change-Id: I0e6a1d8564200b5ac3aa43dfd58ae152d439bbd8
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-01-05 09:24:02 -07:00
Ben Walker
0ebf93e35c nvme/rdma: Pass qsize to nvme_rdma_ctrlr_create_qpair
This eliminates an if statement, since the two callers
of this function know the desired queue size.

Change-Id: I28fabac8613f7b8fc7d96cf95b085b6e4dcf985f
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-01-05 09:24:02 -07:00
Ben Walker
c26c655d59 nvme/rdma: Eliminate nvme_rdma_ctrlr_construct_admin_qpair
Just call the regular qpair create function instead.

Change-Id: Ic35b1eb6fcdf0d82733ea573a493f583dd63d5bd
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-01-05 09:24:02 -07:00
Ben Walker
3ad0c336c8 nvme/rdma: Eliminate max_queue_depth
Use the num_entries value in the generic qpair instead. These
values had to match anyway.

Change-Id: Ia6400fbaba97df3ef6db4dc07a2ab95af1e5143f
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-01-05 09:24:02 -07:00
Ben Walker
10aed30149 nvme/rdma: Handle requested qsize not matching obtained qsize.
Change-Id: I44d9e01dba87c2f78ef13296b78532255d749432
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-01-05 09:24:02 -07:00
Daniel Verkamp
e1b514ce9a nvme/rdma: cache value of bb_mr->rkey
Avoid an extra level of pointer chasing when we are filling out the NVMe
SGL.

Change-Id: I1a40af16fda80f7480c419524876bfb1a1902eb8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-03 16:56:34 -07:00
Cunyin Chang
6152d5bf8f nvme: move hot-plug logic to nvme pcie layer.
Change-Id: I2042b34e4284a9c59aa3092ccd061c075748880c
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2017-01-03 16:56:13 -07:00
Jim Harris
4cc1cf888c nvme: break out request child creation code to separate function
This will allow it to be better be reused for some future patches
enabling splitting of non-PRP-compliant SGL-based requests.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ica38fd6cf191f72baa524bcc4896b3c9939ab762
2017-01-03 15:16:05 -07:00
Yongseok Oh
ee5b26a2d2 nvme: LBA variable fixed to 64bits for _nvme_ns_cmd_setup_request() function (#96) 2017-01-03 09:35:37 -07:00
GangCao
5a3def3936 nvme: free allocated contig_buffer
Change-Id: I1ce45d4937ee7a170d74f381cfaed263e3420ccd
Signed-off-by: GangCao <gang.cao@intel.com>
2016-12-20 13:49:31 -07:00
Ben Walker
bf89b4da10 nvme/rdma: Eliminate _nvme_rdma_ctrlr_create_qpair
This intermediate function is no longer needed.

Change-Id: I3523cc6d8f3b290165a953d42cca8b76eda762c5
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-19 12:51:50 -07:00
Ben Walker
30677dc222 nvme/rdma: Move call to send fabric connect into qpair_connect
Sending the fabric connect command is part of establishing
a connection, so move it into the main connection-establishing
function.

Change-Id: I55e7ffdd16b576c81b51d7d3910203f9afc1f4c2
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-19 12:51:50 -07:00
Ben Walker
a96a6ecf58 nvme: Rename nvme_qpair_construct to nvme_qpair_init
This function initializes the members of an existing
qpair struct. It doesn't construct one from scratch.

Change-Id: I0b9afac1ad25cfb217efd146702f693c74f5f697
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-19 12:51:50 -07:00
Ben Walker
3e5c1d0a2b nvme/rdma: Don't allocate requests/responses until after connected.
No need to allocate all of the requests and responses until
we know a connection can be established.

Change-Id: I072a10aadfd7ced773634448f7d7e788622d0a4c
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-19 12:51:50 -07:00
Ben Walker
ee80b31cb7 nvme/rdma: Delete config_rdma_req
The code is clearer if this function is incorporated
into its only caller.

Change-Id: I33901cddf80ae27896b2acfd1b9e7d212f21f5f3
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-19 12:51:50 -07:00
Ben Walker
414702426d nvme/rdma: Rename nvme_rdma_bind_addr to resolve_addr
This is resolving the address and route to the target, not
binding a socket to an address.

Change-Id: I80055481ed2e020410a1e186a4e7371b60faaee9
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-19 12:51:50 -07:00
Ben Walker
42dc2836bc nvme/rdma: Add a utility for getting the next cm event
Change-Id: Ia7650e729ab233be6464fb0a190c9cd29f462fcf
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-19 12:51:50 -07:00
Ben Walker
fa97f35f06 nvme/rdma: Remove unused code in nvme_rdma_connect
Change-Id: I4f63136f57d074a9f7ff6027f2e8f6fb8a9c8dae
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-19 12:51:50 -07:00
Ben Walker
df46c41a4c nvme: Unify spdk_nvme_discover and spdk_nvme_probe
They were very close to the same already, so finish the job.

Change-Id: Ifba9e3b2d11a3e70cbfbe46f57a67552db2757ed
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-19 11:22:57 -07:00
Ben Walker
c00bce397d nvme: Move nvme_hotplug_monitor up in the file
Avoid having to forward declare.

Change-Id: Ib1e5629f855fa70ba77247972823a8418a5fc7a9
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-19 11:22:53 -07:00
Daniel Verkamp
b8da09b629 nvme/rdma: the NVMe SGL should use rkey, not lkey
We should be sending the bounce buffer's remote key to the target so it
can put it into an RDMA SGE on the remote side.

Change-Id: Icded155ad2292c67baa722f001c9c07178bc2754
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-15 16:39:53 -07:00
Daniel Verkamp
b74979421f nvme/rdma: remove write-only rdma_req->bb_len
Change-Id: Ied1bee7c8db87cca890d94e519ec07ae3fc658b2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-15 16:39:53 -07:00
Daniel Verkamp
e8184c1f25 nvme/rdma: change max queue size from 127 to 128
There is no particular reason for this to be 127; make it 128 to at
least be consistent with the PCIe transport.

Change-Id: I60500e0044d3549ba6350e1f35f09d624848bd21
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-15 16:39:28 -07:00
Ben Walker
b2a86421f4 nvme/rdma: Fix specification of R/W queue depth
The meaning of the parameters was swapped.

Change-Id: I3f4938c446fd06afd1852bcf08e779b7b988855d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-15 16:35:00 -07:00
Ben Walker
375da65762 nvme/rdma: Remove nvmf_cm_construct
This function was only called from one place and saved no
lines of code.

Change-Id: If5e653732df57c1f2c93e20cf4f286eac31df91c
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-15 16:35:00 -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
Daniel Verkamp
9938985766 nvme/rdma: queue request if no rdma_req available
This matches the behavior of nvme_pcie, which queues a request if no
tracker is available.

Change-Id: Idbf6c951c89451cfea22ec6bc553ff46f988f818
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-15 11:13:09 -07:00