From patchwork Mon Nov 25 07:06:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 845537 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 647CF188A08 for ; Mon, 25 Nov 2024 08:09:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732522147; cv=none; b=BKA/RHYIRl+RwjR+L+L/Hh1EY6YF19siDoVkrUL8g7ccNCB6rAx6gWWL3tU+xRWjdM6IOh00aeWKNeaeETh5LCt7imot+TZEDgSyzbgw+EhIg76dO2sOSfApwsQcwaG4t9YnsQ/tgn4np45xsMI37HXTsmQmdCDbwVzF2oK0NRY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732522147; c=relaxed/simple; bh=wf16SXbPE7IKcuRRSTK3G6OqCzknXrmBf1Mn0Cr7weM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=nTnwPVxvdLDOisIfLJCtCXto9iQfaaZeot6sUDhZG3ijutkkcNs8bTa+WSOai60fKnpsNil1JLtkN2feST9t2pw9J7xGhXLIdyfUISu4uVOXq12KHXlXDjYyPxDP9y/bH5cFyoQ7wIkM/5C/K2RW7c2DTHziYMVO7+G7dJ1jiE8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=I0l+aS0/; arc=none smtp.client-ip=203.254.224.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="I0l+aS0/" Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20241125080903epoutp04cb14ebe5e945e1c2eea85421cb4f5aba~LJ7XYOf8H1429314293epoutp04C for ; Mon, 25 Nov 2024 08:09:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20241125080903epoutp04cb14ebe5e945e1c2eea85421cb4f5aba~LJ7XYOf8H1429314293epoutp04C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1732522143; bh=DV5DBIpEJMoashvJk+4uhGWWufd3TPgC6b7DXtx2rfc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I0l+aS0/4sNUdfdntSSEN/eqWE9k6Zxq2/rFWVJQTCB3D9pNMWjRom90tLyaFULhK Gjq/H76aXcofLWgubfLDGwVu8EVM3cN7HjGvlF3wMrF6VGgUcAuTQhB3PwFn+SI66n 9gsQKsA3RVW775xNdrBgJ1QXu5I2VJhdYyUf9Rj4= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20241125080902epcas5p4974fd53f6f0600871071d337ac22d246~LJ7WgZ6QY1684116841epcas5p4R; Mon, 25 Nov 2024 08:09:02 +0000 (GMT) Received: from epsmgec5p1new.samsung.com (unknown [182.195.38.176]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4XxddS48Kqz4x9Q9; Mon, 25 Nov 2024 08:09:00 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmgec5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id D8.C6.19710.C9034476; Mon, 25 Nov 2024 17:09:00 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20241125071510epcas5p47a424c419577f1e5c09375ce39a880c3~LJMUXmqzs1933019330epcas5p46; Mon, 25 Nov 2024 07:15:10 +0000 (GMT) Received: from epsmgmcp1.samsung.com (unknown [182.195.42.82]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20241125071510epsmtrp2709d00e20d479c3c192298df43eb9d77~LJMUWsvqX0316003160epsmtrp2G; Mon, 25 Nov 2024 07:15:10 +0000 (GMT) X-AuditID: b6c32a44-36bdd70000004cfe-4c-6744309c17b8 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgmcp1.samsung.com (Symantec Messaging Gateway) with SMTP id 1E.9E.18937.EF324476; Mon, 25 Nov 2024 16:15:10 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20241125071508epsmtip1759915efa0c70e6cd4a3435cfd11f706~LJMSCDVT50361903619epsmtip1u; Mon, 25 Nov 2024 07:15:07 +0000 (GMT) From: Anuj Gupta To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, anuj1072538@gmail.com, brauner@kernel.org, jack@suse.cz, viro@zeniv.linux.org.uk Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, gost.dev@samsung.com, linux-scsi@vger.kernel.org, vishak.g@samsung.com, linux-fsdevel@vger.kernel.org, Anuj Gupta Subject: [PATCH v10 09/10] scsi: add support for user-meta interface Date: Mon, 25 Nov 2024 12:36:32 +0530 Message-Id: <20241125070633.8042-10-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241125070633.8042-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+N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qLfO6+P4W y5TzZnU/zfWV92i9drY/Zhz+W/7D4XSf2Ws2Pz4oOM3sa8WtXexneEXE7b3e/ZJcVmPsLf/1 TdKN1uZ7ezotu9g5Ntff/aTIe928od34X1vb6nytoIU+R/M5lj6cmpwXdiurWEW788hpMeP+ NQ4H3d9amTJO/6F7q9545TeZN7c9ffzeO9boditlH1UtynFZyD6JaZnnIRZhBtMtRS+/PzJ5 rcRSnJFoqMVcVJwIACZk9b4eAwAA X-CMS-MailID: 20241125071510epcas5p47a424c419577f1e5c09375ce39a880c3 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241125071510epcas5p47a424c419577f1e5c09375ce39a880c3 References: <20241125070633.8042-1-anuj20.g@samsung.com> Add support for sending user-meta buffer. Set tags to be checked using flags specified by user/block-layer. With this change, BIP_CTRL_NOCHECK becomes unused. Remove it. Signed-off-by: Anuj Gupta Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c | 4 ++-- include/linux/bio-integrity.h | 16 +++++++--------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 8947dab132d7..cb7ac8736b91 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -814,14 +814,14 @@ static unsigned char sd_setup_protect_cmnd(struct scsi_cmnd *scmd, if (bio_integrity_flagged(bio, BIP_IP_CHECKSUM)) scmd->prot_flags |= SCSI_PROT_IP_CHECKSUM; - if (bio_integrity_flagged(bio, BIP_CTRL_NOCHECK) == false) + if (bio_integrity_flagged(bio, BIP_CHECK_GUARD)) scmd->prot_flags |= SCSI_PROT_GUARD_CHECK; } if (dif != T10_PI_TYPE3_PROTECTION) { /* DIX/DIF Type 0, 1, 2 */ scmd->prot_flags |= SCSI_PROT_REF_INCREMENT; - if (bio_integrity_flagged(bio, BIP_CTRL_NOCHECK) == false) + if (bio_integrity_flagged(bio, BIP_CHECK_REFTAG)) scmd->prot_flags |= SCSI_PROT_REF_CHECK; } diff --git a/include/linux/bio-integrity.h b/include/linux/bio-integrity.h index fe2bfe122db2..2195bc06dcde 100644 --- a/include/linux/bio-integrity.h +++ b/include/linux/bio-integrity.h @@ -7,13 +7,12 @@ enum bip_flags { BIP_BLOCK_INTEGRITY = 1 << 0, /* block layer owns integrity data */ BIP_MAPPED_INTEGRITY = 1 << 1, /* ref tag has been remapped */ - BIP_CTRL_NOCHECK = 1 << 2, /* disable HBA integrity checking */ - BIP_DISK_NOCHECK = 1 << 3, /* disable disk integrity checking */ - BIP_IP_CHECKSUM = 1 << 4, /* IP checksum */ - BIP_COPY_USER = 1 << 5, /* Kernel bounce buffer in use */ - BIP_CHECK_GUARD = 1 << 6, /* guard check */ - BIP_CHECK_REFTAG = 1 << 7, /* reftag check */ - BIP_CHECK_APPTAG = 1 << 8, /* apptag check */ + BIP_DISK_NOCHECK = 1 << 2, /* disable disk integrity checking */ + BIP_IP_CHECKSUM = 1 << 3, /* IP checksum */ + BIP_COPY_USER = 1 << 4, /* Kernel bounce buffer in use */ + BIP_CHECK_GUARD = 1 << 5, /* guard check */ + BIP_CHECK_REFTAG = 1 << 6, /* reftag check */ + BIP_CHECK_APPTAG = 1 << 7, /* apptag check */ }; struct bio_integrity_payload { @@ -33,8 +32,7 @@ struct bio_integrity_payload { struct bio_vec bip_inline_vecs[];/* embedded bvec array */ }; -#define BIP_CLONE_FLAGS (BIP_MAPPED_INTEGRITY | BIP_CTRL_NOCHECK | \ - BIP_DISK_NOCHECK | BIP_IP_CHECKSUM | \ +#define BIP_CLONE_FLAGS (BIP_MAPPED_INTEGRITY | BIP_IP_CHECKSUM | \ BIP_CHECK_GUARD | BIP_CHECK_REFTAG | BIP_CHECK_APPTAG) #ifdef CONFIG_BLK_DEV_INTEGRITY