Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752573AbaAMTVP (ORCPT ); Mon, 13 Jan 2014 14:21:15 -0500 Received: from mail.linux-iscsi.org ([67.23.28.174]:50684 "EHLO linux-iscsi.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751725AbaAMTVL (ORCPT ); Mon, 13 Jan 2014 14:21:11 -0500 Message-ID: <1389640982.5567.442.camel@haakon3.risingtidesystems.com> Subject: Re: [PATCH 03/14] target/sbc: Add sbc_check_prot + update sbc_parse_cdb for DIF From: "Nicholas A. Bellinger" To: Sagi Grimberg Cc: Sagi Grimberg , "Nicholas A. Bellinger" , target-devel , linux-scsi , linux-kernel , "Martin K. Petersen" , Christoph Hellwig , Hannes Reinecke , Or Gerlitz , oren Duer Date: Mon, 13 Jan 2014 11:23:02 -0800 In-Reply-To: <52D283B8.6050108@dev.mellanox.co.il> References: <1389212157-14540-1-git-send-email-nab@daterainc.com> <1389212157-14540-4-git-send-email-nab@daterainc.com> <52CEB901.6030504@mellanox.com> <1389337456.5567.412.camel@haakon3.risingtidesystems.com> <52D283B8.6050108@dev.mellanox.co.il> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.4.4-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2014-01-12 at 13:59 +0200, Sagi Grimberg wrote: > On 1/10/2014 9:04 AM, Nicholas A. Bellinger wrote: > > On Thu, 2014-01-09 at 16:58 +0200, Sagi Grimberg wrote: > >> On 1/8/2014 10:36 PM, Nicholas A. Bellinger wrote: > >>> 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. :) > > OK, so just to be clear, both the transport and the backstore will be > look in se_cmd protection attributes when executing IO correct? > Correct. --nab -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/