Skip to content

Commit 0fa50a8

Browse files
mikechristiemartinkpetersen
authored andcommitted
scsi: target: core: Remove target_submit_cmd_map_sgls()
Convert target_submit_cmd() to do its own calls and then remove target_submit_cmd_map_sgls() since no one uses it. Link: https://lore.kernel.org/r/20210227170006.5077-15-michael.christie@oracle.com Tested-by: Laurence Oberman <loberman@redhat.com> Reviewed-by: Bodo Stroesser <bostroesser@gmail.com> Signed-off-by: Mike Christie <michael.christie@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 47edc84 commit 0fa50a8

2 files changed

Lines changed: 18 additions & 64 deletions

File tree

‎drivers/target/target_core_transport.c‎

Lines changed: 17 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,8 +1754,7 @@ void target_submit(struct se_cmd *se_cmd)
17541754
EXPORT_SYMBOL_GPL(target_submit);
17551755

17561756
/**
1757-
* target_submit_cmd_map_sgls - lookup unpacked lun and submit uninitialized
1758-
* se_cmd + use pre-allocated SGL memory.
1757+
* target_submit_cmd - lookup unpacked lun and submit uninitialized se_cmd
17591758
*
17601759
* @se_cmd: command descriptor to submit
17611760
* @se_sess: associated se_sess for endpoint
@@ -1766,76 +1765,35 @@ EXPORT_SYMBOL_GPL(target_submit);
17661765
* @task_attr: SAM task attribute
17671766
* @data_dir: DMA data direction
17681767
* @flags: flags for command submission from target_sc_flags_tables
1769-
* @sgl: struct scatterlist memory for unidirectional mapping
1770-
* @sgl_count: scatterlist count for unidirectional mapping
1771-
* @sgl_bidi: struct scatterlist memory for bidirectional READ mapping
1772-
* @sgl_bidi_count: scatterlist count for bidirectional READ mapping
1773-
* @sgl_prot: struct scatterlist memory protection information
1774-
* @sgl_prot_count: scatterlist count for protection information
17751768
*
17761769
* Task tags are supported if the caller has set @se_cmd->tag.
17771770
*
1778-
* Returns non zero to signal active I/O shutdown failure. All other
1779-
* setup exceptions will be returned as a SCSI CHECK_CONDITION response,
1780-
* but still return zero here.
1781-
*
17821771
* This may only be called from process context, and also currently
17831772
* assumes internal allocation of fabric payload buffer by target-core.
1773+
*
1774+
* It also assumes interal target core SGL memory allocation.
1775+
*
1776+
* This function must only be used by drivers that do their own
1777+
* sync during shutdown and does not use target_stop_session. If there
1778+
* is a failure this function will call into the fabric driver's
1779+
* queue_status with a CHECK_CONDITION.
17841780
*/
1785-
int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess,
1781+
void target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess,
17861782
unsigned char *cdb, unsigned char *sense, u64 unpacked_lun,
1787-
u32 data_length, int task_attr, int data_dir, int flags,
1788-
struct scatterlist *sgl, u32 sgl_count,
1789-
struct scatterlist *sgl_bidi, u32 sgl_bidi_count,
1790-
struct scatterlist *sgl_prot, u32 sgl_prot_count)
1783+
u32 data_length, int task_attr, int data_dir, int flags)
17911784
{
17921785
int rc;
17931786

1794-
rc = target_init_cmd(se_cmd, se_sess, sense, unpacked_lun,
1795-
data_length, task_attr, data_dir, flags);
1796-
if (rc < 0)
1797-
return rc;
1787+
rc = target_init_cmd(se_cmd, se_sess, sense, unpacked_lun, data_length,
1788+
task_attr, data_dir, flags);
1789+
WARN(rc, "Invalid target_submit_cmd use. Driver must not use target_stop_session or call target_init_cmd directly.\n");
1790+
if (rc)
1791+
return;
17981792

1799-
if (target_submit_prep(se_cmd, cdb, sgl, sgl_count, sgl_bidi,
1800-
sgl_bidi_count, sgl_prot, sgl_prot_count))
1801-
return 0;
1793+
if (target_submit_prep(se_cmd, cdb, NULL, 0, NULL, 0, NULL, 0))
1794+
return;
18021795

18031796
target_submit(se_cmd);
1804-
return 0;
1805-
}
1806-
EXPORT_SYMBOL(target_submit_cmd_map_sgls);
1807-
1808-
/**
1809-
* target_submit_cmd - lookup unpacked lun and submit uninitialized se_cmd
1810-
*
1811-
* @se_cmd: command descriptor to submit
1812-
* @se_sess: associated se_sess for endpoint
1813-
* @cdb: pointer to SCSI CDB
1814-
* @sense: pointer to SCSI sense buffer
1815-
* @unpacked_lun: unpacked LUN to reference for struct se_lun
1816-
* @data_length: fabric expected data transfer length
1817-
* @task_attr: SAM task attribute
1818-
* @data_dir: DMA data direction
1819-
* @flags: flags for command submission from target_sc_flags_tables
1820-
*
1821-
* Task tags are supported if the caller has set @se_cmd->tag.
1822-
*
1823-
* Returns non zero to signal active I/O shutdown failure. All other
1824-
* setup exceptions will be returned as a SCSI CHECK_CONDITION response,
1825-
* but still return zero here.
1826-
*
1827-
* This may only be called from process context, and also currently
1828-
* assumes internal allocation of fabric payload buffer by target-core.
1829-
*
1830-
* It also assumes interal target core SGL memory allocation.
1831-
*/
1832-
int target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess,
1833-
unsigned char *cdb, unsigned char *sense, u64 unpacked_lun,
1834-
u32 data_length, int task_attr, int data_dir, int flags)
1835-
{
1836-
return target_submit_cmd_map_sgls(se_cmd, se_sess, cdb, sense,
1837-
unpacked_lun, data_length, task_attr, data_dir,
1838-
flags, NULL, 0, NULL, 0, NULL, 0);
18391797
}
18401798
EXPORT_SYMBOL(target_submit_cmd);
18411799

‎include/target/target_core_fabric.h‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,7 @@ void target_submit(struct se_cmd *se_cmd);
162162
sense_reason_t transport_lookup_cmd_lun(struct se_cmd *);
163163
sense_reason_t target_cmd_init_cdb(struct se_cmd *, unsigned char *);
164164
sense_reason_t target_cmd_parse_cdb(struct se_cmd *);
165-
int target_submit_cmd_map_sgls(struct se_cmd *, struct se_session *,
166-
unsigned char *, unsigned char *, u64, u32, int, int, int,
167-
struct scatterlist *, u32, struct scatterlist *, u32,
168-
struct scatterlist *, u32);
169-
int target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *,
165+
void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *,
170166
unsigned char *, u64, u32, int, int, int);
171167
int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
172168
unsigned char *sense, u64 unpacked_lun,

0 commit comments

Comments
 (0)