public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Sagi Grimberg <sagig@dev.mellanox.co.il>
To: "Nicholas A. Bellinger" <nab@daterainc.com>,
	target-devel <target-devel@vger.kernel.org>
Cc: linux-scsi <linux-scsi@vger.kernel.org>,
	Nicholas Bellinger <nab@linux-iscsi.org>,
	Martin Petersen <martin.petersen@oracle.com>,
	Sagi Grimberg <sagig@mellanox.com>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH 1/9] target: Convert DIF emulation to use cmd->prot_type
Date: Mon, 02 Mar 2015 13:30:56 +0200	[thread overview]
Message-ID: <54F449F0.9090805@dev.mellanox.co.il> (raw)
In-Reply-To: <1425119766-11878-2-git-send-email-nab@daterainc.com>

On 2/28/2015 12:35 PM, Nicholas A. Bellinger wrote:
> From: Nicholas Bellinger <nab@linux-iscsi.org>
>
> This patch changes existing DIF emulation to check the command descriptor's
> prot_type, instead of what the backend device is exposing in pi_prot_type.
>
> Since this value is already set in sbc_check_prot(), go ahead and use it to
> allow protected fabrics to function with unprotected devices.
>
> Cc: Martin Petersen <martin.petersen@oracle.com>
> Cc: Sagi Grimberg <sagig@mellanox.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
> ---
>   drivers/target/target_core_sbc.c | 13 +++++++------
>   1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
> index 9a2f9d3..95a7a74 100644
> --- a/drivers/target/target_core_sbc.c
> +++ b/drivers/target/target_core_sbc.c
> @@ -1167,7 +1167,7 @@ sbc_dif_generate(struct se_cmd *cmd)
>   			sdt = paddr + offset;
>   			sdt->guard_tag = cpu_to_be16(crc_t10dif(daddr + j,
>   						dev->dev_attrib.block_size));
> -			if (dev->dev_attrib.pi_prot_type == TARGET_DIF_TYPE1_PROT)
> +			if (cmd->prot_type == TARGET_DIF_TYPE1_PROT)
>   				sdt->ref_tag = cpu_to_be32(sector & 0xffffffff);
>   			sdt->app_tag = 0;
>
> @@ -1186,9 +1186,10 @@ sbc_dif_generate(struct se_cmd *cmd)
>   }
>
>   static sense_reason_t
> -sbc_dif_v1_verify(struct se_device *dev, struct se_dif_v1_tuple *sdt,
> +sbc_dif_v1_verify(struct se_cmd *cmd, struct se_dif_v1_tuple *sdt,
>   		  const void *p, sector_t sector, unsigned int ei_lba)
>   {
> +	struct se_device *dev = cmd->se_dev;
>   	int block_size = dev->dev_attrib.block_size;
>   	__be16 csum;
>
> @@ -1201,7 +1202,7 @@ sbc_dif_v1_verify(struct se_device *dev, struct se_dif_v1_tuple *sdt,
>   		return TCM_LOGICAL_BLOCK_GUARD_CHECK_FAILED;
>   	}
>
> -	if (dev->dev_attrib.pi_prot_type == TARGET_DIF_TYPE1_PROT &&
> +	if (cmd->prot_type == TARGET_DIF_TYPE1_PROT &&

This reminds me, I wander if the dif verify needed checks should be
driven from the cmd->prot_type or from cmd->prot_checks (set at
sbc_set_prot_op_checks()). AFAICT, the protection type simply
determines the way we treat the tags. Although I guess the target is
allowed to check protection even if it wasn't requested to (for example
when the fabric is unprotected and the backend is protected...).

MKP?

Sagi.

  reply	other threads:[~2015-03-02 11:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-28 10:35 [PATCH 0/9] target: Add WRITE_STRIP + READ_INSERT support Nicholas A. Bellinger
2015-02-28 10:35 ` [PATCH 1/9] target: Convert DIF emulation to use cmd->prot_type Nicholas A. Bellinger
2015-03-02 11:30   ` Sagi Grimberg [this message]
2015-02-28 10:35 ` [PATCH 2/9] target: Add protected fabric + unprotected device support Nicholas A. Bellinger
2015-02-28 10:36 ` [PATCH 3/9] target: Update SPC/SBC emulation for sess_prot_type Nicholas A. Bellinger
2015-02-28 10:36 ` [PATCH 4/9] target: Move cmd->prot_op check into target_check_write_prot Nicholas A. Bellinger
2015-02-28 10:36 ` [PATCH 5/9] target: Add internal WRITE_STRIP support Nicholas A. Bellinger
2015-02-28 10:36 ` [PATCH 6/9] target: Move cmd->prot_op check into target_check_read_prot Nicholas A. Bellinger
2015-02-28 10:36 ` [PATCH 7/9] target: Add internal READ_INSERT support Nicholas A. Bellinger
2015-02-28 10:36 ` [PATCH 8/9] target/file: Add checks for backend DIF emulation Nicholas A. Bellinger
2015-02-28 10:36 ` [PATCH 9/9] loopback: Add fabric_prot_type attribute support Nicholas A. Bellinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54F449F0.9090805@dev.mellanox.co.il \
    --to=sagig@dev.mellanox.co.il \
    --cc=hch@lst.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=nab@daterainc.com \
    --cc=nab@linux-iscsi.org \
    --cc=sagig@mellanox.com \
    --cc=target-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox