diff options
author | Mike Christie <michael.christie@oracle.com> | 2023-09-28 04:09:01 +0200 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2023-10-13 21:53:57 +0200 |
commit | 194605d45dcb511983caca699d81855693b25fe0 (patch) | |
tree | b206b2ad791b746ca4ecc0de2eec8956d7916f27 /include/target | |
parent | scsi: target: iscs: Make write_pending_must_be_called a bit field (diff) | |
download | linux-194605d45dcb511983caca699d81855693b25fe0.tar.xz linux-194605d45dcb511983caca699d81855693b25fe0.zip |
scsi: target: Have drivers report if they support direct submissions
In some cases, like with multiple LUN targets or where the target has to
respond to transport level requests from the receiving context it can be
better to defer cmd submission to a helper thread. If the backend driver
blocks on something like request/tag allocation it can block the entire
target submission path and other LUs and transport IO on that session.
In other cases like single LUN targets with storage that can support all
the commands that the target can queue, then it's best to submit the cmd
to the backend from the target's cmd receiving context.
Subsequent commits will allow the user to config what they prefer, but
drivers like loop can't directly submit because they can be called from a
context that can't sleep. And, drivers like vhost-scsi can support direct
submission, but need to keep their default behavior of deferring execution
to avoid possible regressions where the backend can block.
Make the drivers tell LIO core if they support direct submissions and their
current default, so we can prevent users from misconfiguring the system and
initialize devices correctly.
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Link: https://lore.kernel.org/r/20230928020907.5730-2-michael.christie@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'include/target')
-rw-r--r-- | include/target/target_core_base.h | 9 | ||||
-rw-r--r-- | include/target/target_core_fabric.h | 9 |
2 files changed, 18 insertions, 0 deletions
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 159567359bbb..401abdf8a9ef 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -108,6 +108,15 @@ #define SE_MODE_PAGE_BUF 512 #define SE_SENSE_BUF 96 +enum target_submit_type { + /* Use the fabric driver's default submission type */ + TARGET_FABRIC_DEFAULT_SUBMIT, + /* Submit from the calling context */ + TARGET_DIRECT_SUBMIT, + /* Defer submission to the LIO workqueue */ + TARGET_QUEUE_SUBMIT, +}; + /* struct se_hba->hba_flags */ enum hba_flags_table { HBA_FLAGS_INTERNAL_USE = 0x01, diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 2a6c4c935666..dcd7d76d2f30 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -118,6 +118,15 @@ struct target_core_fabric_ops { * its entirety before a command is aborted. */ unsigned int write_pending_must_be_called:1; + /* + * Set this if the driver supports submitting commands to the backend + * from target_submit/target_submit_cmd. + */ + unsigned int direct_submit_supp:1; + /* + * Set this to a target_submit_type value. + */ + u8 default_submit_type; }; int target_register_template(const struct target_core_fabric_ops *fo); |