@@ -1754,8 +1754,7 @@ void target_submit(struct se_cmd *se_cmd)
17541754EXPORT_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}
18401798EXPORT_SYMBOL (target_submit_cmd );
18411799
0 commit comments