Commit Graph

142 Commits

Author SHA1 Message Date
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
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
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
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
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
Daniel Verkamp
fcb00f3780 nvme: expand probe information to a struct
spdk_nvme_probe() will now provide a struct spdk_nvme_probe_info to the
probe and attach callbacks in place of the PCI device pointer.

This struct contains the useful information that could be retrieved from
the PCI device during probe.

The goal of this change is to allow expansion of the probe information
in the future when other transports (specifically, NVMe over Fabrics)
are added that do not necessarily use PCI addressing or device IDs.

Change-Id: I59a2a9e874e248ce5fa1d7f4b57c8056962ff3cd
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-02 14:15:02 -07:00
Daniel Verkamp
bbd7e1c4da env: add spdk_pci_addr_parse()
Add a helper function that converts a PCI address from a string into a
struct spdk_pci_addr and use it in place of the various sscanf()
invocations throughout SPDK.

Change-Id: Id2749723f76db741567e01b4bcb0fffb0e425fcd
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-02 14:15:02 -07:00
Daniel Verkamp
e912a90f77 env: pass PCI address when claiming devices
The PCI device claim function does not need the whole spdk_pci_device
structure, just the address.

Change-Id: If59df512043ee062cf9f759bdc104fc522625ba8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-01 10:07:30 -07:00
Daniel Verkamp
c0527befc5 env: clean up PCI address comparison function
- Split the part that gets a PCI device's address into its own function,
  spdk_pci_device_get_addr(). This is useful outside of the comparison
  function and is orthogonal to comparing addresses.
- Make the comparison function take two addresses instead of a device
  and an address.  The more general form will be useful with addresses
  that are not directly associated with a device.  Because of this, also
  rename the function from spdk_pci_device_compare_addr() to
  spdk_pci_addr_compare().
- Return a signed value similar to strcmp() so that addresses can be
  ordered, not just compared for equality.

Change-Id: Idf304454af09ea57f1e1d5dc3a39b077378cecad
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-01 09:40:36 -07:00
Daniel Verkamp
0404c306cb bdev: make construct RPCs return the bdev names
When creating a bdev via the RPC interface, there was no way to know
what name it was assigned (other than predicting it based on the
numbering scheme).  Change all of the relevant RPC interfaces to return
an array of bdev names so they can be used to construct LUNs/subsystems
dynamically in scripts.

