Skip to content

Commit

Permalink
nvme-apple: use lib tagset init helper
Browse files Browse the repository at this point in the history
Use the block layer helper to initialize the common fields of tag_set
such as blk_mq_ops, number of h/w queues, queue depth, command size,
numa_node, timeout, BLK_MQ_F_XXX flags, driver data. This initialization
is spread all over the block drivers. This avoids the code repetation of
the inialization code of the tag set in current block drivers and any
future ones.

Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
  • Loading branch information
Chaitanya Kulkarni authored and intel-lab-lkp committed Oct 5, 2022
1 parent ba871e1 commit 1466169
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions drivers/nvme/host/apple.c
Expand Up @@ -1228,15 +1228,10 @@ static int apple_nvme_alloc_tagsets(struct apple_nvme *anv)
{
int ret;

anv->admin_tagset.ops = &apple_nvme_mq_admin_ops;
anv->admin_tagset.nr_hw_queues = 1;
anv->admin_tagset.queue_depth = APPLE_NVME_AQ_MQ_TAG_DEPTH;
anv->admin_tagset.timeout = NVME_ADMIN_TIMEOUT;
anv->admin_tagset.numa_node = NUMA_NO_NODE;
anv->admin_tagset.cmd_size = sizeof(struct apple_nvme_iod);
anv->admin_tagset.flags = BLK_MQ_F_NO_SCHED;
anv->admin_tagset.driver_data = &anv->adminq;

blk_mq_init_tag_set(&anv->admin_tagset, &apple_nvme_mq_admin_ops, 1,
APPLE_NVME_AQ_MQ_TAG_DEPTH, sizeof(struct apple_nvme_iod),
NUMA_NO_NODE, NVME_ADMIN_TIMEOUT, BLK_MQ_F_NO_SCHED,
&anv->adminq);
ret = blk_mq_alloc_tag_set(&anv->admin_tagset);
if (ret)
return ret;
Expand All @@ -1245,22 +1240,18 @@ static int apple_nvme_alloc_tagsets(struct apple_nvme *anv)
if (ret)
return ret;

anv->tagset.ops = &apple_nvme_mq_ops;
anv->tagset.nr_hw_queues = 1;
anv->tagset.nr_maps = 1;
/*
* Tags are used as an index to the NVMMU and must be unique across
* both queues. The admin queue gets the first APPLE_NVME_AQ_DEPTH which
* must be marked as reserved in the IO queue.
*/
anv->tagset.reserved_tags = APPLE_NVME_AQ_DEPTH;
anv->tagset.queue_depth = APPLE_ANS_MAX_QUEUE_DEPTH - 1;
anv->tagset.timeout = NVME_IO_TIMEOUT;
anv->tagset.numa_node = NUMA_NO_NODE;
anv->tagset.cmd_size = sizeof(struct apple_nvme_iod);
anv->tagset.flags = BLK_MQ_F_SHOULD_MERGE;
anv->tagset.driver_data = &anv->ioq;

blk_mq_init_tag_set(&anv->admin_tagset, &apple_nvme_mq_admin_ops, 1,
APPLE_ANS_MAX_QUEUE_DEPTH - 1, sizeof(struct apple_nvme_iod),
NUMA_NO_NODE, NVME_IO_TIMEOUT, BLK_MQ_F_SHOULD_MERGE,
&anv->ioq);
ret = blk_mq_alloc_tag_set(&anv->tagset);
if (ret)
return ret;
Expand Down

0 comments on commit 1466169

Please sign in to comment.