Commit Graph

268 Commits

Author SHA1 Message Date
Liang Yan
ddc4e7d0d5 spdk: Add ns cmd readv and writev unit test
Change-Id: I993daff2e5b729c72a96e030d380a5eb71bd41e3
Signed-off-by: Liang Yan <liangx.yan@intel.com>
2016-03-07 14:34:11 -07:00
Daniel Verkamp
3cbeaae6e9 nvme: add unit tests for nvme_ctrlr_process_init()
Change-Id: I87899f1e6bff5d79e5c48fc22d6ac8cdaceee8ee
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-07 13:34:25 -07:00
Zeng Linggang
5096b4e033 build: remove redundant MAKEFLAGS set
Change-Id: I4596284950c491acc576192d8e9b3a31241fbe49
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-03-07 13:25:18 -07:00
Daniel Verkamp
2e61a144dd nvme_manage: sort devices by PCI address
This way, they are listed in a consistent order across runs.

Change-Id: Ie920f4e0c2763efb6c1d2856b5ed0f57ecbe48c8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-04 16:08:14 -07:00
Daniel Verkamp
ce13ccf8b0 nvme_manage: check NS management support earlier
Don't keep prompting the user for input if the controller doesn't
support the NS management command.

Change-Id: I5bf001657ca1cbbdbf33cafff2509ade2d47bd9d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-04 15:49:51 -07:00
Daniel Verkamp
6e2a6ff132 nvme_manage: move ctrlr_list to a local variable
This doesn't need to be stored in the device struct, since it is only
used within ns_attach(), and it is freed at the end of the function.

Change-Id: I0d4a14a6743e8cbf9e8f1a6c19c68cf0dfc2bab2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-04 15:48:45 -07:00
Daniel Verkamp
c015a2485b nvme_manage: move ndata to a local variable
This doesn't need to be stored in the device struct, since it is only
used within ns_manage_add(), and it is freed at the end of the function.

Change-Id: If725408026736d4ef9a0695ab28bc30e6648932e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-04 13:51:46 -07:00
Changpeng Liu
eb9ef5cc2b nvme: Add SGL support in NVMe driver
For those NVMe controllers which can support SGL feature in
firmware, we will use SGL for scattered payloads.

Change-Id: If688e6494ed62e8cba1d55fc6372c6e162cc09c3
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-03-04 09:36:40 -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
e20639540e nvme_spec: declare CSTS with the correct type
nvme_spec.h already has a structure with the correct bitfields for the
CSTS register, so use it in struct spdk_nvme_registers.

Change-Id: Id0663aee2611fb5195f9012a3176799e32701bb0
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-02 08:52:35 -07:00
Daniel Verkamp
8acc50fc05 nvme_spec: add Create I/O SQ QPRIO enum
Change-Id: Ibab79bea19048c636ebbb52ddf549840e2dfc136
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-01 14:42:04 -07:00
Daniel Verkamp
345d9a4da3 nvme: add spdk_ prefix to nvme_qpair_process_completions()
This will be exposed in the public API.  This rename is in a separate
commit to ease review.

Change-Id: I1b7fef36f85265db27935ac4d22ceef3c7282502
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-01 14:42:04 -07: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
0b2848ffb8 nvme: remove nvme_ctrlr_post_failed_request declaration
This function no longer exists and was not part of the public API.

Change-Id: I94fd066b63e812367687d11bc00aa11ab88d4671
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
5ee7a5df37 nvme: add spdk_nvme_ns_is_active() function
This function returns true if the namespace is active or false if it is
inactive (e.g. no namespace has been attached to the specified namespace
ID yet).

Also use the new function to add checks in the examples and tests where
applicable.

Change-Id: I35465b315ae1a1677c5a82191ad9b1da1c216d50
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-01 14:40:44 -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
Ben Walker
03a0af30c8 Add the mailing list to README.md.
Change-Id: Iac2c600095042c86a51bad28038bc4b6c2f31ed2
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-02-26 15:50:59 -07:00
Ben Walker
89ce43646f Add gitter link to README.md
Change-Id: I1f5858ddacdee9cc182aae627454bc146f44fa1d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-02-26 14:36:53 -07:00
Liang Yan
d6ec160211 spdk: Add sgl request unit test
Change-Id: I07b253c394d82b92564bfbdea8014e75b8dbf9ce
Signed-off-by: Liang Yan <liangx.yan@intel.com>
2016-02-26 11:14:17 -07:00
Daniel Verkamp
61f706e8c8 test/nvme/reset: fix behavior with >1 ns per ctrlr
Store each namespace's associated controller in its ns_entry structure
rather than trying to assign them during associate_workers_with_ns().

Change-Id: I679a1902d5c787e35f3afb5292342ce369f1fe52
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-25 13:26:02 -07:00
Daniel Verkamp
20abbe8abe nvme: perform resets in parallel during attach
When multiple NVMe controllers are being initialized during
spdk_nvme_probe(), we can overlap the hardware resets of all controllers
to improve startup time.