Change-Id: I8e03349bdc81afd3d69247396a20df5fcf050f40
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-31 11:17:46 -07:00
Tsuyoshi Uchida
a5f0327897 scsi: translate nvme error to scsi error (#54)
This patch translates NVMe status code to SCSI sense according to NVM
Express: SCSI Translation Reference.

http://nvmexpress.org/wp-content/uploads/NVM_Express_-_SCSI_Translation_Reference-1_5_20150624_Gold.pdf
2016-10-28 13:06:45 -07:00
Pawel Wodkowski
113f8e23a7 bdev: enable IO vector operations
This patch enables vector operation for bdev drivers aio, malloc and
nvme.
The rbd driver still handle only one vector.

Change-Id: Ie2c1f6853bfd54ebd8039df9a0305854ca3297b9
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
2016-10-14 16:21:24 +02:00
Cunyin Chang
076c7d5953 bdev: return error code when try to add duplicate nvme bdev.
Change-Id: Ifdab98324481b110442b08f03669b697d728b851
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-10-13 20:36:57 -07:00
Cunyin Chang
d7635243b9 bdev/nvme: replace the structure nvme_bdf_whitelist with spdk_pci_addr.
Change-Id: I6a4e4304f166fb744164ee5eb113a9185b2425b2
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-10-13 20:36:56 -07:00
Cunyin Chang
72b4cda87f bdev: remove unused field in data struct nvme_bdf_whitelist
Change-Id: Ib21ef75515277d84cb12cdb6733137cbbe2e4ebc
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-10-14 01:55:16 +08:00
Cunyin Chang
9d15f4bfcc bdev: Add rpc interface for nvme
Change-Id: I0de3c68dc3a02559ca5f302aa541a91ffb1ddb42
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-10-14 01:54:13 +08:00
Cunyin Chang
1fad9da400 bdev: add public function spdk_bdev_nvme_create().
Add public function which could be used by rpc method.

Change-Id: Id9d2938801e0acdf0f9827ef2990a54c75aec22a
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-10-14 01:53:31 +08:00
Ben Walker
18a2cc11c1 env: Remove unused DPDK headers.
Remove #includes for all DPDK headers that weren't
necessary.

Change-Id: Ib02522e0f04e64a1c98afceb7508cc0e8d931a9d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-12 09:53:32 -07:00
Ben Walker
7f5b671db7 env: Convert some rte_mempools to spdk_mempools
This converts some, but not all, usage of rte_mempool
to spdk_mempool. The remaining rte_mempools use features
we elected not to expose through spdk_mempool such as
constructors, so that will need to be revisited.

Change-Id: I6528809a864ab466b8d19431789bf0f976b648b6
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-12 09:53:32 -07:00
Jim Harris
81b3d6c9fc Revert "bdev: enable IO vector operations"
This reverts commit 422eab7106.
2016-10-11 15:52:10 -07:00
Ben Walker
2224ff2162 env: Replace rte_malloc with spdk_zmalloc
Use the env library to perform all memory allocations
that previously called DPDK directly.

Change-Id: I6d33e85bde99796e0c85277d6d4880521c34f10d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-11 13:34:09 -07:00
Pawel Wodkowski
422eab7106 bdev: enable IO vector operations
This patch enables vector operation for bdev drivers aio, malloc and
nvme.
The rbd driver still handle only one vector.

Change-Id: I5f401527c2717011ecc21116363bbb722e804112
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
2016-10-11 12:17:47 -07:00
Ben Walker
0dd80395f3 env: Move pci.c from util to env
This allows users to swap their PCI library from
libpciaccess/dpdk to another mechanism using the standard
method for swapping out the env library.

Change-Id: Ib2248f8b43754a540de2ec01897e571f0302b667
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-05 11:53:24 -07:00
Ben Walker
a4747c6048 env: Make the environment library configurable.
This allows users to swap out SPDK's third party
libraries for an implementation based on their own
framework.

Change-Id: Ia0b7384ce5e31acba5ad0d7002dec9e95b759c52
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-05 11:51:37 -07:00
Ben Walker
6b1e4e732d Drop libpciaccess and switch to DPDK PCI
This patch also drops support for automatically unbinding
devices from the kernel - run scripts/setup.sh first.

Our generic pci interface is now hidden behind include/spdk/pci.h
and implemented in lib/util/pci.c. We no longer wrap the calls
in nvme_impl.h or ioat_impl.h. The implementation now only uses
DPDK and the libpciaccess dependency has been removed. If using
a version of DPDK earlier than 16.07, enumerating devices
by class code isn't available and only Intel SSDs will be
discovered. DPDK 16.07 adds enumeration by class code and all
NVMe devices will be correctly discovered.

Change-Id: I0e8bac36b5ca57df604a2b310c47342c67dc9f3c
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-04 15:59:00 -07:00
Ben Walker
f4140ad023 nvme: Change the deallocate interface to generic dsm
Provide a convenience wrapper for general purpose dataset
management commands. The previous wrapper for deallocate
was difficult to use correctly and only for deallocate.

Note that the name is "dataset_management" as opposed to
"data_set_management" to match the NVMe specification.
It's questionable whether "dataset" is valid English, but
it is best to match the specification.

Change-Id: Ifc03d66dbabeabe8146968cf8a09f7ac3446ad68
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-04 14:36:09 -07:00
Daniel Verkamp
d5dffc0596 bdev: replace off_t offsets with uint64_t
off_t is problematic for use as a file/block offset: it is signed, and
on 32-bit platforms, it can be 32 bits (depending on the settings of
_FILE_OFFSET_BITS and _LARGEFILE_SOURCE).

The blockdev layer already uses uint64_t to represent offsets; replace
the blockdev module uses of off_t in internal functions with uint64_t
to match.

Change-Id: I77a2e594572c56f1cd8a7a080f985ea5b27c35f3
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-29 13:13:32 -07:00
Ben Walker
b0e349a804 nvme: Use log library instead of nvme_printf
Change-Id: Ic9b2db9bff3a914b3e5021695287157f1e076f9f
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-09-28 10:15:55 -07:00
Jim Harris
32aa4fa0a3 util: add context parameter for unique I/O channels
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I296992b2e03b9b516cfd26726405e49616ad08a5
2016-09-28 07:53:47 -07:00
Jim Harris
c1e3a87bf7 util: add 'unique' parameter to spdk_get_io_channel
Some subsystems may wish to create unique I/O channels
which are not shared across all users of the same I/O
device on the same thread.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I3ade3675d57338cf85b6a301285e6f392bd6cd2e
2016-09-28 07:53:47 -07:00
GangCao
372942e569 nvme: move global request_mempool allocation into nvme_impl
The user no longer needs to create the request pool.

Change-Id: I83bb8948143d4cc961d232f9f30df3106d5e0eab
Signed-off-by: GangCao <gang.cao@intel.com>
2016-09-27 14:25:39 -07:00
Jim Harris
0babf8ce81 bdev, copy: move all I/O paths to use I/O channels
bdev and copy modules no longer have check_io functions
now - all polling is done via pollers registered when
I/O channels are created.

Other default resources are also removed - for example,
a qpair is no longer allocated and assigned per bdev
exposed by the nvme driver - the qpairs are only allocated
via I/O channels.  Similar principle also applies to the
aio driver.

ioat channels are no longer allocated and assigned to
lcores - they are dynamically allocated and assigned
to I/O channels when needed.  If no ioat channel is
available for an I/O channel, the copy engine framework
will revert to using memcpy/memset instead.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I99435a75fe792a2b91ab08f25962dfd407d6402f
2016-09-26 14:02:07 -07:00
Jim Harris
746a54bef8 bdev: create new get_channel/put_channel function pointers
Also implement these functions for all of the bdev drivers in
the tree.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Idea97743d601150044b1fe2d9d76e922d46d3ee1
2016-09-26 14:02:07 -07:00
Jim Harris
2029c9faf9 bdev_nvme: pass nvme_qpair to nvme_queue_cmd()
This enables some future changes which will use per-thread
nvme_qpairs.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I1efcacfa6aedc970656633c9ce1393dc9b4fdbcc
2016-09-22 09:12:36 -07:00
Daniel Verkamp
7bdba4437d bdev: make fn_table a const pointer
The table of bdev function pointers should not need to be modified at
runtime.

Change-Id: I3e8876fc83df9296ce528231269b1a905c96072c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-02 09:30:28 -07:00
Daniel Verkamp
efa06a2bab bdev: remove free_request bdev backend function
This callback was only used for freeing buffers, but the buffers are now
managed by the bdev core, so none of the free_request callbacks actually
do anything.

Change-Id: Icfe2e6169e829159dda5e3d75a27d8f040de07c6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-02 09:29:32 -07:00
Daniel Verkamp
46a52cee67 bdev: drop "iSCSI" from blockdev name strings
The bdev layer can be used independently of iSCSI, so fix the
misleading names.

Change-Id: I3fd5b113403acdd7578ce93234dde0fd4f148e96
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-30 10:19:48 -07:00
Ben Walker
6e09a48e42 bdev: Separate the module header from the public header
Bdev modules need a separate interface than public
consumers of the blockdevs.

Change-Id: I581ee493570c114f7e96b31a425bc077a791c71e
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-08-26 09:40:06 -07:00
Daniel Verkamp
9272088d93 bdev: add API to query supported I/O types
Some block devices do not support the unmap operation, and we may add
other optional I/O types in the future.  Add a method to check which I/O
types a specific block device supports.

Change-Id: I6e6414bf6b6482ea0224022d8326b252bd363c7f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-26 09:16:36 -07:00
Daniel Verkamp
d2ea70cafd iscsi: use spdk/endian.h functions
Switch from the non-portable <sys/endian.h> functions (htobeXX/beXXtoh)
to the SPDK endian conversion functions.

Change-Id: Id49b87f2e536c68f0d5d567e78e1990c0a37ef14
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-25 13:29:56 -07:00
Daniel Verkamp
861e78bf48 bdev: add block device abstraction layer
Change-Id: I235cf146a52714756c9782c03b118f518c5f5182
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-21 10:35:03 -07:00