Commit Graph

476 Commits

Author SHA1 Message Date
Jim Harris
be9a3b9f69 bdev: pass descriptors for I/O operations
This enables checking permissions - for example,
spdk_bdev_write will fail if the descriptor was not
created with write permissions.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I68b65a560f471f2e0f71a7f42cfa6689b911110f

Reviewed-on: https://review.gerrithub.io/369493
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-07-14 13:31:30 -04:00
Jim Harris
57d174ff67 bdev: add spdk_bdev_open/close
Retire the old claim/unclaim semantics in favor of
open/close.  Clients must now open a bdev to get
an spdk_bdev_desc, then pass this desc to get an
I/O channel.

This allows multiple clients to open a bdev,
although only one may open a bdev with write
access.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I4d319f1278170124169a8a75fd791e926b3f7171

Reviewed-on: https://review.gerrithub.io/367611
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-05 18:04:28 -04:00
Daniel Verkamp
b0e128db3d nvmf/rpc: add adrfam to listen address
This allows the user to optionally specify the address family for
construct_nvmf_subsystem (default is IPv4).

Note that the RDMA transport still only supports IPv4 because of the way
it binds to the listen address; this will be fixed in a separate patch.

Change-Id: I534ed75f6f81e53559d1bebcd2f34f1a2b210a97
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/367429
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-05 13:01:20 -04:00
Daniel Verkamp
2d34864a61 nvmf: stub out Abort command support
Add handling of the Abort command in virtual subsystems.  This doesn't
actually abort any requests - the spdk_nvmf_request_abort()
implementation just fails all abort requests - but at least this gives
us a place to hook up actual abort handling later.

Change-Id: Iafaa393c6f9e7f404af91747cbd81c64ab4810bb
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/365905
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-20 20:03:01 -04:00
Daniel Verkamp
a0a41eefb1 nvmf: allow inactive namespaces in virtual mode
Now that virtual mode namespaces can be chosen arbitrarily, there can be
holes in the ns_list.  Make sure all of the virtual mode code paths are
prepared to handle these inactive but valid NSIDs.

Change-Id: I0d70fd9dae37a29a8358e1d38dcc6cac3237fd9a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/365717
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-16 12:48:38 -04:00
Daniel Verkamp
f65731c47e nvmf: allow caller to pick NSID when adding ns
Change-Id: I1ea22fd3f56a3c048e25dead986992c848cf37b1
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/365508
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Sriram Popuri <sgpopuri@gmail.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-06-15 16:52:31 -04:00
Ben Walker
aff7e226f7 bdev: spdk_bdev_[read|write|flush|unmap|reset] now return int
It is not actually useful to be immediately returned
a handle to the bdev_io. There isn't anything valid
that the user can do with it at that point. Instead,
return an integer error code.

Change-Id: Iffa9a8dc5b2eefab57e3cc1f68919985431d17d1
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/364137
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-06-08 16:35:49 -04:00
Daniel Verkamp
887683858b nvmf: add NVMe I/O passthru for virtual mode
Change-Id: I338f47000a1c898309a7421fe52f148bae9f2e6b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/364116
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-06 13:07:32 -04:00
Daniel Verkamp
7b2a6b05d0 nvmf: add public API to get subsystem serial number
Change-Id: I61b6579e8698d16e5a8ab74d304af9ea53f9dce4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/363307
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-01 19:43:45 -04:00
Daniel Verkamp
bbfcb0943b nvmf_tgt: use public API to set serial number
Also move the validation of serial number length into the library.

Change-Id: Ibc9384fc1fccb87bd15b75da7f3942570900bd96
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/363304
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-01 19:43:45 -04:00
Daniel Verkamp
77db92cf38 nvmf: remove unnecessary subsystem num_hosts field
Change-Id: Ic1b7b1b6497dbae5ceda9bb91f9d4d2037b7243f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/363301
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-01 19:43:45 -04:00
Daniel Verkamp
806644a05f nvmf: remove spdk_nvmf_subsystem_exists()
spdk_nvmf_subsystem_exists(nqn) is exactly equivalent to
spdk_nvmf_find_subsystem(nqn) != NULL.

