Commit Graph

354 Commits

Author SHA1 Message Date
Changpeng Liu
f903336eed nvmf: fix the wrong cleanup logic in the RDMA initialization process
Print the error information when the kernel RNIC driver did not load
properly, and fix the cleanup logic for the exceptional exit.

Change-Id: I97a45e73d830280b994818f3defc491bc2b6b020
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-11-02 10:30:39 -07:00
Changpeng Liu
30b5285c4f nvmf: fill Controller ID field according to the specification
As we can support multiple sessions now for each Subsystem, the Host
will use cntlid field to create IO queues, if 2 different Hosts
connected to the same Subsystem, for IO queues' creation process, it
will use cntlid field with 0 for current code logic.

Change-Id: I6fd437892e8eb3146f62f4b211c0baadd70b505e
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-11-02 10:29:45 -07:00
Daniel Verkamp
fd6ebca7a8 nvmf: only save PCI address in direct ctrlr data
The NVMe over Fabrics target was storing the PCI device pointer for each
direct-mode controller, but it only really needs the PCI address, which
is exposed via the get_nvmf_subsystems RPC.

Also update the same code path to use the new spdk_pci_device_get_addr()
function for brevity.

Change-Id: I0708b3331b7c279c1a86f0d7459b5deb40dd7c89
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-01 09:40:36 -07:00
Daniel Verkamp
1290f02f78 nvmf/rdma: add event_channel NULL check in fini
If the RDMA transport failed to initialize, g_rdma.event_channel may be
NULL.

Change-Id: I4510ee5893389f244f0fbaa1cd4a182868939b25
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-31 10:15:36 -07:00
Ben Walker
20dc7f7d19 nvmf: For iWARP, register buffers with IBV_ACCESS_REMOTE_WRITE
For iWARP devices, buffers that are intended to be the
target of an RDMA read initiated by the target must additionally
have IBV_ACCESS_REMOTE_WRITE permission. This is because iWARP's
RDMA read path essentially requests the remote side to do
an RDMA write.

This is unfortunate because there is no way to differentiate between
memory that the remote side can do an RDMA write to and memory
that will only be the target of RDMA reads initiated by the
target. There is nothing we can do about this serious deficiency in
the specification, however, so we have to live with it.

Change-Id: I3d2f2814ce0cb1df4e5347296ef371db4d16be21
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-31 08:58:40 -07:00
Ben Walker
f64690d49a nvmf: Handle NICs that don't report RDMA initiator_depth
I believe this is required for NICs to report, but handle
the case where it isn't reported.

Change-Id: I38d10c3590d1df8bb902ab312af0f9e01b9e5032
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-21 09:09:06 -07:00
Ben Walker
a1a085cf6b nvmf: Transports now allocate sessions
This makes it consistent with the way connections and
requests work.

Change-Id: Ifb97499ba72f7dfd02ac54ba1b622726d266262c
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-21 09:09:05 -07:00
Ben Walker
8b487155fa nvmf: Fail when sessions span RNICs
The shared memory pool for a session is associated with
a particular RNIC via the protection domain. New connections
attempting to join a session that came in on a different RNIC
can't use that memory, so must be rejected.

Change-Id: Ibd79fe90566a231f76b7472e5e9b484c3e528454
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-21 09:09:05 -07:00
Ben Walker
349295caf2 nvmf: Rearrange rdma file to match callback order
Rearrange the functions in rdma.c to match the order
of the function pointers in the transport. No other
code changes.

Change-Id: I9dbc68912ecd5dfdf53f20b4807d4116933a3c3a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-21 09:09:05 -07:00
Ben Walker
b0c1149953 nvmf: Replace rdma_reg_* with ibv_reg_mr
Use the lower level registration functions. The RDMA-CM
examples use the ibv_* versions, so who knows if the
rdma_reg_* wrappers are even well tested.

Change-Id: I8e8250ab09a1401e636aebe2fc04a60806f7a827
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-21 09:09:05 -07:00
Ziye Yang
379ebca018 nvmf,rdma: only call spdk_nvmf_rdma_conn_destroy to free rdma_conn
Previously, we mixed use free and spdk_nvmf_rdma_conn_destroy to
free allocated spdk_nvmf_rdma_conn structure, which sounds not
exactly free all the resources.

