Commit Graph

45 Commits

Author SHA1 Message Date
Cunyin Chang
b7349216b9 nvme: optimization for nvme probe and detachment.
remove the unnecessary rte_eal_pci_probe_one() in function
spdk_pci_device_detach(), this could cause error message when we
terminate the application, it will also not make sense try to probe one
device after we detach it, we could call spdk_pci_nvme_device_attach()
instead of spdk_pci_nvme_enumerate() when we have one given device address,
dpdk will try to scan the device and add it back to pci device list then.

Change-Id: I35f5bb412249bb20da57394f0531c10a49691906
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2017-03-15 09:00:25 -07:00
Daniel Verkamp
ee2eda24bc env/vtophys: allow registration of >2MB regions
Change-Id: I4f005ce979a94b07bbaa109795ce0f6708b7fb8c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-10 11:39:28 -07:00
Daniel Verkamp
93982c19bb env/vtophys: expose mem map in public API
Change-Id: I2e96b295fa3943e004e424250c4734e8da9fb796
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-10 11:39:28 -07:00
Daniel Verkamp
2f10ea11db env_dpdk: only set proc-type and base-virtaddr for multiprocess
These options are only necessary for applications that intend to be used
in a multi-process configuration.

Change-Id: I3e1fa0682611d92267d0ad1b3f2016dc926b96b6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-08 16:35:34 -07:00
Daniel Verkamp
b58a5d73ef util: add SPDK_COUNTOF() array size macro
SPDK_COUNTOF works like sizeof, except it returns the number of elements
in an array instead of the number of bytes.

Change-Id: I38ff4dd3485ed9b630cc5660ff84851d0031911f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-07 12:43:42 -07:00
Jim Harris
16bbcb3f36 env: register PMDs on associated first probe
This avoids registering PMDs that are not used by a given
application.  For example, an app may wish to *not* use
ioat - in this case, ioat PMD would not be registered with
DPDK, and we would not waste time probing these devices
when probing other devices like NVMe.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: If378e40bde9057c7808603aa1918bcfe80fa0e9d
2017-03-06 12:44:34 -07:00
Daniel Verkamp
4055a502ea vtophys: add function to dynamically allocate maps
Change-Id: I335a8712416576fecdde96cfb47baf83ea4f15e5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-02 12:29:34 -07:00
Daniel Verkamp
b98eb28d85 vtophys: add default translation to mem map
This will allow returning a different default value per mem map.

Change-Id: I94d3de197acfb2e6ad40092ab0588ba4e951af80
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-02 12:29:34 -07:00
Daniel Verkamp
2c43c9bcca vtophys: begin refactoring into general memory map
Add a top-level structure that can be reused for other kinds of memory
address translations.

Change-Id: I046f98b76b4e98087d90095d6e9dea5cd6ab7898
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-02 12:29:34 -07:00
Daniel Verkamp
007196152f env_dpdk: print DPDK version during initialization
Change-Id: Ib6478c3e54a93f6f4c77c63cef4ab2ff47df2f10
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-01 13:46:51 -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
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
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
Daniel Verkamp
a9133b405a env/vtophys: expand vtophys map value to 64 bits
Split the ref_count field of the bottom level of the vtophys map tree to
a separate array so that the pfn_2mb field can be expanded to a full 64
bits again.  This doesn't change behavior for the current use as a page
frame number; it is setup work for storing an arbitrary 64-bit pointer
value in the bottom level.

Change-Id: I0bc44df3edc9df4a479229d69c2f3884d43a340d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-07 15:13:22 -07:00
Daniel Verkamp
47eec4329e env: add API to get NUMA socket ID of a PCI device
Change-Id: Ic13298752bd5c68e3449d7dc004bd466ef468085
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-31 14:50:18 -07:00
Daniel Verkamp
b809cdd3ab env: add spdk_mempool_create() socket_id parameter
Change-Id: I8ab0bb2c6e1fdf1681fbd049a096c1768e54dc27
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-30 13:05:30 -07:00
Daniel Verkamp
4c55092882 env: add a name for special "any socket ID" value
Change-Id: I1f339ee5ff80eee9cf7d6378daa71e2f59c158b2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-30 13:05:30 -07:00
Daniel Verkamp
aaa87dc00e env_dpdk: allow linking against DPDK shared libs
Detect whether the specified DPDK directory contains static or shared
libraries, and use the appropriate extension when building the library
list. Static libraries are still preferred.

Change-Id: I78c68fd38fba1ea42dd605fb77209651f8cdca75
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-26 10:51:11 -07:00
Daniel Verkamp
bc7b070deb env_dpdk: move system libraries out of ENV_LIBS
The $(ENV_LIBS) variable was including system library linker arguments
like '-ldl', but $(ENV_LIBS) is intended to be used as a dependency for
other Makefile targets, and those arguments don't belong there.

Add the system library linker arguments to ENV_LINKER_ARGS instead.

Change-Id: I247264d287047f1423365806042982b492eec311
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-26 10:51:11 -07:00
Daniel Verkamp
5eacff59cd ioat: add Skylake Xeon device ID
There is only a single device ID for all channels on the SKX
implementation of I/OAT.

Change-Id: I90ee79b1b673a199754f1ca4c9e38e934294e261
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-19 09:39:59 -07:00
Ziye Yang
e1b607d07b ioat: add missing Haswell channel 1 device ID
I do not see any reason to ignore using this channel. If that,
we should give comments in the file, otherwise we need to add it.

Change-Id: I56ad491c67a23831befc8c761ad0a02e721a15a4
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-01-13 10:33:49 -07:00
Ben Walker
9511b2a20b env: Add spdk_pci_get_device
This function will return a device handle from a pci
address.

Change-Id: I323d92c71014ef571f3df9f19c2ec887844707e8
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-12 10:13:16 -07:00
Ben Walker
4caf3c563a env: Add a function to convert pci addr to string
Convert an spdk_pci_addr to a string.

Change-Id: Idab0a16822cc37d7095d19f062dfca65356211e8
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-09 14:39:51 -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
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
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
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
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
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
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
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
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
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
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
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