Change-Id: Icafa43166c99d1364b49cef30a5ade4b6625bcd5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/363299
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-01 19:43:45 -04:00
Daniel Verkamp
1c7b6f8dab nvmf: add spdk_ prefix to nvmf_find_subsystem()
Change-Id: I02a44c3790830b3918dca418c6bb85e82ddac273
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/363298
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-01 19:43:45 -04:00
Daniel Verkamp
81344a66ef nvmf: make spdk_nvmf_ctrlr_ops contents private
This structure is not part of the public API and shouldn't be in
spdk/nvmf.h.

Change-Id: I29fbb269d3ab77cd9fa9908726abc7c7a4c6d8c1
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/363296
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-01 19:43:45 -04:00
John Meneghini
8a44220b1a env: Rename spdk_malloc/zmalloc/realloc/free to spdk_dma_(func)
- rename spdk_malloc_socket to spdk_dma_malloc_socket
  - rename spdk_malloc to spdk_dma_malloc
  - rename spdk_zmalloc to spdk_dma_zmalloc
  - rename spdk_realloc to spdk_dma_realloc
  - rename spdk_free to spdk_dma_free

Change-Id: I52a11b7a4243281f9c56f503e826fd7c4a1fd883
Signed-off-by: John Meneghini <johnm@netapp.com>
Reviewed-on: https://review.gerrithub.io/362604
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-05-31 15:30:27 -04:00
Ben Walker
d969ac445a io_channel: Remove per-channel priority
This wasn't used anywhere and we currently believe there
are superior software-only techniques for controlling
quality of service.

Change-Id: Icdadd5870ed0629b338c307d2619bbc242c3e7a3
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/362065
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-05-26 13:42:19 -04:00
Daniel Verkamp
b9bcc3531e bdev: make enum spdk_bdev_io_status private
The user should not see the bdev_io status directly; the NVMe and SCSI
error code wrappers provide the ability to translate to the desired
format regardless of what kind of error is stored inside the bdev_io.

Replace the spdk_bdev_io_completion_cb status parameter with a bool
simply indiciating whether the I/O completed successfully.

Change-Id: Iad18c2dac4374112c41b7a656154ed3ae1a68569
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/362047
Tested-by: <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-05-23 16:30:10 -04:00
Daniel Verkamp
5f3841f0e3 nvmf: allow NQN to be 223 bytes + null terminator
An ECN to the NVMe 1.3 specification has clarified that the NQN may
contain 223 bytes before the null terminator.  Make all of our NQN
length checks consistently enforce this behavior.

Change-Id: Iebfd57d11abea64964c7a6ad9d886e40efa243c3
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-05-18 14:36:39 -07:00
wenzhong wu
8651c2eb47 nvmf: call function spdk_nvmf_valid_nqn to check the host_nqn.
Change-Id: I035fe2538b46d0a19eb00fd829fae9e735c1ded9
Signed-off-by: wenzhong wu <wenzhongx.wu@intel.com>
2017-05-16 03:19:54 +08:00
Daniel Verkamp
326786a943 bdev: add getters for block size and block count
Change-Id: I6fad28da43c163ea4e2c4a04ced356b67d63652f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-05-12 10:34:58 -07:00
Daniel Verkamp
1bcf22cde1 bdev: add getters for bdev name and product name
Change-Id: I6a75fada94fa845ecedd4cd8afc78f4259df14fe
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-05-12 09:36:30 -07:00
Ben Walker
b961d9cc12 include: Move the remainder of the code base to stdinc.h
Change-Id: I6a142feeaad3117bd3c75e7c5cb7231a1cfa78ae
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-05-08 13:20:36 -07:00
Ziye Yang
e48e569d83 nvmf/rdma: Replace the queue empty check
Replace with it with check the returned req
via spdk_unlikely macro

