@@ -5245,14 +5245,66 @@ nvme_init_lm_migration_send(struct nvme_passthru_cmd *cmd,
52455245}
52465246
52475247/**
5248- * nvme_lm_migration_recv - Migration Receive command
5249- * @hdl: Transport handle
5250- * @args: &struct nvme_lm_migration_rev_args argument structure
5248+ * nvme_init_lm_migration_recv() - Initialize passthru command for
5249+ * Migration Receive command
5250+ * @cmd: Passthru command to use
5251+ * @offset: Offset: This field specifies the offset, in bytes, within
5252+ * the data available to be returned and specifies the starting
5253+ * point for that data for what is actually returned to the host.
5254+ * @mos: Management Operation Specific (MOS): This field is specific to
5255+ * the SEL type
5256+ * @cntlid: Controller ID: This field specifies the identifier of the
5257+ * controller to which the operation is performed.
5258+ * @csuuidi: Controller State UUID Index (CSUUIDI)
5259+ * @sel: Select (SEL): This field specifies the type of management
5260+ * operation to perform
5261+ * @uidx: UUID Index (UIDX)
5262+ * @csuidxp: Controller State UUID Index Parameter (CSUIDXP)
5263+ * @data: Pointer to data buffer
5264+ * @len: Length of @data
52515265 *
5252- * Return: 0 on success, the nvme command status if a response was
5253- * received (see &enum nvme_status_field) or a negative error otherwise.
5266+ * Initializes the passthru command buffer for the Migration Receive command.
52545267 */
5255- int nvme_lm_migration_recv (struct nvme_transport_handle * hdl , struct nvme_lm_migration_recv_args * args );
5268+ static inline void
5269+ nvme_init_lm_migration_recv (struct nvme_passthru_cmd * cmd ,
5270+ __u64 offset , __u16 mos , __u16 cntlid , __u16 csuuidi , __u8 sel ,
5271+ __u8 uidx , __u8 csuidxp , void * data , __u32 len )
5272+ {
5273+ __u32 cdw11 = 0 ;
5274+ __u32 data_len = 0 ;
5275+
5276+ if (sel == NVME_LM_SEL_GET_CONTROLLER_STATE ) {
5277+ cdw11 = NVME_FIELD_ENCODE (csuidxp ,
5278+ NVME_LM_GET_CONTROLLER_STATE_CSUIDXP_SHIFT ,
5279+ NVME_LM_GET_CONTROLLER_STATE_CSUIDXP_MASK ) |
5280+ NVME_FIELD_ENCODE (csuuidi ,
5281+ NVME_LM_GET_CONTROLLER_STATE_CSUUIDI_SHIFT ,
5282+ NVME_LM_GET_CONTROLLER_STATE_CSUUIDI_MASK ) |
5283+ NVME_FIELD_ENCODE (cntlid ,
5284+ NVME_LM_GET_CONTROLLER_STATE_CNTLID_SHIFT ,
5285+ NVME_LM_GET_CONTROLLER_STATE_CNTLID_MASK );
5286+ data_len = len ;
5287+ }
5288+
5289+ memset (cmd , 0 , sizeof (* cmd ));
5290+
5291+ cmd -> opcode = nvme_admin_migration_receive ;
5292+ cmd -> data_len = data_len ;
5293+ cmd -> addr = (__u64 )(uintptr_t )data ;
5294+ cmd -> cdw10 = NVME_FIELD_ENCODE (sel ,
5295+ NVME_LM_MIGRATION_RECV_SEL_SHIFT ,
5296+ NVME_LM_MIGRATION_RECV_SEL_MASK ) |
5297+ NVME_FIELD_ENCODE (mos ,
5298+ NVME_LM_MIGRATION_RECV_MOS_SHIFT ,
5299+ NVME_LM_MIGRATION_RECV_MOS_MASK );
5300+ cmd -> cdw11 = cdw11 ;
5301+ cmd -> cdw12 = (__u32 )offset ;
5302+ cmd -> cdw13 = (__u32 )(offset >> 32 );
5303+ cmd -> cdw14 = NVME_FIELD_ENCODE (uidx ,
5304+ NVME_LM_MIGRATION_RECV_UIDX_SHIFT ,
5305+ NVME_LM_MIGRATION_RECV_UIDX_MASK );
5306+ cmd -> cdw15 = len ? (__u32 )((len - 1 ) / sizeof (__u32 )) : 0 ;
5307+ }
52565308
52575309/**
52585310 * nvme_lm_set_features_ctrl_data_queue - Set Controller Datea Queue feature
0 commit comments