Commit Graph

297 Commits

Author SHA1 Message Date
Isaac Otsiabah
7c60aec01e nvme: add I/O timeout callback
Change-Id: Ie6220590467b88fe1e63b4b0f8a01221fc0c1206
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-10 16:17:18 -07:00
Isaac Otsiabah
a4cc346b17 nvme: convert nvme_tracker list to a TAILQ
Change-Id: I822529b28b683f707604c07721040f22689961c4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-10 15:45:53 -07:00
Daniel Verkamp
ea3a2772ac nvme: do not attach DPDK driver if user does not want to attach
This bug was preventing multiple calls to spdk_nvme_probe() from
working, since the first call would return 0 from all of the DPDK driver
init callbacks and prevent other devices from ever being enumerated in
subsequent calls.

Reported-by: Tsuyoshi Uchida <tuchida@us.fujitsu.com>
Change-Id: I871aa170bbd03be111604eeabe3a7a7a4f40ce89
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-09 15:04:26 -07:00
Ben Walker
8a9c1d4011 nvme: Make striping a quirk
Use the standard quirk mechanism to specify which devices
need software assisted striping.

Change-Id: Id8156876a90b4caf9d687637e14c7ad4a66ceda6
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-09 14:38:42 -07:00
Ben Walker
d3f66cdb2b nvme: Hotplug events just place new controllers in the init list.
This way, all new controllers discovered will be initialized
in parallel.

Change-Id: Iebedb3905eb2787a3708f74425afae40ca31253d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-08 15:22:48 -07:00
Ben Walker
34100924e4 nvme: Rename nvme_probe_one to nvme_ctrlr_probe
Simplify the arguments as well.

Change-Id: I653e1aad4e574cf95d793b41b749cb19e0024c2b
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-08 15:22:48 -07:00
Ben Walker
7473d6b37c nvme: Call the probe_cb if a device isn't claimed
If the first call to spdk_nvme_probe probes a device and
the driver elects not to take it, still call the probe
callback for that device on subsequence calls to
spdk_nvme_probe.

Change-Id: If06467cf6796c827a0bbfba6e36d5b91534526fc
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-08 15:22:48 -07:00
Ben Walker
11ef5d396b nvme: Move hotplug monitor check inside _spdk_nvme_probe
Move this down a level so it happens on all paths.

Change-Id: Iea9913f0e102353882466c8dea4ee39abb857520
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-08 15:22:47 -07:00
Ben Walker
06557b0a4d nvme: Add remove callback to transport scan
Scanning the transport may result in both new
devices and removed devices, so pass the callback
for both operations.

Change-Id: I6f73dbe6fd7cf61575c354b43f8ae3e2a01e2965
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-08 15:22:47 -07:00
Ben Walker
d70ff832bf nvme: nvme_transport_ctrlr_scan now takes a transport id
Simplify the arguments to nvme_transport_ctrlr_scan to take
a transport id that identifies the discovery service (or
NULL to scan PCIe).

Further, separate scan into two functions - scan and attach.
Scan is for scanning an entire bus, attach is for a specific
device.

Change-Id: I464f351a02a04bc5a45096dcf5dc8fc5ac489041
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-08 15:22:47 -07:00
Ziye Yang
da43f64b17 nvme/rdma: Get right initiatior depth by ibv_device_query
Change-Id: I125e95dd405c21c5aea852e619801f1ef2de94ee
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-12-08 14:18:36 -07:00
Ben Walker
5f78155fde nvme: Embed a transport_id in the discovery_info struct
Instead of repeating the fields, just embed a transport_id.

Change-Id: I282704c9d59784abd5f7c93be4e47c673fcf6dde
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-08 11:48:21 -07:00
Ben Walker
a2f35bcc16 nvme: Remove nvme_attach
Change-Id: Ia688e49574d8d80f1473f93f127586ca5aaa7d91
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-08 11:48:21 -07:00
Ben Walker
4af9f06c73 nvme: Rename discover_info to transport_id
This is a small step toward making discovery more like
scanning a local PCI bus.

Change-Id: Ie7149ad060f2eeb56939b1241187bdf09681f2aa
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-08 11:48:21 -07:00
Ziye Yang
f74d64f07f nvme/rdma: fix the nvme_rdma_pre_copy_mem
Before adding readv/writev support in nvme_rdma,
using this patch.

Change-Id: I25ff0df61d0346f22560d011158d7f80e72007ea
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-12-08 10:33:05 -07:00
GangCao
52f3c2fa52 nvme: free IO qpair when cleaning up died process
Change-Id: I136945b6bed4d2cdb0ee54b27b224c2e9cec377f
Signed-off-by: GangCao <gang.cao@intel.com>
2016-12-08 10:32:52 -07:00
GangCao
48820a5ef6 nvme: check the IO qpair is on the list before removing
Change-Id: Ic9706a51dcf65a848088448a3cfcdabd20f42f7d
Signed-off-by: GangCao <gang.cao@intel.com>
2016-12-08 10:32:48 -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
GangCao
47341b89b7 nvme: make the mutex with robust attribute for multi-process case
Change-Id: I0dbdad447c6b3b30100a0165a1e1ca300c53c8ca
Signed-off-by: GangCao <gang.cao@intel.com>
2016-12-07 13:46:03 -07:00
Daniel Verkamp
307d1320d8 nvme/rdma: use common Get Log page function for discovery
Change-Id: Ic635dabd039c56dfebdd0da64c4efe672b240013
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-07 13:36:24 -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
Ziye Yang
320c7fb825 nvme: drop Set Features of Keep Alive Timeout
The NVMe over Fabrics transports should already be setting this in the
initial admin queue Connect command, so setting it again is not useful.

