From: James Smart <jsmart2021@gmail.com>
To: linux-scsi@vger.kernel.org
Cc: linux-nvme@lists.infradead.org,
Muneendra <muneendra.kumar@broadcom.com>,
James Smart <jsmart2021@gmail.com>
Subject: [PATCH 1/4] nvme-fc: Add new routine nvme_fc_io_getuuid
Date: Tue, 10 May 2022 13:00:25 -0700 [thread overview]
Message-ID: <20220510200028.37399-2-jsmart2021@gmail.com> (raw)
In-Reply-To: <20220510200028.37399-1-jsmart2021@gmail.com>
From: Muneendra <muneendra.kumar@broadcom.com>
Add nvme_fc_io_getuuid() to the nvme-fc transport.
The routine is invoked by the fc LLDD on a per-io request basis.
The routine translates from the fc-specific request structure to
the bio and the cgroup structure in order to obtain the fc appid
stored in the cgroup structure. If a value is not set or a bio
is not found, a NULL appid (aka uuid) will be returned to the LLDD.
Signed-off-by: Muneendra <muneendra.kumar@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
---
drivers/nvme/host/fc.c | 16 ++++++++++++++++
include/linux/nvme-fc-driver.h | 14 ++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 080f85f4105f..a484fe228cd5 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -1899,6 +1899,22 @@ nvme_fc_ctrl_ioerr_work(struct work_struct *work)
nvme_fc_error_recovery(ctrl, "transport detected io error");
}
+/*
+ * nvme_fc_io_getuuid - Routine called to get the appid field
+ * associated with request by the lldd
+ * @req:IO request from nvme fc to driver
+ * Returns: UUID if there is an appid associated with VM or
+ * NULL if the user/libvirt has not set the appid to VM
+ */
+char *nvme_fc_io_getuuid(struct nvmefc_fcp_req *req)
+{
+ struct nvme_fc_fcp_op *op = fcp_req_to_fcp_op(req);
+ struct request *rq = op->rq;
+
+ return rq->bio ? blkcg_get_fc_appid(rq->bio) : NULL;
+}
+EXPORT_SYMBOL_GPL(nvme_fc_io_getuuid);
+
static void
nvme_fc_fcpio_done(struct nvmefc_fcp_req *req)
{
diff --git a/include/linux/nvme-fc-driver.h b/include/linux/nvme-fc-driver.h
index 5358a5facdee..fa092b9be2fd 100644
--- a/include/linux/nvme-fc-driver.h
+++ b/include/linux/nvme-fc-driver.h
@@ -564,6 +564,15 @@ int nvme_fc_rcv_ls_req(struct nvme_fc_remote_port *remoteport,
void *lsreqbuf, u32 lsreqbuf_len);
+/*
+ * Routine called to get the appid field associated with request by the lldd
+ *
+ * If the return value is NULL : the user/libvirt has not set the appid to VM
+ * If the return value is non-zero: Returns the appid associated with VM
+ *
+ * @req: IO request from nvme fc to driver
+ */
+char *nvme_fc_io_getuuid(struct nvmefc_fcp_req *req);
/*
* *************** LLDD FC-NVME Target/Subsystem API ***************
@@ -1048,5 +1057,10 @@ int nvmet_fc_rcv_fcp_req(struct nvmet_fc_target_port *tgtport,
void nvmet_fc_rcv_fcp_abort(struct nvmet_fc_target_port *tgtport,
struct nvmefc_tgt_fcp_req *fcpreq);
+/*
+ * add a define, visible to the compiler, that indicates support
+ * for feature. Allows for conditional compilation in LLDDs.
+ */
+#define NVME_FC_FEAT_UUID 0x0001
#endif /* _NVME_FC_DRIVER_H */
--
2.26.2
next prev parent reply other threads:[~2022-05-10 20:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-10 20:00 [PATCH 0/4] Add VMID support to nvme-fc transport and lpfc driver James Smart
2022-05-10 20:00 ` James Smart [this message]
2022-05-12 9:50 ` [PATCH 1/4] nvme-fc: Add new routine nvme_fc_io_getuuid Hannes Reinecke
2022-05-12 23:38 ` Himanshu Madhani
2022-05-16 5:57 ` Christoph Hellwig
2022-05-10 20:00 ` [PATCH 2/4] lpfc: commonize VMID code location James Smart
2022-05-12 9:50 ` Hannes Reinecke
2022-05-12 23:45 ` Himanshu Madhani
2022-05-10 20:00 ` [PATCH 3/4] lpfc: rework lpfc_vmid_get_appid() to be protocol independent James Smart
2022-05-12 9:51 ` Hannes Reinecke
2022-05-12 23:48 ` Himanshu Madhani
2022-05-10 20:00 ` [PATCH 4/4] lpfc: Add support for vmid tagging of NVMe I/Os James Smart
2022-05-12 9:51 ` Hannes Reinecke
2022-05-12 23:50 ` Himanshu Madhani
2022-05-17 1:40 ` [PATCH 0/4] Add VMID support to nvme-fc transport and lpfc driver Martin K. Petersen
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=20220510200028.37399-2-jsmart2021@gmail.com \
--to=jsmart2021@gmail.com \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=muneendra.kumar@broadcom.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.