Commit Graph

212 Commits

Author SHA1 Message Date
Ben Walker
ca7a61e18a nvmf: New RDMA connections move to lcore after CONNECT capsule
Instead of starting the connection poller immediately upon
the connect event, wait for the first connect capsule to
start the poller.

This builds toward associating all connections with the same
session with the same lcore.

Change-Id: I7f08b2dd34585d093ad36a4ebca63c5f782dcf14
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-15 10:32:40 -07:00
Daniel Verkamp
eca013c2e1 nvmf: simplify RDMA queue depth calculation
Pull out the duplicated min checks against the ibdev_attr values.

Change-Id: I774c355ba669486afde5c05c55a4ed653723db98
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-14 12:58:17 -07:00
Daniel Verkamp
31965a7021 nvmf: don't store connection QID
Drop the debug print in conn.c that was the only user.

We still have the connect data structure when determining the connection
type, and after that point, the queue ID is not needed.

Change-Id: Ida9e170099f977ec6b84478874863c40d6f7d8a1
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-14 12:58:17 -07:00
Daniel Verkamp
5da444122e nvmf: remove arbitrary 4 RDMA device limit
Use the number of devices returned by ibv_get_device_list() instead of
stopping at 4.

While we're here, drop the unused MAX_SESSIONS_PER_DEVICE definition
too.

Change-Id: I21ca6c6c95b7f2cccc1de4d0a34b95217a522bfc
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 17:20:26 -07:00
Daniel Verkamp
6dfbcfa883 nvmf: mark debug string array as static
It is not used outside rdma.c.

Change-Id: Ic32aff4e07d6a430688e76b2dd223d5a5a61964e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 17:00:51 -07:00
Daniel Verkamp
411df9ad9b nvmf: make request_release and free_req private
These can be isolated in rdma.c rather than being part of the generic
transport API.

Change-Id: Idc2b969a2f7685420cda2f7c4aa12495ffc3fcbc
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 16:58:17 -07:00
Daniel Verkamp
dcc055e31f nvmf: move RDMA internal structs into rdma.c
Clean up everything that isn't strictly necessary in rdma.h.

Change-Id: Ied9acbed5f5b64860eae39816cdcb74620009a79
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 15:24:49 -07:00
Daniel Verkamp
1ade6e1dc0 nvmf: nest NVMf conn inside RDMA conn
This essentially turns the current nesting (of RDMA conn inside NVMf
conn) inside out.  Now the transport owns the connection structure and
allocates it when necessary.

Change-Id: Ib5ca84e2a57b16741d84943a5b858e9c3297d44b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 15:03:26 -07:00
Daniel Verkamp
f542245706 nvmf: move conn allocation to transport layer
This sets up the RDMA layer to be able to embed the NVMf conn inside the
RDMA conn.

Change-Id: I5e3714ac8503826504d78d06fb5eaafabd025bb8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 15:02:34 -07:00
Changpeng Liu
2cb8321a35 nvmf: make admin queue has the same size of bounce buffer as IO queues
The NVMf target set the maximum data transfer size(MDTS) to the default value
of 128KB now, and the initiator driver will read the value and set it to the
block layer, so each command sent from initiator will not runoff 128KB.

Change-Id: I1d4f259e887b2fc70c7f1c5406c07c58f7fc9b8d
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-07-11 09:13:38 -07:00
Ben Walker
11b0c3cc51 nvmf: Standardize rdma init/fini functions
Change-Id: Ifa453e865e110cd534d34aae1bc036cc9f09b1bd
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-11 09:06:30 -07:00
Daniel Verkamp
5ca81749de nvmf: return error if wc status indicates error
If any completion indicates an error, we need to close the connection.

Change-Id: I50b30aa692ae121932f1baec32f713422ff415ed
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-08 10:55:00 -07:00
Cunyin Chang
20b3efdf0c nvmf: combine recv_sgl and bb_sgl into one array.
The bb_sgl must follow recv_sgl make the logic obscure.

Change-Id: I8d47477986efd8f2d4ed964ab9373b7f157af274
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-07-06 09:17:22 -07:00
Ben Walker
2a806421c3 nvmf: Always use 2 sgl elements for recv
Admin commands technically don't allow inline data,
but there is nothing from preventing us from posting
a recv buffer that could handle inline data. It just
won't be used for incoming admin capsules.

