Commit Graph

1193 Commits

Author SHA1 Message Date
Liang Yan
e3580da167 test: Use lspci to discover default kernel drivers
Instead of searching /sys for devices and checking which
driver happens to be loaded, use lspci. The lspci tool is
a bit smarter - it knows which driver is loaded now but
also which driver is the default driver the kernel wants
to load for that type of device. It's that default that
we need.

Change-Id: I1dc01ab6eac233e85f42316567bde2f4ed2203c6
Signed-off-by: Liang Yan <liang.z.yan@intel.com>
2016-11-02 16:37:40 -07:00
Daniel Verkamp
dca887b7d8 env: remove spdk_pci_device_get_device_name()
It always returns NULL in the current DPDK env implementation and was
not used outside of a few ioat examples where it is not particularly
informational.

Change-Id: I14b237c33bc25ddebc6b36bfbd6a4edf6762e3ca
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-02 15:58:03 -07:00
Jim Harris
1732eeb4bb env: add spdk_malloc
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ieaca9fdded2231c6d01101b345ac6c9a01608eef
2016-11-02 14:15:15 -07:00
Daniel Verkamp
cc1146a8b5 iscsi: move iSCSI-specific SenseLength into PDU
This removes the 2 bytes of SenseLength from the beginning of the SCSI
sense_data buffer, so now the offsets within sense.data match up to the
expected values from the SCSI spec.

Change-Id: I9188560096a9ec5a8fcf83bec95201521b127494
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-02 14:15:09 -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
1df1c2dc44 porting: minor formatting tweaks
Links are not recognized inside preformatted code backticks, so remove
the formatting from the link to env.h.

The DPDK OS support line makes more sense in the next paragraph, so move
it down.

Change-Id: Ic8781857230b64978a3b30721124dd555b536801
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-02 10:37:29 -07:00
Changpeng Liu
9f860cc4b4 nvme: replace trace log with error log for error conditions
Change-Id: I634573f8d9b5ed05d850960f8c45c10d96fa3a7a
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-11-02 10:31:23 -07:00
Changpeng Liu
f903336eed nvmf: fix the wrong cleanup logic in the RDMA initialization process
Print the error information when the kernel RNIC driver did not load
properly, and fix the cleanup logic for the exceptional exit.

Change-Id: I97a45e73d830280b994818f3defc491bc2b6b020
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-11-02 10:30:39 -07:00
Changpeng Liu
30b5285c4f nvmf: fill Controller ID field according to the specification
As we can support multiple sessions now for each Subsystem, the Host
will use cntlid field to create IO queues, if 2 different Hosts
connected to the same Subsystem, for IO queues' creation process, it
will use cntlid field with 0 for current code logic.

Change-Id: I6fd437892e8eb3146f62f4b211c0baadd70b505e
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-11-02 10:29:45 -07:00
Daniel Verkamp
c4b80ef36e porting: update for new env library API
Change-Id: If0af5f10e1143c7d02b5275f0f9b36a13ec0c312
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-02 09:13:03 -07:00
Daniel Verkamp
e5a7da08c4 etc/nvmf.conf: add [Rpc] section example
nvmf_tgt supports the same RPC option as iscsi_tgt, so copy its [Rpc]
description into the example nvmf.conf.

Change-Id: Ic5e99c70d6fb0713607673d3e78b1c01989e139a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-02 09:12:53 -07:00
Daniel Verkamp
e1baabee4a bdev: add get_bdevs RPC
Add an RPC interface to list all blockdevs and their properties.

Change-Id: I50db730d5eff8cffcbe8fe5df6b3461457e8581e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-02 09:10:54 -07:00
Daniel Verkamp
d921d9ed9f json: add spdk_json_write_[u]int64()
Change-Id: I29c2c8f8546774842adf7e77e7bb550735c6fccc
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-02 09:10:54 -07:00
Daniel Verkamp
3c3824a3d2 nvmf_tgt: add list of libs that need whole-archive
Some of the SPDK libraries only expose constructor functions, so they
would normally be eliminted by the linker.  Add a new list in the
Makefile of libraries that must be linked with --whole-archive (while
still being added to the dependency list for the app).

Change-Id: I7e41a807c945468730fa84f1bdee23dfd6b59358
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-02 09:10:54 -07:00
GangCao
bfc8bc87fb nvme: add the per process admin cpl queue for multi-process case
Change-Id: Ie67e3414db807160092bb10812a586b7230e0a89
Signed-off-by: GangCao <gang.cao@intel.com>
2016-11-01 16:48:21 -07:00
Daniel Verkamp
80f63aad73 copy_engine/ioat: use spdk_pci_addr for whitelist
Change-Id: Ie8f9f4923fcc571ef7d976157ce60e196d01e54d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-01 10:07:30 -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
c01291b215 doc: remove link to nvme_driver_integration page
The NVMe-specific driver integration docs were removed as part of commit
bfdc02ab48 (nvme: Eliminate nvme_impl.h
and use the swappable env lib.), so the link is dead now.