Change-Id: I2917b442c34d63ba5c014add58f429ae4b831595
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-10-20 16:24:38 -07:00
Ben Walker
769468fc52 nvmf: Allocate RDMA wr on heap instead of stack.
The RDMA API doesn't say whether the wr is copied, so be
safe and allocate it on the heap.

Change-Id: I091af50aa031e1861333f19d864eb52335d6b756
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-20 16:22:58 -07:00
Ben Walker
cfafcc3edd nvmf: Init transport before adding listeners
Change-Id: I1fbaca75c6b95127ff2b6ac7c0ea0f0a918b9405
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-20 16:22:58 -07:00
Ben Walker
93ab45d68c nvmf: Add an accessor for transport name
This allows the entire transport structure definition
to become private.

Change-Id: I9ca19edbfc3cfb75b9b113a89bb2b90bc499ab16
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-14 15:26:45 -07:00
Ben Walker
1e6ffa0394 nvmf: Add a public API header
This changes as little code as possible while still creating
a single public API header. This enables future clean up
of the public API and clarification of the exposed
concepts.

Change-Id: I780e7a5a9afd27acf0276516bd71b896ad301c50
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-14 15:26:31 -07:00
Ben Walker
18a2cc11c1 env: Remove unused DPDK headers.
Remove #includes for all DPDK headers that weren't
necessary.

Change-Id: Ib02522e0f04e64a1c98afceb7508cc0e8d931a9d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-12 09:53:32 -07:00
Ben Walker
7f5b671db7 env: Convert some rte_mempools to spdk_mempools
This converts some, but not all, usage of rte_mempool
to spdk_mempool. The remaining rte_mempools use features
we elected not to expose through spdk_mempool such as
constructors, so that will need to be revisited.

Change-Id: I6528809a864ab466b8d19431789bf0f976b648b6
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-12 09:53:32 -07:00
Ben Walker
0aa2986475 Replace rte_get_tsc calls with spdk_get_ticks
Change-Id: I809b900321433693ff9f2498183ad0dcdbb15030
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-11 13:34:09 -07:00
Ben Walker
2224ff2162 env: Replace rte_malloc with spdk_zmalloc
Use the env library to perform all memory allocations
that previously called DPDK directly.

Change-Id: I6d33e85bde99796e0c85277d6d4880521c34f10d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-11 13:34:09 -07:00
Ben Walker
8c5a2b0823 nvmf: Rename some uses of virtual to virt for C++ compat
'virtual' is a keyword in C++, so avoid using it in variable
and structure names in case any files are eventually
included from a C++ project.

Change-Id: I2122750445def63038af68a3000758e33b937f9d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-07 09:15:12 -07:00
Ben Walker
d4652fd37f nvmf: Share completion queue channels
All completion queues for the same listen address
now share a common completion queue channel.

Change-Id: I42c149fe7e221951e8a3826b1713482c37a265b8
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-07 09:15:11 -07:00
Ben Walker
a0a92ff4c2 nvmf: Combine acceptor_init/fini with transport init/fini
These 4 callbacks can be condensed into two callbacks, which
simplifies the API.

Change-Id: I069da00de34b252753cdc8961439e13a75d1cc68
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-07 09:14:53 -07:00
Ben Walker
a4747c6048 env: Make the environment library configurable.
This allows users to swap out SPDK's third party
libraries for an implementation based on their own
framework.

Change-Id: Ia0b7384ce5e31acba5ad0d7002dec9e95b759c52
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-05 11:51:37 -07:00
Daniel Verkamp
bcd1edeae4 nvmf: replace off_t with uint64_t
The offset variable is used to store the result of a uint64_t * uint32_t
multiplication; a signed integer is not the correct type for the result.

Change-Id: If1fb22314ba7e3cec91808cc051678f809c9e58b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-29 13:27:39 -07:00
Ben Walker
1ad2c3ea73 nvmf: Add support for multiple sessions per subsystem.
This feature should only be used if clients are coordinating
with one another.

Change-Id: I89a437441a7e3fbcc1e5f6efa1c8e970ade7c2ec
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-09-29 11:04:15 -07:00
Ben Walker
a17ad921e2 Replace RTE_VERIFY with assert
We already require the assert header from the C standard library,
so use that instead of RTE_VERIFY to further isolate DPDK
dependencies.

Change-Id: I4a718af858c88aff6080e33e6c3dd533c077b8f4
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-09-28 10:15:56 -07:00
GangCao
372942e569 nvme: move global request_mempool allocation into nvme_impl
The user no longer needs to create the request pool.

Change-Id: I83bb8948143d4cc961d232f9f30df3106d5e0eab
Signed-off-by: GangCao <gang.cao@intel.com>
2016-09-27 14:25:39 -07:00
Ziye Yang
b1e3279ae0 nvmf: change nvmf_session to spdk_nvmf_session
Make the structure definition consistent

Change-Id: If147066cee041a2a357bc7efcb1f882f914e5b42
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-27 09:57:17 -07:00
Cunyin Chang
d20b90b21e nvmf: Add support for RPC interfaces.
Change-Id: I6f0fe35bf2876df181ad11294b62d64d97dcac2c
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-09-26 16:07:30 -07:00
Jim Harris
0babf8ce81 bdev, copy: move all I/O paths to use I/O channels
bdev and copy modules no longer have check_io functions
now - all polling is done via pollers registered when
I/O channels are created.

Other default resources are also removed - for example,
a qpair is no longer allocated and assigned per bdev
exposed by the nvme driver - the qpairs are only allocated
via I/O channels.  Similar principle also applies to the
aio driver.

ioat channels are no longer allocated and assigned to
lcores - they are dynamically allocated and assigned
to I/O channels when needed.  If no ioat channel is
available for an I/O channel, the copy engine framework
will revert to using memcpy/memset instead.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I99435a75fe792a2b91ab08f25962dfd407d6402f
2016-09-26 14:02:07 -07:00
Jim Harris
06cf905c9a nvmf: allocate I/O channel for bdevs in virtual mode
I/O channels are not actually used for I/O yet however.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iaa3774ecacc7ec206c7c0c66e6b2f2d10c8fa785
2016-09-26 14:02:07 -07:00
Ben Walker
f3d90c9165 nvmf: Reap entire batches of completions for RDMA at once
Instead of polling for only 1 completion at at time,
poll for batches of 32.

Change-Id: I5ef99a270489e7b3d2a58cb765915f187775a93e
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-09-23 10:08:10 -07:00
Ziye Yang
b0b59a356f NVMf: add spdk prefix for two funcs defined in session.h
Purpose: To make the function definition style consistent

Change-Id: I7ade943881aa5076fdd419958e386ae3c3661da6
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-23 10:07:41 -07:00
Ziye Yang
5dcf922cda nvmf: fix tgt subsystem delete related operations.
1 In our nvmf tgt implemention, we use the async
mode to delete the nvmf subsystem. However, when
we parse nvmf subsystem, we need to use the sync
function to delete the nvmf subsystem. Since if
there is error, we will call spdk_app_stop, thus
async functions will not be executed. It is
approved in my local test.

2 Add debug info in spdk_nvmf_delete_subsystem

Change-Id: Ia8ecd6eee1bbd25cb3e1ceeb0e2146f3f03be228
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-22 15:33:26 -07:00
Ben Walker
4bf7878521 nvmf: Combine nvmf recv and send cqs
ibv_poll_cq is actually an expensive call to make, so take
steps to begin to minimize the number of times it is called.

Change-Id: I6fc64979604220eb8cacd612b46e3a3b1bca0924
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-09-22 09:11:38 -07:00
Jim Harris
f93bb8a32d Switch spdk_bdev_read/write arg order for length and offset.
This matches the general order (LBA start then LBA count) for
the NVMe API.

While here, fix a copy/paste error in a debug message (write
instead of writev).

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ice326af5d6025867dffed4d1f6c7b81fb9eba5eb
2016-09-14 10:51:25 -07:00
Liang Yan
5c8f4f180e nvmf: Update status code for discovery command
Set status code to invalid opcode when opcode is not supported
in nvmf_process_discovery_cmd.

Change-Id: Ibab8097e536f26f16c322d5f539277688906cfc3
Signed-off-by: Liang Yan <liang.z.yan@intel.com>
2016-09-14 09:19:34 -07:00
Daniel Verkamp
df70bc1559 nvmf: use case-sensitive comparison for NQNs
The spec does not define NQNs as case-insensitive, so replace the
strcasecmp() matching of NQNs with strcmp().

