lkml.org 
[lkml]   [2014]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 03/14] target/sbc: Add sbc_check_prot + update sbc_parse_cdb for DIF
From
Date
On Thu, 2014-01-09 at 16:58 +0200, Sagi Grimberg wrote:
> On 1/8/2014 10:36 PM, Nicholas A. Bellinger wrote:
> > From: Nicholas Bellinger <nab@linux-iscsi.org>
> >
> > This patch adds sbc_check_prot() for performing various DIF
> > related CDB sanity checks, along with setting SCF_PROT once
> > sanity checks have passed.
> >
> > Also, add calls in sbc_parse_cdb() for READ_[10,12,16] +
> > WRITE_[10,12,16] to perform DIF sanity checking.
> >
> > 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>
> > ---
> > drivers/target/target_core_sbc.c | 39 ++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 39 insertions(+)
> >
> > diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
> > index 52ae54e..600ffcb 100644
> > --- a/drivers/target/target_core_sbc.c
> > +++ b/drivers/target/target_core_sbc.c
> > @@ -563,6 +563,27 @@ sbc_compare_and_write(struct se_cmd *cmd)
> > return TCM_NO_SENSE;
> > }
> >
> > +bool
> > +sbc_check_prot(struct se_device *dev, struct se_cmd *cmd, unsigned char *cdb)
> > +{
> > + if (!dev->dev_attrib.pi_prot_type)
> > + return true;
> > +
> > + if (dev->dev_attrib.pi_prot_type == TARGET_DIF_TYPE2_PROT &&
> > + (cdb[1] & 0xe0))
> > + return false;
> > +
> > + if (!(cdb[1] & 0xe0)) {
> > + pr_warn("Target: Unprotected READ/WRITE to DIF device\n");
> > + return true;
> > + }
> > + if (!cmd->t_prot_sg || !cmd->t_prot_nents)
> > + return true;
> > +
> > + cmd->se_cmd_flags |= SCF_PROT;
>
> Isn't this the place to fill the se_cmd DIF execution parameters?
> prot_op, prot_type, guard_type, initial_reftag, apptag etc...
> Next, all parties interested in DIF execution should look in se_cmd
> (backstore, transport).

Yes, working on this for -v2 as well. :)

--nab



\
 
 \ /
  Last update: 2014-01-10 09:01    [W:0.088 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site