Change-Id: I1202b3955af9a68496d8ced7cf66c20cf26f7fff
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-05-08 09:40:15 -07:00
Cunyin Chang
bee8c04a4b nvmf: Move the check of NVMe remove from session layer to subsystem layer.
Change-Id: Icf2f7122c9af0cd6420384c93813d2e79ed9c69e
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2017-04-24 13:57:25 -07:00
Daniel Verkamp
6b91943209 scripts/check_format.sh: check spaces in comments
Fix up all existing spacing errors in comments and add an automated
check for patterns like /*comment*/.

Change-Id: I28f61c93612dc0f8aed66bd509da78e91ea9737e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-04-24 13:37:41 -07:00
Ben Walker
16ae587966 env: Move lcore functions into env layer.
They were previously in the event library.

Change-Id: I24ffd8f771e895ccf5395c8120423cd114893139
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-04-04 09:19:01 -07:00
Daniel Verkamp
4b887a8cbc nvmf: start even if no transports are available
Attempting to add a listen address for an unavailable transport will
fail with a better error message.

Change-Id: If4cf5b66c16dadcb6e0f0b28cea4aa510ba6a9fc
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-23 13:17:52 -07:00
Daniel Verkamp
7035c39136 nvmf: print error if transport name isn't found
Rather than failing silently, let the user know why the listen address
failed.

Change-Id: I41c2a51c6071ee739b282a1a39198a2887a73c4d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-23 13:17:52 -07:00
Daniel Verkamp
790bad22c3 nvmf: add discovery controller ops
Simplify code that previously needed to check for subsystem type by
factoring out the discovery controller operations into a new ops
instance.

Change-Id: Id87b498e4623451993fe779ffb765be5a6743fd9
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-17 15:55:36 -07:00
Daniel Verkamp
d535f9b7bb nvmf: split discovery service into its own file
No functional change, just rearranging code.

Change-Id: I28328dfefd7de269d326834c484f2c2fca4e6c1f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-17 15:55:36 -07:00
Ben Walker
1f38243914 nvmf/rdma: Combine RDMA WRITE and SEND into single post
When data needs to be transferred from the controller
to the host, do a single ibv_post_send containing
both the data and the completion.

Change-Id: I072c545b31593e0e324c97ed700b42c6a4c358e1
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-17 14:42:06 -07:00
Ben Walker
6696fce7ae nvmf/rdma: Manually inline nvmf_post_rdma_send
This call had been reduced to a simple wrapper
around the ibv call. Delete it.

Change-Id: I42926d123db262617119a9cff77bc0d0eb1e8f31
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-17 14:42:06 -07:00
Ben Walker
7488116a78 nvmf/rdma: Manually inline nvmf_rdma_post_[read|write]
These functions were only called from one place and
their functionality has been reduced to a wrapper
around the underlying ibv call. Remove them.

Change-Id: I65182012dbe6393b9d57f4191fd327bcd025a6c8
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-17 14:42:06 -07:00
Ben Walker
a4a3b5e7fd nvmf/rdma: Move all SGL setup to the prep_data step
This keeps all SGL handling in the prep_data function.

Change-Id: I9bfeed3748c1b329288350b85aa87bd604cfce4e
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-17 14:42:06 -07:00
Ben Walker
e0bdfb14ee nvmf/rdma: Manually inline nvmf_rdma_post_recv
Now that all of the SGL mappings are static,
this function just called ibv_post_recv. Delete
the function and call ibv_post_recv directly.

Change-Id: I45216170a157709249b08c4cb0ebdb1adb906049
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-17 14:42:06 -07:00
Ben Walker
cc294653ca nvmf/rdma: Send data and completion at the same time
For an NVMe read, send the completion immediately
following the RDMA WRITE, without waiting for
the acknowledgement. RDMA is strictly ordered,
so the WRITE will arrive before the completion.

Change-Id: I7e4e01d7a02c2130b655ef90f5fdaec992d9361a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-16 16:44:45 -07:00
Ben Walker
d0fb728ad2 nvmf/rdma: Don't use in-capsule buffers for READ/WRITE
Except for a CONNECT capsule, always use the central data
pool for RDMA READ/WRITE operations. The in-capsule
data buffer is associated with the receive operation
while the pool data buffers are associated with the
completion, and using the in-capsule data buffer
causes a lifetime mismatch.

