Commit Graph

117 Commits

Author SHA1 Message Date
Jim Harris
4794c791de bdev: add pointer to module structure
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ic3051b63942770e45be22af0ae03a78a7c543f81

Reviewed-on: https://review.gerrithub.io/368597
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-07-12 12:42:56 -04:00
Jim Harris
908cab3f1c bdev: populate module_name
Add a name parameter to the MODULE_REGISTER macros, and then
modify each bdev module to pass a string for its name.

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

Reviewed-on: https://review.gerrithub.io/368596
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-07-10 19:17:08 -04:00
Daniel Verkamp
2bdec64fbf jsonrpc: modify API to pass request to handler
This will enable asynchronous request handling in a future patch, and it
also removes the need for the RPC handlers to know about request id and
the JSON-RPC rules about notification-only requests.

Change-Id: I25aaa8e48bff8d5594ffcccecb61842b1e31ec3c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/368225
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-07-06 13:48:12 -04:00
Ziye Yang
a9428cb39e blockdev, nvme: do not probe local nvme device if not configured.
Change-Id: Icdb017d7e6b0a38f8ff3aa78ea60117936dfe178
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/366702
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-06-30 18:21:49 -04:00
Daniel Verkamp
37a7ff0fd7 nvme: add API to convert trtype and adrfam to string
Also add adrfam to the NVMe bdev JSON config output.

Change-Id: I9472bda04947cffc0df9b02eba0035bac01b7d7b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/367292
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-06-30 12:43:18 -04:00
Ben Walker
c224997be5 bdev: Remove direct calls to start/stop pollers
Abstract these through the bdev API to break this
dependency on the event framework.

Change-Id: I108505bf27e94b2985f53d0a4dc0b847ae264d25
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/366340
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-06-22 10:47:31 -04:00
Ben Walker
0cb7586e13 bdev: Use message passing from io_channel.h instead of events
This breaks one dependency of the bdev library on the
event framework.

Change-Id: I47ac81a3e4e951f94a66b5de2639eb485dc62e41
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/366339
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-06-22 10:47:31 -04:00
Daniel Verkamp
721a4d44ec bdev/nvme: generalize check for NVMe-oF TRID types
Anything that is not a PCIe TransportID is a remote NVMe over Fabrics
address and must have a subsystem NQN.

Change-Id: I1d34ce09a2c4ad7d3ec14fd90b5afccc33eb2bbf
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/365917
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
Ziye Yang
99cad03497 bdev,nvme: make conf can parse NVMe-oF target
Preivously, we can only parse NVMe-oF target by
rpc. Also the handling for local NVMe device and
remote NVMe devices are not consistent. With this
patch, we can handle it in the consistent way.

Change-Id: Id5c25f8b38a38ac997887b78c2321f148b8844ec
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/364348
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-06-16 15:35:33 -04:00
Ben Walker
e6d5f6c418 bdev/nvme: Delete+Recreate I/O queues around a reset
This ensures all I/O will be aborted and that no I/O
will be submitted while the reset is ocurring.

Change-Id: I0f5c993b91d9be6073c6ddf66ae12010f56f864c
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/364682
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-06-14 19:06:44 -04:00
Daniel Verkamp
eba5c996c8 bdev: add NVMe I/O passthru command
Change-Id: I4d281be99553629563026cc4f9ab890d0a97986c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/364115
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-06 13:07:32 -04:00
Daniel Verkamp
bac4c02bc4 bdev: change name and product_name to char *
Dynamically allocate bdev names to remove the arbitrary 16-character
name length limit.

All of the existing product_names are constant strings, so those can
just use string literals instead of a copy per bdev.

Change-Id: I3280da67a4fcf2e4ec8ee8193362ca1b96a9c0cb
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/363601
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-06 12:37:39 -04:00
Ziye Yang
7bc1a7d1a6 blockdev_nvme: free name in nvme_ctrlr
Need to free this variable.

Change-Id: I78a7d5b312db6487ed65b9d314590a28408da761
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/363477
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-06-06 12:37:26 -04:00
Edward Yang
54e16f96b3 bdev: Add spdk_bdev_nvme_admin_passthru
Support passthru for NVMe admin commands.

Change-Id: If926f2ecabb078a553158f544c10a92452dbdb39
Signed-off-by: Edward Yang <eyang@us.fujitsu.com>
Reviewed-on: https://review.gerrithub.io/363294
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-05 18:07:10 -04:00
Daniel Verkamp
a0cb1377f6 Update existing fallthrough comments for GCC 7
The stricter warning levels (-Wimplicit-fallthrough=4) require all-caps
FALLTHROUGH, so update the existing comments to match.

