@@ -5063,14 +5063,79 @@ nvme_init_dim_send(struct nvme_passthru_cmd *cmd,
50635063}
50645064
50655065/**
5066- * nvme_lm_cdq() - Controller Data Queue - Controller Data Queue command
5067- * @hdl: Transport handle
5068- * @args: &struct nvme_lm_cdq_args argument structure
5066+ * nvme_init_lm_cdq_create() - Initialize passthru command for
5067+ * Controller Data Queue create - Controller Data Queue command
5068+ * @cmd: Passthru command to use
5069+ * @mos: Management Operation Specific (MOS): This field is
5070+ * specific to the SEL type
5071+ * @cntlid: Controller ID: For Create CDQ, specifies the target
5072+ * migratable controller
5073+ * @cdqsize: For Create CDQ, specifies the size of CDQ, in dwords - 4 byte
5074+ * @data: Pointer to data buffer
50695075 *
5070- * Return: The nvme command status if a response was received (see
5071- * &enum nvme_status_field) or -1 with errno set otherwise.)
5076+ * Initializes the passthru command buffer for the Controller Data Queue
5077+ * command. Note: The result CDQID is returned in the CQE dword0, which the
5078+ * submission function must handle.
5079+ */
5080+ static inline void
5081+ nvme_init_lm_cdq_create (struct nvme_passthru_cmd * cmd ,
5082+ __u16 mos , __u16 cntlid , __u32 cdqsize , void * data )
5083+ {
5084+ __u16 cqs ;
5085+
5086+ memset (cmd , 0 , sizeof (* cmd ));
5087+
5088+ cqs = NVME_FIELD_ENCODE (cntlid ,
5089+ NVME_LM_CREATE_CDQ_CNTLID_SHIFT ,
5090+ NVME_LM_CREATE_CDQ_CNTLID_MASK );
5091+
5092+ cmd -> opcode = nvme_admin_ctrl_data_queue ;
5093+ cmd -> data_len = cdqsize << 2 ;
5094+ cmd -> addr = (__u64 )(uintptr_t )data ;
5095+ cmd -> cdw10 = NVME_FIELD_ENCODE (NVME_LM_SEL_CREATE_CDQ ,
5096+ NVME_LM_CDQ_SEL_SHIFT ,
5097+ NVME_LM_CDQ_SEL_MASK ) |
5098+ NVME_FIELD_ENCODE (mos ,
5099+ NVME_LM_CDQ_MOS_SHIFT ,
5100+ NVME_LM_CDQ_MOS_MASK );
5101+ cmd -> cdw11 = NVME_FIELD_ENCODE (NVME_LM_CREATE_CDQ_PC ,
5102+ NVME_LM_CREATE_CDQ_PC_SHIFT ,
5103+ NVME_LM_CREATE_CDQ_PC_MASK ) |
5104+ NVME_FIELD_ENCODE (cqs ,
5105+ NVME_LM_CQS_SHIFT ,
5106+ NVME_LM_CQS_MASK );
5107+ cmd -> cdw12 = cdqsize ;
5108+ }
5109+
5110+ /**
5111+ * nvme_init_lm_cdq_delete() - Initialize passthru command for
5112+ * Controller Data Queue delete - Controller Data Queue command
5113+ * @cmd: Passthru command to use
5114+ * @mos: Management Operation Specific (MOS): This field is
5115+ * specific to the SEL type
5116+ * @cdqid: Controller Data Queue ID (CDQID): For Delete CDQ, this
5117+ * field is the CDQID to delete.
5118+ *
5119+ * Initializes the passthru command buffer for the Controller Data Queue delete
5120+ * command.
50725121 */
5073- int nvme_lm_cdq (struct nvme_transport_handle * hdl , struct nvme_lm_cdq_args * args );
5122+ static inline void
5123+ nvme_init_lm_cdq_delete (struct nvme_passthru_cmd * cmd ,
5124+ __u16 mos , __u16 cdqid )
5125+ {
5126+ memset (cmd , 0 , sizeof (* cmd ));
5127+
5128+ cmd -> opcode = nvme_admin_ctrl_data_queue ;
5129+ cmd -> cdw10 = NVME_FIELD_ENCODE (NVME_LM_SEL_DELETE_CDQ ,
5130+ NVME_LM_CDQ_SEL_SHIFT ,
5131+ NVME_LM_CDQ_SEL_MASK ) |
5132+ NVME_FIELD_ENCODE (mos ,
5133+ NVME_LM_CDQ_MOS_SHIFT ,
5134+ NVME_LM_CDQ_MOS_MASK );
5135+ cmd -> cdw11 = NVME_FIELD_ENCODE (cdqid ,
5136+ NVME_LM_DELETE_CDQ_CDQID_SHIFT ,
5137+ NVME_LM_DELETE_CDQ_CDQID_MASK );
5138+ }
50745139
50755140/**
50765141 * nvme_lm_track_send() - Track Send command
0 commit comments