aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2013-12-23 15:38:30 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2014-01-18 04:58:09 -0500
commitdef2b339b422070ecb99298a80e4b15033adc0ce (patch)
tree820c7c3d2e4395ba9567e500111eb53975fe74a9
parent2ed22c9cbca61f0f696a0a1cbbb777da281bd79d (diff)
target: Add protection SGLs to target_submit_cmd_map_sgls
This patch adds support to target_submit_cmd_map_sgls() for accepting 'sgl_prot' + 'sgl_prot_count' parameters for DIF protection information. Note the passed parameters are stored at se_cmd->t_prot_sg and se_cmd->t_prot_nents respectively. Also, update tcm_loop and vhost-scsi fabrics usage of target_submit_cmd_map_sgls() to take into account the new parameters. Cc: Martin K. Petersen <martin.petersen@oracle.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Hannes Reinecke <hare@suse.de> Cc: Sagi Grimberg <sagig@mellanox.com> Cc: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r--drivers/target/loopback/tcm_loop.c2
-rw-r--r--drivers/target/target_core_transport.c16
-rw-r--r--drivers/vhost/scsi.c2
-rw-r--r--include/target/target_core_fabric.h3
4 files changed, 18 insertions, 5 deletions
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index 763ee450f71b..112b795a7b80 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -217,7 +217,7 @@ static void tcm_loop_submission_work(struct work_struct *work)
217 scsi_bufflen(sc), tcm_loop_sam_attr(sc), 217 scsi_bufflen(sc), tcm_loop_sam_attr(sc),
218 sc->sc_data_direction, 0, 218 sc->sc_data_direction, 0,
219 scsi_sglist(sc), scsi_sg_count(sc), 219 scsi_sglist(sc), scsi_sg_count(sc),
220 sgl_bidi, sgl_bidi_count); 220 sgl_bidi, sgl_bidi_count, NULL, 0);
221 if (rc < 0) { 221 if (rc < 0) {
222 set_host_byte(sc, DID_NO_CONNECT); 222 set_host_byte(sc, DID_NO_CONNECT);
223 goto out_done; 223 goto out_done;
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index fa4fc0429452..aebe0bb3f23b 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -1310,6 +1310,8 @@ transport_generic_map_mem_to_cmd(struct se_cmd *cmd, struct scatterlist *sgl,
1310 * @sgl_count: scatterlist count for unidirectional mapping 1310 * @sgl_count: scatterlist count for unidirectional mapping
1311 * @sgl_bidi: struct scatterlist memory for bidirectional READ mapping 1311 * @sgl_bidi: struct scatterlist memory for bidirectional READ mapping
1312 * @sgl_bidi_count: scatterlist count for bidirectional READ mapping 1312 * @sgl_bidi_count: scatterlist count for bidirectional READ mapping
1313 * @sgl_prot: struct scatterlist memory protection information
1314 * @sgl_prot_count: scatterlist count for protection information
1313 * 1315 *
1314 * Returns non zero to signal active I/O shutdown failure. All other 1316 * Returns non zero to signal active I/O shutdown failure. All other
1315 * setup exceptions will be returned as a SCSI CHECK_CONDITION response, 1317 * setup exceptions will be returned as a SCSI CHECK_CONDITION response,
@@ -1322,7 +1324,8 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess
1322 unsigned char *cdb, unsigned char *sense, u32 unpacked_lun, 1324 unsigned char *cdb, unsigned char *sense, u32 unpacked_lun,
1323 u32 data_length, int task_attr, int data_dir, int flags, 1325 u32 data_length, int task_attr, int data_dir, int flags,
1324 struct scatterlist *sgl, u32 sgl_count, 1326 struct scatterlist *sgl, u32 sgl_count,
1325 struct scatterlist *sgl_bidi, u32 sgl_bidi_count) 1327 struct scatterlist *sgl_bidi, u32 sgl_bidi_count,
1328 struct scatterlist *sgl_prot, u32 sgl_prot_count)
1326{ 1329{
1327 struct se_portal_group *se_tpg; 1330 struct se_portal_group *se_tpg;
1328 sense_reason_t rc; 1331 sense_reason_t rc;
@@ -1364,6 +1367,14 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess
1364 target_put_sess_cmd(se_sess, se_cmd); 1367 target_put_sess_cmd(se_sess, se_cmd);
1365 return 0; 1368 return 0;
1366 } 1369 }
1370 /*
1371 * Save pointers for SGLs containing protection information,
1372 * if present.
1373 */
1374 if (sgl_prot_count) {
1375 se_cmd->t_prot_sg = sgl_prot;
1376 se_cmd->t_prot_nents = sgl_prot_count;
1377 }
1367 1378
1368 rc = target_setup_cmd_from_cdb(se_cmd, cdb); 1379 rc = target_setup_cmd_from_cdb(se_cmd, cdb);
1369 if (rc != 0) { 1380 if (rc != 0) {
@@ -1406,6 +1417,7 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess
1406 return 0; 1417 return 0;
1407 } 1418 }
1408 } 1419 }
1420
1409 /* 1421 /*
1410 * Check if we need to delay processing because of ALUA 1422 * Check if we need to delay processing because of ALUA
1411 * Active/NonOptimized primary access state.. 1423 * Active/NonOptimized primary access state..
@@ -1445,7 +1457,7 @@ int target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess,
1445{ 1457{
1446 return target_submit_cmd_map_sgls(se_cmd, se_sess, cdb, sense, 1458 return target_submit_cmd_map_sgls(se_cmd, se_sess, cdb, sense,
1447 unpacked_lun, data_length, task_attr, data_dir, 1459 unpacked_lun, data_length, task_attr, data_dir,
1448 flags, NULL, 0, NULL, 0); 1460 flags, NULL, 0, NULL, 0, NULL, 0);
1449} 1461}
1450EXPORT_SYMBOL(target_submit_cmd); 1462EXPORT_SYMBOL(target_submit_cmd);
1451 1463
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index f175629513ed..84488a890b69 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -889,7 +889,7 @@ static void tcm_vhost_submission_work(struct work_struct *work)
889 cmd->tvc_lun, cmd->tvc_exp_data_len, 889 cmd->tvc_lun, cmd->tvc_exp_data_len,
890 cmd->tvc_task_attr, cmd->tvc_data_direction, 890 cmd->tvc_task_attr, cmd->tvc_data_direction,
891 TARGET_SCF_ACK_KREF, sg_ptr, cmd->tvc_sgl_count, 891 TARGET_SCF_ACK_KREF, sg_ptr, cmd->tvc_sgl_count,
892 sg_bidi_ptr, sg_no_bidi); 892 sg_bidi_ptr, sg_no_bidi, NULL, 0);
893 if (rc < 0) { 893 if (rc < 0) {
894 transport_send_check_condition_and_sense(se_cmd, 894 transport_send_check_condition_and_sense(se_cmd,
895 TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0); 895 TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0);
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index 4cf4fda404a3..0218d689b3d7 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -105,7 +105,8 @@ sense_reason_t transport_lookup_cmd_lun(struct se_cmd *, u32);
105sense_reason_t target_setup_cmd_from_cdb(struct se_cmd *, unsigned char *); 105sense_reason_t target_setup_cmd_from_cdb(struct se_cmd *, unsigned char *);
106int target_submit_cmd_map_sgls(struct se_cmd *, struct se_session *, 106int target_submit_cmd_map_sgls(struct se_cmd *, struct se_session *,
107 unsigned char *, unsigned char *, u32, u32, int, int, int, 107 unsigned char *, unsigned char *, u32, u32, int, int, int,
108 struct scatterlist *, u32, struct scatterlist *, u32); 108 struct scatterlist *, u32, struct scatterlist *, u32,
109 struct scatterlist *, u32);
109int target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, 110int target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *,
110 unsigned char *, u32, u32, int, int, int); 111 unsigned char *, u32, u32, int, int, int);
111int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess, 112int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,