Change-Id: I5f8608101cad31d8ea8e84d48604397f98400e87
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/363491
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-02 19:48:49 -04:00
Ziye Yang
9104fe73ce bdev: make (v)bdev init in async manner
Change-Id: I93684a004e2ae276734edbb4767b5ba1bac3dd48
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/362111
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-05-31 15:30:58 -04:00
Ben Walker
d969ac445a io_channel: Remove per-channel priority
This wasn't used anywhere and we currently believe there
are superior software-only techniques for controlling
quality of service.

Change-Id: Icdadd5870ed0629b338c307d2619bbc242c3e7a3
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/362065
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-05-26 13:42:19 -04:00
Jim Harris
24e0f710cf bdev/nvme: only enable hotplug in primary processes
Only DPDK primary processes can initiate device probe.

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

Reviewed-on: https://review.gerrithub.io/362452
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-05-25 13:52:09 -04:00
Jim Harris
fa1429ba02 bdev/nvme: clean up return codes
This prepares for translating -ENOMEM from the NVMe
driver into an associated bdev status code.

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

Reviewed-on: https://review.gerrithub.io/362234
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-05-24 11:42:15 -04:00
Ben Walker
305cb239d2 io_channel: Remove unique flag
This is no longer used anywhere. For the places where we previously
used it, we've since found alternate solutions that do not
require it.

Change-Id: I738a80b95ef50348ce1c14969a3812b0a625b3fd
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/362064
Tested-by: <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-05-22 19:27:17 -04:00
Jim Harris
af781ee003 bdev/nvme: print errno on spdk_nvme_ns_cmd submission failure
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I785bfd663a2921f5e4c0630bce7906a928f26376
2017-05-18 10:23:43 -07:00
Daniel Verkamp
22b6098965 bdev: remove spdk_bdev thin_provisioning flag
Blockdevs already indicate support for unmap via
spdk_bdev_io_type_supported(bdev, SPDK_BDEV_IO_TYPE_UNMAP).

Change-Id: I634f27a281fd900bb3a6da2e4ff8a74e43579578
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-05-09 08:42:10 -07:00
Ben Walker
9ed75e4dab bdev: Rename rbuf to just buf
We plan to use these buffers for more than just reads.

Change-Id: I8fa6cb432a6cfe4406fbf240cd3aa2ae4ab5f3d5
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-05-09 08:14:31 -07:00
Ben Walker
ed159eae1b bdev: Eliminate spdk_bdev_io::ctx
The user can get there via the bdev, so this didn't
have a purpose.

Change-Id: I7f85bb71d5ee238d37ba3624d0ac68a161c95e49
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-05-09 08:14:31 -07:00
Ben Walker
3415ce1227 bdev: Pass correct channel to bdev modules
Change-Id: I38911e70303f66f479c1495d4dbe02b2205cab8a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-05-09 08:14:31 -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
Liang Yan
b0091cfe5c bdev/nvme: Increase maximum controllers to 1024
Change-Id: I5a7a5f40b0d3c8c21e26f5358bc84f538a62bff4
Signed-off-by: Liang Yan <liang.z.yan@intel.com>
2017-05-02 13:51:39 -07:00
Daniel Verkamp
6b4da26449 bdev/nvme: dynamically allocate probe_ctx
Avoid allocating a large amount of stack space when increasing
NVME_MAX_CONTROLLERS.

Change-Id: I7017e5ed9f4d4f5c860dac608c3e5ae3c35864e7
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-05-02 13:51:39 -07:00
Ben Walker
15f910ece7 bdev/nvme: Improve names of fields in config file
Remove the "Nvme" from several field names. The parser
will still accept the old name for backward compatibility.

Change-Id: I6fa86ec359b23fb63960d0aa479a845b36a0977a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-04-12 13:11:01 -07:00
Ben Walker
acd0b4573d bdev/nvme: Allow the user to control the I/O timeout behavior
The user can now not only specify an optional timeout for
commands, but also the action to take when a timeout is
detected.

Change-Id: I7d7cdd846d580e0b3a5f733d398ee9b19d6fe034
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-04-12 13:11:01 -07:00
Ben Walker
9d73eed8a6 bdev: Consistently pass user context to fn_table calls
Some calls were passing bdev->ctxt, some calls just
bdev. In most of our implementations those are the
same pointer, but they aren't necessarily.

Change-Id: If2d19f9eef059aded10a917ffb270c1dc4a8dc41
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-04-07 08:14:34 -07:00
Ben Walker
16ae587966 env: Move lcore functions into env layer.
They were previously in the event library.

Change-Id: I24ffd8f771e895ccf5395c8120423cd114893139
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-04-04 09:19:01 -07:00
Ben Walker
cf90e4de16 bdev/nvme: Simplify logic in remove_cb
This was doing an extra loop iteration.

