@@ -3867,6 +3867,9 @@ static const struct target_core_fabric_ops srpt_template = {
.tfc_discovery_attrs = srpt_da_attrs,
.tfc_wwn_attrs = srpt_wwn_attrs,
.tfc_tpg_attrib_attrs = srpt_tpg_attrib_attrs,
+
+ .default_direct_submit = 1,
+ .direct_submit_supp = 1,
};
/**
@@ -1611,6 +1611,8 @@ static const struct target_core_fabric_ops efct_lio_ops = {
.sess_get_initiator_sid = NULL,
.tfc_tpg_base_attrs = efct_lio_tpg_attrs,
.tfc_tpg_attrib_attrs = efct_lio_tpg_attrib_attrs,
+ .default_direct_submit = 1,
+ .direct_submit_supp = 1,
};
static const struct target_core_fabric_ops efct_lio_npiv_ops = {
@@ -1646,6 +1648,9 @@ static const struct target_core_fabric_ops efct_lio_npiv_ops = {
.sess_get_initiator_sid = NULL,
.tfc_tpg_base_attrs = efct_lio_npiv_tpg_attrs,
.tfc_tpg_attrib_attrs = efct_lio_npiv_tpg_attrib_attrs,
+
+ .default_direct_submit = 1,
+ .direct_submit_supp = 1,
};
int efct_scsi_tgt_driver_init(void)
@@ -3975,6 +3975,9 @@ static const struct target_core_fabric_ops ibmvscsis_ops = {
.fabric_drop_tpg = ibmvscsis_drop_tpg,
.tfc_wwn_attrs = ibmvscsis_wwn_attrs,
+
+ .default_direct_submit = 1,
+ .direct_submit_supp = 1,
};
static void ibmvscsis_dev_release(struct device *dev) {};
@@ -1822,6 +1822,9 @@ static const struct target_core_fabric_ops tcm_qla2xxx_ops = {
.tfc_wwn_attrs = tcm_qla2xxx_wwn_attrs,
.tfc_tpg_base_attrs = tcm_qla2xxx_tpg_attrs,
.tfc_tpg_attrib_attrs = tcm_qla2xxx_tpg_attrib_attrs,
+
+ .default_direct_submit = 1,
+ .direct_submit_supp = 1,
};
static const struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = {
@@ -1859,6 +1862,9 @@ static const struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = {
.fabric_init_nodeacl = tcm_qla2xxx_init_nodeacl,
.tfc_wwn_attrs = tcm_qla2xxx_wwn_attrs,
+
+ .default_direct_submit = 1,
+ .direct_submit_supp = 1,
};
static int tcm_qla2xxx_register_configfs(void)
@@ -1102,6 +1102,7 @@ static const struct target_core_fabric_ops loop_ops = {
.tfc_wwn_attrs = tcm_loop_wwn_attrs,
.tfc_tpg_base_attrs = tcm_loop_tpg_attrs,
.tfc_tpg_attrib_attrs = tcm_loop_tpg_attrib_attrs,
+ .direct_submit_supp = 0,
};
static int __init tcm_loop_fabric_init(void)
@@ -2278,6 +2278,9 @@ static const struct target_core_fabric_ops sbp_ops = {
.tfc_wwn_attrs = sbp_wwn_attrs,
.tfc_tpg_base_attrs = sbp_tpg_base_attrs,
.tfc_tpg_attrib_attrs = sbp_tpg_attrib_attrs,
+
+ .default_direct_submit = 1,
+ .direct_submit_supp = 1,
};
static int __init sbp_init(void)
@@ -432,6 +432,9 @@ static const struct target_core_fabric_ops ft_fabric_ops = {
.tfc_wwn_attrs = ft_wwn_attrs,
.tfc_tpg_nacl_base_attrs = ft_nacl_base_attrs,
+
+ .default_direct_submit = 1,
+ .direct_submit_supp = 1,
};
static struct notifier_block ft_notifier = {
@@ -1687,6 +1687,9 @@ static const struct target_core_fabric_ops usbg_ops = {
.tfc_wwn_attrs = usbg_wwn_attrs,
.tfc_tpg_base_attrs = usbg_base_attrs,
+
+ .default_direct_submit = 1,
+ .direct_submit_supp = 1,
};
/* Start gadget.c code */
@@ -2461,6 +2461,9 @@ static const struct target_core_fabric_ops vhost_scsi_ops = {
.tfc_wwn_attrs = vhost_scsi_wwn_attrs,
.tfc_tpg_base_attrs = vhost_scsi_tpg_attrs,
.tfc_tpg_attrib_attrs = vhost_scsi_tpg_attrib_attrs,
+
+ .default_direct_submit = 0,
+ .direct_submit_supp = 1,
};
static int __init vhost_scsi_init(void)
@@ -1832,6 +1832,9 @@ static const struct target_core_fabric_ops scsiback_ops = {
.tfc_wwn_attrs = scsiback_wwn_attrs,
.tfc_tpg_base_attrs = scsiback_tpg_attrs,
.tfc_tpg_param_attrs = scsiback_param_attrs,
+
+ .default_direct_submit = 1,
+ .direct_submit_supp = 1,
};
static const struct xenbus_device_id scsiback_ids[] = {
@@ -118,6 +118,16 @@ 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 if the driver wants to default to directly submitting
+ * commands.
+ */
+ unsigned int default_direct_submit:1;
};
int target_register_template(const struct target_core_fabric_ops *fo);
In some cases, like with multiple LUN targets, it can be better to defer the cmd submission to a helper thread, because if the backend driver blocks on something like request/tag allocation it can block the entire submission path for all LUNs. In other cases like single LUN targets with fast 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 recv context. The next patch 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 perf regressions for the multiple LUN case. This patch has the drivers tell LIO core if they support direct submissions and their current default, so in the next patch we can prevent users from misconfiguring the system and initialize devices correctly. Signed-off-by: Mike Christie <michael.christie@oracle.com> --- drivers/infiniband/ulp/srpt/ib_srpt.c | 3 +++ drivers/scsi/elx/efct/efct_lio.c | 5 +++++ drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 3 +++ drivers/scsi/qla2xxx/tcm_qla2xxx.c | 6 ++++++ drivers/target/loopback/tcm_loop.c | 1 + drivers/target/sbp/sbp_target.c | 3 +++ drivers/target/tcm_fc/tfc_conf.c | 3 +++ drivers/usb/gadget/function/f_tcm.c | 3 +++ drivers/vhost/scsi.c | 3 +++ drivers/xen/xen-scsiback.c | 3 +++ include/target/target_core_fabric.h | 10 ++++++++++ 11 files changed, 43 insertions(+)