Commit Graph

1018 Commits

Author SHA1 Message Date
Ben Walker
d3f66cdb2b nvme: Hotplug events just place new controllers in the init list.
This way, all new controllers discovered will be initialized
in parallel.

Change-Id: Iebedb3905eb2787a3708f74425afae40ca31253d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-08 15:22:48 -07:00
Ben Walker
34100924e4 nvme: Rename nvme_probe_one to nvme_ctrlr_probe
Simplify the arguments as well.

Change-Id: I653e1aad4e574cf95d793b41b749cb19e0024c2b
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-08 15:22:48 -07:00
Ben Walker
7473d6b37c nvme: Call the probe_cb if a device isn't claimed
If the first call to spdk_nvme_probe probes a device and
the driver elects not to take it, still call the probe
callback for that device on subsequence calls to
spdk_nvme_probe.

Change-Id: If06467cf6796c827a0bbfba6e36d5b91534526fc
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-08 15:22:48 -07:00
Ben Walker
11ef5d396b nvme: Move hotplug monitor check inside _spdk_nvme_probe
Move this down a level so it happens on all paths.

Change-Id: Iea9913f0e102353882466c8dea4ee39abb857520
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-08 15:22:47 -07:00
Ben Walker
06557b0a4d nvme: Add remove callback to transport scan
Scanning the transport may result in both new
devices and removed devices, so pass the callback
for both operations.

Change-Id: I6f73dbe6fd7cf61575c354b43f8ae3e2a01e2965
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-08 15:22:47 -07:00
Ben Walker
d70ff832bf nvme: nvme_transport_ctrlr_scan now takes a transport id
Simplify the arguments to nvme_transport_ctrlr_scan to take
a transport id that identifies the discovery service (or
NULL to scan PCIe).

Further, separate scan into two functions - scan and attach.
Scan is for scanning an entire bus, attach is for a specific
device.

Change-Id: I464f351a02a04bc5a45096dcf5dc8fc5ac489041
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-08 15:22:47 -07:00
Ziye Yang
da43f64b17 nvme/rdma: Get right initiatior depth by ibv_device_query
Change-Id: I125e95dd405c21c5aea852e619801f1ef2de94ee
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-12-08 14:18:36 -07:00
Ben Walker
5f78155fde nvme: Embed a transport_id in the discovery_info struct
Instead of repeating the fields, just embed a transport_id.

Change-Id: I282704c9d59784abd5f7c93be4e47c673fcf6dde
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-08 11:48:21 -07:00
Ben Walker
a2f35bcc16 nvme: Remove nvme_attach
Change-Id: Ia688e49574d8d80f1473f93f127586ca5aaa7d91
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-08 11:48:21 -07:00
Ben Walker
4af9f06c73 nvme: Rename discover_info to transport_id
This is a small step toward making discovery more like
scanning a local PCI bus.

Change-Id: Ie7149ad060f2eeb56939b1241187bdf09681f2aa
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-08 11:48:21 -07:00
Ziye Yang
f74d64f07f nvme/rdma: fix the nvme_rdma_pre_copy_mem
Before adding readv/writev support in nvme_rdma,
using this patch.

Change-Id: I25ff0df61d0346f22560d011158d7f80e72007ea
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-12-08 10:33:05 -07:00
GangCao
52f3c2fa52 nvme: free IO qpair when cleaning up died process
Change-Id: I136945b6bed4d2cdb0ee54b27b224c2e9cec377f
Signed-off-by: GangCao <gang.cao@intel.com>
2016-12-08 10:32:52 -07:00
GangCao
48820a5ef6 nvme: check the IO qpair is on the list before removing
Change-Id: Ic9706a51dcf65a848088448a3cfcdabd20f42f7d
Signed-off-by: GangCao <gang.cao@intel.com>
2016-12-08 10:32:48 -07:00
Changpeng Liu
df06c0d2af iscsi: drop the connection when quit the process
We cannot quit the process when user did not Logout from the session,
because the active connections always bigger than zero. User cannot
use Ctrl+C to quit SPDK iSCSI target. Add a new state to connection
to avoid destruct connection more than once.

Change-Id: I8efa79aa47534bd6ead965713769f751d9802e47
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-12-08 10:02:27 -07:00
GangCao
6bdcf5abe8 nvme: use nvme_robust_mutex related operations
Change-Id: I35416506dbafe5e9d21861e207e295e114bdb3db
Signed-off-by: GangCao <gang.cao@intel.com>
2016-12-07 13:46:03 -07:00
GangCao
47341b89b7 nvme: make the mutex with robust attribute for multi-process case
Change-Id: I0dbdad447c6b3b30100a0165a1e1ca300c53c8ca
Signed-off-by: GangCao <gang.cao@intel.com>
2016-12-07 13:46:03 -07:00
Daniel Verkamp
50365733e3 bdev/nvme: simplify nvme_version formatting
Drop the complicated buffer size/strlen math and just split the version
string formatting into two cases depending on whether the tertiary
version is set.

Change-Id: I4b4983cb8805e8734c408f473dd8c592ec8e8138
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-07 13:36:37 -07:00
Daniel Verkamp
cdc332d178 bdev/nvme: fix vendor_id formatting
The printf # specifier adds 0x for %x values, but the field width then
includes the 0x part, so for example printf("%#04x", 0x1) prints "0x01"
rather than the intended "0x0001".

Rather than increasing the field width, just manually insert the 0x in
the format string and drop # for less confusion.

Change-Id: Ie6044619a22b51b39562bfa5c0c0239933bf38c8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-07 13:36:37 -07:00
Daniel Verkamp
307d1320d8 nvme/rdma: use common Get Log page function for discovery
Change-Id: Ic635dabd039c56dfebdd0da64c4efe672b240013
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-07 13:36:24 -07:00
Daniel Verkamp
da92639400 nvme: set NUMDU in Get Log Page command
NUMDU was added with NVMe 1.2.1 and allows a larger log page size to be
described.

