This is necessary to avoid failing very large write_zeroes operations.
This is the minimal workaround to get the current bdevio tests to pass -
the real fix will be implemented in the bdev layer later.
Change-Id: I4e49f1b4da5d4c7f9507757d6c71ba3880d22437
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/383306
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
The SCSI spec defines two separate fields within the first byte of
the Inquiry data. Define them as bitfields and add enum values for the
peripheral qualifier field.
Change-Id: Ibbb158338da199fc1b67b04c52ec91633577c571
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382713
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Current implementation supports only adding port to scsi_dev.
This change is required to support dynamic remapping of portals.
Change-Id: Idce49aeae43c8861ebe2807df853694f7bacf884
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/379931
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Closing the framework has to go through all subsystems
without failure, so return codes are unnecessary.
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I53c9b4df12d2357e641130869f398b18637e6ff7
Reviewed-on: https://review.gerrithub.io/381681
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
When constructing a SCSI device, LUN 0 must be assigned to some LUN.
However, the current code was assuming that LUN 0 had to be in the first
array element of lun_id_list in spdk_scsi_dev_construct(). Combined
with the scripts/rpc.py implementation that uses a Python (unordered)
dictionary object to generate the lun_ids array, there could be cases
where LUN 0 exists in the list but isn't first.
Fix the check by allowing LUN 0 in any position of the lun_id_list
array.
Change-Id: I39f387ec238fcecca8d2d786d3d42c42a4790637
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/381611
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
This reverts commit d3828a23ec.
GitHub issue #202 reports that this causes a crash with two or more
iSCSI connections on the same LUN.
Change-Id: I9ffb85d393eb506aac9d176299a3b3bcf021a38c
Reviewed-on: https://review.gerrithub.io/379866
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
spdk_bdev_get_io_channel() already handles this.
Change-Id: I6b28fe10b86b00762ff15324fcd0a32aae94e012
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/376267
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Replace SPDK_TRACE_DEBUG with component-specific flags.
Change-Id: Iee7eafab5e6ac8713f247323a18552b5afb0e86a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/375834
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This matches the name to the behavior and prepares for addition of a new
log macro for "info" log level.
Change-Id: I94ccd49face4309d3368e399528776ab140748c4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/375833
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
The SCSI spec says that zero transfer length shouldn't be considered an
error.
Change-Id: I98958cc393e0e487e25fdbb0eb7fc8126aff9945
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/374320
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
We report SPDK_WORK_BLOCK_SIZE (1 MiB) as the Maximum Transfer Length in
the Block Limits VPD. The initiator should not submit a request larger
than this; if it does, fail the request.
Change-Id: I39575cdca4555ac1f78e055a48569be3f47e4781
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/373162
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
None of these make sense as global parameters - they're
all only configurable per-disk. This is a large simplification
and removes the SCSI library's dependency on the config
file entirely.
Change-Id: I1236158a23fa49e437938c51022b13772e404561
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/371598
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This is far simpler, although it does limit the bdev
layer to unmapped just one range per command. In practice,
all of our code reports limits of just one range per command
anyway.
Change-Id: I99247ab349fe85b9925769e965833b06708d0d70
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/370382
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This enables checking permissions - for example,
spdk_bdev_write will fail if the descriptor was not
created with write permissions.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I68b65a560f471f2e0f71a7f42cfa6689b911110f
Reviewed-on: https://review.gerrithub.io/369493
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This includes file names, functions, #defines, etc.
There are still a few uses of "blockdev" outside of
include/ and lib/ - these can be handled later.
This preps for a future patch to consolidate vbdev
modules and bdev modules into just bdev modules.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I70e575709ae1b0a116b08515fd38ae793de05377
Reviewed-on: https://review.gerrithub.io/369325
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This variable was misleading and unnecessary. Replaced all it's
occurences with SPDK_SCSI_DEV_MAX_LUN.
Change-Id: Iaaf9ed5efb60f9a89585121d2fbec7b43c3723e9
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/368115
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
lun_id could potentially overflow the dev->lun array bounds if it was
equal to dev->maxlun, which is actually the maximum lun array index plus
one, not the maximum valid LUN index.
Change-Id: I5662c6f6fa634a7dd755c9bfc1a24d3c4cabe7ea
Reported-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/369074
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This will enable asynchronous request handling in a future patch, and it
also removes the need for the RPC handlers to know about request id and
the JSON-RPC rules about notification-only requests.
Change-Id: I25aaa8e48bff8d5594ffcccecb61842b1e31ec3c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/368225
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Retire the old claim/unclaim semantics in favor of
open/close. Clients must now open a bdev to get
an spdk_bdev_desc, then pass this desc to get an
I/O channel.
This allows multiple clients to open a bdev,
although only one may open a bdev with write
access.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I4d319f1278170124169a8a75fd791e926b3f7171
Reviewed-on: https://review.gerrithub.io/367611
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Added new function in preparation to implementing device hotremove.
Change-Id: I5b85f76f543b882acf3b0fe40c9e92125594b257
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/366725
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Added optional callback inside scsi lun hotremove, so that higher-level
abstraction can be notified about hotremove.
Change-Id: I5f1bd8160e3d770a484068dd73928bc2b64c876f
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/367309
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This is an artifact from a past design. There is no longer
any reason to create an event here - the bdev layer will
correctly queue events and call completions on the correct
thread.
Change-Id: I145dab4046899834c0449ec7380dcbb28215b493
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/364831
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This removes the event framework dependency from the
scsi library entirely.
Change-Id: I73546d06721487f86c4c6a3be24474a5677bdb41
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/365728
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This separates the scsi library from the event framework's
subsystem mechanism.
Change-Id: Iac2bbdb861e28ee9af0f13bc7187ac24279d0f5b
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/365284
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
It is not actually useful to be immediately returned
a handle to the bdev_io. There isn't anything valid
that the user can do with it at that point. Instead,
return an integer error code.
Change-Id: Iffa9a8dc5b2eefab57e3cc1f68919985431d17d1
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/364137
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Resets were not correctly aborting all I/O.
Change-Id: I03fd5f7094b3aa53f070eb731c30e5f9bfbfea16
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/363626
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Mark the intentional switch/case fallthrough locations with comments
recognized by -Wimplicit-fallthrough=4 in GCC 7.
Change-Id: Ibf2b077d9432e7f23a3833f98edd4768e5e8cfe9
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/363490
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
There is now just one type of reset, which is equivalent
to a HARD reset previously.
Change-Id: I955b219cbc5c25793d97de1cc003b30ae99313ac
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/362615
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This patch adds property of transport protocol id to spdk_scsi_dev.
This allows to change it depending on which appliation is using
the device. Previously only iSCSI was used for all.
Setting protocol id is done at the time when device is added to
vhost controller (vhost) or target node (iSCSI).
Please note that for SPDK vhost SAS protocol id is used,
as that is what kernel vhost reports as well.
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I455a856c5d7796a749b6650fee0218d526e094ed
Reviewed-on: https://review.gerrithub.io/362864
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
The next patch will make bdev modules init
in the async manner.
Change-Id: I4909c80510d786daf54003b99a5925428cf37373
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/362110
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
- rename spdk_malloc_socket to spdk_dma_malloc_socket
- rename spdk_malloc to spdk_dma_malloc
- rename spdk_zmalloc to spdk_dma_zmalloc
- rename spdk_realloc to spdk_dma_realloc
- rename spdk_free to spdk_dma_free
Change-Id: I52a11b7a4243281f9c56f503e826fd7c4a1fd883
Signed-off-by: John Meneghini <johnm@netapp.com>
Reviewed-on: https://review.gerrithub.io/362604
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This wasn't used anywhere and we currently believe there
are superior software-only techniques for controlling
quality of service.
Change-Id: Icdadd5870ed0629b338c307d2619bbc242c3e7a3
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/362065
Reviewed-by: Jim Harris <james.r.harris@intel.com>
NAA locally assinged designator(3h) format was defined in SPC4,
as SPDK claimed can only support SPC3, so we used NAA IEEE
extended identifier format instead.
Change-Id: Ia4c153263c6b89ae8160488deaf16fd0e5cac8dc
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/361904
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This ensures that all spdk_bdev_io structures now have
an attached channel, simplifying some future work around
things like counting the number of outstanding IOs for
a given channel (which otherwise would have had to
account specially for resets).
Reset semantics are still that they affect the entire bdev
and not just the channel it was submitted on.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I8aad21a88faacecfd94bdba350059528eb62c390
Reviewed-on: https://review.gerrithub.io/362251
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
1) Consolidate the checks for a null LUN
2) Eliminate a bunch of static functions that are no
longer needed due to #1
This prepares for some upcoming bdev reset changes.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I38475581b69ba4a034fc7b9e133cfcdfc535a5d3
Reviewed-on: https://review.gerrithub.io/362262
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
The user should not see the bdev_io status directly; the NVMe and SCSI
error code wrappers provide the ability to translate to the desired
format regardless of what kind of error is stored inside the bdev_io.
Replace the spdk_bdev_io_completion_cb status parameter with a bool
simply indiciating whether the I/O completed successfully.
Change-Id: Iad18c2dac4374112c41b7a656154ed3ae1a68569
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/362047
Tested-by: <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Specify the function as a parameter to spdk_scsi_dev_queue_mgmt_task.
This makes the API clearer by making it explicit that the management
function is required for management tasks.
Change-Id: I92d893aadb6faebea81dd79729894d2c2fddf088
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
The type of a task is known due to the function used to submit it:
- spdk_scsi_dev_queue_task() for normal SCSI command tasks
- spdk_scsi_dev_queue_mgmt_task() for management tasks
Change-Id: I183a1f89ab85f3fce1de2491e77d95d4b147fd72
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
The SCSI read and write functions use the same LBA range check, so move
it up to spdk_bdev_scsi_readwrite().
spdk_bdev_scsi_read() previously passed task->transfer_len / blen rather
than xfer_len to the LBA range checking function, but this should
actually be using the transfer length field from the CDB (which is the
xfer_len parameter).
Change-Id: I8285abf936a18a0baf7cc25709945637e4e6b87d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Factor out the common data direction Check Condition logic from read
and write.
Change-Id: Ia2fbd5f69eefd826ebb5ab2a8e99aeb380f1b7ea
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
What was previously called "maxlba" was actually the block count
of the device, which is the maximum LBA plus one.
Change-Id: I5e141a3eb0c79b2aa70006739c5586cb50744d3d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
The SCSI library already provides a callback when the task is released
(free_fn), so the user can update their own task counter.
Change-Id: I7fb13f6fff66dbba2315fd03fb06e49f793be123
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
The task free callback function is required, so make its assignment part
of task construction.
Change-Id: I2f5fdf73b064653ee85b4e7961cb1653a0a4107d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>