[PATCH v11 07/10] block: introduce BIP_CHECK_GUARD/REFTAG/APPTAG bip_flags

Anuj Gupta anuj20.g at samsung.com
Wed Feb 5 03:51:34 PST 2025


On Tue, Feb 04, 2025 at 06:39:14AM +0100, Christoph Hellwig wrote:
> On Mon, Feb 03, 2025 at 08:09:48PM +0530, Anuj Gupta wrote:
> > +	if (bi->csum_type == BLK_INTEGRITY_CSUM_IP)
> > +		bip->bip_flags |= BIP_IP_CHECKSUM;
> 
> We'll also need to set the BIP_CHECK_GUARD flag here I think.

Right, I think this patch should address the problem [*]
I couldn't test this patch, as nvme-tcp doesn't support T10-PI and so
does rdma_rxe. I don't have rdma h/w to test this.
It would be great if someone can give this a run.

[*]

Subject: [PATCH] nvmet: set bip_flags to specify integrity checks

A recent patch [1] changed how the driver sets checks for integrity buffer.
The checks are now specified via newly introduced bip_flags that indicate
how to check the integrity payload. nvme target never sets these flags.
Modify it, so that it starts using these new bip_flags.

[1] https://lore.kernel.org/linux-nvme/20241128112240.8867-8-anuj20.g@samsung.com/

Signed-off-by: Anuj Gupta <anuj20.g at samsung.com>
---
 drivers/nvme/target/io-cmd-bdev.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-cmd-bdev.c
index c1f574fe3280..4bab24bcd6e8 100644
--- a/drivers/nvme/target/io-cmd-bdev.c
+++ b/drivers/nvme/target/io-cmd-bdev.c
@@ -210,6 +210,10 @@ static int nvmet_bdev_alloc_bip(struct nvmet_req *req, struct bio *bio,
 		return PTR_ERR(bip);
 	}
 
+	if (bi->csum_type)
+		bip->bip_flags |= BIP_CHECK_GUARD;
+	if (bi->flags & BLK_INTEGRITY_REF_TAG)
+		bip->bip_flags |= BIP_CHECK_REFTAG;
 	/* virtual start sector must be in integrity interval units */
 	bip_set_seed(bip, bio->bi_iter.bi_sector >>
 		     (bi->interval_exp - SECTOR_SHIFT));
-- 
2.25.1


More information about the Linux-nvme mailing list