Commit Graph

427 Commits

Author SHA1 Message Date
Jim Harris
366d931183 Reduce NVME_MAX_IO_QUEUES to 1024.
Most devices today support far fewer than 1024, but this is a
more reasonable default upper limit than the spec-defined 64K.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ia8a6d80c3a5aa181f27c8354758c6ca468013d92
2015-11-30 09:33:34 -07:00
Daniel Verkamp
ecf1d7d4d4 build: use $(LIB) as library target name
lib/memory was already using this pattern; extend it to lib/util and
lib/nvme.

Change-Id: I84a633d7805522fc94d8fc11ad5486ce552702e5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-11 14:59:55 -07:00
Daniel Verkamp
1c3b08c63c build: move $(OBJS) definition to spdk.common.mk
Change-Id: I2dd592269ef644cfe73921151b9b174dc255323d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-11 14:59:55 -07:00
Daniel Verkamp
1c28700070 build: remove useless 'objs' targets
The .o files are always kept anyway, so there is no need for an explicit
rule.

Change-Id: Id1687ba89daabfda5802e4328deb127403277928
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-11 14:59:54 -07:00
Daniel Verkamp
dba4829471 build: factor out common compile and link commands
Add common $(COMPILE_C), $(LINK_C), and $(LIB_C) variables that contain
the commands to build a .o from a .c, an app from objects and libraries,
and a library from objects, respectively.

Change-Id: Ie2eaa13156b8bf3db7a4ffa66161382d829aef07
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-11 14:59:54 -07:00
Daniel Verkamp
668847e150 nvme: add max completions limit to I/O polling
nvme_ctrlr_process_io_completions() now takes a second parameter,
max_completions, to let the user limit the number of I/Os completed on
each poll.

If there are many I/Os waiting to be completed, the
nvme_ctrlr_process_io_completions() function could run for a long time
before returning control to the user, so the max_completions parameter
lets the user have more control of latency.

Change-Id: I3173059d94ec1cc5dbb636fc0ffd3dc09f3bfe4b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-05 15:07:52 -07:00
Daniel Verkamp
181de7bf79 nvme: reorder nvme_controller for better packing
After converting is_resetting to bool, it is smaller and can be packed
more efficiently with is_failed and reordered after the larger fields
used in the I/O path.

Change-Id: Ifa2301eb61ce8d38eb5412cca61d2a91b1474101
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-05 12:48:55 -07:00
Daniel Verkamp
bc185fe7dc nvme: convert is_resetting to bool
It was previously uint32_t because it was accessed with special
uint32_t-only atomic read/write helper functions, but that was replaced
with normal variable accesses protected by a mutex.

Change-Id: I304a7ef8c723cb33fd08110b697f848823a163e7
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-05 12:48:55 -07:00
Daniel Verkamp
3677f46af8 build: allow make to work from any directory
Set SPDK_ROOT_DIR explicitly in each Makefile so that make from a
subdirectory will work (assuming all dependencies from the upper
directory have already been built).  This allows partial rebuilds of the
source tree, as well as building the unit tests without requiring DPDK.

Change-Id: I3f65b805d490b40ff5ec53cceb61df542ce814f1
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-04 10:19:08 -07:00
Daniel Verkamp
a945f60c79 build: enable signed-vs-unsigned compare warning
Change-Id: I93f069241cb74b3ec7d272bc390998372c376b16
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-02 14:40:22 -07:00
Daniel Verkamp
f79a334e33 build: fix old-style declaration warnings
Fix all of the uses of __thread so they are at the beginning (similar to
e.g. static).

Don't actually enable -Wold-style-declaration, since clang doesn't
understand that.

Change-Id: I0dcbb758143eab90fc978334c8f256c6602cc4cd
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-02 14:40:12 -07:00
Daniel Verkamp
4f677a1d4c nvme: only invoke request free macro in one place
Rename the nvme_free_request macro to nvme_dealloc_request to match
nvme_alloc_request and add a wrapper function to nvme.c so that the
macro contents are only expanded once.

The DPDK nvme_impl.h uses rte_mempool_put(), which generates a large
amount of code inline.  Moving this macro expansion to a wrapper
function avoids inlining it in the multiple places nvme_free_request()
gets called, most of which are error handling cases that are not in the
hot I/O path.

Change-Id: I64ea9c39ba47e26672eee8d5058f1489e07eee5b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-10-20 07:43:41 -07:00
Liang Yan
2bec440057 nvme: Change some strange alignment in nvme_ctrlr.c
Change-Id: I295d1864eaf8233df0678c3df948ac353613b27d
Signed-off-by: Liang Yan <liangx.yan@intel.com>
2015-09-29 14:01:44 -07:00
Daniel Verkamp
d2e10e88ec nvme: move nvme_request_add_child to nvme_ns_cmd.c
This is the only place nvme_request_add_child() is used, so move it
nearby and make it static to allow the compiler to inline it.