Change-Id: I3e7e4406e01ab870654a166d52221c11fc0ac683
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-30 17:23:21 -07:00
Daniel Verkamp
f7afa70bcb nvmf: print status string if ibv_poll_cq() fails
Change-Id: I016cd53fa94db64f4f058f022665df44b760a5cf
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-30 16:30:20 -07:00
Ben Walker
554543168f nvmf: Delay allocating rdma requests until CONNECT capsule.
The queue type and queue depth are not known until
the connect capsule is processed. Delay allocating more
than 1 recv wqe until then.

Change-Id: I0e68c24bc3d6f37043946de6c2cbcb3198cd5d1b
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-29 14:01:54 -07:00
Ben Walker
ed3e30bb07 nvmf: Re-post recv wqe when SEND completes
Currently, the recv wqe is re-posted immediately. This
closes a small window where we could get more I/O
than we could handle.

Change-Id: I9b0b1f0cc526069033b9e04f170195c4fb130e37
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-29 14:01:54 -07:00
Ben Walker
d511559fc6 nvmf: Rename free_rdma_reqs and make it public
This is going to be used elsehwere in teh code, so
name it according to the public namign convention
and make it public.

Change-Id: Id5fd57e78e146f3235741a251bb30244d6530f2c
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-29 14:01:54 -07:00
Ben Walker
76abc37913 nvmf: Rename alloc_rdma_reqs and make it public
This is going to be used elsewhere in the code, so
name it according to the public naming convention
and make it public.

Change-Id: I0dcb88e902c5e609fe6acd06ad06743203fcaa60
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-29 14:00:17 -07:00
Ben Walker
6bd23031ae nvmf: Add alloc_rdma_req function
Break out the code to allocate a single rdma request
to be used elsewhere.

Change-Id: I687ce5ec862831fed5300157bfb4bf980d22c782
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-29 14:00:17 -07:00
Ben Walker
aceb76d2b5 nvmf: Post recv_desc immediately when they are allocated.
This avoids two loops back to back.

Change-Id: I42cb774defedf484869b0322eac84125b6b62330
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-29 14:00:17 -07:00
Ben Walker
9efe055ec1 nvmf: Remove pending list for RDMA operations.
The queue depth allowed for incoming commands is set
such that we can do the maximum number of RDMA reads
necessary. There is never a case where a READ will need
to be queued anymore.

Change-Id: I4f7e7f4a59f6358065b82f36a5e22744af210d07
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-28 14:53:24 -07:00
Ben Walker
3bf5869912 nvmf: Simplify queue depth parameters
There were 4 variables tracking queue depths. In reality,
only one is needed once the minimum is computed correctly.

Change-Id: I9bb890e92a33a3c7bd6e27cbd31d6bee7ca0cf3d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-28 14:45:32 -07:00
Ziye Yang
88669436f9 nvmf: remove unnecessary nvmf.h
The function call of spdk_nvmf_check_pools can be
directly put in nvmf.c.

Reason: This pool is created by nvmf subsystem,
it should be recycled by this subsystem.

Change-Id: I49e49bcb56079fc25d26b1f5078a1808c2f8e189
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-06-28 12:45:33 -07:00
Daniel Verkamp
20f9d86541 nvmf: clean up tracelogs
Change-Id: I57993bde54502a6e65a5379438ce1f7fb7ddffc6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-28 09:32:52 -07:00
Daniel Verkamp
226b4b7a93 nvmf: extract keyed SGL fields in rdma.c
Drop the RDMA-specific fields from spdk_nvmf_request and get them
directly from the command SGL in the transport-specific read function.

Change-Id: Icd06a9018a8c341213fbc8d26d3d7cbf2fb32d30
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 16:08:13 -07:00
Daniel Verkamp
29d4ad597f nvmf: combine tx_desc + rx_desc into rdma_request
Change-Id: I5fa886e0eeed08bd2fb03c237a2a8129c1df4720
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 15:45:15 -07:00
Daniel Verkamp
996705f1b8 nvmf: do not dealloc tx_desc in RDMA error cases
The connection will be closed in these cases anyway, so just let the
normal connection cleanup deal with the active tx_desc.

Change-Id: I96c68d5802e189bb82b180cc3c7d7c3f4135be1f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 14:32:18 -07:00
Daniel Verkamp
d63007e5ca nvmf: clean up nvmf_recv() error path
If spdk_nvmf_request_exec() fails, the connection will be closed anyway,
so just leave the tx_desc in the active array; it will be cleaned up in
the normal connection cleanup path.

Change-Id: Ie4f60bd6001658403dd7e1c6a47d40be756ef6f2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 14:14:02 -07:00
Daniel Verkamp
3d9ef1a94e nvmf: set status in spdk_nvmf_request_prep_data()
If an invalid SGL is specified, send a response with a status code
indicating what the error was rather than silently dropping the command.