The kernel NVMe over Fabrics target additionally has a bug in the Set
Features - Keep Alive Timeout handler (it is extracting the KATO value
from the wrong offset in the command), so this works around the kernel
bug by not sending the Set Features command at all.

Change-Id: I0d7f09b71fcea116acf8810c5880157bb9315a04
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-12-07 12:34:02 -07:00
Ziye Yang
efd7ecd5d4 nvme/rdma: fix the kato value assginment in connection
Change-Id: Idc63a8f20a85bc73d48bd622b5a6e18ca4ed50d6
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-12-07 12:34:02 -07:00
Ziye Yang
8eaf533156 nvme/rdma: set IOSQES and IOCQES in cc register
The reason is that kernel nvmf target will check the
value. If not set, it will fail the other commands later.
Even for discovery ctrlr, kernel nvmf target will
check the cc value.

Change-Id: I998327f91ba96281d261952878eb84d648a823da
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-12-07 12:34:02 -07:00
Daniel Verkamp
152a3f0528 nvme/rdma: Connect command HSQSIZE is 0-based
Change-Id: I8e089c515bc6dfdf3088cfbb772d58527c6bd8de
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-07 12:34:02 -07:00
Ben Walker
5b8c0c5ace nvme: Rename spdk_nvme_transport to spdk_nvme_transport_type
It's not the whole transport - it's just an enum for the
type of transport.

Change-Id: Ia435a21792f221ddf50ddf4f0923c6152622eccb
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-07 09:47:00 -07:00
GangCao
6515577822 nvme: check mutex init return code in ctrlr_construct
Change-Id: I0561f45f96ad6e88e7cdfec44c1f20677de2cb19
Signed-off-by: GangCao <gang.cao@intel.com>
2016-12-06 12:58:24 -07:00
Ziye Yang
b93d5a7ae5 nvme/rdma: set NUMDL/NUMDU fields in Get Log Page
Change it according to the spec thus we can test
kernel nvmf target

Change-Id: Ica98dd40503a40c0f0de8efaefb1f6f67a89cde8
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-12-06 12:57:57 -07:00
Daniel Verkamp
f93fd72680 env: split PCI drivers into individual files
Change the PCI enumeration API to individual functions per device type
so that only the drivers that are actually in use get linked into the
final executable.  All of the common code is still shared internally in
the env_dpdk library.

Change-Id: I2ba83afe59202a510f999a0674e23e60b6581221
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-06 09:30:55 -07:00
Daniel Verkamp
13827a74a8 nvme: do not detach automatically on hot remove
The user's remove_cb should detach the NVMe controller when it can
ensure that it is no longer in use.  In the interim (between remove_cb
and spdk_nvme_detach()), the controller will remain in a failed state,
so any new I/O submissions will return an error code but not crash.

examples/nvme/hotplug is not yet updated for this change, but that will
be done in a separate patch.

Change-Id: I8827ba36f9688ccb734e7871f20f11ec11e88f96
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-05 11:13:16 -07:00
Ziye Yang
10690dedcd nvme/rdma: change the arg to 0 in nvme_rdma_fabric_prop_get_cmd
The buf is NULL, the size of buffer should be 0.

Change-Id: Iba89732ea6abeb65106ae1e158902e1dd9a1204c
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-12-05 13:02:04 +08:00
Daniel Verkamp
be4f8d0562 nvme/rdma: fix double free in qpair creation error path
While we're here, fix up typos and add error logs for all error exits
in nvme_rdma_qpair_connect().

Change-Id: I236fe6571c2012ca047aa8a447638d9227454c2f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-02 15:59:46 -07:00
GangCao
bb726d516b nvme: add multi-process support
This version of multi-process support needs to have DPDK 16.11 builtin.

Change-Id: I3352944516f327800b4bd640347afc6127d82ed4
Signed-off-by: GangCao <gang.cao@intel.com>
2016-12-02 12:24:22 -07:00
Daniel Verkamp
9d025383eb nvme: rename nqn fields in public API to subnqn
The discover and probe 'nqn' fields are subsystem NQNs, so name them
subnqn to be consistent with the spec and the rest of the code and to
distinguish them from host NQNs.

Change-Id: I4a80fbc1f4b037c8a4f91c8f28d2a96e47c66c47
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-01 08:08:19 -07:00
Daniel Verkamp
89136259ec nvme/rdma: add hostnqn to spdk_nvme_ctrlr_opts
Allow the host NQN to be overriden when connecting to NVMe over Fabrics
controllers.

