Skip to content

Commit 63e8fd6

Browse files
mgurtovoykeithbusch
authored andcommitted
nvmet: set maxcmd to be per controller
This is a preparation for having a dynamic configuration of max queue size for a controller. Make sure that the maxcmd field stays the same as the MQES (+1) value as we do today. Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Israel Rukshin <israelr@nvidia.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com> Signed-off-by: Keith Busch <kbusch@kernel.org>
1 parent 143667e commit 63e8fd6

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/nvme/target/admin-cmd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req)
428428
id->cqes = (0x4 << 4) | 0x4;
429429

430430
/* no enforcement soft-limit for maxcmd - pick arbitrary high value */
431-
id->maxcmd = cpu_to_le16(NVMET_MAX_CMD);
431+
id->maxcmd = cpu_to_le16(NVMET_MAX_CMD(ctrl));
432432

433433
id->nn = cpu_to_le32(NVMET_MAX_NAMESPACES);
434434
id->mnan = cpu_to_le32(NVMET_MAX_NAMESPACES);

drivers/nvme/target/discovery.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ static void nvmet_execute_disc_identify(struct nvmet_req *req)
282282
id->lpa = (1 << 2);
283283

284284
/* no enforcement soft-limit for maxcmd - pick arbitrary high value */
285-
id->maxcmd = cpu_to_le16(NVMET_MAX_CMD);
285+
id->maxcmd = cpu_to_le16(NVMET_MAX_CMD(ctrl));
286286

287287
id->sgls = cpu_to_le32(1 << 0); /* we always support SGLs */
288288
if (ctrl->ops->flags & NVMF_KEYED_SGLS)

drivers/nvme/target/nvmet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ void nvmet_add_async_event(struct nvmet_ctrl *ctrl, u8 event_type,
545545

546546
#define NVMET_QUEUE_SIZE 1024
547547
#define NVMET_NR_QUEUES 128
548-
#define NVMET_MAX_CMD NVMET_QUEUE_SIZE
548+
#define NVMET_MAX_CMD(ctrl) (NVME_CAP_MQES(ctrl->cap) + 1)
549549

550550
/*
551551
* Nice round number that makes a list of nsids fit into a page.

drivers/nvme/target/passthru.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ static u16 nvmet_passthru_override_id_ctrl(struct nvmet_req *req)
132132

133133
id->sqes = min_t(__u8, ((0x6 << 4) | 0x6), id->sqes);
134134
id->cqes = min_t(__u8, ((0x4 << 4) | 0x4), id->cqes);
135-
id->maxcmd = cpu_to_le16(NVMET_MAX_CMD);
135+
id->maxcmd = cpu_to_le16(NVMET_MAX_CMD(ctrl));
136136

137137
/* don't support fuse commands */
138138
id->fuses = 0;

0 commit comments

Comments
 (0)