aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/target/target_core_transport.c48
-rw-r--r--include/target/target_core_fabric.h3
2 files changed, 51 insertions, 0 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index c10c3653eabc..42da7a300729 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -1687,6 +1687,54 @@ void target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess,
1687} 1687}
1688EXPORT_SYMBOL(target_submit_cmd); 1688EXPORT_SYMBOL(target_submit_cmd);
1689 1689
1690/**
1691 * target_submit_tmr - lookup unpacked lun and submit uninitialized se_cmd
1692 * for TMR CDBs
1693 *
1694 * @se_cmd: command descriptor to submit
1695 * @se_sess: associated se_sess for endpoint
1696 * @sense: pointer to SCSI sense buffer
1697 * @unpacked_lun: unpacked LUN to reference for struct se_lun
1698 * @fabric_context: fabric context for TMR req
1699 * @tm_type: Type of TM request
1700 *
1701 * Callable from all contexts.
1702 **/
1703
1704void target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
1705 unsigned char *sense, u32 unpacked_lun,
1706 void *fabric_tmr_ptr, unsigned char tm_type, int flags)
1707{
1708 struct se_portal_group *se_tpg;
1709 int ret;
1710
1711 se_tpg = se_sess->se_tpg;
1712 BUG_ON(!se_tpg);
1713
1714 transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess,
1715 0, DMA_NONE, MSG_SIMPLE_TAG, sense);
1716
1717 /* See target_submit_cmd for commentary */
1718 target_get_sess_cmd(se_sess, se_cmd, (flags & TARGET_SCF_ACK_KREF));
1719
1720 ret = core_tmr_alloc_req(se_cmd, fabric_tmr_ptr, tm_type, GFP_KERNEL);
1721 if (ret < 0) {
1722 dump_stack();
1723 /* FIXME XXX */
1724 return;
1725 }
1726
1727 ret = transport_lookup_tmr_lun(se_cmd, unpacked_lun);
1728 if (ret) {
1729 transport_send_check_condition_and_sense(se_cmd,
1730 se_cmd->scsi_sense_reason, 0);
1731 transport_generic_free_cmd(se_cmd, 0);
1732 return;
1733 }
1734 transport_generic_handle_tmr(se_cmd);
1735}
1736EXPORT_SYMBOL(target_submit_tmr);
1737
1690/* 1738/*
1691 * Used by fabric module frontends defining a TFO->new_cmd_map() caller 1739 * Used by fabric module frontends defining a TFO->new_cmd_map() caller
1692 * to queue up a newly setup se_cmd w/ TRANSPORT_NEW_CMD_MAP in order to 1740 * to queue up a newly setup se_cmd w/ TRANSPORT_NEW_CMD_MAP in order to
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index c5c16efe396d..fcc340698d81 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -116,6 +116,9 @@ int transport_lookup_cmd_lun(struct se_cmd *, u32);
116int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); 116int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *);
117void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, 117void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *,
118 unsigned char *, u32, u32, int, int, int); 118 unsigned char *, u32, u32, int, int, int);
119void target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
120 unsigned char *sense, u32 unpacked_lun,
121 void *fabric_tmr_ptr, unsigned char tm_type, int flags);
119int transport_handle_cdb_direct(struct se_cmd *); 122int transport_handle_cdb_direct(struct se_cmd *);
120int transport_generic_handle_cdb_map(struct se_cmd *); 123int transport_generic_handle_cdb_map(struct se_cmd *);
121int transport_generic_handle_data(struct se_cmd *); 124int transport_generic_handle_data(struct se_cmd *);