diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-12-23 15:38:30 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2014-01-18 04:58:09 -0500 |
commit | def2b339b422070ecb99298a80e4b15033adc0ce (patch) | |
tree | 820c7c3d2e4395ba9567e500111eb53975fe74a9 /drivers/target | |
parent | 2ed22c9cbca61f0f696a0a1cbbb777da281bd79d (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>
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/loopback/tcm_loop.c | 2 | ||||
-rw-r--r-- | drivers/target/target_core_transport.c | 16 |
2 files changed, 15 insertions, 3 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 | } |
1450 | EXPORT_SYMBOL(target_submit_cmd); | 1462 | EXPORT_SYMBOL(target_submit_cmd); |
1451 | 1463 | ||