drivers/vdpa/solidrun/snet_vdpa.h

Source file repositories/reference/linux-study-clean/drivers/vdpa/solidrun/snet_vdpa.h

File Facts

System
Linux kernel
Corpus path
drivers/vdpa/solidrun/snet_vdpa.h
Extension
.h
Size
5624 bytes
Lines
210
Domain
Driver Families
Bucket
drivers/vdpa
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 snet_vq {
	/* VQ callback */
	struct vdpa_callback cb;
	/* VQ state received from bus */
	struct vdpa_vq_state vq_state;
	/* desc base address */
	u64 desc_area;
	/* device base address */
	u64 device_area;
	/* driver base address */
	u64 driver_area;
	/* Queue size */
	u32 num;
	/* Serial ID for VQ */
	u32 sid;
	/* is ready flag */
	bool ready;
	/* IRQ number */
	u32 irq;
	/* IRQ index, DPU uses this to parse data from MSI-X table */
	u32 irq_idx;
	/* IRQ name */
	char irq_name[SNET_NAME_SIZE];
	/* pointer to mapped PCI BAR register used by this VQ to kick */
	void __iomem *kick_ptr;
};

struct snet {
	/* vdpa device */
	struct vdpa_device vdpa;
	/* Config callback */
	struct vdpa_callback cb;
	/* To lock the control mechanism */
	struct mutex ctrl_lock;
	/* Spinlock to protect critical parts in the control mechanism */
	spinlock_t ctrl_spinlock;
	/* array of virqueues */
	struct snet_vq **vqs;
	/* Used features */
	u64 negotiated_features;
	/* Device serial ID */
	u32 sid;
	/* device status */
	u8 status;
	/* boolean indicating if snet config was passed to the device */
	bool dpu_ready;
	/* IRQ number */
	u32 cfg_irq;
	/* IRQ index, DPU uses this to parse data from MSI-X table */
	u32 cfg_irq_idx;
	/* IRQ name */
	char cfg_irq_name[SNET_NAME_SIZE];
	/* BAR to access the VF */
	void __iomem *bar;
	/* PCI device */
	struct pci_dev *pdev;
	/* Pointer to snet pdev parent device */
	struct psnet *psnet;
	/* Pointer to snet config device */
	struct snet_dev_cfg *cfg;
};

struct snet_dev_cfg {
	/* Device ID following VirtIO spec. */
	u32 virtio_id;
	/* Number of VQs for this device */
	u32 vq_num;
	/* Size of every VQ */
	u32 vq_size;
	/* Virtual Function id */
	u32 vfid;
	/* Device features, following VirtIO spec */
	u64 features;
	/* Reserved for future usage */
	u32 rsvd[6];
	/* VirtIO device specific config size */
	u32 cfg_size;
	/* VirtIO device specific config address */
	void __iomem *virtio_cfg;
} __packed;

struct snet_cfg {
	/* Magic key */
	u32 key;
	/* Size of total config in bytes */
	u32 cfg_size;
	/* Config version */
	u32 cfg_ver;
	/* Number of Virtual Functions to create */
	u32 vf_num;

Annotation

Implementation Notes