Commit Graph

1129 Commits

Author SHA1 Message Date
Cunyin Chang
6c067d0e9f bdev/nvme: Add function to allocate bdev/nvme device.
Change-Id: I246d6427e8adfb53f041776eff6d547a6f9604a6
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2017-02-23 17:40:05 -07:00
Daniel Verkamp
fd63bcdca8 env/vtophys: only print errors in debug builds
Change-Id: Iaff2b81f0427b27d89e71ee3090bbcf8ec7576e0
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-23 14:22:58 -07:00
Daniel Verkamp
b08738fe92 env/vtophys: mark exceptional cases as unlikely
Make sure the compiler arranges the fast path as the fallthrough case by
annotating the checks in spdk_vtophys().

Change-Id: If0fc3149297131894b5c7a94bff31bf8ee40326e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-23 14:22:58 -07:00
Daniel Verkamp
f314f0ca4f env/vtophys: eliminate redundant error check
Change-Id: I238b02e2df154b2ac40c746f156c0746f2518764
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-23 14:22:58 -07:00
Daniel Verkamp
302804d164 env/vtophys: make map read-only in spdk_vtophys()
Now that all DPDK memory is registered at startup, spdk_vtophys() never
needs to add new translations to the vtophys map.  This means that any
lookup that fails to find an allocated map_1gb will always return
SPDK_VTOPHYS_ERROR rather than trying to allocate it and then failing
the lookup anyway.

Change-Id: I7e6f7af183199651f5808a17810a17970b0e3331
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-23 14:22:58 -07:00
Daniel Verkamp
b49de91ef2 env/vtophys: register all DPDK memory at startup
Change-Id: Ibb37a7ea520c79ad9fe9089af7419c192fba5477
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-23 14:22:58 -07:00
Daniel Verkamp
7336c0036e env/vtophys: combine DPDK physical address lookups
vtophys_get_paddr() and vtophys_get_dpdk_paddr() are doing similar
things; combine them into one function that works for all DPDK
memory addresses.

Part of the vtophys test is temporarily disabled until the next commit,
which will register all DPDK memory at startup and stop lookiing up
addresses at runtime.

Change-Id: I91312837aa1e6170bacaf3b0d2adbdc4391d3afa
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-23 14:22:58 -07:00
Daniel Verkamp
6ea5280b04 env/vtophys: pass physical address to _spdk_vtophys_register_one()
This just moves the lookup of the physical address up one level - now
_spdk_vtophys_register_one() is only responsible for filling out the
mapping table, not looking up the translation.

Change-Id: I9fd5b85da623e403fda0563b6bdebd4aaaf42864
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-23 14:22:58 -07:00
Daniel Verkamp
d1638fb677 env/vtophys: store unshifted physical address
Rather than storing the page frame number, just store the full physical
address of each 2 MB page.  This simplifies the lookup code and makes
the map generic (values are inserted and retrieved without any
modification) for future uses.

Change-Id: Ib1081513a0682f6b8b908f3401c00d87b00f484c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-23 14:22:58 -07:00
Ben Walker
ee5ca14e21 bdev_nvme: The RPC call now directly attaches to an NVMe device
No need to build a whitelist and scan anymore - the NVMe
driver can directly attach to a specified device.

Change-Id: Ie60c09b6ab37a7f068c496f0cad53bfdc8617349
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-02-22 19:17:03 -07:00
GangCao
c30ec061e1 nvmf: update listen_addrs after successful transport operation
Change-Id: I0b4d50d1f64076a59a7c29e2cc7fd992e09ed3f3
Signed-off-by: GangCao <gang.cao@intel.com>
2017-02-22 19:16:11 -07:00
Ziye Yang
27cf11d04e nvme,rdma: optimize nvme_rdma_post_recv
Move the ibv_recv_wr initialization in
nvme_rdma_alloc_rsps. Thus we can save some
CPU times

Change-Id: Id449b2684290431f8b3ba97ec4058171d34038bf
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-02-22 19:15:41 -07:00
Ziye Yang
b89e758c8d nvme.rdma: move ibv_send_wr init while allocate rdma reqs
We do not need to set it for submission since the contents
are same