Change-Id: I8fcf2e89ae7d9722677e834f76a8fe805c52f91b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-01 08:08:19 -07:00
Cunyin Chang
e8c63cdde0 nvme: Add support for hotplug.
Change-Id: Iac504ce15e4ea3100e5afa31764fcfff7f979dbb
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-12-01 10:21:59 +08:00
Cunyin Chang
d1a37e98e6 nvme: Make the nvme_transport_ctrlr_scan() could scan a specific device.
Change-Id: I74f7582f5175742e96268dc9c0cc83db2e1eaea0
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-12-01 10:17:41 +08:00
Daniel Verkamp
6ab28a201b nvme/rdma: register responses as a single ibv_mr
Change-Id: I55ec9275142584768543e3a6de6eb5c675f6a063
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-30 17:10:39 -07:00
Daniel Verkamp
1712d1b7a2 nvme/rdma: convert SGL trace helper into a macro
This makes the function and file/line info actually useful (instead of
pointing to the helper function itself).

Change-Id: I22bac68827115880a49d456706a7eaecdc12e9b5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-30 17:10:39 -07:00
Daniel Verkamp
a9e436911f nvme: remove transport qpair_destroy() function
Each transport should handle its own qpair cleanup internally.

Change-Id: I7dd737be820ea6bad686f4aad7d74044fad58a47
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-30 17:10:39 -07:00
Daniel Verkamp
ba16e46349 nvme: pass opts and probe_info to nvme_attach()
Let the transport access the controller options during
ctrlr_construct().

Change-Id: I83590c111e75c843685dd9315f0f08416168356d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-30 17:10:39 -07:00
GangCao
02a142abee nvme: move callback check only for the owning process
Change-Id: I05b5540fe8b1e22e8aebe23598b8cd44c8990861
Signed-off-by: GangCao <gang.cao@intel.com>
2016-11-30 17:04:48 -07:00
Ziye Yang
2e6ec373bf nvme/rdma: fix the I/O qpair creation issue
Change-Id: I357f4a83736977d319175445b4d65443f57b2c6f
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-11-30 16:57:18 -07:00
Daniel Verkamp
11a2f1cf47 nvme/rdma: simplify nvme_rdma_req_get()
nvme_rdma_req_get() is an internal function, and its only caller already
checks for a valid rqpair, so the NULL check is unnecessary.

Also clean up the redundant STAILQ_EMPTY/STAILQ_FIRST logic and use
STAILQ_REMOVE_HEAD.

Change-Id: Ic3828e8b5e881879173cb59350e39c5fac90e6ef
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-30 16:38:48 -07:00
Daniel Verkamp
9c2186ea65 nvme/rdma: make nvme_rdma_pre_copy_mem() return void
nvme_rdma_pre_copy_mem() does not have any failure cases, so remove its
return value and remove the never-taken branch in its only caller,
nvme_rdma_qpair_submit_request().

Change-Id: I91011734ed0c20f8db691d62172fe1a3021dd3a1
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-30 16:38:48 -07:00
Daniel Verkamp
5660dfde83 nvme/rdma: simplify nvme_rdma_req_put()
nvme_rdma_req_put() is an internal nvme_rdma.c function, and all of the
callers already have the rqpair, so pass it directly.  We also already
verify that all of the callers have a valid rqpair and req before
calling nvme_rdma_req_put(), so it doesn't need to check for NULL
pointers.

This also means that spdk_nvme_rdma_req doesn't need to hold a pointer
to its rqpair anymore.

Change-Id: I893a46a9074f0a843e379d10c123f9292eb3b1a4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-30 16:38:48 -07:00
Daniel Verkamp
de8b8712f8 nvme/rdma: remove unused outstanding_reqs counter
The only place where outstanding_reqs was checked was in
nvme_rdma_req_put(), but the error case there could only happen if some
kind of internal programming error occurred (e.g. calling
nvme_rdma_req_put() on an invalid request).

Change-Id: I71e40ce562a8720dfaf70437ffd4c6493327c091
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-30 16:38:48 -07:00
Daniel Verkamp
e343a735e0 nvme/rdma: inline and simplify send WR init
nvme_rdma_ibv_send_wr_init() was only called in one place, so just move
its contents into nvme_rdma_qpair_submit_request() since it allows
simplification of the code:

- req was always NULL, so remove the code that used req entirely.
- wr and sg_list are never NULL, so remove the checks for those.

Change-Id: I12a4f3502219d3681607686945e343f6808c0d2f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-30 16:38:48 -07:00
Daniel Verkamp
22d8acbcf1 nvme/rdma: check discovery entry subtype
We currently don't handle discovery service referrals, so skip those, as
well as any other unknown subsystem type.

Change-Id: I64f889e9272fb57b5cf9bb5467b3abca3955baf5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-30 16:38:48 -07:00
Cunyin Chang
51b15b93e7 nvme: Make sure the driver not exit when aer not supported.
QEMU's virtual NVMe controller device does not support the AER Set
Feature, so ignore its failure and continue.

Change-Id: I8b5c217a3112edabb6f76ec3e5f4ef774981a1d7
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-11-30 16:37:46 -07:00