Change-Id: I12d1fd847d3bc0ea8de7698e934626c2586a7452
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 13:56:38 -07:00
Daniel Verkamp
558347432f nvmf: simplify nvmf_check_rdma_completions()
The error case could only be reached with tx_desc != NULL in one case,
so move the cleanup code there and drop the goto.

Change-Id: I7aace6b40dd75ef8d86fb173f9d58110e929b082
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 13:13:03 -07:00
Daniel Verkamp
8e6ef319f6 nvmf: eliminate redundant CID in spdk_nvmf_request
Change-Id: I58ac25c1a7e0d4f1fe32349fff74178843cb5b20
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 12:52:19 -07:00
Daniel Verkamp
08cc45fec4 nvmf: make internal functions private to rdma.c
Change-Id: Id073674f5be7b164afa9d83ba34ad6f83883f12f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 12:28:28 -07:00
Daniel Verkamp
6e5f700bea nvmf: move RDMA connection handling to rdma.c
Also split the generic nvmf_trace_command() function out of
the RDMA-specific handler and move it to request.c

Change-Id: If29b89db33c5e080c9816977ae5b18b90884e775
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 10:24:01 -07:00
Daniel Verkamp
2a3e39a154 nvmf: add spdk_ prefix to struct nvmf_request
Also finish up the req_state -> req conversion.

Change-Id: I131dd52dcd36a790b942e06f0207a3274cc04ffc
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 10:24:00 -07:00
Daniel Verkamp
9bc34acdbc nvmf: move RDMA conn values to spdk_nvmf_rdma_conn
Change-Id: I60997d6d5d228855953c149e0abcd7f950ed741c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 10:23:09 -07:00
Daniel Verkamp
2e550d5165 nvmf: factor out RDMA-specific request completion
Move toward making request.c transport agnostic.

