Skip to content

Commit 19cc7c9

Browse files
committed
types: Add Create Queue Specific (CQS) shift and mask for LM CDQ command
While the NVMe standard defines the Controller Data Queue command's CNTLID field as bits 15:00, this field is offset into CDW11 by the Create Queue Specific (CQS) field in bits 31:16, making the existing CDW format incorrect Define the `NVME_LM_CQS_SHIFT` and `NVME_LM_CQS_MASK` fields and use the in the `nvme_lm_cdq` ioctl. Signed-off-by: Nate Thornton <[email protected]>
1 parent 4cef519 commit 19cc7c9

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/nvme/ioctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2400,7 +2400,7 @@ int nvme_lm_cdq(struct nvme_lm_cdq_args *args)
24002400
sz = args->sz;
24012401

24022402
if (args->sel == NVME_LM_SEL_CREATE_CDQ) {
2403-
cdw11 = NVME_SET(args->cntlid, LM_CREATE_CDQ_CNTLID) |
2403+
cdw11 = NVME_SET(NVME_SET(args->cntlid, LM_CREATE_CDQ_CNTLID), LM_CQS) |
24042404
NVME_LM_CREATE_CDQ_PC;
24052405
data_len = sz << 2;
24062406
} else if (args->sel == NVME_LM_SEL_DELETE_CDQ) {

src/nvme/types.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9995,6 +9995,8 @@ struct nvme_ns_mgmt_host_sw_specified {
99959995
* @NVME_LM_QT_SHIFT: Shift amount to set Queue Type (QT) field relative to MOS
99969996
* @NVME_LM_QT_MASK: Mask to set QT field relative to MOS
99979997
* @NVME_LM_QT_USER_DATA_MIGRATION_QUEUE: User Data Migration Queue type
9998+
* @NVME_LM_CQS_SHIFT: Shift amount for Create Queue Specific (CQS) field
9999+
* @NVME_LM_CQS_MASK: Mask to set CQS field
999810000
* @NVME_LM_CREATE_CDQ_PC: Physically Contiguous (PC)
999910001
* @NVME_LM_CREATE_CDQ_CNTLID_SHIFT: Shift amount to set CNTLID field relative to MOS
1000010002
* @NVME_LM_CREATE_CDQ_CNTLID_MASK: Mask to set CNTLID field relative to MOS
@@ -10016,6 +10018,8 @@ enum nvme_lm_cdq_fields {
1001610018
/* Controller Data Queue - Create CDQ */
1001710019
NVME_LM_QT_SHIFT = 0,
1001810020
NVME_LM_QT_MASK = 0xff,
10021+
NVME_LM_CQS_SHIFT = 16,
10022+
NVME_LM_CQS_MASK = 0xffff,
1001910023
NVME_LM_QT_USER_DATA_MIGRATION_QUEUE = 0,
1002010024
NVME_LM_CREATE_CDQ_PC = 1,
1002110025
NVME_LM_CREATE_CDQ_CNTLID_SHIFT = 0,

0 commit comments

Comments
 (0)