Change-Id: I4210abb6d1ab4bdc2be42cb4f28ccbabafa69176
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-01 09:43:32 -07:00
Daniel Verkamp
03aa3af0e7 nvme_manage: use spdk_pci_addr_compare()
Replace open-coded PCI address retrieval and comparison functions with
the new env.h PCI APIs.

Change-Id: I282a3f8d2e0c7c2cfde7b8a752260dd2bf0cb031
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-01 09:40:36 -07:00
Daniel Verkamp
fd6ebca7a8 nvmf: only save PCI address in direct ctrlr data
The NVMe over Fabrics target was storing the PCI device pointer for each
direct-mode controller, but it only really needs the PCI address, which
is exposed via the get_nvmf_subsystems RPC.

Also update the same code path to use the new spdk_pci_device_get_addr()
function for brevity.

Change-Id: I0708b3331b7c279c1a86f0d7459b5deb40dd7c89
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-01 09:40:36 -07:00
Daniel Verkamp
ed1e7ca2d7 env: add struct spdk_pci_id and getter function
Use the new public PCI ID structure in the NVMe library to replace the
previously private struct pci_id.

Change-Id: I267d343917f60bdae949a824bc0fe67457cbbc0d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-01 09:40:36 -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
7d30f5aa1e bdev/rbd: use consistent block_size name in RPC
Rename the construct_rbd_bdev "size" parameter to block_size so that it
is consistent with other bdev construct RPCs.

Change-Id: I88f8ed35444495ffce9550dc224fbcbd58231787
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-31 13:48:27 -07:00
GangCao
075ba523bd nvme: set the qprio when constructing the qpair
Change-Id: Id5b35c023b975cc07fe721e4749bac6a0c803719
Signed-off-by: GangCao <gang.cao@intel.com>
2016-10-31 13:41:22 -07:00
Daniel Verkamp
91d7bf5d15 test/nvmf: use bdev names from construct_*_bdev
Replace hard-coded list of Malloc0 Malloc1 with dynamically-generated
list based on the names that were returned from the bdev creation RPC
calls.

Change-Id: I2171b650fa540184de0e6dfd6bb5f66611e9c0d8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-31 11:19:24 -07:00
Daniel Verkamp
8d22515b52 rpc.py: trim whitespace before splitting args
Leading and trailing whitespace will otherwise lead to empty array
elements, which are not intended.

Change-Id: Ie7bd5dfce8cb9904090a06491d0bde4905de1e3a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-31 11:19:24 -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
Daniel Verkamp
93de96b412 nvme: add Keep Alive Timeout feature support
Add a field to struct spdk_nvme_ctrlr_opts that allows the user to
specify a keep alive timeout, and add automatic submission of Keep Alive
commands to spdk_nvme_ctrlr_process_admin_completions().

Change-Id: Ib282299a571d8edc59c7933418751bc3a6c98b40
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-31 10:28:55 -07:00
Daniel Verkamp
c56b53a89e json: add flag to format when writing
Specify SPDK_JSON_WRITE_FLAG_FORMATTED when creating a write context to
output more human-readable JSON.

Change-Id: Ie1f0451496aae7e36e4cdb1f05edb4bc4963be17
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-31 10:23:13 -07:00
Daniel Verkamp
fc411e38a0 json: add jsoncat test tool
jsoncat parses the input file using the SPDK JSON parsing library, then
prints it back out using the SPDK JSON writing library.

Change-Id: I6f35533cdb4977306ff50be9a706a783a62cdfc1
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-31 10:23:12 -07:00
Daniel Verkamp
1290f02f78 nvmf/rdma: add event_channel NULL check in fini
If the RDMA transport failed to initialize, g_rdma.event_channel may be
NULL.

