Commit Graph

321 Commits

Author SHA1 Message Date
Ben Walker
a644cacb56 nvmf: Remove is_valid from session
Unused.

Change-Id: I992d4cea9b03f6dfe923f4d5ebc4c467d4ab01e5
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-11 11:20:18 -07:00
Ben Walker
d028fb6956 nvmf: Eliminate two stage initialization of sessions
Everything can be done when the session is created.

Change-Id: I7cb38c093b2b1b69460cabba465828eed0cec432
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-11 11:20:18 -07:00
Ben Walker
49441a5835 nvmf: Don't set reserved fields in vcprop
Change-Id: Iab46cf7d34938d8b07c5480f778eedd1ba455d57
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-11 11:20:18 -07:00
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
Ben Walker
c65e726acd nvme: Limit max completions in a single poll
For a single poll of the completion queue, if the user
submits I/O from within their completion callback and their
completion callback is particularly slow to execute, the loop
could potentially continue forever. To support this, we
need to limit the number of completions we'll process
in one batch.

Change-Id: If6bae47e52b36347dbe5622ace68c866ee88a0b2
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-07 17:05:17 -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
a464f1394e nvme: add API to get CAP and VS registers
This is intended to be used for examples/nvme/identify and similar
diagnostic utilities.

Change-Id: Ib2f941e9af7a3fb7555865ef253742e30ccad2b5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-07 15:32:20 -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
Changpeng Liu
90c15f6863 nvme: remove duplicated header file include
Change-Id: I96b84ec19f8394da8311c452789e962b0255395b
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-07-07 11:17:43 +08:00
Cunyin Chang
adcbbe19ff event: Add dpdk framework start function into event.
Make sure the reactor mask in profile take effect.

Change-Id: Ia471b2b88a711f05738cf93068c4f3a8c9a3039d
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-07-01 10:07:42 -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
GangCao
e0f4313dbd event: create/get/put mempool per sockect
Change-Id: I6ea82f7b0ffc86e01466717d1b5bf0816cb232ae
Signed-off-by: GangCao <gang.cao@intel.com>
2016-06-30 13:32:30 -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
Daniel Verkamp
e2d3cc6502 nvme: replace rte_memcpy with specialized function
Use the knowledge that both the source and destination of
nvme_copy_command() are aligned to emit the aligned variants of the
SSE2/AVX mov instructions.

Change-Id: I0a7e32a3bb10b9a1920cd85691b79fa7172eecb3
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-28 14:17:21 -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