Change-Id: I1a4ac42393c1a21175b3564980d56b6e7a6ae80d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-07 13:36:24 -07:00
Ziye Yang
320c7fb825 nvme: drop Set Features of Keep Alive Timeout
The NVMe over Fabrics transports should already be setting this in the
initial admin queue Connect command, so setting it again is not useful.

The kernel NVMe over Fabrics target additionally has a bug in the Set
Features - Keep Alive Timeout handler (it is extracting the KATO value
from the wrong offset in the command), so this works around the kernel
bug by not sending the Set Features command at all.

Change-Id: I0d7f09b71fcea116acf8810c5880157bb9315a04
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-12-07 12:34:02 -07:00
Ziye Yang
efd7ecd5d4 nvme/rdma: fix the kato value assginment in connection
Change-Id: Idc63a8f20a85bc73d48bd622b5a6e18ca4ed50d6
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-12-07 12:34:02 -07:00
Ziye Yang
8eaf533156 nvme/rdma: set IOSQES and IOCQES in cc register
The reason is that kernel nvmf target will check the
value. If not set, it will fail the other commands later.
Even for discovery ctrlr, kernel nvmf target will
check the cc value.

Change-Id: I998327f91ba96281d261952878eb84d648a823da
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-12-07 12:34:02 -07:00
Daniel Verkamp
152a3f0528 nvme/rdma: Connect command HSQSIZE is 0-based
Change-Id: I8e089c515bc6dfdf3088cfbb772d58527c6bd8de
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-07 12:34:02 -07:00
Ben Walker
5b8c0c5ace nvme: Rename spdk_nvme_transport to spdk_nvme_transport_type
It's not the whole transport - it's just an enum for the
type of transport.

Change-Id: Ia435a21792f221ddf50ddf4f0923c6152622eccb
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-07 09:47:00 -07:00
Changpeng Liu
144065f30c iscsi: fix big READ task release process for ERL1
When we enabled the ERL1 configuation, for the DATAIN task release
process, we will queue the task to the SNACK list firstly, and then
remove the list when got ACK from initiator, but for this part of
logic, the reference count of primary task was not released correctly.

Change-Id: Ic5959cf644c74f676be0b84c5650292dc426b2d8
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-12-06 13:00:32 -07:00
GangCao
6515577822 nvme: check mutex init return code in ctrlr_construct
Change-Id: I0561f45f96ad6e88e7cdfec44c1f20677de2cb19
Signed-off-by: GangCao <gang.cao@intel.com>
2016-12-06 12:58:24 -07:00
Ziye Yang
b93d5a7ae5 nvme/rdma: set NUMDL/NUMDU fields in Get Log Page
Change it according to the spec thus we can test
kernel nvmf target

Change-Id: Ica98dd40503a40c0f0de8efaefb1f6f67a89cde8
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-12-06 12:57:57 -07:00
Daniel Verkamp
f93fd72680 env: split PCI drivers into individual files
Change the PCI enumeration API to individual functions per device type
so that only the drivers that are actually in use get linked into the
final executable.  All of the common code is still shared internally in
the env_dpdk library.

Change-Id: I2ba83afe59202a510f999a0674e23e60b6581221
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-06 09:30:55 -07:00
Daniel Verkamp
dfe9fa9bea env: do not link env lib with --whole-archive
It is not necessary, and it prevents the linker from removing unused
object files.

Fix the iscsi_tgt Makefile's library order so that env is added at the
end after the libraries that use it.