Change-Id: I345094e2e8a858b318be73d28f09393566587d95
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-02-22 19:14:54 -07:00
Changpeng Liu
22440c7a23 iscsi: fix the run out of task pool issue
When performed limitation iSCSI tests, 128 target nodes with 1
connection for each target node, for IO bigger than 256KiB iSCSI
target will report run of out task pool issue sometimes. When
all the iSCSI parameters with default values, each connection
will consume maximum 189 tasks, we hardcoded the task pool with
16384, so 189 * 128 connection will exceed 16384. Increase the
default number from 16384 to 32768 will fix the issue.
With 1MiB block size and queue depth with 128 for each connection,
there will be 64 outstanding iSCSI commands in the iSCSI target,
for Writes, the maximum R2T number is 4, so the maximum tasks for
the 4 R2T is (1 + 16) * 4 = 68, 8KiB for the first burst task, 16
for the data segment. For Reads, the maximum 64 data in segment can
be used as 4 iSCSI Read commands. The rest 56 iSCSI commands will
cost 56 tasks, so the total number is 56 + 64 + 68 = 188, 1 additional
task for NOP task.

Change-Id: I945871cbe3076139f08c2ef647af2d9c84601dcb
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2017-02-22 19:13:50 -07:00
Daniel Verkamp
0f95673d82 bdev/split: use "offset_blocks" in JSON config
This is consistent with the rest of the RPC calls that report a number
of blocks, and it matches the field in the split_disk structure.

Change-Id: Ie25534617112d65979c317fe13e05a6c32520a15
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-22 18:57:12 -07:00
Daniel Verkamp
7829c5ec9c bdev/split: add driver name to driver_specific JSON
The driver_specific object should contain a single object with the
blockdev driver's name so that the user can determine how to interpret
it.  This matches the NVMe blockdev driver.

Change-Id: I434b910a95dd527363af78469dc900e9d19ec12e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-22 18:57:12 -07:00
Daniel Verkamp
d3a0709299 bdev/nvme: remove redundant driver_specific fields
Now that namespace splitting support has been removed from the NVMe bdev
in commit efccac8 ("bdev/nvme: remove NvmeLunsPerNs and LunSizeInMB"),
the block_size and total_size fields in the NVMe bdev's driver_specific
config data are redundant.  The generic get_bdevs num_blocks and
block_size fields provide the same information.

Change-Id: I080d2017d608716a593bb553ee667e9c4017ffb7
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-22 17:57:13 -07:00
Daniel Verkamp
5f2f2052c0 nvme: reorder spdk_nvme_timeout_cb arguments
Move cb_arg to the first argument to match the other NVMe callback
function signatures.

