@@ -4197,22 +4197,37 @@ nvme_init_dev_self_test(struct nvme_passthru_cmd *cmd, __u32 nsid,
41974197}
41984198
41994199/**
4200- * nvme_virtual_mgmt() - Virtualization resource management
4201- * @hdl: Transport handle
4202- * @args: &struct nvme_virtual_mgmt_args argument structure
4203- *
4204- * The Virtualization Management command is supported by primary controllers
4205- * that support the Virtualization Enhancements capability. This command is
4206- * used for several functions:
4207- *
4208- * - Modifying Flexible Resource allocation for the primary controller
4209- * - Assigning Flexible Resources for secondary controllers
4210- * - Setting the Online and Offline state for secondary controllers
4200+ * nvme_init_virtual_mgmt() - Initialize passthru command for
4201+ * Virtualization Resource Management
4202+ * @cmd: Passthru command to use
4203+ * @act: Virtual resource action, see &enum nvme_virt_mgmt_act
4204+ * @rt: Resource type to modify, see &enum nvme_virt_mgmt_rt
4205+ * @cntlid: Controller id for which resources are bing modified
4206+ * @nr: Number of resources being allocated or assigned
42114207 *
4212- * Return: 0 on success, the nvme command status if a response was
4213- * received (see &enum nvme_status_field) or a negative error otherwise .
4208+ * Initializes the passthru command buffer for the Virtualization
4209+ * Management command .
42144210 */
4215- int nvme_virtual_mgmt (struct nvme_transport_handle * hdl , struct nvme_virtual_mgmt_args * args );
4211+ static inline void
4212+ nvme_init_virtual_mgmt (struct nvme_passthru_cmd * cmd ,
4213+ enum nvme_virt_mgmt_act act , enum nvme_virt_mgmt_rt rt ,
4214+ __u16 cntlid , __u16 nr )
4215+ {
4216+ memset (cmd , 0 , sizeof (* cmd ));
4217+ cmd -> opcode = nvme_admin_virtual_mgmt ;
4218+ cmd -> cdw10 = NVME_FIELD_ENCODE (act ,
4219+ NVME_VIRT_MGMT_CDW10_ACT_SHIFT ,
4220+ NVME_VIRT_MGMT_CDW10_ACT_MASK ) |
4221+ NVME_FIELD_ENCODE (rt ,
4222+ NVME_VIRT_MGMT_CDW10_RT_SHIFT ,
4223+ NVME_VIRT_MGMT_CDW10_RT_MASK ) |
4224+ NVME_FIELD_ENCODE (cntlid ,
4225+ NVME_VIRT_MGMT_CDW10_CNTLID_SHIFT ,
4226+ NVME_VIRT_MGMT_CDW10_CNTLID_MASK );
4227+ cmd -> cdw11 = NVME_FIELD_ENCODE (nr ,
4228+ NVME_VIRT_MGMT_CDW11_NR_SHIFT ,
4229+ NVME_VIRT_MGMT_CDW11_NR_MASK );
4230+ }
42164231
42174232/**
42184233 * nvme_flush() - Send an nvme flush command
0 commit comments