drivers/crypto/virtio/virtio_crypto_common.h

Source file repositories/reference/linux-study-clean/drivers/crypto/virtio/virtio_crypto_common.h

File Facts

System
Linux kernel
Corpus path
drivers/crypto/virtio/virtio_crypto_common.h
Extension
.h
Size
4244 bytes
Lines
154
Domain
Driver Families
Bucket
drivers/crypto
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 data_queue {
	/* Virtqueue associated with this send _queue */
	struct virtqueue *vq;

	/* To protect the vq operations for the dataq */
	spinlock_t lock;

	/* Name of the tx queue: dataq.$index */
	char name[32];

	struct crypto_engine *engine;
	struct work_struct done_work;
};

struct virtio_crypto {
	struct virtio_device *vdev;
	struct virtqueue *ctrl_vq;
	struct data_queue *data_vq;

	/* Work struct for config space updates */
	struct work_struct config_work;

	/* To protect the vq operations for the controlq */
	spinlock_t ctrl_lock;

	/* Maximum of data queues supported by the device */
	u32 max_data_queues;

	/* Number of queue currently used by the driver */
	u32 curr_queue;

	/*
	 * Specifies the services mask which the device support,
	 * see VIRTIO_CRYPTO_SERVICE_*
	 */
	u32 crypto_services;

	/* Detailed algorithms mask */
	u32 cipher_algo_l;
	u32 cipher_algo_h;
	u32 hash_algo;
	u32 mac_algo_l;
	u32 mac_algo_h;
	u32 aead_algo;
	u32 akcipher_algo;

	/* Maximum length of cipher key */
	u32 max_cipher_key_len;
	/* Maximum length of authenticated key */
	u32 max_auth_key_len;
	/* Maximum size of per request */
	u64 max_size;

	unsigned long status;
	atomic_t ref_count;
	struct list_head list;
	struct module *owner;
	uint8_t dev_id;

	/* Does the affinity hint is set for virtqueues? */
	bool affinity_hint_set;
};

struct virtio_crypto_sym_session_info {
	/* Backend session id, which come from the host side */
	__u64 session_id;
};

/*
 * Note: there are padding fields in request, clear them to zero before
 *       sending to host to avoid to divulge any information.
 * Ex, virtio_crypto_ctrl_request::ctrl::u::destroy_session::padding[48]
 */
struct virtio_crypto_ctrl_request {
	struct virtio_crypto_op_ctrl_req ctrl;
	struct virtio_crypto_session_input input;
	struct virtio_crypto_inhdr ctrl_status;
	struct completion compl;
};

struct virtio_crypto_request;
typedef void (*virtio_crypto_data_callback)
		(struct virtio_crypto_request *vc_req, int len);

struct virtio_crypto_request {
	uint8_t status;
	struct virtio_crypto_op_data_req *req_data;
	struct scatterlist **sgs;
	struct data_queue *dataq;
	virtio_crypto_data_callback alg_cb;

Annotation

Implementation Notes