Change-Id: Iaf1a1e4d5faaa3100d3c0fca6c7c3a8d1cd77101
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-04-03 13:26:07 -07:00
Daniel Verkamp
7f957f56c1 bdev/nvme: add HotplugEnable option
Change-Id: I53fb7c3b469d5d5bb5b86c095bf1efc914299ec7
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-04-03 11:17:47 -07:00
Daniel Verkamp
edbca2a676 conf: add Boolean value helper function
Change-Id: Ie86745fe397167416aee356dc773a1bf8387b492
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-04-03 11:17:47 -07:00
Daniel Verkamp
f390a2aad6 bdev/nvme: unregister hotplug poller at shutdown
Change-Id: Ic6a51f5e61ffd2d57e561fd1d3019b5a69a09048
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-04-03 11:17:47 -07:00
Daniel Verkamp
d55c3b8f8a bdev/nvme: convert probe messages to TRACELOGs
Also add a message when a controller is attached and assigned a name.

Change-Id: I54f2d711d55ba7ae99913fdfea652770b1f8931d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-04-03 11:17:47 -07:00
Cunyin Chang
321d28ef02 bdev/nvme: Shorten the name of hot inserted NVMe device.
Make sure the name will not exceed the length of SPDK_BDEV_MAX_NAME_LENGTH.

Change-Id: I33a3f10c836e650fdcb578c7d9e58169d9bb766a
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2017-03-29 09:17:08 -07:00
Cunyin Chang
01922c74d1 bdev/nvme: Make sure the bdev/nvme increment by 1 for new inserted device.
Change-Id: I691bb567c9fbfdb7e41f5602fe58645f232a0ee8
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2017-03-27 13:26:38 -07:00
Cunyin Chang
e5b62c126a bdev/nvme: assign names to hot-inserted devices.
this patch fix the potential possibility of coredump when
we have NVMe device hot inserted.

Change-Id: Idac255f25f42b4746c2d3ae6dfc57a19b7001160
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2017-03-24 15:50:40 -07:00
Ziye Yang
dc1a2f814e bdev,nvme: check the return value of spdk_nvme_ctrlr_get_ns
Change-Id: Icae49d87562b07e80099622681cdf83fa6930b30
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-03-24 12:18:51 -07:00
Dariusz Stojaczyk
0e2ea8797f bdev/nvme: remove dangling pointer from g_nvme_bdevs list on bdev_nvme destruction
It was causing segfaults and infinite looping.

Change-Id: I4c19b5d3af1ba1360250cd5f6aa573a27003409f
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
2017-03-23 14:40:35 -07:00
Seth Howell
39ad6c3151 bdev/nvme: Fix null terminator checks in trid
The fields are char arrays, not pointers.

Change-Id: Ieb21e7a70853ed582e459d167a66b1aa5b8c93d3
Signed-off-by: Seth Howell <seth.howell@intel.com>
2017-03-20 14:13:10 -07:00
Ben Walker
d326998ce7 bdev/nvme: Names are now explicitly assigned by the user
Names for the NVMe bdevs are now assigned by the user.
This means the same name will always be assigned to the
same device, even across restarts.

Change-Id: If9825ec9abcb5236b4671bc44a825e4f0d704fe3
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-15 17:42:45 -07:00
Ziye Yang
b0ad3322f0 bdev/nvme: RPC call can now specify remote NVMe-oF devices
Change-Id: Ief3cf71489f0725249d51851b8d3270cb4e034db
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-03-14 08:38:04 -07:00
Ben Walker
0829424e19 conf: No longer allow wildcard claiming of NVMe devices
All devices must be specified by BDF. Add support for scripts
to use lspci to grab the available NVMe device BDFs for the
current machine.

Change-Id: I4a53b335e3d516629f050ae1b2ab7aff8dd7f568
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-14 08:38:04 -07:00
Daniel Verkamp
b58a5d73ef util: add SPDK_COUNTOF() array size macro
SPDK_COUNTOF works like sizeof, except it returns the number of elements
in an array instead of the number of bytes.

Change-Id: I38ff4dd3485ed9b630cc5660ff84851d0031911f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-07 12:43:42 -07:00
cunyinch
c932e122b7 bdev/nvme: Add support for hotplug in bdev/nvme layer.
Change-Id: I4decd60fdb065a1865519013f47b6c32111fa5c4
Signed-off-by: cunyinch <cunyin.chang@intel.com>
2017-03-02 11:44:14 +08:00
Ben Walker
963777ca36 bdev: Lift restriction on number of bdevs per NVMe controller
Change-Id: If239803581ca0b1d2b3e5089d634c409269606e2
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-02-28 18:52:51 -07:00
Ben Walker
4fa782363a bdev: Add a utility function to get the nvme bdev
Change-Id: I9408533fdfe8a4bd0c8f422555a85afc93e3a568
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-02-28 18:52:51 -07:00