Change-Id: I25fbe74fff21a5c23138e1a6e2d40bc6a4a984ec
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 10:23:03 -07:00
Daniel Verkamp
e067f3302d nvmf: pass nvmf_request to nvmf_post_rdma_read()
Make nvmf_post_rdma_read() interface generic (don't require a tx_desc).

Change-Id: I331a93eed4bb1912a47a88bb904cf392fcc364c6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 10:21:30 -07:00
Daniel Verkamp
a435e9eeee nvmf: pass bb and in-capsule data to prep_data
This fixes an oversight that allowed in-capsule data block SGLs to
potentially refer to more than the received in-capsule data size.

It also makes spdk_nvmf_request_prep_data() less dependent on the
RDMA-specific rx_desc/tx_desc structures.

Change-Id: I34d61aca4cf5ba033849673116d16ec90488dcd4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 10:21:29 -07:00
Daniel Verkamp
8999f448ef nvmf: move BB SGL adjustment into rdma.c
The RDMA read and write commands can determine the desired length based
on the nvmf_request length field.

Change-Id: I97b63289556e7de3c19c5a17ecbacbbbdfc10425
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 09:13:35 -07:00
Daniel Verkamp
5248414d61 nvmf: give tx_desc/rx_desc bufs meaningful names
Replace the generic "msg_buf" naming with command and response.

Change-Id: I19baff43b41a5eb7db9be9d7feec33d17112e320
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 09:13:35 -07:00
Daniel Verkamp
f0242ce745 nvmf: remove bb pools and replace with rte_malloc
The mempool functionality is never used at runtime - all bounce buffers
were immediately assigned to a rx_desc.

Change-Id: Ie2195059858e34b30b07e104739f046c13abc335
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 09:13:34 -07:00
Daniel Verkamp
31d2a116c8 nvmf: remove rx_desc and tx_desc mempools
The RDMA tx_desc and rx_desc pools were only used at startup; all
descriptors are immediately allocated and put into a queue, and the
mempool functionality was never used at runtime.

Change-Id: I2882274962550191a555c8483b8f7be2854b32ec
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 09:12:42 -07:00
Ben Walker
e7dce1cfc0 nvmf: Move tx/rx descriptor management to rdma.c
This is an implementation detail of the RDMA layer.

Change-Id: Ib97d6fbd593789eed0b6e746972b8882a3320995
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 12:42:26 -07:00
Ben Walker
41aadf1591 nvmf: Move processing of pending RDMA reads into rdma.c
This code is operating on a list owned by the RDMA
connection, so move it to rdma.c

Change-Id: I8b81f9d1ffc1df489c9b698969725ed0d1db6a06
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 12:40:20 -07:00
Ben Walker
5677fe3c8d nvmf: Move *_desc lists into nvmf_rdma_conn
These are an implementation detail of RDMA, so move
them into the RDMA portion of the connection.

Change-Id: I68d146019c5d78fbf5e9968abfd7baed2a54a2ed
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 12:26:43 -07:00
Ben Walker
0216e537f7 nvmf: Add spdk_nvmf_rdma_conn structure
Separate out the RDMA connection from the
NVMf connection. For now, the RDMA connection
is just embedded in the NVMf connection, but
eventually they will have different lifetimes.

Change-Id: I9407d94891e22090bff90b8415d88a4ac8c3e95e
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 12:04:41 -07:00
Ben Walker
1fe2ab57d6 nvmf: Simplify acceptor
Remove an extra layer of functions.

Change-Id: Ic08628031d9055d973af4aed12ab245f5ff6887b
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 11:57:43 -07:00
Ben Walker
1b9cc2a9bc nvmf: Group rdma globals into a structure
This structure will be expanded in future patches.

Change-Id: Ibb04917134243560e09a2a255844739eb33fab65
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 11:44:10 -07:00
Ben Walker
c917957bff nvmf: Remove rx_desc pointer from tx_desc
The nvmf_request structure holds the pair of pointers
for rx_desc and tx_desc.

Change-Id: I3e735979bbdcdc0e70ad78762e289849d41158ba
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 09:25:17 -07:00
Daniel Verkamp
81d9213894 nvmf: use nvmf_request instead of rx_desc in trace
The nvmf_request object is generic and is mapped 1:1 with rx_desc.

Change-Id: I397224a3859c3c93d6eca99f7ba7c53ce7963f57
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-23 14:36:30 -07:00
Daniel Verkamp
90c28166c0 nvmf: use cm_id context to store conn pointer
Instead of searching the global list of connections to find a matching
cm_id, we can just store the pointer back to the spdk_nvmf_conn in the
rdma_cm_id context field.

Change-Id: I39ea16be6a633a1136d65743747b63b600f20e63
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-23 11:54:54 -07:00
Daniel Verkamp
54b538d1cb nvmf: move RDMA resource defaults to rdma.c
Change-Id: I98e92b4351b64ce87117341d86b1d39d8a826e72
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-20 14:24:47 -07:00
Ziye Yang
6ec18cd05b nvmf: add nvmf_ibv_send_wr_init and nvmf_trace_ibv_sge
The purpose is to reduce duplicated code.

Change-Id: I84b14fd3d0286f358cc1877250477a4cc538d210
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-06-20 09:20:46 -07:00
Ben Walker
dc6a0a2bd2 nvmf: Rename init_grp.h/c to host.h/c
Match the names in the specification.

Change-Id: Ic3f95220efea4dfbdf209af43db20da26ae232b6
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-17 13:31:05 -07:00
Ben Walker
422b147499 nvmf: Standardize names in init_grp.h
Prefix with spdk_nvmf_host.

Change-Id: I053030febf5b7157cc2c7075ac6170bc59ce0ced
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-17 13:31:05 -07:00
Ben Walker
6eb1bee64b nvmf: Rename spdk_nvmf_init_grp to spdk_nvmf_host
Host is the term used in the specification.

Change-Id: Ie9a06e3ff176e00e2fdcdc5bede701fe768d4b35
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-17 13:31:05 -07:00
Ben Walker
ba37804100 nvmf: Don't allocate our own RDMA protection domain
If we just pass NULL to rdma_create_qp, it will do
the right thing.

Change-Id: I9621a5110ace6237a1e47c6e5defb4cac3afc4ae
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-10 11:19:33 -07:00
Ben Walker
309a97f782 nvmf: Use RDMA CM wrappers for registering memory
The wrappers are much simpler to use than the low
level ib verbs calls.

Change-Id: I4b09a96a60020bc27df9396d40d955733f618837
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-10 11:19:33 -07:00
Ben Walker
1b17e4ee35 nvmf: Combine nvmf_rdma_conn_init and nvmf_rdma_qp_init
They are only ever called in sequence and do related
operations.

Change-Id: I825abe08deba1dafb405757bb4f2d52062a801ca
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-10 11:19:33 -07:00
Daniel Verkamp
c78d4d0b6c nvmf: move includes from nvmf.h where they're used
Most of the #include statements in nvmf.h aren't part of the public API.

Change-Id: I0d43dd542a28744a91a4fd0c4c806a991d1e194e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-09 14:25:26 -07:00
Daniel Verkamp
0f912a0eaf nvmf: add NVMe over Fabrics userspace target
Change-Id: I739916824d033bd1a8f8b7f5def09e58f23d13cb
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-06 15:21:25 -07:00