Commit 395ccb25 authored by Nicholas Bellinger's avatar Nicholas Bellinger

target/sbc: Add sbc_dif_read_strip software emulation

Split up __sbc_dif_verify_read() so that VERIFY READ emulation can
perform target-core specific READ_STRIP, seperate from the existing
FILEIO/RAMDISK backend emulation code.

Also add sbc_dif_read_strip() in order to determine number of sectors
using cmd->prot_length, and skip the extra sbc_dif_copy_prot().
Reviewed-by: default avatarSagi Grimberg <sagig@mellanox.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Or Gerlitz <ogerlitz@mellanox.com>
Cc: Quinn Tran <quinn.tran@qlogic.com>
Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent a84bf9ee
...@@ -1271,9 +1271,9 @@ sbc_dif_verify_write(struct se_cmd *cmd, sector_t start, unsigned int sectors, ...@@ -1271,9 +1271,9 @@ sbc_dif_verify_write(struct se_cmd *cmd, sector_t start, unsigned int sectors,
} }
EXPORT_SYMBOL(sbc_dif_verify_write); EXPORT_SYMBOL(sbc_dif_verify_write);
sense_reason_t static sense_reason_t
sbc_dif_verify_read(struct se_cmd *cmd, sector_t start, unsigned int sectors, __sbc_dif_verify_read(struct se_cmd *cmd, sector_t start, unsigned int sectors,
unsigned int ei_lba, struct scatterlist *sg, int sg_off) unsigned int ei_lba, struct scatterlist *sg, int sg_off)
{ {
struct se_device *dev = cmd->se_dev; struct se_device *dev = cmd->se_dev;
struct se_dif_v1_tuple *sdt; struct se_dif_v1_tuple *sdt;
...@@ -1326,8 +1326,31 @@ sbc_dif_verify_read(struct se_cmd *cmd, sector_t start, unsigned int sectors, ...@@ -1326,8 +1326,31 @@ sbc_dif_verify_read(struct se_cmd *cmd, sector_t start, unsigned int sectors,
kunmap_atomic(paddr); kunmap_atomic(paddr);
kunmap_atomic(daddr); kunmap_atomic(daddr);
} }
sbc_dif_copy_prot(cmd, sectors, true, sg, sg_off);
return 0; return 0;
} }
sense_reason_t
sbc_dif_read_strip(struct se_cmd *cmd)
{
struct se_device *dev = cmd->se_dev;
u32 sectors = cmd->prot_length / dev->prot_length;
return __sbc_dif_verify_read(cmd, cmd->t_task_lba, sectors, 0,
cmd->t_prot_sg, 0);
}
sense_reason_t
sbc_dif_verify_read(struct se_cmd *cmd, sector_t start, unsigned int sectors,
unsigned int ei_lba, struct scatterlist *sg, int sg_off)
{
sense_reason_t rc;
rc = __sbc_dif_verify_read(cmd, start, sectors, ei_lba, sg, sg_off);
if (rc)
return rc;
sbc_dif_copy_prot(cmd, sectors, true, sg, sg_off);
return 0;
}
EXPORT_SYMBOL(sbc_dif_verify_read); EXPORT_SYMBOL(sbc_dif_verify_read);
...@@ -78,6 +78,7 @@ sense_reason_t sbc_dif_verify_write(struct se_cmd *, sector_t, unsigned int, ...@@ -78,6 +78,7 @@ sense_reason_t sbc_dif_verify_write(struct se_cmd *, sector_t, unsigned int,
unsigned int, struct scatterlist *, int); unsigned int, struct scatterlist *, int);
sense_reason_t sbc_dif_verify_read(struct se_cmd *, sector_t, unsigned int, sense_reason_t sbc_dif_verify_read(struct se_cmd *, sector_t, unsigned int,
unsigned int, struct scatterlist *, int); unsigned int, struct scatterlist *, int);
sense_reason_t sbc_dif_read_strip(struct se_cmd *);
void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *); void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *);
int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *); int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment