From: Chaitanya Kulkarni <chaitanyak@nvidia.com>
To: <linux-nvme@lists.infradead.org>
Cc: <hch@lst.de>, <kbusch@kernel.org>, <sagi@grimberg.me>,
Chaitanya Kulkarni <kch@nvidia.com>
Subject: [PATCH 5/9] nvme-fc: centralize admin tagset initialization
Date: Fri, 28 Jan 2022 01:20:11 -0800 [thread overview]
Message-ID: <20220128092015.19289-6-chaitanyak@nvidia.com> (raw)
In-Reply-To: <20220128092015.19289-1-chaitanyak@nvidia.com>
From: Chaitanya Kulkarni <kch@nvidia.com>
Add and use helper to remove duplicate code for admin tag initialization
for all transports.
Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
drivers/nvme/host/fc.c | 12 +++---------
drivers/nvme/host/nvme.h | 17 +++++++++++++++++
2 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 23c896a138a3..ec2afedfa991 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -3529,18 +3529,12 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
nvme_fc_init_queue(ctrl, 0);
- memset(&ctrl->admin_tag_set, 0, sizeof(ctrl->admin_tag_set));
- ctrl->admin_tag_set.ops = &nvme_fc_admin_mq_ops;
- ctrl->admin_tag_set.queue_depth = NVME_AQ_MQ_TAG_DEPTH;
- ctrl->admin_tag_set.reserved_tags = NVMF_RESERVED_TAGS;
- ctrl->admin_tag_set.numa_node = ctrl->ctrl.numa_node;
+ nvme_init_admin_tagset(&(ctrl->admin_tag_set), ctrl,
+ ctrl->ctrl.numa_node, &nvme_fc_admin_mq_ops,
+ BLK_MQ_F_NO_SCHED, NVMF_RESERVED_TAGS);
ctrl->admin_tag_set.cmd_size =
struct_size((struct nvme_fcp_op_w_sgl *)NULL, priv,
ctrl->lport->ops->fcprqst_priv_sz);
- ctrl->admin_tag_set.driver_data = ctrl;
- ctrl->admin_tag_set.nr_hw_queues = 1;
- ctrl->admin_tag_set.timeout = NVME_ADMIN_TIMEOUT;
- ctrl->admin_tag_set.flags = BLK_MQ_F_NO_SCHED;
ret = blk_mq_alloc_tag_set(&ctrl->admin_tag_set);
if (ret)
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index f8658f984d64..6a3fd759415a 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -938,4 +938,21 @@ static inline bool nvme_multi_css(struct nvme_ctrl *ctrl)
return (ctrl->ctrl_config & NVME_CC_CSS_MASK) == NVME_CC_CSS_CSI;
}
+static inline void nvme_init_admin_tagset(struct blk_mq_tag_set *set,
+ void *driver_data, int numa_node,
+ const struct blk_mq_ops *ops,
+ unsigned int flags,
+ unsigned int reserved_tags)
+{
+ memset(set, 0, sizeof(*set));
+ set->driver_data = driver_data;
+ set->numa_node = numa_node;
+ set->ops = ops;
+ set->flags = flags;
+ set->reserved_tags = reserved_tags;
+ set->queue_depth = NVME_AQ_MQ_TAG_DEPTH;
+ set->nr_hw_queues = 1;
+ set->timeout = NVME_ADMIN_TIMEOUT;
+}
+
#endif /* _NVME_H */
--
2.29.0
next prev parent reply other threads:[~2022-01-28 9:26 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-28 9:20 [PATCH 0/9] nvme: add helpers and remove duplicate code Chaitanya Kulkarni
2022-01-28 9:20 ` [PATCH 1/9] nvme-fc: add a helper to initialize connect_q Chaitanya Kulkarni
2022-01-28 9:23 ` Chaitanya Kulkarni
2022-01-30 9:44 ` Sagi Grimberg
2022-02-01 8:09 ` Christoph Hellwig
2022-01-28 9:20 ` [PATCH 2/9] nvme-rdma: use " Chaitanya Kulkarni
2022-01-30 9:44 ` Sagi Grimberg
2022-01-28 9:20 ` [PATCH 3/9] nvme-tcp: " Chaitanya Kulkarni
2022-01-30 9:44 ` Sagi Grimberg
2022-01-28 9:20 ` [PATCH 4/9] nvme-loop: " Chaitanya Kulkarni
2022-01-30 9:44 ` Sagi Grimberg
2022-01-28 9:20 ` Chaitanya Kulkarni [this message]
2022-01-28 9:23 ` [PATCH 5/9] nvme-fc: centralize admin tagset initialization Chaitanya Kulkarni
2022-01-30 9:47 ` Sagi Grimberg
2022-02-02 6:48 ` Chaitanya Kulkarni
2022-02-01 8:11 ` Christoph Hellwig
2022-02-02 6:46 ` Chaitanya Kulkarni
2022-01-28 9:20 ` [PATCH 6/9] nvme-pci: use helper for " Chaitanya Kulkarni
2022-01-28 9:20 ` [PATCH 7/9] nvme-rdma: " Chaitanya Kulkarni
2022-01-28 9:20 ` [PATCH 8/9] nvme-tcp: " Chaitanya Kulkarni
2022-01-28 9:20 ` [PATCH 9/9] nvme-loop: " Chaitanya Kulkarni
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=20220128092015.19289-6-chaitanyak@nvidia.com \
--to=chaitanyak@nvidia.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=kch@nvidia.com \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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.