Change-Id: Ieb45e521d78daa7c706078a3dd5c5a146f8dc1d6
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-16 16:44:45 -07:00
Ben Walker
23f273c0b1 nvmf/rdma: Revert 8fefa7e
After commit b654e9b, this is no longer required.

Change-Id: I0cf1a7059d7fba0303aca5ad5a15afe3890b4172
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-16 16:44:45 -07:00
Ben Walker
1db3a03712 nvmf/rdma: Do not assume acks are ordered.
The RDMA protocol this module uses is strictly ordered,
which means messages are delivered in exactly the order
they are sent. However, we have detected a number of
cases where the acknowledgements for those messages
arrive out of order. This patch attempts to handle
that case.

Separate the data required to post a recv from the
data required to send a response. If a recv arrives
when no response object is available, queue the
recv.

Change-Id: I2d6f2f8636b820d0c746505e5a5e3d3442ce5ba4
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-16 16:44:45 -07:00
GangCao
f75fe7394a nvmf: add an outstanding admin IO tracker in direct mode
Change-Id: I06e0de6dc28115f0cb53151d67138f9271093687
Signed-off-by: GangCao <gang.cao@intel.com>
2017-03-15 08:02:39 -07:00
GangCao
7224a42d9d nvmf: add a periodical admin poller for AER event in direct mode
Change-Id: Ib8cba61fe3d531f9228d0c385913d63914ba8093
Signed-off-by: GangCao <gang.cao@intel.com>
2017-03-15 08:02:39 -07:00
GangCao
89d10dd80e nvmf: add support of default subsystem identifier
Change-Id: I607e800fea00c21dfd28c8fee0a981ae59e46a5c
Signed-off-by: GangCao <gang.cao@intel.com>
2017-03-14 15:33:25 -07:00
Cunyin Chang
e58e56c9c6 nvmf: Add support of hotplug for nvmf virtual mode.
Change-Id: I941d119e6b74eadfccd7eb7675b2f7b46d2b5907
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2017-03-14 14:53:56 -07:00
Cunyin Chang
39b386a5c5 nvmf: Add interface for transport layer to check if one connection is idle.
Change-Id: I094d5adb85af8279c9823528f40190fa28801b7b
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2017-03-14 13:29:32 -07:00
Daniel Verkamp
50947d5557 nvmf/rdma: use SPDK_COUNTOF to count SGL elements
This clarifies the relation between the values assigned to sg_list and
num_sge (no functional change).

Change-Id: I8e81d47dd97a033b17cd3b813b06e4887127146c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-14 09:53:53 -07:00
Ben Walker
8fefa7e9ee nvmf/rdma: Match queue depth math to Linux kernel initiator
Change-Id: Iffe8c35ae76f5541aa95480f1aaaf654fcdfeffd
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-13 15:50:05 -07:00
Ben Walker
75990199ae nvmf: Remove sge log messages. The mappings are static now.
The mappings are all static, so it isn't interesting
to print them out on each I/O.

Change-Id: I85301b4518d4523a7c031f6ca9ff678d91428504
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-13 15:11:13 -07:00
Ziye Yang
5c36cd7481 nvmf/rdma: Use separate ibv_send_wr for RDMA READ/WRITE
This allows pipelining of READ/WRITE with completion.

Change-Id: Ib3ab5bffb8e3e5de8cbae7a3b2fff7d9f6646d2d
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-03-13 15:11:13 -07:00
Ziye Yang
0239003a72 nvmf/rdma: Initialize SGL for recv work request just once
Change-Id: I22b76cafe1a496f40cf7661daee3361ba1dee324
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-03-13 15:11:13 -07:00
Ziye Yang
4e74233835 nvmf/rdma: Separate cmd wr from rsp wr
This allows static initialization of the scatter
gather list as well as future optimizations
around pipelining commands with data.

Change-Id: I8af8f3e3425610bc720677c9bc84f163cfb6278a
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-03-13 15:11:13 -07:00