Change-Id: I241eb46703c12691444037a350be65143259e82e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-06 09:30:55 -07:00
Tsuyoshi Uchida
07456bb114 bdev/nvme: add information in blockdev_nvme_dump_config_json (#78)
Add the following infromation.
- PCI Address
- Vendor ID
- Model Number
- Serial Number
- Firmware Revision
- NVMe spec version
- Namespace sector size
- Namespace total size
2016-12-05 13:59:39 -07:00
Daniel Verkamp
13827a74a8 nvme: do not detach automatically on hot remove
The user's remove_cb should detach the NVMe controller when it can
ensure that it is no longer in use.  In the interim (between remove_cb
and spdk_nvme_detach()), the controller will remain in a failed state,
so any new I/O submissions will return an error code but not crash.

examples/nvme/hotplug is not yet updated for this change, but that will
be done in a separate patch.

Change-Id: I8827ba36f9688ccb734e7871f20f11ec11e88f96
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-05 11:13:16 -07:00
Ziye Yang
10690dedcd nvme/rdma: change the arg to 0 in nvme_rdma_fabric_prop_get_cmd
The buf is NULL, the size of buffer should be 0.

Change-Id: Iba89732ea6abeb65106ae1e158902e1dd9a1204c
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-12-05 13:02:04 +08:00
Daniel Verkamp
be4f8d0562 nvme/rdma: fix double free in qpair creation error path
While we're here, fix up typos and add error logs for all error exits
in nvme_rdma_qpair_connect().

Change-Id: I236fe6571c2012ca047aa8a447638d9227454c2f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-02 15:59:46 -07:00
GangCao
bb726d516b nvme: add multi-process support
This version of multi-process support needs to have DPDK 16.11 builtin.

Change-Id: I3352944516f327800b4bd640347afc6127d82ed4
Signed-off-by: GangCao <gang.cao@intel.com>
2016-12-02 12:24:22 -07:00
Cunyin Chang
050802cda9 env_dpdk: Remove the device from dev_device_list in DPDK.
Change-Id: I4b4b1969d53a4671754ae2b15e51d1169bd36a9e
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-12-02 09:44:48 -07:00
Daniel Verkamp
9d025383eb nvme: rename nqn fields in public API to subnqn
The discover and probe 'nqn' fields are subsystem NQNs, so name them
subnqn to be consistent with the spec and the rest of the code and to
distinguish them from host NQNs.

Change-Id: I4a80fbc1f4b037c8a4f91c8f28d2a96e47c66c47
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-01 08:08:19 -07:00
Daniel Verkamp
89136259ec nvme/rdma: add hostnqn to spdk_nvme_ctrlr_opts
Allow the host NQN to be overriden when connecting to NVMe over Fabrics
controllers.

Change-Id: I8fcf2e89ae7d9722677e834f76a8fe805c52f91b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-01 08:08:19 -07:00
Cunyin Chang
e8c63cdde0 nvme: Add support for hotplug.
Change-Id: Iac504ce15e4ea3100e5afa31764fcfff7f979dbb
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-12-01 10:21:59 +08:00
Cunyin Chang
d1a37e98e6 nvme: Make the nvme_transport_ctrlr_scan() could scan a specific device.
Change-Id: I74f7582f5175742e96268dc9c0cc83db2e1eaea0
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-12-01 10:17:41 +08:00
Daniel Verkamp
6ab28a201b nvme/rdma: register responses as a single ibv_mr
Change-Id: I55ec9275142584768543e3a6de6eb5c675f6a063
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-30 17:10:39 -07:00
Daniel Verkamp
1712d1b7a2 nvme/rdma: convert SGL trace helper into a macro
This makes the function and file/line info actually useful (instead of
pointing to the helper function itself).

Change-Id: I22bac68827115880a49d456706a7eaecdc12e9b5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-30 17:10:39 -07:00
Daniel Verkamp
a9e436911f nvme: remove transport qpair_destroy() function
Each transport should handle its own qpair cleanup internally.

Change-Id: I7dd737be820ea6bad686f4aad7d74044fad58a47
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-30 17:10:39 -07:00
Daniel Verkamp
ba16e46349 nvme: pass opts and probe_info to nvme_attach()
Let the transport access the controller options during
ctrlr_construct().

Change-Id: I83590c111e75c843685dd9315f0f08416168356d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-30 17:10:39 -07:00
GangCao
02a142abee nvme: move callback check only for the owning process
Change-Id: I05b5540fe8b1e22e8aebe23598b8cd44c8990861
Signed-off-by: GangCao <gang.cao@intel.com>
2016-11-30 17:04:48 -07:00
Ziye Yang
2e6ec373bf nvme/rdma: fix the I/O qpair creation issue
Change-Id: I357f4a83736977d319175445b4d65443f57b2c6f
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-11-30 16:57:18 -07:00
Daniel Verkamp
11a2f1cf47 nvme/rdma: simplify nvme_rdma_req_get()
nvme_rdma_req_get() is an internal function, and its only caller already
checks for a valid rqpair, so the NULL check is unnecessary.

Also clean up the redundant STAILQ_EMPTY/STAILQ_FIRST logic and use
STAILQ_REMOVE_HEAD.

Change-Id: Ic3828e8b5e881879173cb59350e39c5fac90e6ef
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-30 16:38:48 -07:00
Daniel Verkamp
9c2186ea65 nvme/rdma: make nvme_rdma_pre_copy_mem() return void
nvme_rdma_pre_copy_mem() does not have any failure cases, so remove its
return value and remove the never-taken branch in its only caller,
nvme_rdma_qpair_submit_request().

Change-Id: I91011734ed0c20f8db691d62172fe1a3021dd3a1
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-30 16:38:48 -07:00
Daniel Verkamp
5660dfde83 nvme/rdma: simplify nvme_rdma_req_put()
nvme_rdma_req_put() is an internal nvme_rdma.c function, and all of the
callers already have the rqpair, so pass it directly.  We also already
verify that all of the callers have a valid rqpair and req before
calling nvme_rdma_req_put(), so it doesn't need to check for NULL
pointers.

This also means that spdk_nvme_rdma_req doesn't need to hold a pointer
to its rqpair anymore.

Change-Id: I893a46a9074f0a843e379d10c123f9292eb3b1a4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-30 16:38:48 -07:00
Daniel Verkamp
de8b8712f8 nvme/rdma: remove unused outstanding_reqs counter
The only place where outstanding_reqs was checked was in
nvme_rdma_req_put(), but the error case there could only happen if some
kind of internal programming error occurred (e.g. calling
nvme_rdma_req_put() on an invalid request).

Change-Id: I71e40ce562a8720dfaf70437ffd4c6493327c091
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-30 16:38:48 -07:00
Daniel Verkamp
e343a735e0 nvme/rdma: inline and simplify send WR init
nvme_rdma_ibv_send_wr_init() was only called in one place, so just move
its contents into nvme_rdma_qpair_submit_request() since it allows
simplification of the code:

- req was always NULL, so remove the code that used req entirely.
- wr and sg_list are never NULL, so remove the checks for those.

Change-Id: I12a4f3502219d3681607686945e343f6808c0d2f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-30 16:38:48 -07:00
Daniel Verkamp
22d8acbcf1 nvme/rdma: check discovery entry subtype
We currently don't handle discovery service referrals, so skip those, as
well as any other unknown subsystem type.

Change-Id: I64f889e9272fb57b5cf9bb5467b3abca3955baf5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-30 16:38:48 -07:00
Cunyin Chang
51b15b93e7 nvme: Make sure the driver not exit when aer not supported.
QEMU's virtual NVMe controller device does not support the AER Set
Feature, so ignore its failure and continue.

Change-Id: I8b5c217a3112edabb6f76ec3e5f4ef774981a1d7
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-11-30 16:37:46 -07:00
Daniel Verkamp
8a6b62c9ec env/pci: fix compilation with DPDK < 16.07
Change-Id: Ibac6d3132ad7cfa66b9ad3d3a933492acfa1b25e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-30 16:33:07 -07:00
Cunyin Chang
06c6d16cf8 nvme: Monitor uevent for device insert and remove
Change-Id: Ib47226d11a77eaa17a4e8a5e3e2c1a02c890f6ae
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-11-30 14:27:43 -07:00
Cunyin Chang
0e807fae27 nvme: Handle SIGBUS generated when a device is hot removed
Catch SIGBUS and handle it by remapping new memory into the
location where the BAR previously was.

Change-Id: Ie8d00a60a0bbe7f7ec57a5c39c0a63c5d9443206
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-11-30 14:25:04 -07:00
Cunyin Chang
56765aa39f env_dpdk: Add spdk_pci_device_[attach|detach]
These functions will attach or detach from a PCI device. Attaching
typically means mapping the BAR.

Change-Id: Iaaf59010b8a0366d32ec80bb90c1c277ada7cfe7
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-11-30 14:10:52 -07:00
Cunyin Chang
1c6cd96ee4 env_dpdk: NVMe and IOAT drivers are always registered.
Change-Id: I46ea311e9d8972641c4c4c6d764955847b1f9786
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-11-30 13:22:12 -07:00
Ziye Yang
88ae5a7629 nvme: move devhandle from spdk_nvme_ctrlr to nvme_pcie_ctrlr
This variable is only for nvme_pcie

Change-Id: I2bb8e65c3e6c26ef5919915b95d006bc92ebe750
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-11-29 16:13:10 -07:00
Cunyin Chang
7a17d4e249 iscsi: Check the connection state in function spdk_iscsi_conn_execute().
This patch make sure the connection in normal state before any further
operation on this connection.

Change-Id: I776740b5b33b1de6707990c09d9131c385adf556
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-11-29 16:10:23 -07:00
John Kariuki
ec71fa1aa5 reactor: fix lcore type and add socket in NUMA notice
Change-Id: Ib0afc9415338c6c7aa11f55513c552c484b61cbd
Signed-off-by: John Kariuki <John.K.Kariuki@intel.com>
2016-11-29 12:50:19 -07:00
GangCao
494b0c32c2 nvme: update the handling of pending admin requests
Change-Id: I035c59b6c4e4fdbbc8665c74541274e9d86ca8af
Signed-off-by: GangCao <gang.cao@intel.com>
2016-11-28 15:11:14 -07:00
Daniel Verkamp
c454900960 log: print trace flag names in SPDK_TRACELOG()
Change-Id: I962ee098818f48563e67f9b4214bc3519eee48b4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-28 13:15:08 -07:00
Tsuyoshi Uchida
438064c925 bdev/nvme: change name of variables to lower case (#77)
LunSizeInMB -> lun_size_in_mb
LunSizeInsector -> lun_size_in_sector
2016-11-28 11:08:26 -07:00
Tsuyoshi Uchida
d7d7add855 nvme: fix ctrlr free issue (#74)
spdk_nvme_probe frees ctrlr when nvme_ctrlr_process_init is failed. But
ctrlr has already been freed while calling nvme_ctrlr_destruct. So
spdk_nvme_probe doen't need to free ctrlr.
2016-11-28 10:58:26 -07:00
Tsuyoshi Uchida
b573c3a9ef nvme: fix keep alive interval ticks (#76) 2016-11-28 10:52:44 -07:00
Daniel Verkamp
263cd7944b env: remove return statements in void functions
Change-Id: I846a411a33a1f31c1a3ce28409a165ef6c449551
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-28 10:08:35 -07:00
Daniel Verkamp
efca92b85b nvme/rdma: partly remove CC.EN = 1 hack
The generic NVMe library controller initialization process already
handles enabling the controller; the RDMA transport should not need to
set EN itself.

For now, the discovery controller is cheating and not using the normal
initialization process, so move the EN = 1 hack to the discovery
controller bringup until it is overhauled to use the full
nvme_ctrlr_process_init() path.

The previous code where CC.EN was set to 1 before going through the
controller init process would cause an EN = 1 to EN = 0 transition,
which triggers a controller level reset.

This change stops us from causing a reset during the controller
startup sequence, which is defined by the NVMe over Fabrics spec as
terminating the host/controller association (breaking the connection).

Our NVMe over Fabrics target does not yet implement this correctly, but
we should still do the right thing in preparation for a full reset
implementation.

This patch also reverts the NVMe over Fabrics target reset
handling hack that was added as part of the NVMe over Fabrics host
commit to its previous state of just printing an error message.

Change-Id: I0aedd73dfd2dd1168e7b13b79575cc387737d4f0
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-23 16:34:41 -07:00
Daniel Verkamp
bdf982302e nvme: add trace logs for initialization process
Change-Id: Iba26bf9264dc6c72d84ecba96787efe141ba53fc
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-23 16:34:13 -07:00
Daniel Verkamp
ed598ee066 nvme/rdma: fix log level for debug messages
Most of the NOTICE level messages should have been TRACE.

Change-Id: Icbc4d398ab2580cf3a2349be11441b7a09603020
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-23 16:34:13 -07:00
Daniel Verkamp
e2a2165550 nvme/rdma: use getaddrinfo() to parse service ID
Also remove unreachable code handling addr == NULL.

Change-Id: Ia6b5639853bbb6f4193a1b4352d465829b1293d1
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-23 16:34:13 -07:00
Daniel Verkamp
e15a704e2f nvme/rdma: fix nvme_rdma_qpair_destroy() NULL check
Verify that qpair is not NULL before doing pointer math on it.
The NULL check after calling nvme_rdma_qpair(qpair) would not
trigger if qpair was NULL.

Fixes a crash if the Connect command failed, causing
nvme_rdma_ctrlr_create_qpair() to return NULL.

Change-Id: I158a5b1752892a7d5a72a9ac20c0c5b2cd781a81
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-23 16:34:13 -07:00
Daniel Verkamp
648c15d1b9 nvme/rdma: fix connect error message
Change-Id: I21c4cc98fb5b1bd9c7714898599496def265ff83
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-23 16:34:13 -07:00
Daniel Verkamp
6ca517d460 nvmf: split subsystem lookup from host check
This allows us to print better error messages when connecting to a
subsystem that exists but does not allow a specific host.

Additionally, we can now return the correct error code for a host that
is not allowed.

Change-Id: I16cd4ac2745cf50bb54601b464b0d23954f86fda
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-23 16:34:13 -07:00
Ben Walker
aa3d7381cc nvme: Don't add discovery controller to attached_ctrlrs list.
Change-Id: I214b9291cc8f54928bdeb6f078d473661edfebfc
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-11-23 13:37:29 -07:00
Ben Walker
03f84b5bbf env: Detect correct DPDK header install location
Official installs of DPDK place headers in a 'dpdk'
subdirectory under include, so detect that.

Change-Id: If64421c84c91cae31688994484c22fce398dc622
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-11-23 13:37:29 -07:00
Daniel Verkamp
97cc39e1ef nvme: clear status.done flag in keep-alive config
The status.done flag polled by nvme_ctrlr_set_keep_alive_timeout()
was never initialized.

Change-Id: I323fae5f4ce12209a9699965ce07894bc3c6205a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-23 10:28:25 -07:00
Changpeng Liu
a3ed1795cd nvmf: add subsystem check on creation and cleanup for nvmf rpc
Change-Id: I85826c99c450426c26870ae261a7b7c8daeba031
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-11-23 10:27:54 -07:00
Changpeng Liu
277ca8ddd0 nvme: free associated memory when deleting the IO queue pair
Change-Id: Ibc139c5fd2e0ef72b6dbd5a8416aec916759430f
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-11-23 10:27:44 -07:00
Daniel Verkamp
2bfb991e42 nvmf: share Get/Set Features - Number of Queues
The code in virtual.c and direct.c was identical - move it to session.c
to share it.

Change-Id: Ic6e4e9238e8ffacb212e76293c440109aa839f8c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-23 09:46:31 -07:00
Daniel Verkamp
48631ef2b9 nvmf: add Set Features - Keep Alive Timer to Direct mode
Move the current Virtual mode implementation to session.c and use it for
Direct as well.

Change-Id: I3f0ac93b4247b93d158b0dcb77e257b4b91be129
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-23 09:46:22 -07:00
Daniel Verkamp
4be1cd85f0 nvmf: use bdev_io NVMe status code if available
Change-Id: If7003bf5c6a6fa0a4d1c6b8fda4cc19b6dc77482
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-23 09:46:09 -07:00
Daniel Verkamp
ff898d9e9a nvmf: implement Get/Set Features - Host ID
Store the host identifier from the Connect command and report it via Get
Features.

Change-Id: I79bc27e05c5944549e7986aadb919c19748e7474
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-23 09:13:02 -07:00
Daniel Verkamp
b2678a5246 nvmf: return Invalid Log Page for unsupported pages
Change-Id: I27cbdf06caf66e5a23ec2b7e836915f2e386cea2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-23 08:50:49 -07:00
Daniel Verkamp
7a06e80143 nvmf: report unsupported Get/Set feature IDs
Also return Invalid Field rather than Invalid Opcode to be more
accurate.  The spec doesn't seem to define any more specific error code
for this case.

Change-Id: I992c6cca3020ff80b8495c71170222bc75316800
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-23 08:50:30 -07:00
GangCao
3c11422403 nvme: acquire ctrlr_lock when submitting and completing admin IOs
Change-Id: I19f395d1859f75a665a1a0cd7bef1d88ebb15631
Signed-off-by: GangCao <gang.cao@intel.com>
2016-11-22 16:56:38 -07:00
Daniel Verkamp
5e5a3851c3 nvmf: zero out Get Log Page buffer
None of the log pages are actually implemented yet, but at the very
least, we don't want to leak random bits of uninitialized data.

Change-Id: Ic889260eb18d49122f2f250b645bdc5be3561dc5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-22 16:33:56 -07:00
Daniel Verkamp
1cb7e396a7 json: add printf-style spdk_json_write_string_fmt()
Change-Id: I9ea18072d4e54344f145a0b2d16aa6ab7f4d5e03
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-22 16:32:35 -07:00
GangCao
022b8a6df4 nvme: increase number of NVME_ADMIN_TRACKERS
Change-Id: I9f5ef187b70a61eda8f0d16677dd5cbe4e4fa3c2
Signed-off-by: GangCao <gang.cao@intel.com>
2016-11-22 14:38:05 -07:00
Daniel Verkamp
7d5bcb4893 nvme: remove spdk_nvme_transport_type from API
Use the NVMe over Fabrics spec definitions for TRTYPE rather than the
internal library transport type.

Change-Id: Idead559a8f8d95274fc580d10e82033822e6eda8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-22 13:42:00 -07:00
Daniel Verkamp
9a40113a19 nvme: convert probe strings into char arrays
These need to be available for the lifetime of the probe_info structure,
so they can't be pointing at e.g. temporary buffers on the stack.

Change-Id: I5aaa898acf9314aab51600dd756f966965d37fd0
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-22 13:42:00 -07:00
Daniel Verkamp
16ae39419d nvme: untangle internal enum_cb complexity
Change-Id: I73ddb996a652b78534ce49e5d4e43b269940ec4d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-22 13:41:38 -07:00
Daniel Verkamp
b4bd76bc63 util: add vsprintf version of spdk_sprintf_alloc
-Wformat-nonliteral needs to be disabled since clang triggers it on the
call to vsnprintf() now that it is nested two calls deep.

Change-Id: I228b9d099cfc2b65181941cbb4798b7f8eae3baa
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-22 11:52:00 -07:00
Jim Harris
407b550ff4 build: define SPDK_LIB_LIST to simplify building dependencies and linker args
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ia969f9e5ed01f4b58cec2559133347d836118131
2016-11-22 11:45:48 -07:00
Daniel Verkamp
ae6fbf1d2d util: add spdk_strlen_pad() function
This is a counterpart to spdk_strcpy_pad() which determines the length
of a string in a fixed-size buffer that may be right-padded with a
specific character.

Change-Id: I2dab8d218ee9d55f7c264daa3956c2752d9fc7f7
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-22 11:36:34 -07:00
Daniel Verkamp
1910c552f7 nvme/rdma: remove pointless nvme_rdma_ctrlr::cb
It always points to the same internal RDMA request complete function, so
just call that function directly.

Change-Id: Ic1fb6236bf43eaad62413df77d43be9ab855e5c7
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-21 17:02:12 -07:00
Daniel Verkamp
d75b2f6c6f nvme/rdma: use max BB size as max_xfer_size
We can't transfer more than the bounce buffer in a single command, so
report that rather than some bogus value.

Change-Id: I39b147916dcc2ee478470917298763a239a6a35a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-21 17:02:12 -07:00
Daniel Verkamp
fd36d11e17 nvmf_tgt: stub out Async Event Config feature
Record the user-provided asynchronous event configuration set via Set
Features, and return it in Get Features.

This value is not actually used, since AER is not implemented yet in the
virtual controller model, but it at least implements the mandatory
Set/Get Features.

This allows the hack in the NVMe host code that ignored the Set Features
failure to be reverted.

Change-Id: I2ac639eb8b069ef8e87230a21fa77225f32aedde
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-21 17:02:12 -07:00
Daniel Verkamp
be54ddb05c nvme/rdma: retrieve CAP during ctrlr_construct
Fill in the cached copy of CAP in the generic NVMe controller to match
the PCIe transport.

This is not really early enough, since CAP is used during the reset
process to determine the reset timeout, but that will have to be fixed
separately by rearranging some of the transport callbacks.

Change-Id: Ia8e20dbb8f21c2871afb9e00db56d0730e597331
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-21 17:02:11 -07:00
Daniel Verkamp
4544a8b2ee nvme/rdma: fix incorrect NQN strncpy() usage
Make sure the entire NQN field is zero-padded, rather than using
strlen() on the input.

Change-Id: Icee68bd033feed057813beeb30cec102ed90840e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-21 17:02:11 -07:00
Daniel Verkamp
cf3fb7bb7d bdev/rpc: add driver-specific data to get_bdevs
Change-Id: Ieb37c9fdb55b36b62adcb421ab1d0426052d23a4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-21 12:35:57 -07:00
GangCao
9ec380ba90 nvme: check whether the process is already added at the probe phase
Change-Id: I556c0fd993998a291bff227365102b9985e6d7ec
Signed-off-by: GangCao <gang.cao@intel.com>
2016-11-21 12:35:47 -07:00
Pawel Wodkowski
a1948352a3 lib/scsi: handle scattered input/output buffers for non IO commands
Fix buffer overflow/underflow for commands with alloc length scattered
into multiple preallocated buffers (eg. INQUIRY)

Change-Id: If6f7cabc7a6a7fb384bb015e14dc38548f484d0f
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
2016-11-21 10:52:35 -07:00
Daniel Verkamp
8c5738ec5c nvme: stub out RDMA transport when not enabled
This fixes a compiler warning about unhandled enum cases in a switch.

Change-Id: Icecb56b47a05c13f390f03b877f8eae243b481a6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-18 14:44:17 -07:00
Ziye Yang
246c39a7ee nvme: Add nvme over fabrics support
Change-Id: I6f6259e77baa5dc5861f31ec4a9034e15297d333
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-11-18 13:58:44 -07:00
GangCao
af9eca84d6 nvme: rename struct spdk_nvme_controller_process
Change-Id: If8f29409b86281532eae6d87d056a2f02f6609d4
Signed-off-by: GangCao <gang.cao@intel.com>
2016-11-18 12:53:52 -07:00
GangCao
224e0ff0b7 nvme: use default mutex init under FreeBSD
Change-Id: I0bd06efb4a87b92f924df21ef8a8782aff1bef1a
Signed-off-by: GangCao <gang.cao@intel.com>
2016-11-17 16:37:26 -07:00
Tsuyoshi Uchida
e235cf5a2d nvme: add admin opcode string and generic status string (#73)
- add SPDK_NVME_OPC_KEEP_ALIVE to admin_opcode
- add SPDK_NVME_SC_INVALID_SGL_OFFSET, SPDK_NVME_SC_INVALID_SGL_OFFSET,
SPDK_NVME_SC_HOSTID_INCONSISTENT_FORMAT, SPDK_NVME_SC_KEEP_ALIVE_EXPIRED
and SPDK_NVME_SC_KEEP_ALIVE_INVALID to generic_status
2016-11-17 16:17:26 -07:00
Changpeng Liu
c8ce161852 bdev/nvme: set bdev write cache flag according to NVMe capability
Change-Id: Iad307b0d1883d00b2e68bbdfaa94f05955a8314d
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-11-17 13:15:24 -07:00
Daniel Verkamp
44e60dc47d build: consolidate library outputs in build/lib
Make it easier to use SPDK libraries by putting them all in a single
directory that can be added with -L rather than scattered around the
source tree.

Change-Id: I5c0f5dd6e7058b5f92fa9bc41548190ffc064761
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-17 13:15:09 -07:00
Daniel Verkamp
56517c7236 iscsi: fix unused variable warning in release build
Change-Id: I9ef2365a66cd582c4016c081f04ef0a4e8d9109a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-17 10:29:11 -07:00
Daniel Verkamp
fb08791096 copy_engine: only calculate task size once
Track the maximum copy task size as modules are registered rather than
recalculating it every time spdk_copy_task_size() is called.

Change-Id: I141aca61e7075402dac41915080d1b43faee32ce
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-16 15:04:45 -07:00
Daniel Verkamp
5b63b8a448 copy_engine: rename spdk_copy_module_get_max_ctx_size() to spdk_copy_task_size()
Make the public API clearer - if the user wants to allocate a
spdk_copy_task directly, they need to allocate spdk_copy_task_size()
bytes.

Also change the return type to size_t for consistency.

Change-Id: I0f3757056757c510421d680c5b4532edd9bc2561
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-16 15:04:40 -07:00
Daniel Verkamp
945217d2b2 copy_engine: split internals into spdk_internal
Change-Id: I3102e9761888c5afdc20d1a1abc9abf50484233d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-16 14:44:35 -07:00
Daniel Verkamp
ee64969a7b copy_engine: add spdk_ prefix to types
Change-Id: I060718887950ee7f890e76d7e041e70db39974a2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-16 14:14:50 -07:00
Daniel Verkamp
d27b24c94b log: split internal TRACELOG macro into new header
The SPDK_TRACELOG macro depends on a CONFIG setting (DEBUG), so it
should not be part of the public API.

Create a new include/spdk_internal directory for headers that should
only be used within SPDK, not exported for public use.

Change-Id: I39b90ce57da3270e735ba32210c4b3a3468c460b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-16 13:33:51 -07:00
GangCao
ac99f2fbc5 nvme: add new member initialized for nvme_driver struct
Change-Id: I8db8225bff2f11998b58df7987bff3d53e206b4a
Signed-off-by: GangCao <gang.cao@intel.com>
2016-11-16 13:16:56 -07:00
Daniel Verkamp
396c32c48f conf: move structures out of public API header
Change-Id: Id2a7f083d959c9bbe493c383e6c9578de34c5eae
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-16 10:33:16 -07:00
Daniel Verkamp
04c48172b9 conf: add accessors for section name and num
Remove usage of the conf structs so they can be moved out of the public
API header.

Change-Id: I1c7375ec7708b323f50af09aeb7b2b2c9c770df4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-16 10:33:12 -07:00
GangCao
8464f90039 nvme: update the comment for the tailq field of spdk_nvme_qpair struct
Change-Id: Ifba4d699e0b2b0f7ca8bf68c03f3caaddfcda1a5
Signed-off-by: GangCao <gang.cao@intel.com>
2016-11-16 10:27:54 -07:00
GangCao
ec5b6fed61 nvme: add ref to track the shared usage of ctrlr among processes
Considering the process can be terminated in the cases like ctrl+c,
kill command or memory fault, the ref is tracked in the per process
structure spdk_nvme_controller_process and whenever there is other
process attaches or detaches the controller, a scan will be issued
to cleanup those unexpectedly exited processes.

Change-Id: Ib4f974f567a865748d42da4ead49edd383dfc752
Signed-off-by: GangCao <gang.cao@intel.com>
2016-11-16 10:27:45 -07:00
GangCao
124abbc045 env: explicitly set 0 to reserved memory
Change-Id: Ieb8dd2c0cb9dcb3b4de3b3e3f6680e2bf5d40173
Signed-off-by: GangCao <gang.cao@intel.com>
2016-11-16 10:02:54 -07:00
Changpeng Liu
b77f2a6bc3 iscsi: replace trace log with error log for error cases
Change-Id: I938a90b6f16ba427549875cdf2bf883b38280777
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-11-16 10:02:03 -07:00
Jim Harris
3d1b60557c env: add spdk_vtophys_register/unregister
These APIs can be used to register/unregister regions
of pinned, huge page memory that are separate from
huge page memory allocated by the default DPDK
allocations.  These APIs will be used by an upcoming
SPDK vhost-scsi target to enable SPDK to target
NVMe DMA operations directly to VM memory that has
been allocated by QEMU using pinned huge pages.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I649a4adeeb758b29bd29cd42c8872eed3d5d6ce9
2016-11-16 09:21:57 -07:00
Daniel Verkamp
fc9983b638 env: drop spdk_pci_device_get_class()
Now that the env PCI framework already requires enumerating devices
based on an enum of specific device types, it is not useful to query the
class code of a PCI device handle.

It is currently unused and does not work in its current form on FreeBSD
(it reads a file from /sys).  This lets us drop a big chunk of file
reading and parsing code.

Change-Id: I1d720398416ba3d6f91e077b807ec11a6de562cf
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-16 08:44:21 -07:00
Ben Walker
b43db69a44 nvmf: Remove spdk_nvmf_transport from public API
The details of the structure were removed earlier, but
now remove all references even to a pointer to the
structure. The user can refer to transports by their
string name.

Change-Id: I273356f46329ea5372dcd951eda6f14767477d69
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-11-16 08:11:46 -07:00
Ben Walker
bb5d8e506c nvmf: Combine nvmf_tgt_init and nvmf_transport_init
Change-Id: I6d0f92842f3b8626bc2c25b38bfa7f7ddea5e7cc
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-11-16 08:11:46 -07:00
Ben Walker
3cbed2ed86 nvmf: Add some accessors for subsystem data
This is a step toward abstracting away the definition
of the subsystem.

Change-Id: I88b2aa107b27152620f51a1ca2a153792b4c85e9
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-11-16 08:11:46 -07:00
Ben Walker
f1017d7769 nvmf: Remove num from subsystem
It wasn't used for anything.

Change-Id: Ifc8c97481490f6389a739a37df03dea6c88ec692
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-11-16 08:11:46 -07:00
liupan1111
0dacdf2947 replace SPDK_TRACELOG with SPDK_ERRLOG when an error happens (#68) 2016-11-14 10:30:49 -07:00
Daniel Verkamp
6bd65015d7 env: rename default implementation to env_dpdk
Change-Id: I6aa48861917547e7081951b6d953693e109b02e6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-14 08:48:20 -07:00
Tsuyoshi Uchida
81d60e6f30 scsi: fix panic issue of spdk_scsi_dev_queue_task
When task->lun is NULL, spdk_scsi_dev_queue_task panics. This patch
fixes it.
2016-11-10 13:29:12 -07:00
GangCao
621f96f7aa util/bit_array: use spdk_realloc for process sharing
Change-Id: I8fe49388e7bec9306474f27de7c17e767dfa19e8
Signed-off-by: GangCao <gang.cao@intel.com>
2016-11-09 15:04:20 -07:00
GangCao
84b7670dff nvme: use spdk_zmalloc for IO qpair creation
Change-Id: I1a9b324605069b5fc1a5a7a23e87933ad3b2b3ca
Signed-off-by: GangCao <gang.cao@intel.com>
2016-11-09 15:03:45 -07:00
Pawel Wodkowski
8b449060eb lib/scsi: allocate only requested amount of data
Remove 4k allocation size in spdk_scsi_task_alloc_data(). From now on
all commands must obay allocation length.

Change-Id: Ica9384c62d431483ae1d0bd2e6fdee18b570861f
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
2016-11-09 12:33:15 -07:00
Pawel Wodkowski
4fdc493c8e scsi_bdev: respect allocation length in READ CAPACITY 10/16
Change-Id: Iedab4471edc8639fde32bb29acba9172b0f65734
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
2016-11-09 11:50:23 -07:00
Pawel Wodkowski
0244b5d78d scsi_bdev: respect allocation length in MODE SENSE 6 and 10
This refactor MODE SENSE 6 and 10 related functions to respect buffer
size parameter.

Change-Id: I03bad456bac0554a8bf7b56f69d1f9cf5b1991f6
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
2016-11-09 10:52:34 -07:00
Pawel Wodkowski
f30f0c76f1 scsi: refactor usage of iov from spdk_scsi_task
This patch is preparation for fixing alloc_len overrun in SENSE 6/10 and
READCAP 6/10. To simplify code forbid usage of iov outside of
scsi/task.c.

This also drop SPDK_SCSI_TASK_ALLOC_BUFFER flag that obfuscate code. As
a replacement assume that if field alloc_len is non zero it mean that
iov.buffer is internally allocated. Functions
spdk_scsi_task_free_data(), spdk_scsi_task_set_data() and
spdk_scsi_task_alloc_data() manage this field.

Change-Id: Ife357a5bc36121f93a4c5d259b9a5a01559e7708
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
2016-11-09 10:19:53 -07:00
Daniel Verkamp
51c6917fad bdev/rbd: remove redundant len field
Use the len field from the generic spdk_bdev_io instead of duplicating
it in blockdev_rbd_io.

Change-Id: I3ebfab8dd1303add83bc2206fc87319ba7d605b3
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-09 10:05:35 -07:00
Jim Harris
0095e2b994 bdev/nvme: account for 2MB straddle in queued_next_sge()
This function needs to check for SGEs that straddle a
2MB page boundary, and ensure it does not return
a length that will cross that boundary.

This cannot happen in practice currently with SPDK
since all buffers are allocated using rte_malloc(),
but an upcoming vhost-scsi target may produce
SGEs from a guest VM's physical memory that span
a 2MB boundary.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I8b83c7c39c4cf33815abb22ff2ebc90941b21e28
2016-11-09 10:04:52 -07:00
Jim Harris
aac30ff3f4 bdev/nvme: reorganize queued_next_sge()
No functional change, but removes a few assumptions
that will be invalid in a future patch that fixes a
bug in this function.  Primarily we no longer assume
that this function will always increment the
iovpos and reset iov_offset to 0.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I770f2f24c37626063e113af850a2af792aed332a
2016-11-09 10:04:52 -07:00
Daniel Verkamp
1f3d48b22d bdev: move spdk_bdev_fn_table into bdev_module.h
The bdev function table should not be part of the public API.

Change-Id: I5d6f40d1b37c4471041c1c9d6253a3f92e9e9701
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-09 09:59:39 -07:00
Daniel Verkamp
3e32462142 bdev/rbd: remove unused blockdev_rbd_io::ch
It was written but never read (and the I/O channel is already stored in
the generic spdk_bdev_io).

Change-Id: Id33392e9d3940b2c1439e9fed2553aa091ecedf8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-09 09:16:53 -07:00
Daniel Verkamp
22698fd8bb bdev/rbd: replace custom enum with spdk_bdev_io_type
No need to duplicate the bdev-defined I/O type.

Change-Id: I15cb68c3c68b3f25b286b04500b53081ed5e7881
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-09 09:16:53 -07:00
Daniel Verkamp
71ff831d0e bdev/rbd: simplify status code processing
The status field in blockdev_rbd_io was only used within
blockdev_rbd_io_poll(), so replace it with a local variable.

Change-Id: I3629225f28b752a3acc7521699c33bc98f1e4b7b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-09 09:16:53 -07:00
Daniel Verkamp
0aec36be1f nvme: return virtual address in SGL callback
Instead of the next_sge callback returning the physical address
directly, make it return the virtual address and convert to physical
address inside the NVMe library.

This is necessary for NVMe over Fabrics host support, since the RDMA
userspace API requires virtual addresses rather than physical addresses.
It is also more consistent with the normal non-SGL NVMe functions that
already take virtual addresses.

Change-Id: I79a7af64ead987535f6bf3057b2b22aef3171c5b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-09 08:57:40 -07:00
Daniel Verkamp
2b2ce628dc bdev/rbd: simplify pool_name allocation
Remove the complex list management for pool_name and just strdup() it
directly.  It is not worth the trouble to save a few bytes.

Change-Id: I8a4f7eeea619bd824ea593854423e317041c540e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-08 13:10:54 -07:00
Daniel Verkamp
9f2e5cd713 bdev/rbd: remove unused cb_fn and size fields
Change-Id: I46082e036ac2a3318fa4191a5cb4d460d41cecf8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-08 13:10:38 -07:00
Daniel Verkamp
bb8451cced Replace rte_panic() with abort()
Remove a DPDK dependency from generic code.

Change-Id: I8e3e2c0a36d980b426a1967ed1f88fb8b855c382
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-08 08:57:49 -07:00
Daniel Verkamp
a8e6c0aeaf bdev/nvme: only create bdevs for active namespaces
Change-Id: I3ebe0786e8ef6fe722834fb72e6deede036625ec
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-08 08:57:34 -07:00