Commit Graph

133 Commits

Author SHA1 Message Date
Ben Walker
011c0a24df nvmf: Remove cntlid from spdk_nvmf_conn
The cntlid is inside the session, so no need for
duplicate data.

Change-Id: I5669ee6393807959506dfec36a7583af77386fc4
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-11 11:20:18 -07:00
Ben Walker
a9c7af9d83 nvmf: Simplify conn lcore allocation
Since we only allocate workers to the master lcore,
remove the logic that places I/O conns on the same
lcore as the admin conn.

The "right" logic would be to place the I/O conn
on the same lcore as the whole session, and this
patch builds toward that.

Change-Id: I8983b56de41062ec834b0a169ba0fa61326c466d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-11 11:20:18 -07:00
Ben Walker
72a7fd3cff nvmf: Only run on the master lcore.
Temporarily, only run on the master lcore. This makes
some temporary refactoring possible that is required
to move to a truly scalable threading model.

Change-Id: I13a2e03107a27f8ec18b023b15f653d374a137b5
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-11 11:20:18 -07:00
Ben Walker
828dca7351 nvmf: Move some stray session init code to the right place
A connection function was initializing some session data, so
move that code to the function that initializes the session.

Change-Id: I5f2d4349585cb97985a7bbd9fb8d6c66eeaa7d4e
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-11 09:41:48 -07:00
Ben Walker
64f6abea9c nvmf: Sessions now contain a list of connections.
There was an extra layer of indirection complicating
things for no reason. This removes it.

Change-Id: I8d4e654eb17f8f6ec028d775329794f0745fb0f7
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-11 09:41:48 -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
Daniel Verkamp
f8296a99c2 nvmf: rename subsystem_grp.[ch] to subsystem.[ch]
NVMf does not have the concept of subsystem groups; the (former)
subsystem_grp files really contain structures and functions related to
individual subsystems.

Change-Id: I4b3a64de799fffb29f8685ea4908d754516815cd
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-08 10:54:10 -07:00
Daniel Verkamp
554701492c nvmf: simplify property handling
Create a list of valid properties with get and set callbacks (set is
optional to allow read-only fields).

Remove handling for fields declared as "reserved" in the NVMe over
Fabrics 1.0 specification.

Also simplify the vcprop structure to only contain the required fields.

Change-Id: I14d3ddfd008c62b75fce8e64d193c87fb6f7b5ad
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-07 15:52:49 -07:00
Daniel Verkamp
a9df326a0e nvmf: only allow one Controller per Subsystem
Multiple NVMe controllers within a subsystem does not work correctly,
since we would need to virtualize the controller data, namespace IDs,
and so on.  For now, only allow pass-through mapping of a single NVMe
controller per subsystem.

Change-Id: Ib2d3576d2856c46a086f38eb6bec56f3e7a73575
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-07 15:09:30 -07:00
Daniel Verkamp
0e93df5c34 nvme: combine CAP register into one 64-bit union
Previously, we used cap_lo and cap_hi to represent the 32-bit halves of
the full CAP register.  However, it is simpler to keep them in a single
64-bit structure, and is no less efficient on 64-bit platforms.

Also name the NSSRS field from NVMe 1.2, which was previously reserved.

Change-Id: I1d5d9b0dccbb12373b4aed3db29c883881d43223
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-07 13:52:16 -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
Changpeng Liu
4fbe54f10e nvmf: add discovery subsystem to NVMf target
Change-Id: I4ee79ad268ae75208feddd62e22d6210a9c0d944
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-06-30 16:20:09 -07:00
Daniel Verkamp
7066b5b952 nvmf: remove unused MaxRecvDataSegmentLength config
Change-Id: Ida9551aae5c1b6456c5871c77eadebc57f28bee8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-29 15:37:52 -07:00
Daniel Verkamp
dde6da8442 nvmf: remove unused listen_port from nvmf_tgt_init
We need to bind to each port declared in the config file; there is not a
single global port number.

Change-Id: I41c315588078d131c32cb145d22314047505c95c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-29 15:37:52 -07:00
Daniel Verkamp
e056066733 nvmf: fix NVMf-specific Identify Controller offset
The access to the NVMf IOCCSZ (I/O Queue Command Capsule Supported Size)
field in the Identify Controller data was incorrect.

Change-Id: I23b0aa175de8e5d8a0220e9c35e0cb6868121cb5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-29 15:37:52 -07:00
Daniel Verkamp
196dfe4278 nvmf: remove MaxInCapsuleData configuration option
The maximum in-capsule data size is determined by the I/O queue bounce
buffer size, and there is no point in limiting it beyond that, so remove
the need to configure it.

Change-Id: I64806516b847e819f57ac9f62a162f7a04805b57
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-29 15:36:43 -07:00
Daniel Verkamp
4946c154c2 nvmf: change default RDMA port to 4420
4420 is the officially assigned IP port from IANA for NVMe over Fabrics.

Change-Id: I433a5ed0780d1ffd7ca6512617759d59fa5e8def
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-29 15:36:14 -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
Ziye Yang
9620917a86 nvmf: Remove the cmd_type variable.
When Debug is not defined, SPDK_TRACELOG will do nothing,
thus cmd_type is an unused variable, and will trigger the
compilation warnings. And this patch will solve this issue

Change-Id: I821f7601a16c98e514227aee2e18fbfa61928bea
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-06-29 10:49:27 -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
Daniel Verkamp
42111e78de nvmf: replace IQN references with NQN
NVMe over Fabrics defines its own NVMe Qualified Name (NQN) format; it
does not use iSCSI Qualified Names.

Also change the default node base for nvmf_tgt to "nqn.2016-06.io.spdk".

Change-Id: I2b73c1426ef1d8c83cc2df499d79228ea61257cd
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-28 14:38:15 -07:00
Daniel Verkamp
20b632d00e nvmf: fix host ID printing
Fix the sizes of the UUID fields to match RFC 4122.

Change-Id: I1458a22579f455cde0a67ee3ce616e78d5c810c2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-28 14:38:15 -07:00
Daniel Verkamp
19fec6bb9c nvme: add remove callback to spdk_nvme_probe()
This will allow removal notifications to be propagated to the library
user (e.g. for hotplug).

The callback is currently unused, but this at least prepares the API for
the future hotplug support.

Based on a patch by Dave Jiang <dave.jiang@intel.com>

Change-Id: I20b1c2dbf5e084e0b45a7e51205aba4514ee9a95
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-28 14:21:58 -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
8b419899b4 nvmf: remove unused spdk_nvmf_request::entries
Change-Id: I4ed0cbf906400dd2c9f10f3ec98b988aaec412e8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 15:50:44 -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
6419922466 nvmf: check status of nvmf_check_rdma_completions
If the transport poll routine fails, we need to close the connection.

Change-Id: Ie534b0f05e6642c31e0450865e309a784abbe744
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 14:19:32 -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
f358b0093f nvmf: move request_complete call into request_exec
Make all command processing functions return a bool to indicate
asynchronous (false) or synchronous (true) completion.

Change-Id: I7c2e4d28fa473b36ff26c902e4bb69f38b64d18d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 13:46:19 -07:00
Daniel Verkamp
7cf7ed0764 nvmf: switch request.c traces to SPDK_TRACE_NVMF
Only use SPDK_TRACE_RDMA within the RDMA transport code.

Change-Id: Ie15fd24bb142a68f3661929267ebe396b556c351
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 13:22:01 -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
cef7ad58ec nvmf: remove unused nvmf_session::vcfeat field
Change-Id: Icebadbf3d49c957f7ae908627b69e5b0773cc6a5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 13:01:39 -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