Change-Id: I4e699c8071dcb7ba4ce3cdb82ee985600208204c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-22 17:55:43 -07:00
liu-wenhua
84501695fd nvmf: Data transfer cannot be simply determined by NVMe opcode (#120)
Whether a nvme command having data transfer cannot be completely
determined by command opcode. For set features command, some features
don't require data transfer.
Change spdk_nvmf_request_prep_data to fix this issue.
2017-02-22 14:54:30 -07:00
Ben Walker
08c69c9cc5 nvme: Handle failing MMIO reads while resetting
This has been reported for a number of different device
types. We suspect these devices are technically out of
spec, but they work with most other available NVMe
drivers on accident.

Change-Id: I529cfc03fc314cbab2a1cd40620bf1dd5b54182d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-02-21 14:20:41 -07:00
Pawel Wodkowski
e8e40b0c54 scsi: change rotation rate to 0x1
Change medium rotation rate type to 0x1 - non-rotating media.

Change-Id: I855d27851bb633c66d337d3f8a3447de3ad1c87b
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
2017-02-21 11:20:56 -07:00
Pawel Wodkowski
76384f4b0b bdev/split: report base bdev name and offset block in RPC
Change-Id: Ib8fd9396ad63c5a5fd6b838d1175eba9414de7a8
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
2017-02-21 11:20:29 -07:00
Ziye Yang
849d140b4d nvmf,rdma: remove unnecessary memset
Reason: the 4 fields of struct ibv_recv_wr is already
set in the following 4 lines.

Change-Id: I97437ee2e4c6e944154813bb48b1740b182220df
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-02-21 11:17:01 -07:00
GangCao
4e4dc3999a nvmf: move g_discovery_log_page_size variable under g_nvmf_tgt
Change-Id: I87348063ea032a7a5415d07f98dca66bf572a958
Signed-off-by: GangCao <gang.cao@intel.com>
2017-02-21 11:15:24 -07:00
GangCao
905b03786c nvmf: move g_discovery_log_page variable under g_nvmf_tgt
Change-Id: Iae5234689df5c94fcf6bbef3a10aebe06b2ddd9e
Signed-off-by: GangCao <gang.cao@intel.com>
2017-02-21 11:15:24 -07:00
GangCao
50baa132e3 nvmf: move g_discovery_genctr variable under g_nvmf_tgt
Change-Id: Id035a07d8ce49b89dc120be9d073ce46b488ce95
Signed-off-by: GangCao <gang.cao@intel.com>
2017-02-21 11:15:24 -07:00
GangCao
67027a9ea3 nvmf: move the g_subsystems variable within g_nvmf_tgt as subsystems
Change-Id: I8e5aaeca29e2de13c65628d5c80846b83a23099e
Signed-off-by: GangCao <gang.cao@intel.com>
2017-02-21 11:15:24 -07:00
Ben Walker
5502004d67 nvme: After detach, force the device back into DPDK's internal list
Change-Id: I0d745034d8319bc864d91e891b7c9bd0f7c25b6d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-02-17 15:17:49 -07:00
Daniel Verkamp
34f052d298 event/app: remove pidfile feature
The responsibility for writing the pid file should lie with the init
system, not the application itself.

This was also broken by the recent instance ID/shared memory ID rework;
the pid file was named based on the pid, making it fairly worthless.

Change-Id: Ifb4f2d3ce5cf132f2c2e8bd3d0ba605ff8ccd8fe
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-17 11:00:12 -07:00
Daniel Verkamp
6ef4af240d event: remove MultiprocessGroupID config option
This was added by mistake in commit 18d26e42a3 ("env: Move DPDK
intialization into the env library."). It is always dead code, because
shm_id is set to getpid() right above it, and it will never be -1.

Change-Id: I19c798a87bf7a3b12547d772b981b038857abcaa
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-17 11:00:12 -07:00
Tomasz Zawadzki
c210a81fd9 scsi: spdk_scsi_lun_construct should return only new objects
This patch makes spdk_scsi_lun_construct behave as documented.
spdk_scsi_lun_construct will return only newly created LUN.
If LUN with that name already exists, NULL will be returned.

Unit test relevant to this behaviour is now changed to show
this functionality is now working.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I002903d6f96555c638aba3fa99cc2c2504ced603
2017-02-16 11:03:59 +01:00
Tomasz Zawadzki
90b0873665 scsi: handle return status of spdk_scsi_lun_claim(lun)
This is necessary to prevent claiming the same LUN twice
and properly cleanup in case of an error during spdk_scsi_dev_construct.

This patch addresses three issues:
- spdk_scsi_lun_claim error is correctly handled in spdk_scsi_dev_add_lun
- on error when constructing scsi dev, it is now correctly removed along with attached luns
- spdk_scsi_dev_destruct not only unclaims, but calls spdk_scsi_lun_destruct on each lun in dev

Unit tests relevant to this behaviour are changed to show this functionality is now working.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I111c320f875e5003e3f1f7748a2630097301ce1b
2017-02-16 11:03:48 +01:00
Tomasz Zawadzki
86278ab90e unit_test: check for adding same lun twice to scsi device
This patch adds two new unit tests for scsi device:
- creating two different devices, each containing the same lun
- creating one device, with the same lun twice

As noted in code, three asserts are incorrectly set to show functionality
that is not working currently.
Next patch in series implements that functionality and changes asserts
in the unit tests.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I2645401fee4f2cd986458e0a4db108ce4e1bf9db
2017-02-16 10:11:20 +01:00
Ben Walker
18d26e42a3 env: Move DPDK intialization into the env library.
Change-Id: Ie3a324f1523ffa0ddb0bd6a24a9a3cd0acbf64b0
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-02-15 17:16:37 -07:00
Ben Walker
25270f1d7c Rename instance_id to shm_id and make it default to pid
By default, all SPDK applications will not share memory.
To share memory, start the applications with the same
shared memory id.

Change-Id: Ib6180369ef0ed12d05983a21d7943e467402b21a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-02-15 17:16:37 -07:00
Daniel Verkamp
d6fd64cdab json: make sure parse always sets *end
Funnel all of the return paths in the main parsing routine through the
code that sets the *end pointer so that all error cases set it.

Change-Id: I0565913f7b9488470ede79dc1af84eb4b9a03225
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-15 16:31:07 -07:00
Daniel Verkamp
2be0162140 nvmf: factor out common AER Get/Set Features code
The direct and virtual mode code is identical; move it to session.c like
the other virtualized get/set features.

Change-Id: I0a0e2dd795197c142ad5d9d0e4ddedb2aa5c8c2a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-14 16:56:29 -07:00
Ziye Yang
39d5920645 nvmf,tgt: SPDK_NVME_FEAT_ASYNC_EVENT_CONFIGURATION handle
Even for direct mode, each session should use its own
async event configuration like virtual mode instead of
passthrough.

Change-Id: I9c1175f3677c672c0cad684341b8a46a575d753e
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-02-14 16:48:13 -07:00
Ben Walker
dd16a7277d rpc: Decouple RPC config from instance ID
Instance ID is too overloaded and the uses are beginning
to conflict. Separate the RPC configuration out.

Change-Id: I712731130339fee4fc8de4dc2d0fea7040773c58
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-02-14 14:47:25 -07:00
Daniel Verkamp
e4dc6bbecb trace: use snprintf() to ensure g_shm_name is terminated
Change-Id: Id74a1a4de170fae1d4c10c3c0bffb2eba010c3cc
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-14 13:03:11 -07:00
Daniel Verkamp
4404793d09 string: make spdk_parse_ip_addr() params non-const
The host and port output parameters point into the (non-const) char *ip,
so it makes more sense for them to be non-const as well.

This allows the flexibility to pass non-const char pointers as the
output parameters, which will be used in the nvmf_tgt/conf.c parsing
code.

Change-Id: I1d5b102fc389c06d36432904e4fda944437b659e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-14 10:28:29 -07:00
Daniel Verkamp
b4572d452b ioat: print PCI addresses in hex for consistency
Change-Id: I0cc81e0b44f75268b1171c4ab5a23f97d9f8c8e2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-14 10:27:47 -07:00
Daniel Verkamp
a9de0d5f69 net/interface: check socket() return value
Change-Id: I3abd1d2c98cda10acfb85abc221e294563843c07
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-14 10:27:12 -07:00
Tsuyoshi Uchida
7912aa4a17 iscsi: move extern g_conn_array to conn.h (#111) 2017-02-13 09:57:37 -07:00
Tsuyoshi Uchida
4c8a8f09f3 iscsi: delete the unnecessary comment (#110) 2017-02-13 09:50:45 -07:00
Daniel Verkamp
59fc5ba613 nvme: fix extended LBA block size calculations
For namespaces with end-to-end protection information, metadata size
of exactly 8 bytes, and extended LBA configured, the NVMe driver would
calculate the size of the data block incorrectly.  The NVMe spec has a
special provision for this specific case (8-byte metadata only) and
PRACT = 1 that requires that the host does not send the metadata as part
of the host memory buffer.

To fix this, clean up the calculation of the per-block data transfer
size by adding a new extended_lba_size field in the namespace, which
represents the total size of data to be transferred per block based on
the namespace's configured metadata size and whether it transfers
metadata as part of the data buffer.  Then add the special case for
PRACT = 1 and PI configured and extended LBA in the R/W helper
functions.

Change-Id: I0b383a58c773cac06e6c018858b57129064c6059
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-10 10:24:26 -07:00
Daniel Verkamp
84d904841f util: move common helper functions to util.h
These were repeated a few different places, so pull them into a common
header file.

Change-Id: Id807fa2cfec0de2e0363aeb081510fb801781985
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-10 09:38:52 -07:00
GangCao
fcdb601ea5 nvmf: continue rdma_poll even meets error
Change-Id: I82fc3e939cc82a696b4c0b186bbc1d6cd82b8b54
Signed-off-by: GangCao <gang.cao@intel.com>
2017-02-08 10:09:02 -07:00
Daniel Verkamp
ff0047816d nvme: track submit time instead of timeout time
This removes one addition from the submission path (negligible, but a
nice side effect), but also opens up the possibility of reporting the
total time an I/O took - since we are always tracking the submission
time anyway, there is no extra cost to report it in the completion
callback.

Change-Id: I7129e7c09d20da8082042a7622d045846461dd9c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-08 09:23:58 -07:00
Ziye Yang
38980dedfa nvmf,tgt: fix issue while shutting down nvmf tgt with CTRL + C
The phenoemon is that we can not shutdown the nvmf tgt.
The solution is that we need to adjust the shutting down orders of
nvmf tgt subsystem and rdma trasport layer.

Change-Id: Ie39657370b1574960e0ee7cf604cc5872db0bed3
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-02-07 17:43:45 -07:00