Rewrite the initialization sequence as a polling function,
nvme_ctrlr_process_init(), that maintains a per-controller state machine
to determine which initialization step is underway.  Each step also has
a timeout to ensure the process will terminate if the hardware is hung.

Currently, only the hardware reset (toggling of CC.EN and waiting for
CSTS.RDY) is done in parallel; the rest of initialization is done
sequentially in nvme_ctrlr_start() as before.  These steps could also be
parallelized in a similar framework if measurements indicate that they
take a significant amount of time.

Change-Id: I02ce5863f1b5c13ad65ccd8be571085528d98bd5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-25 13:25:59 -07:00
Daniel Verkamp
a62b194f1b nvme: add timestamp counter interface to nvme_impl
Change-Id: Ic652163e4f5944c1516eaf58615f7eabcbe34a7a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-24 21:17:12 -07:00
Daniel Verkamp
d82473cd7d nvme: remove cc.en check in ctrlr_wait_for_ready
This check was dead code, since both places that called
nvme_ctrlr_wait_for_ready() could only ever have cc.en = 1.

Remove the original nvme_ctrlr_wait_for_ready() wrapper and rename
_nvme_ctrlr_wait_for_ready() without the underscore to replace it.

Change-Id: I6c9aa6a5b93606fb89d168c23f6735fcf3a84eaa
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-24 21:17:11 -07:00
Liang Yan
02191a0086 spdk: nvme ns cmd child requests testing
Two test cases should be added.
1. ns cmd don't have child requests;
2. Assert that the correct number of child requests are created
and verify that each one has the correct payload_offset.

Change-Id: I1182a1a6673ceaf2ba35be268f80d8668af82848
Signed-off-by: Liang Yan <liangx.yan@intel.com>
2016-02-24 16:57:53 -07:00
Daniel Verkamp
a15573c47c nvme: don't reset already-disabled controllers
In nvme_ctrlr_hw_reset(), if we encounter a controller whose CC.EN bit
is already 0 (controller is disabled), the previous code would enable
the controller just so that it could be disabled to get a full reset
(transition from CC.EN = 1 to CC.EN = 0).  However, it is a safe
assumption that if CC.EN is already 0, the controller has just been
reset, so we don't need to reset it again.

This saves a significant amount of time (2+ seconds per controller with
Intel SSD DC P3700) during initialization for devices that were disabled
on startup.

Change-Id: I552b1f0f185a84a8a0ce57a93b012d9d5fe096f3
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-23 16:53:09 -07:00
Daniel Verkamp
4cb05719bd build: add config option to use Address Sanitizer
Change-Id: I98bf4ab1c58a90341c2a8529de4537fb0250f00d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-23 16:41:31 -07:00
Daniel Verkamp
bba5f43ce5 kperf: use $(MAKE) to invoke make
Change-Id: I51e587abe2c032ff97ea3133e53dd3bc36dd58cf
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-23 16:36:37 -07:00
Daniel Verkamp
ab7541d810 kperf: add .gitignore entries
Change-Id: I80725118e44e147e12dcac31d0ba58f175a89d10
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-23 16:36:37 -07:00
Daniel Verkamp
add9186f73 README: cd to DPDK dir in a subshell
Tweak the build instructions slightly to make them simpler to follow.

If someone is reading the instructions top to bottom, the section about
how to build SPDK assumes the current directory is the top-level SPDK
repository, but if the reader just finished building DPDK, they would be
in the DPDK directory.

Change-Id: Ie3dd587bcf1ac41ac3579a75f9b329b0eeaafd7a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-23 12:24:52 -07:00
Ben Walker
55dc5f2131 Add vfio support to scripts.
cleanup.sh and unbind.sh have been combined into a single
setup.sh that takes one optional parameter (reset). If no
parameter is given, the script will automatically bind
all NVMe and IOAT devices to either uio_pci_generic
or vfio-pci, as appropriate based on IOMMU settings. If
the reset parameter is given, the devices will be bound back
to the appropriate kernel drivers.

Change-Id: I25db3234f1ecfb352a281e5093f4c1aa455152ae
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-02-22 11:30:47 -07:00
Daniel Verkamp
c0a1cd3827 ioat.h: remove duplicated spdk/pci.h inclusion
Change-Id: I9371faa22bf79a670b1ffceb5620e5fad6e58079
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-22 09:57:11 -07:00
Daniel Verkamp
5dafa4940f nvme.h: include stdbool.h and stdint.h
Explicitly include system headers for types that are used in public
headers.

These were being pulled in by example code, so SPDK itself would build,
but other apps that did not include stdbool.h would fail to compile when
including spdk/nvme.h.

Also include nvme.h first in nvme_internal.h so this case gets tested
during normal compilation.

Change-Id: I8ed0fc4e0dcf71551738c461b4b825cc2ee1d233
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-22 09:57:11 -07:00
Daniel Verkamp
093d5479f9 spdk_nvme_ns_cmd_reservation_report: fix request allocation
payload here is a pointer to the buffer, not a struct nvme_payload.

