From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sagi Grimberg Subject: Re: [PATCH 7/9] target: Enable WRITE_INSERT emulation in target_execute_cmd Date: Mon, 07 Apr 2014 10:39:27 +0300 Message-ID: <5342562F.1070706@dev.mellanox.co.il> References: <1396517753-23546-1-git-send-email-nab@daterainc.com> <1396517753-23546-8-git-send-email-nab@daterainc.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1396517753-23546-8-git-send-email-nab@daterainc.com> Sender: target-devel-owner@vger.kernel.org To: "Nicholas A. Bellinger" , target-devel Cc: linux-scsi , "Martin K. Petersen" , Sagi Grimberg , Or Gerlitz , Quinn Tran , Giridhar Malavali , Nicholas Bellinger List-Id: linux-scsi@vger.kernel.org On 4/3/2014 12:35 PM, Nicholas A. Bellinger wrote: > From: Nicholas Bellinger > > 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 > Cc: Sagi Grimberg > Cc: Or Gerlitz > Cc: Quinn Tran > Cc: Giridhar Malavali > Signed-off-by: Nicholas Bellinger > --- > 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 This is useless though without the code setting this prot_op in sbc_set_prot_op_checks()...