Change-Id: I5946d9ee8e1d0aa5966e9b1b3c6f14f3f5119aec
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-13 11:28:54 -07:00
Ziye Yang
6a6ef0d7e0 nvmf: update nvmf_disconnect to spdk_nvmf_session_disconnect
1 Rename this function and make it more meaninful, since
we have spdk_nvmf_session_connect which is used to link a
connection to the session
2 split spdk_nvmf_session_destruct.

Change-Id: I150df7ccdf4de3428d8cecbb286d5f7944510a8c
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-13 09:50:46 -07:00
Cunyin Chang
b3ca958328 nvmf: Make the function spdk_nvmf_rdma_acceptor_init() reentrant.
Change-Id: Ie715affe7e451fc517c5f57f1597d0bc70f69947
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-09-13 09:49:25 -07:00
Roland Dreier
4c0aab3f2a nvmf: Correct log messages when polling recv CQ
Fix copy-and-paste errors - when polling the recv CQ, we should print
"Recv" instead of "Send" in log messages.

Signed-off-by: Roland Dreier <roland@purestorage.com>
2016-09-13 08:26:31 -07:00
Ben Walker
4fb468e0df nvmf: Remove memcpy from completion path
This can just directly assign the completion instead
of calling memcpy.

Change-Id: I07819c824eba45245b00fa3538a99bc81bcb9fcc
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-09-12 15:33:43 -07:00
Ben Walker
af8b5732d3 nvmf: Optimize nvmf_ibv_send_wr_init
This function always shows up as one of the hottest functions when
profiling. I believe it is the memset that is expensive, so instead
use default initialization when the wr is declared on the stack
and just set the members that need to be updated in the function.
Also make the function inline for good measure.

Change-Id: I29e24cdd375311fa033b5a6df772ff4f73e35302
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-09-12 15:33:43 -07:00
Ziye Yang
e8be2f64d7 nvmf: fix the error handling in spdk_nvmf_session_connect
We need to free the session resource, if there is error
for creating a new session

Change-Id: I7c4f3e779e0b30e213e02b8676d93bd2fe9bf851
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-12 10:18:46 -07:00
Daniel Verkamp
bc0867dcaf nvmf: move subsytem poller to nvmf_tgt app
The application is now entirely responsible for scheduling subsystem
pollers and sending events between threads.

Change-Id: I88da1f53b5e8852c7c4acd6f0a7a1e2219fbed41
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-12 10:10:27 -07:00
Ziye Yang
9f2fc78e3f NVMf: Handle the memory leak issue of nvmf tgt
Reason: In acceptor_poller_unregistered_event, we
directly call spdk_nvmf_check_pools and spdk_app_stop,
it will fail the memory check.

And function nvmf_delete_subsystem_poller_unreg will
not be called since we already call spdk_app_stop.

Change-Id: I3ffa30c87b149a66cee1d87d1bb81d4dc8cc96b9
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-09 07:58:29 -07:00
Cunyin Chang
9e501ce2fe nvmf: Remove the data structure spdk_nvmf_controller.
Change-Id: Ie6e8d0f60abc16216b8c95f12c658ba7cbb3aba0
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-09-06 13:54:58 -07:00
Ziye Yang
1c5093358e nvmf,rdma: update spdk_nvmf_rdma_conn_destroy
Merge two if judge statements into one.

Change-Id: I72f7e4a936bc0b628c06a9ebb7c816150805f495
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-06 13:19:02 -07:00
Ziye Yang
2628a7a4dd nvmf, subsystem: update spdk_nvmf_subsystem_poller
Remove RDMA in comments.

Change-Id: Ice9d310e73cd953b4c7a494e1b4e7a13335649e7
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-06 13:18:41 -07:00
Ziye Yang
1675e153fb nvmf: Update get_rdma_conn and get_rdma_req
The "+" is not correct, should be "-". Currently,
the issue doest not happen since the offset is 0,
then both + and - is OK. But if we adjust the location
of spdk_nvmf_conn or spdk_nvmf_request, we can find
this bug.

Change-Id: Ib358dc729da901a69442d0402a6089989f49b05c
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-06 13:18:26 -07:00