Use nvme_allocate_request_contig() and pass the length in bytes rather
than dwords.

Change-Id: Idbbb3614b1d69148fe041d26e0c148bd9ce53724
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-19 15:24:09 -07:00
Daniel Verkamp
959bc24b0a autotest: run ioat_ut under Valgrind
Change-Id: I235bd39c0f4c85f12db20a87976ce73cfdb89bc2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-19 15:24:09 -07:00
Daniel Verkamp
85d69f7c36 autotest: enforce Valgrind checking for unit tests
If any memory is leaked or other errors occur, valgrind will now exit
with an error code and fail the tests.

Change-Id: I6c65cae17dcd21eb97d70bd82df828eaa0f8f109
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-19 15:24:09 -07:00
Daniel Verkamp
c162dd0e38 nvme_qpair_ut: clean up submitted tracker
This fixes a memory leak in the unit test.

Change-Id: Ie94459e8e46e966c437ad43702a04f1a8f9becdb
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-19 13:15:34 -07:00
Daniel Verkamp
639fee5f13 nvme: remove initialization of nvme_reqest::parent
The parent field is in the cache line of nvme_request that is only
supposed to be accessed for split (child) I/Os.  All accesses to parent
are done from child-specific calls now, so it does not need to be
initialized in the common case of a non-split I/O.
nvme_request_add_child() will set parent when splitting occurs.

Change-Id: Ib86c16ba1ea2ce32f62079831101da2a099047af
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-18 15:15:36 -07:00
Daniel Verkamp
7c34c2005d nvme: store SGL callback in nvme_payload
Allows simplification of _nvme_qpair_build_sgl_request(), which does not
need to know whether a request is a child or not.

This also removes a read of req->parent for non-split I/Os; the parent
field is in the section of nvme_request that is only intended to be
initialized for split I/Os, which should be detected by looking at
num_children.

Additionally, this fixes a potential problem if requests were nested
more than one level deep (e.g. req->parent was not the original user
request).

Change-Id: I3ea1dc134bbb1e3b8c6b5a479f5d760bd97ea848
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-18 15:07:18 -07:00
Ziye Yang
d0a543daf6 SPDK: fix the compliation issues in ioat_impl.h
This patch fixes the following issues in ioat_impl.h
while CONFIG_PCIACCESS is set to n:

1 lack of the definition of ioat_pcicfg_unmap_bar.
2 Define a macro to remove the duplicated vendor code
for ioat_driver_id enumration.

Change-Id: I4011098ac296d1ec320bffb5ffa6e098b70a5545
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-02-18 09:42:58 -07:00
Daniel Verkamp
9322c25808 doc: add spdk/ path to Doxygen indexes
Reference the public headers in the way that apps should include them
(e.g. spdk/nvme.h rather than just nvme.h).

Change-Id: I0489d906e9c55ff00ffa4e8c9532b0941ce69449
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-17 12:18:27 -07:00
Changpeng Liu
6d497a8e88 spdk: add NVMe controller memory buffer definitions
Change-Id: I49de87a502b979e1457bde4e850a081faee31cae
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-02-18 10:31:23 +08:00
Andrey Kuzmin
5bb66add46 Include rte_config.h before other DPDK headers
Building the tip of the spdk master against the dpdk-2.2.0 fails with
inappropriate RTE_CACHE_LINE_SIZE error. The simple reversal of the RTE
include file order below fixed it for me.

Change-Id: I8782b7ee21d7f185e6e678f874fbdab9403117a5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-16 14:44:41 -07:00
Ziye Yang
accf229829 SPDK: remove the duplicated code in ioat/nvme_impl.h
This patch is used to remove the duplicated code.
As we found the structure in "ifdef and else" are same.

Change-Id: I1717ce3dcc14134ac59c165d801e5e811b987be5
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-02-16 14:40:12 -07:00
Ziye Yang
3d7bcab40a SPDK: Add spdk_pci_device_cfg read/write for byte, word.
This patch is used to support spdk_pci_device_cfg read/write
with byte and word size.

Change-Id: I49084e231bd6b5f5b22180a3eb36ddad4430b3a4
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-02-16 09:54:43 -07:00
Daniel Verkamp
04adec22bc Add extern "C" wrapper to all public headers
Also consistently place the extern "C" before any includes or other
declarations in files that already had it.

Change-Id: Ia316d5be3e509ec76c4a98cfa90ed516073351e0
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-12 07:52:35 -07:00
Daniel Verkamp
bfd92d4719 nvme: update doc index file with spdk_ prefixes
Change-Id: I5745d1f9af63547b05f4dfdd364f18bcf615f2b0
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-11 13:45:58 -07:00
Daniel Verkamp
5cab054f4e ioat: add spdk_ prefixes
Change-Id: Ic42f204a9a4e65661931af2220e8f8ac77242a69
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-11 12:35:57 -07:00
Daniel Verkamp
c7150a5611 ioat_spec: add spdk_ prefixes
Change-Id: I91444f10b98d7e247af5eb2fea719e283a1156a2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-11 10:39:28 -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