Skip to content

Commit 2ca023a

Browse files
NateThorntonigaw
authored andcommitted
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 <n.thornton@samsung.com>
1 parent e7bf9eb commit 2ca023a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

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
@@ -9997,6 +9997,8 @@ struct nvme_ns_mgmt_host_sw_specified {
99979997
* @NVME_LM_QT_SHIFT: Shift amount to set Queue Type (QT) field relative to MOS
99989998
* @NVME_LM_QT_MASK: Mask to set QT field relative to MOS
99999999
* @NVME_LM_QT_USER_DATA_MIGRATION_QUEUE: User Data Migration Queue type
10000+
* @NVME_LM_CQS_SHIFT: Shift amount for Create Queue Specific (CQS) field
10001+
* @NVME_LM_CQS_MASK: Mask to set CQS field
1000010002
* @NVME_LM_CREATE_CDQ_PC: Physically Contiguous (PC)
1000110003
* @NVME_LM_CREATE_CDQ_CNTLID_SHIFT: Shift amount to set CNTLID field relative to MOS
1000210004
* @NVME_LM_CREATE_CDQ_CNTLID_MASK: Mask to set CNTLID field relative to MOS
@@ -10018,6 +10020,8 @@ enum nvme_lm_cdq_fields {
1001810020
/* Controller Data Queue - Create CDQ */
1001910021
NVME_LM_QT_SHIFT = 0,
1002010022
NVME_LM_QT_MASK = 0xff,
10023+
NVME_LM_CQS_SHIFT = 16,
10024+
NVME_LM_CQS_MASK = 0xffff,
1002110025
NVME_LM_QT_USER_DATA_MIGRATION_QUEUE = 0,
1002210026
NVME_LM_CREATE_CDQ_PC = 1,
1002310027
NVME_LM_CREATE_CDQ_CNTLID_SHIFT = 0,

0 commit comments

Comments
 (0)