Change-Id: If4a7e17fde0b0272e1d4432c1dcedbec27c25371
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-28 14:04:11 -07:00
Jim Harris
1d90157262 Fix header file dependencies.
Move dependency includes into a new spdk.deps.mk file,
then include it at the end of Makefiles that build
source files.

Also add a test to autobuild.sh to confirm that
binaries are regenerated if we make after touching a
header file.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: If6a1905706a840f92cbdf3ace7fbdb27fe2de213
2015-09-28 09:07:04 -07:00
Daniel Verkamp
736ec4967e nvme: refactor _nvme_ns_cmd_rw()
Pull the almost-identical request splitting code for driver-assisted
striping and maximum I/O size into its own function,
_nvme_ns_cmd_split_request().

Change-Id: I3c15ac2073f8f5aec721c427199c8fb1a5d6a1fc
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-25 14:21:57 -07:00
Daniel Verkamp
325b7db392 nvme: use rte_memcpy() to submit commands
GCC generates a series of 64-bit MOV instructions for the memcpy() into
the submission queue.  We can do better with 128-bit SSE2 instructions.

DPDK already has a memcpy implementation that is optimized for small
inline copies, so use it instead of memcpy.

Change-Id: I5f09259b4d5cb089ace4a8ea6d2078c03fee84f3
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-25 09:33:42 -07:00
Daniel Verkamp
8d424e6e71 nvme: simplify logic for whether to call callback
No change in behavior, just a simplification.

We already have a check for retry, so pull the cb_fn check out and put
it under the !retry branch.

This makes it clearer that requests that are going to be retried will
not get their callbacks called.

Change-Id: I70c7067e550c7fca78b0441b5474833f73863315
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-24 14:53:42 -07:00
Liang Yan
655d98f52e nvme: remove _nvme_io_qpair_destroy function
Since it is empty function. It  can be deleted.
Add nvme_assert to fix issue reported by scan-build.

Change-Id: Ia0e8f656e1dac0da7ec72f8404469ea1b0dcb40e
Signed-off-by: Liang Yan <liangx.yan@intel.com>
2015-09-24 11:16:10 -07:00
Daniel Verkamp
3181a61450 nvme: replace stray printf with nvme_printf
This is the only place that was using printf directly in the NVMe
library.  Replace it with the official nvme_printf logging mechanism.

Change-Id: I689a7c0854b5e47eb357150f814e347cd44be79c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-23 16:25:16 -07:00
Daniel Verkamp
5717784633 nvme: assert that tracker's request is valid
In nvme_qpair_complete_tracker, make sure we got a valid request in the
tracker that is being completed.

This should never occur in practice, but safeguard against it in case of
programmer error.  Fixes a scan-build warning about potential NULL
dereference.

Change-Id: Id82af604d2a5ed5de0aeccf3affa1900f6712ebe
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-22 16:44:12 -07:00
Daniel Verkamp
c028633b50 nvme: assert valid nvme_qpair_construct parameters
Document the assumptions made by qpair_construct using asserts.

These values can't actually be 0 in practice due to the way they are
derived, but scan-build can't see that.  It is also useful to have these
asserts in case of future modifications.

Change-Id: I546c057f5cbe7ccc62acd90b595e423cd450d86a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-22 16:31:26 -07:00
Daniel Verkamp
8217814218 nvme: remove dump_command and dump_completion
nvme_dump_command is totally unused aside from the unit test.

nvme_dump_completion was used in qpair, but it can be replaced with the
equivalent nvme_qpair_print_completion.

Also added the missing nvme_completion fields to nvme_qpair_print_completion
that had been printed by nvme_dump_command.

Change-Id: Ia5ee66f3553df06febe8f465d42e49a84c555dd2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-22 15:48:12 -07:00
Daniel Verkamp
18ce432337 nvme: simplify nvme_ctrlr_construct_admin_qpairs
Remove unnecessary local variables.

Change-Id: Iddcbe24f0a704b6576c9139734258a27a6d272c6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-22 10:12:33 -07:00
Daniel Verkamp
d7dda8ec63 nvme: delete outdated comments about xfer size
This is calculated elsewhere now, so remove the comments around
nvme_qpair_construct calls.

Change-Id: I2dc4956a9e250b88e62038bc55cdd315940ad391
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-22 09:40:53 -07:00
Daniel Verkamp
4f939758ea nvme: remove dead store
rc is reinitialized before it is ever read.

Change-Id: I9abbc256fb06022f3024b0aa3827be02a273f20a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-22 09:39:00 -07:00
Daniel Verkamp
1010fb3af1 SPDK: Initial check-in
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-21 08:52:41 -07:00