Change-Id: I4510ee5893389f244f0fbaa1cd4a182868939b25
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-31 10:15:36 -07:00
Daniel Verkamp
0d8e28a171 calsoft.py: fix error reporting
Report all of the tests that failed (and remove some overly fancy
Python magic that didn't work anyway).

Change-Id: I4ee47e845fe4727c69f84b505ea5ae19a15a9270
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-31 09:35:21 -07:00
Ben Walker
20dc7f7d19 nvmf: For iWARP, register buffers with IBV_ACCESS_REMOTE_WRITE
For iWARP devices, buffers that are intended to be the
target of an RDMA read initiated by the target must additionally
have IBV_ACCESS_REMOTE_WRITE permission. This is because iWARP's
RDMA read path essentially requests the remote side to do
an RDMA write.

This is unfortunate because there is no way to differentiate between
memory that the remote side can do an RDMA write to and memory
that will only be the target of RDMA reads initiated by the
target. There is nothing we can do about this serious deficiency in
the specification, however, so we have to live with it.

Change-Id: I3d2f2814ce0cb1df4e5347296ef371db4d16be21
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-31 08:58:40 -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
Wenbo Wang
c257e5b4ad nvme: add quirk to delay checking device readiness (#56) 2016-10-28 11:26:31 -07:00
Tsuyoshi Uchida
f78bcc4821 iscsi_tgt: modify usage (#55)
- Delete -v and -V from usage because they are not implemented.
- Add -q to usage.
2016-10-27 13:37:13 -07:00
Piotr Pelplinski
a2d0fa5351 spdk: add support for readv and writev in scsi layer
This patch adds support for spdk_bdev_readv in scsi layer.
It also fixes write so that it uses multiple iov's instead of one.
Currently we should use only task->iov (for single vector operation)
or task->iovs (for multiple vector operations).

Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: Ia3b2f6d18fd212b11d7b63b11dc46ec5bbc74788
2016-10-26 04:24:08 -07:00
Daniel Verkamp
563b2caf06 nvme: factor out common tracker abort code
Change-Id: Ib2d4b1783f43884da3006f062ebded6b6fd7523c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-25 10:05:19 -07:00
Wenbo Wang
8bf37ee769 nvme: change nvme_intel.c to nvme_quirks.c
Make the quirks mechanism generic in preparation for quirks for devices
from other vendors.

Change-Id: Ic003b020a38f1b966021db30e3f2bce9cf6a1a0d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-24 17:01:26 -07:00
Piotr Pelplinski
074b6d2430 spdk: remove iobuf from spdk_scsi_task
This patch removes reduntant field in spdk_scsi_task and
fixes all logic to use iov.iov_base

Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: Ie2fa1e2357b6383c118d05aec9206d1c60537d40
2016-10-24 09:11:05 -07:00
Ben Walker
78a018260d test: Clearly denote start/end test in log
This makes it easier to search logs on test
boundaries.

Change-Id: I4500479cb8c8322d5ba73bbefd51e006cbb1e82a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-24 09:10:39 -07:00
Ben Walker
4ebf15eedf iscsi: Use Python to parse output of lspci
Instead of using shell commands, use python to parse the output
of lspci. This is considered more "Pythonic".

Change-Id: I88ef0fe8cbfbcaa9c5d323552a82ef63e46f52cf
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-24 08:29:53 -07:00
Daniel Verkamp
fe3ac8e5c7 rpc: always unregister RPC setup poller
Previously, if spdk_rpc_setup() returned early due to the RPC service
being disabled in the configuration file, it would leave itself
registered as a poller and continue to run for the life of the app.

Change-Id: I0532fe23a732b87d68f83847b2db7627f87e9a1c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-21 15:42:53 -07:00
Ben Walker
f64690d49a nvmf: Handle NICs that don't report RDMA initiator_depth
I believe this is required for NICs to report, but handle
the case where it isn't reported.

Change-Id: I38d10c3590d1df8bb902ab312af0f9e01b9e5032
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-21 09:09:06 -07:00
Ben Walker
a1a085cf6b nvmf: Transports now allocate sessions
This makes it consistent with the way connections and
requests work.

Change-Id: Ifb97499ba72f7dfd02ac54ba1b622726d266262c
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-21 09:09:05 -07:00
Ben Walker
8b487155fa nvmf: Fail when sessions span RNICs
The shared memory pool for a session is associated with
a particular RNIC via the protection domain. New connections
attempting to join a session that came in on a different RNIC
can't use that memory, so must be rejected.

Change-Id: Ibd79fe90566a231f76b7472e5e9b484c3e528454
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-21 09:09:05 -07:00
Ben Walker
349295caf2 nvmf: Rearrange rdma file to match callback order
Rearrange the functions in rdma.c to match the order
of the function pointers in the transport. No other
code changes.

Change-Id: I9dbc68912ecd5dfdf53f20b4807d4116933a3c3a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-21 09:09:05 -07:00
Ben Walker
b0c1149953 nvmf: Replace rdma_reg_* with ibv_reg_mr
Use the lower level registration functions. The RDMA-CM
examples use the ibv_* versions, so who knows if the
rdma_reg_* wrappers are even well tested.

Change-Id: I8e8250ab09a1401e636aebe2fc04a60806f7a827
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-21 09:09:05 -07:00
Daniel Verkamp
bee15d8be0 nvme: move PCIe-specific definitions to nvme_pcie
Add a transport function to get the max data transfer size to break the
dependency on NVME_MAX_XFER_SIZE.

Change-Id: I846d12878bdd8b80903ca1b1b49b3bb8e2be98bb
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-21 09:06:30 -07:00