From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: target-devel <target-devel@vger.kernel.org>
Cc: linux-nvme <linux-nvme@lists.infradead.org>,
linux-scsi <linux-scsi@vger.kernel.org>,
Jens Axboe <axboe@fb.com>, Christoph Hellwig <hch@lst.de>,
Martin Petersen <martin.petersen@oracle.com>,
Sagi Grimberg <sagi@grimberg.me>, Hannes Reinecke <hare@suse.de>,
Mike Christie <michaelc@cs.wisc.edu>,
Dave B Minturn <dave.b.minturn@intel.com>,
Nicholas Bellinger <nab@linux-iscsi.org>
Subject: [RFC 7/8] nvmet/admin-cmd: Hookup T10-PI to ID_NS.ms + ID_NS.dps feature bits
Date: Tue, 7 Jun 2016 06:36:55 +0000 [thread overview]
Message-ID: <1465281416-28355-8-git-send-email-nab@linux-iscsi.org> (raw)
In-Reply-To: <1465281416-28355-1-git-send-email-nab@linux-iscsi.org>
From: Nicholas Bellinger <nab@linux-iscsi.org>
This patch updates nvmet_execute_identify_ns() to report
target-core backend T10-PI related feature bits to the
NVMe host controller.
Note this assumes support for NVME_NS_DPC_PI_TYPE1 and
NVME_NS_DPC_PI_TYPE3 as reported by backend drivers via
/sys/kernel/config/target/core/*/*/attrib/pi_prot_type.
Cc: Jens Axboe <axboe@fb.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Martin Petersen <martin.petersen@oracle.com>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
---
drivers/nvme/target/admin-cmd.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 240e323..3a808dc 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -200,6 +200,7 @@ static void nvmet_execute_identify_ns(struct nvmet_req *req)
{
struct nvmet_ns *ns;
struct nvme_id_ns *id;
+ struct se_device *dev;
u16 status = 0;
ns = nvmet_find_namespace(req->sq->ctrl, req->cmd->identify.nsid);
@@ -228,6 +229,22 @@ static void nvmet_execute_identify_ns(struct nvmet_req *req)
id->nlbaf = 0;
id->flbas = 0;
+ /* Populate bits for T10-PI from se_device backend */
+ rcu_read_lock();
+ dev = rcu_dereference(ns->dev);
+ if (dev && dev->dev_attrib.pi_prot_type) {
+ int pi_prot_type = dev->dev_attrib.pi_prot_type;
+
+ id->lbaf[0].ms = cpu_to_le16(sizeof(struct t10_pi_tuple));
+ printk("nvmet_set_id_ns: ms: %u\n", id->lbaf[0].ms);
+
+ if (pi_prot_type == 1)
+ id->dps = NVME_NS_DPC_PI_TYPE1;
+ else if (pi_prot_type == 3)
+ id->dps = NVME_NS_DPC_PI_TYPE3;
+ }
+ rcu_read_unlock();
+
/*
* Our namespace might always be shared. Not just with other
* controllers, but also with any other user of the block device.
--
1.9.1
next prev parent reply other threads:[~2016-06-07 6:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-07 6:36 [RFC 0/8] nvmet: Add support for multi-tenant configfs Nicholas A. Bellinger
2016-06-07 6:36 ` [RFC 1/8] nvmet: Add nvmet_fabric_ops get/put transport helpers Nicholas A. Bellinger
2016-06-07 6:36 ` [RFC 2/8] nvmet: Add support for configfs-ng multi-tenant logic Nicholas A. Bellinger
2016-06-07 6:36 ` [RFC 3/8] nvmet: Hookup nvmet_ns->dev to nvmet_ns_enable Nicholas A. Bellinger
2016-06-07 6:36 ` [RFC 4/8] nvmet/io-cmd: Hookup sbc_ops->execute_rw backend ops Nicholas A. Bellinger
2016-06-07 6:36 ` [RFC 5/8] nvmet/io-cmd: Hookup sbc_ops->execute_sync_cache " Nicholas A. Bellinger
2016-06-07 6:36 ` [RFC 6/8] nvmet/io-cmd: Hookup sbc_ops->execute_unmap " Nicholas A. Bellinger
2016-06-07 6:36 ` Nicholas A. Bellinger [this message]
2016-06-09 13:52 ` [RFC 7/8] nvmet/admin-cmd: Hookup T10-PI to ID_NS.ms + ID_NS.dps feature bits Christoph Hellwig
2016-06-10 6:55 ` Nicholas A. Bellinger
2016-06-07 6:36 ` [RFC 8/8] nvme/loop: Add support for bio integrity handling 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=1465281416-28355-8-git-send-email-nab@linux-iscsi.org \
--to=nab@linux-iscsi.org \
--cc=axboe@fb.com \
--cc=dave.b.minturn@intel.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=michaelc@cs.wisc.edu \
--cc=sagi@grimberg.me \
--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;
as well as URLs for NNTP newsgroup(s).