On Mon, 2014-04-07 at 10:39 +0300, Sagi Grimberg wrote:
> On 4/3/2014 12:35 PM, Nicholas A. Bellinger wrote:
> > From: Nicholas Bellinger <n...@linux-iscsi.org>
> >
> > This patch enables WRITE_INSERT emulation in target_execute_cmd()
> > in order to locally generate DIF PI before submitting the WRITE
> > to the underlying backend device.
> >
> > This is required for fabric drivers that currently don't support
> > DIF over-the-wire, in order to inact with backend devices that
> > have hardware (IBLOCK) or software (FILEIO + RAMDISK) support
> > for handling T10 PI.
> >
> > Cc: Martin K. Petersen <martin.peter...@oracle.com>
> > Cc: Sagi Grimberg <sa...@mellanox.com>
> > Cc: Or Gerlitz <ogerl...@mellanox.com>
> > Cc: Quinn Tran <quinn.t...@qlogic.com>
> > Cc: Giridhar Malavali <giridhar.malav...@qlogic.com>
> > Signed-off-by: Nicholas Bellinger <n...@linux-iscsi.org>
> > ---
> >   drivers/target/target_core_transport.c |    9 +++++++++
> >   1 file changed, 9 insertions(+)
> >
> > diff --git a/drivers/target/target_core_transport.c 
> > b/drivers/target/target_core_transport.c
> > index 9c820ba..530a9e8 100644
> > --- a/drivers/target/target_core_transport.c
> > +++ b/drivers/target/target_core_transport.c
> > @@ -1767,6 +1767,15 @@ void target_execute_cmd(struct se_cmd *cmd)
> >     cmd->t_state = TRANSPORT_PROCESSING;
> >     cmd->transport_state |= CMD_T_ACTIVE|CMD_T_BUSY|CMD_T_SENT;
> >     spin_unlock_irq(&cmd->t_state_lock);
> > +   /*
> > +    * Perform WRITE_INSERT of PI using software emulation when backend
> > +    * device has PI enabled, if the transport has not already generated
> > +    * PI using hardware WRITE_INSERT offload.
> > +    */
> > +   if (cmd->prot_op == TARGET_PROT_DOUT_INSERT) {
> > +           if (!(cmd->se_sess->sup_prot_ops & TARGET_PROT_DOUT_INSERT))
> > +                   sbc_dif_write_insert(cmd);
> > +   }
> >   
> >     if (target_handle_task_attr(cmd)) {
> >             spin_lock_irq(&cmd->t_state_lock);
> Looks good to me.
> 
> Reviewed-by: Sagi Grimberg <sa...@mellanox.com>
> 
> This is useless though without the code setting this prot_op in 
> sbc_set_prot_op_checks()...

Not sure I follow..  sbc_set_prot_op_checks() is already setting
TARGET_PROT_DOUT_INSERT when no protect field in the WRITE CDB has been
set, eg:

static int
sbc_set_prot_op_checks(u8 protect, enum target_prot_type prot_type,
                       bool is_write, struct se_cmd *cmd)
{
        if (is_write) {
                cmd->prot_op = protect ? TARGET_PROT_DOUT_PASS :
                                         TARGET_PROT_DOUT_INSERT;

                <SNIP>
        }
}

Which in-turn is what causes this code to invoke sbc_dif_write_insert
(now sbc_dif_generate) when the backend supports PI, and the fabric
itself does not support WRITE_INSERT hw offload.

--nab 

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to