@@ -5166,14 +5166,83 @@ nvme_init_lm_track_send(struct nvme_passthru_cmd *cmd,
51665166}
51675167
51685168/**
5169- * nvme_lm_migration_send() - Migration Send command
5170- * @hdl: Transport handle
5171- * @args: &struct nvme_lm_migration_send_args argument structure
5169+ * nvme_init_lm_migration_send() - Initialize passthru command for
5170+ * Migration Send command
5171+ * @cmd: Passthru command to use
5172+ * @sel: Select (SEL): This field specifies the type of management
5173+ * operation to perform.
5174+ * @mos: Management Operation Specific (MOS): This field is specific
5175+ * to the SEL type
5176+ * @cntlid: Controller ID: This field specifies the identifier of the
5177+ * controller to which the operation is performed.
5178+ * @stype: Suspend Type (STYPE): This field specifies the type of suspend.
5179+ * @dudmq: Delete User Data Migration Queue (DUDMQ): If set, the migration
5180+ * queue is deleted is deleted as part of the Suspend operation.
5181+ * @csvi: Controller State Version Index (CSVI)
5182+ * @csuuidi: Controller State UUID Index (CSUUIDI)
5183+ * @cso: Offset: This field specifies the offset, in bytes, within
5184+ * the data available to be returned and specifies the starting
5185+ * point for that data for what is actually returned to the host.
5186+ * @uidx: UUID Index (UIDX)
5187+ * @data: Pointer to data buffer
5188+ * @len: Length of @data
51725189 *
5173- * Return: 0 on success, the nvme command status if a response was
5174- * received (see &enum nvme_status_field) or a negative error otherwise.
5190+ * Initializes the passthru command buffer for the Migration Send command.
51755191 */
5176- int nvme_lm_migration_send (struct nvme_transport_handle * hdl , struct nvme_lm_migration_send_args * args );
5192+ static inline void
5193+ nvme_init_lm_migration_send (struct nvme_passthru_cmd * cmd ,
5194+ __u16 sel , __u16 mos , __u16 cntlid , __u8 stype , bool dudmq ,
5195+ __u8 csvi , __u16 csuuidi , __u64 cso , __u8 uidx ,
5196+ void * data , __u32 len )
5197+ {
5198+ __u32 cdw10 = NVME_FIELD_ENCODE (sel ,
5199+ NVME_LM_MIGRATION_SEND_SEL_SHIFT ,
5200+ NVME_LM_MIGRATION_SEND_SEL_MASK ) |
5201+ NVME_FIELD_ENCODE (mos ,
5202+ NVME_LM_MIGRATION_SEND_MOS_SHIFT ,
5203+ NVME_LM_MIGRATION_SEND_MOS_MASK );
5204+ __u32 cdw11 = 0 ;
5205+ __u32 cdw14 = NVME_FIELD_ENCODE (uidx ,
5206+ NVME_LM_MIGRATION_SEND_UIDX_SHIFT ,
5207+ NVME_LM_MIGRATION_SEND_UIDX_MASK );
5208+
5209+ if (sel == NVME_LM_SEL_SUSPEND ) {
5210+ cdw11 = NVME_FIELD_ENCODE (stype ,
5211+ NVME_LM_STYPE_SHIFT ,
5212+ NVME_LM_STYPE_MASK ) |
5213+ NVME_FIELD_ENCODE (cntlid ,
5214+ NVME_LM_SUSPEND_CNTLID_SHIFT ,
5215+ NVME_LM_SUSPEND_CNTLID_MASK );
5216+ if (dudmq )
5217+ cdw11 |= NVME_LM_DUDMQ ;
5218+ } else if (sel == NVME_LM_SEL_RESUME ) {
5219+ cdw11 = NVME_FIELD_ENCODE (cntlid ,
5220+ NVME_LM_RESUME_CNTLID_SHIFT ,
5221+ NVME_LM_RESUME_CNTLID_MASK );
5222+ } else if (sel == NVME_LM_SEL_SET_CONTROLLER_STATE ) {
5223+ cdw11 = NVME_FIELD_ENCODE (csuuidi ,
5224+ NVME_LM_SET_CONTROLLER_STATE_CSUUIDI_SHIFT ,
5225+ NVME_LM_SET_CONTROLLER_STATE_CSUUIDI_MASK ) |
5226+ NVME_FIELD_ENCODE (csvi ,
5227+ NVME_LM_SET_CONTROLLER_STATE_CSVI_SHIFT ,
5228+ NVME_LM_SET_CONTROLLER_STATE_CSVI_MASK ) |
5229+ NVME_FIELD_ENCODE (cntlid ,
5230+ NVME_LM_SET_CONTROLLER_STATE_CNTLID_SHIFT ,
5231+ NVME_LM_SET_CONTROLLER_STATE_CNTLID_MASK );
5232+ }
5233+
5234+ memset (cmd , 0 , sizeof (* cmd ));
5235+
5236+ cmd -> opcode = nvme_admin_migration_send ;
5237+ cmd -> data_len = len ;
5238+ cmd -> addr = (__u64 )(uintptr_t )data ;
5239+ cmd -> cdw10 = cdw10 ;
5240+ cmd -> cdw11 = cdw11 ;
5241+ cmd -> cdw12 = (__u32 )cso ;
5242+ cmd -> cdw13 = (__u32 )(cso >> 32 );
5243+ cmd -> cdw14 = cdw14 ;
5244+ cmd -> cdw15 = len / sizeof (__u32 );
5245+ }
51775246
51785247/**
51795248 * nvme_lm_migration_recv - Migration Receive command
0 commit comments