Skip to content

Commit ed01fee

Browse files
author
Christoph Hellwig
committed
nvme-fabrics: only reserve a single tag
Fabrics drivers currently reserve two tags on the admin queue. But given that the connect command is only run on a freshly created queue or after all commands have been force aborted we only need to reserve a single tag. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Reviewed-by: Daniel Wagner <[email protected]>
1 parent 1e28eed commit ed01fee

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

drivers/nvme/host/fabrics.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
/* default is -1: the fail fast mechanism is disabled */
1919
#define NVMF_DEF_FAIL_FAST_TMO -1
2020

21+
/*
22+
* Reserved one command for internal usage. This command is used for sending
23+
* the connect command, as well as for the keep alive command on the admin
24+
* queue once live.
25+
*/
26+
#define NVMF_RESERVED_TAGS 1
27+
2128
/*
2229
* Define a host as seen by the target. We allocate one at boot, but also
2330
* allow the override it when creating controllers. This is both to provide

drivers/nvme/host/fc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2863,7 +2863,7 @@ nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl)
28632863
memset(&ctrl->tag_set, 0, sizeof(ctrl->tag_set));
28642864
ctrl->tag_set.ops = &nvme_fc_mq_ops;
28652865
ctrl->tag_set.queue_depth = ctrl->ctrl.opts->queue_size;
2866-
ctrl->tag_set.reserved_tags = 1; /* fabric connect */
2866+
ctrl->tag_set.reserved_tags = NVMF_RESERVED_TAGS;
28672867
ctrl->tag_set.numa_node = ctrl->ctrl.numa_node;
28682868
ctrl->tag_set.flags = BLK_MQ_F_SHOULD_MERGE;
28692869
ctrl->tag_set.cmd_size =
@@ -3485,7 +3485,7 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
34853485
memset(&ctrl->admin_tag_set, 0, sizeof(ctrl->admin_tag_set));
34863486
ctrl->admin_tag_set.ops = &nvme_fc_admin_mq_ops;
34873487
ctrl->admin_tag_set.queue_depth = NVME_AQ_MQ_TAG_DEPTH;
3488-
ctrl->admin_tag_set.reserved_tags = 2; /* fabric connect + Keep-Alive */
3488+
ctrl->admin_tag_set.reserved_tags = NVMF_RESERVED_TAGS;
34893489
ctrl->admin_tag_set.numa_node = ctrl->ctrl.numa_node;
34903490
ctrl->admin_tag_set.cmd_size =
34913491
struct_size((struct nvme_fcp_op_w_sgl *)NULL, priv,

drivers/nvme/host/rdma.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ static struct blk_mq_tag_set *nvme_rdma_alloc_tagset(struct nvme_ctrl *nctrl,
798798
memset(set, 0, sizeof(*set));
799799
set->ops = &nvme_rdma_admin_mq_ops;
800800
set->queue_depth = NVME_AQ_MQ_TAG_DEPTH;
801-
set->reserved_tags = 2; /* connect + keep-alive */
801+
set->reserved_tags = NVMF_RESERVED_TAGS;
802802
set->numa_node = nctrl->numa_node;
803803
set->cmd_size = sizeof(struct nvme_rdma_request) +
804804
NVME_RDMA_DATA_SGL_SIZE;
@@ -811,7 +811,7 @@ static struct blk_mq_tag_set *nvme_rdma_alloc_tagset(struct nvme_ctrl *nctrl,
811811
memset(set, 0, sizeof(*set));
812812
set->ops = &nvme_rdma_mq_ops;
813813
set->queue_depth = nctrl->sqsize + 1;
814-
set->reserved_tags = 1; /* fabric connect */
814+
set->reserved_tags = NVMF_RESERVED_TAGS;
815815
set->numa_node = nctrl->numa_node;
816816
set->flags = BLK_MQ_F_SHOULD_MERGE;
817817
set->cmd_size = sizeof(struct nvme_rdma_request) +

drivers/nvme/host/tcp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,7 +1575,7 @@ static struct blk_mq_tag_set *nvme_tcp_alloc_tagset(struct nvme_ctrl *nctrl,
15751575
memset(set, 0, sizeof(*set));
15761576
set->ops = &nvme_tcp_admin_mq_ops;
15771577
set->queue_depth = NVME_AQ_MQ_TAG_DEPTH;
1578-
set->reserved_tags = 2; /* connect + keep-alive */
1578+
set->reserved_tags = NVMF_RESERVED_TAGS;
15791579
set->numa_node = nctrl->numa_node;
15801580
set->flags = BLK_MQ_F_BLOCKING;
15811581
set->cmd_size = sizeof(struct nvme_tcp_request);
@@ -1587,7 +1587,7 @@ static struct blk_mq_tag_set *nvme_tcp_alloc_tagset(struct nvme_ctrl *nctrl,
15871587
memset(set, 0, sizeof(*set));
15881588
set->ops = &nvme_tcp_mq_ops;
15891589
set->queue_depth = nctrl->sqsize + 1;
1590-
set->reserved_tags = 1; /* fabric connect */
1590+
set->reserved_tags = NVMF_RESERVED_TAGS;
15911591
set->numa_node = nctrl->numa_node;
15921592
set->flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_BLOCKING;
15931593
set->cmd_size = sizeof(struct nvme_tcp_request);

drivers/nvme/target/loop.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ static int nvme_loop_configure_admin_queue(struct nvme_loop_ctrl *ctrl)
349349
memset(&ctrl->admin_tag_set, 0, sizeof(ctrl->admin_tag_set));
350350
ctrl->admin_tag_set.ops = &nvme_loop_admin_mq_ops;
351351
ctrl->admin_tag_set.queue_depth = NVME_AQ_MQ_TAG_DEPTH;
352-
ctrl->admin_tag_set.reserved_tags = 2; /* connect + keep-alive */
352+
ctrl->admin_tag_set.reserved_tags = NVMF_RESERVED_TAGS;
353353
ctrl->admin_tag_set.numa_node = ctrl->ctrl.numa_node;
354354
ctrl->admin_tag_set.cmd_size = sizeof(struct nvme_loop_iod) +
355355
NVME_INLINE_SG_CNT * sizeof(struct scatterlist);
@@ -520,7 +520,7 @@ static int nvme_loop_create_io_queues(struct nvme_loop_ctrl *ctrl)
520520
memset(&ctrl->tag_set, 0, sizeof(ctrl->tag_set));
521521
ctrl->tag_set.ops = &nvme_loop_mq_ops;
522522
ctrl->tag_set.queue_depth = ctrl->ctrl.opts->queue_size;
523-
ctrl->tag_set.reserved_tags = 1; /* fabric connect */
523+
ctrl->tag_set.reserved_tags = NVMF_RESERVED_TAGS;
524524
ctrl->tag_set.numa_node = ctrl->ctrl.numa_node;
525525
ctrl->tag_set.flags = BLK_MQ_F_SHOULD_MERGE;
526526
ctrl->tag_set.cmd_size = sizeof(struct nvme_loop_iod) +

0 commit comments

Comments
 (0)