Skip to content

Commit 194605d

Browse files
mikechristiemartinkpetersen
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 40ddd6d commit 194605d

File tree

13 files changed

+55
-0
lines changed

13 files changed

+55
-0
lines changed

drivers/infiniband/ulp/srpt/ib_srpt.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3867,6 +3867,9 @@ static const struct target_core_fabric_ops srpt_template = {
38673867
.tfc_discovery_attrs = srpt_da_attrs,
38683868
.tfc_wwn_attrs = srpt_wwn_attrs,
38693869
.tfc_tpg_attrib_attrs = srpt_tpg_attrib_attrs,
3870+
3871+
.default_submit_type = TARGET_DIRECT_SUBMIT,
3872+
.direct_submit_supp = 1,
38703873
};
38713874

38723875
/**

drivers/scsi/elx/efct/efct_lio.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,6 +1611,8 @@ static const struct target_core_fabric_ops efct_lio_ops = {
16111611
.sess_get_initiator_sid = NULL,
16121612
.tfc_tpg_base_attrs = efct_lio_tpg_attrs,
16131613
.tfc_tpg_attrib_attrs = efct_lio_tpg_attrib_attrs,
1614+
.default_submit_type = TARGET_DIRECT_SUBMIT,
1615+
.direct_submit_supp = 1,
16141616
};
16151617

16161618
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 = {
16461648
.sess_get_initiator_sid = NULL,
16471649
.tfc_tpg_base_attrs = efct_lio_npiv_tpg_attrs,
16481650
.tfc_tpg_attrib_attrs = efct_lio_npiv_tpg_attrib_attrs,
1651+
1652+
.default_submit_type = TARGET_DIRECT_SUBMIT,
1653+
.direct_submit_supp = 1,
16491654
};
16501655

16511656
int efct_scsi_tgt_driver_init(void)

drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3975,6 +3975,9 @@ static const struct target_core_fabric_ops ibmvscsis_ops = {
39753975
.fabric_drop_tpg = ibmvscsis_drop_tpg,
39763976

39773977
.tfc_wwn_attrs = ibmvscsis_wwn_attrs,
3978+
3979+
.default_submit_type = TARGET_DIRECT_SUBMIT,
3980+
.direct_submit_supp = 1,
39783981
};
39793982

39803983
static void ibmvscsis_dev_release(struct device *dev) {};

drivers/scsi/qla2xxx/tcm_qla2xxx.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,6 +1822,9 @@ static const struct target_core_fabric_ops tcm_qla2xxx_ops = {
18221822
.tfc_wwn_attrs = tcm_qla2xxx_wwn_attrs,
18231823
.tfc_tpg_base_attrs = tcm_qla2xxx_tpg_attrs,
18241824
.tfc_tpg_attrib_attrs = tcm_qla2xxx_tpg_attrib_attrs,
1825+
1826+
.default_submit_type = TARGET_DIRECT_SUBMIT,
1827+
.direct_submit_supp = 1,
18251828
};
18261829

18271830
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 = {
18591862
.fabric_init_nodeacl = tcm_qla2xxx_init_nodeacl,
18601863

18611864
.tfc_wwn_attrs = tcm_qla2xxx_wwn_attrs,
1865+
1866+
.default_submit_type = TARGET_DIRECT_SUBMIT,
1867+
.direct_submit_supp = 1,
18621868
};
18631869

18641870
static int tcm_qla2xxx_register_configfs(void)

drivers/target/iscsi/iscsi_target_configfs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,4 +1590,7 @@ const struct target_core_fabric_ops iscsi_ops = {
15901590
.tfc_tpg_nacl_param_attrs = lio_target_nacl_param_attrs,
15911591

15921592
.write_pending_must_be_called = 1,
1593+
1594+
.default_submit_type = TARGET_DIRECT_SUBMIT,
1595+
.direct_submit_supp = 1,
15931596
};

drivers/target/loopback/tcm_loop.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,6 +1102,8 @@ static const struct target_core_fabric_ops loop_ops = {
11021102
.tfc_wwn_attrs = tcm_loop_wwn_attrs,
11031103
.tfc_tpg_base_attrs = tcm_loop_tpg_attrs,
11041104
.tfc_tpg_attrib_attrs = tcm_loop_tpg_attrib_attrs,
1105+
.default_submit_type = TARGET_QUEUE_SUBMIT,
1106+
.direct_submit_supp = 0,
11051107
};
11061108

11071109
static int __init tcm_loop_fabric_init(void)

drivers/target/sbp/sbp_target.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2278,6 +2278,9 @@ static const struct target_core_fabric_ops sbp_ops = {
22782278
.tfc_wwn_attrs = sbp_wwn_attrs,
22792279
.tfc_tpg_base_attrs = sbp_tpg_base_attrs,
22802280
.tfc_tpg_attrib_attrs = sbp_tpg_attrib_attrs,
2281+
2282+
.default_submit_type = TARGET_DIRECT_SUBMIT,
2283+
.direct_submit_supp = 1,
22812284
};
22822285

22832286
static int __init sbp_init(void)

drivers/target/tcm_fc/tfc_conf.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,9 @@ static const struct target_core_fabric_ops ft_fabric_ops = {
432432

433433
.tfc_wwn_attrs = ft_wwn_attrs,
434434
.tfc_tpg_nacl_base_attrs = ft_nacl_base_attrs,
435+
436+
.default_submit_type = TARGET_DIRECT_SUBMIT,
437+
.direct_submit_supp = 1,
435438
};
436439

437440
static struct notifier_block ft_notifier = {

drivers/usb/gadget/function/f_tcm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,6 +1687,9 @@ static const struct target_core_fabric_ops usbg_ops = {
16871687

16881688
.tfc_wwn_attrs = usbg_wwn_attrs,
16891689
.tfc_tpg_base_attrs = usbg_base_attrs,
1690+
1691+
.default_submit_type = TARGET_DIRECT_SUBMIT,
1692+
.direct_submit_supp = 1,
16901693
};
16911694

16921695
/* Start gadget.c code */

drivers/vhost/scsi.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2598,6 +2598,9 @@ static const struct target_core_fabric_ops vhost_scsi_ops = {
25982598
.tfc_wwn_attrs = vhost_scsi_wwn_attrs,
25992599
.tfc_tpg_base_attrs = vhost_scsi_tpg_attrs,
26002600
.tfc_tpg_attrib_attrs = vhost_scsi_tpg_attrib_attrs,
2601+
2602+
.default_submit_type = TARGET_QUEUE_SUBMIT,
2603+
.direct_submit_supp = 1,
26012604
};
26022605

26032606
static int __init vhost_scsi_init(void)

0 commit comments

Comments
 (0)