drivers/vfio/pci/mlx5/cmd.h

Source file repositories/reference/linux-study-clean/drivers/vfio/pci/mlx5/cmd.h

File Facts

System
Linux kernel
Corpus path
drivers/vfio/pci/mlx5/cmd.h
Extension
.h
Size
7183 bytes
Lines
252
Domain
Driver Families
Bucket
drivers/vfio
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct mlx5_vf_migration_tag_stop_copy_data {
	__le64 stop_copy_size;
};

enum mlx5_vf_migf_header_flags {
	MLX5_MIGF_HEADER_FLAGS_TAG_MANDATORY = 0,
	MLX5_MIGF_HEADER_FLAGS_TAG_OPTIONAL = 1 << 0,
};

enum mlx5_vf_migf_header_tag {
	MLX5_MIGF_HEADER_TAG_FW_DATA = 0,
	MLX5_MIGF_HEADER_TAG_STOP_COPY_SIZE = 1 << 0,
};

struct mlx5_vf_migration_header {
	__le64 record_size;
	/* For future use in case we may need to change the kernel protocol */
	__le32 flags; /* Use mlx5_vf_migf_header_flags */
	__le32 tag; /* Use mlx5_vf_migf_header_tag */
	__u8 data[]; /* Its size is given in the record_size */
};

struct mlx5_vhca_data_buffer {
	struct page **page_list;
	struct dma_iova_state state;
	loff_t start_pos;
	u64 length;
	u32 npages;
	u32 mkey;
	u32 *mkey_in;
	enum dma_data_direction dma_dir;
	u8 stop_copy_chunk_num;
	bool pre_copy_init_bytes_chunk;
	struct list_head buf_elm;
	struct mlx5_vf_migration_file *migf;
};

struct mlx5vf_async_data {
	struct mlx5_async_work cb_work;
	struct work_struct work;
	struct mlx5_vhca_data_buffer *buf;
	struct mlx5_vhca_data_buffer *header_buf;
	int status;
	u8 stop_copy_chunk:1;
	void *out;
};

struct mlx5vf_save_work_data {
	struct mlx5_vf_migration_file *migf;
	size_t next_required_umem_size;
	struct work_struct work;
	u8 chunk_num;
};

#define MAX_NUM_CHUNKS 2

struct mlx5_vf_migration_file {
	struct file *filp;
	struct mutex lock;
	enum mlx5_vf_migf_state state;

	enum mlx5_vf_load_state load_state;
	u32 pdn;
	loff_t max_pos;
	u64 record_size;
	u32 record_tag;
	u64 stop_copy_prep_size;
	u64 pre_copy_initial_bytes;
	u64 pre_copy_initial_bytes_start;
	size_t next_required_umem_size;
	u8 num_ready_chunks;
	/* Upon chunk mode preserve another set of buffers for stop_copy phase */
	struct mlx5_vhca_data_buffer *buf[MAX_NUM_CHUNKS];
	struct mlx5_vhca_data_buffer *buf_header[MAX_NUM_CHUNKS];
	struct mlx5vf_save_work_data save_data[MAX_NUM_CHUNKS];
	spinlock_t list_lock;
	struct list_head buf_list;
	struct list_head avail_list;
	struct mlx5vf_pci_core_device *mvdev;
	wait_queue_head_t poll_wait;
	struct completion save_comp;
	struct mlx5_async_ctx async_ctx;
	struct mlx5vf_async_data async_data;
	u8 inflight_save:1;
};

struct mlx5_vhca_cq_buf {
	struct mlx5_frag_buf_ctrl fbc;
	struct mlx5_frag_buf frag_buf;
	int cqe_size;

Annotation

Implementation Notes