drivers/crypto/intel/qat/qat_common/adf_pfvf_vf_proto.c
Source file repositories/reference/linux-study-clean/drivers/crypto/intel/qat/qat_common/adf_pfvf_vf_proto.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/intel/qat/qat_common/adf_pfvf_vf_proto.c- Extension
.c- Size
- 10739 bytes
- Lines
- 375
- Domain
- Driver Families
- Bucket
- drivers/crypto
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/completion.hlinux/minmax.hlinux/types.hadf_accel_devices.hadf_common_drv.hadf_pfvf_msg.hadf_pfvf_utils.hadf_pfvf_vf_msg.hadf_pfvf_vf_proto.h
Detected Declarations
function adf_send_vf2pf_msgfunction adf_recv_pf2vf_msgfunction adf_send_vf2pf_reqfunction adf_vf2pf_blkmsg_data_reqfunction adf_vf2pf_blkmsg_get_bytefunction adf_vf2pf_blkmsg_get_crcfunction adf_send_vf2pf_blkmsg_reqfunction adf_handle_pf2vf_msgfunction adf_recv_and_handle_pf2vf_msgfunction adf_enable_vf2pf_commsexport adf_enable_vf2pf_comms
Annotated Snippet
if (ret) {
dev_err(&GET_DEV(accel_dev),
"Failed to send request msg to PF\n");
return ret;
}
/* Wait for response, if it times out retry */
ret = wait_for_completion_timeout(&accel_dev->vf.msg_received,
timeout);
if (ret) {
if (likely(resp))
*resp = accel_dev->vf.response;
/* Once copied, set to an invalid value */
accel_dev->vf.response.type = 0;
return 0;
}
dev_err(&GET_DEV(accel_dev), "PFVF response message timeout\n");
} while (--retries);
return -EIO;
}
static int adf_vf2pf_blkmsg_data_req(struct adf_accel_dev *accel_dev, bool crc,
u8 *type, u8 *data)
{
struct pfvf_message req = { 0 };
struct pfvf_message resp = { 0 };
u8 blk_type;
u8 blk_byte;
u8 msg_type;
u8 max_data;
int err;
/* Convert the block type to {small, medium, large} size category */
if (*type <= ADF_VF2PF_SMALL_BLOCK_TYPE_MAX) {
msg_type = ADF_VF2PF_MSGTYPE_SMALL_BLOCK_REQ;
blk_type = FIELD_PREP(ADF_VF2PF_SMALL_BLOCK_TYPE_MASK, *type);
blk_byte = FIELD_PREP(ADF_VF2PF_SMALL_BLOCK_BYTE_MASK, *data);
max_data = ADF_VF2PF_SMALL_BLOCK_BYTE_MAX;
} else if (*type <= ADF_VF2PF_MEDIUM_BLOCK_TYPE_MAX) {
msg_type = ADF_VF2PF_MSGTYPE_MEDIUM_BLOCK_REQ;
blk_type = FIELD_PREP(ADF_VF2PF_MEDIUM_BLOCK_TYPE_MASK,
*type - ADF_VF2PF_SMALL_BLOCK_TYPE_MAX);
blk_byte = FIELD_PREP(ADF_VF2PF_MEDIUM_BLOCK_BYTE_MASK, *data);
max_data = ADF_VF2PF_MEDIUM_BLOCK_BYTE_MAX;
} else if (*type <= ADF_VF2PF_LARGE_BLOCK_TYPE_MAX) {
msg_type = ADF_VF2PF_MSGTYPE_LARGE_BLOCK_REQ;
blk_type = FIELD_PREP(ADF_VF2PF_LARGE_BLOCK_TYPE_MASK,
*type - ADF_VF2PF_MEDIUM_BLOCK_TYPE_MAX);
blk_byte = FIELD_PREP(ADF_VF2PF_LARGE_BLOCK_BYTE_MASK, *data);
max_data = ADF_VF2PF_LARGE_BLOCK_BYTE_MAX;
} else {
dev_err(&GET_DEV(accel_dev), "Invalid message type %u\n", *type);
return -EINVAL;
}
/* Sanity check */
if (*data > max_data) {
dev_err(&GET_DEV(accel_dev),
"Invalid byte %s %u for message type %u\n",
crc ? "count" : "index", *data, *type);
return -EINVAL;
}
/* Build the block message */
req.type = msg_type;
req.data = blk_type | blk_byte | FIELD_PREP(ADF_VF2PF_BLOCK_CRC_REQ_MASK, crc);
err = adf_send_vf2pf_req(accel_dev, req, &resp);
if (err)
return err;
*type = FIELD_GET(ADF_PF2VF_BLKMSG_RESP_TYPE_MASK, resp.data);
*data = FIELD_GET(ADF_PF2VF_BLKMSG_RESP_DATA_MASK, resp.data);
return 0;
}
static int adf_vf2pf_blkmsg_get_byte(struct adf_accel_dev *accel_dev, u8 type,
u8 index, u8 *data)
{
int ret;
ret = adf_vf2pf_blkmsg_data_req(accel_dev, false, &type, &index);
if (ret < 0)
return ret;
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/completion.h`, `linux/minmax.h`, `linux/types.h`, `adf_accel_devices.h`, `adf_common_drv.h`, `adf_pfvf_msg.h`, `adf_pfvf_utils.h`.
- Detected declarations: `function adf_send_vf2pf_msg`, `function adf_recv_pf2vf_msg`, `function adf_send_vf2pf_req`, `function adf_vf2pf_blkmsg_data_req`, `function adf_vf2pf_blkmsg_get_byte`, `function adf_vf2pf_blkmsg_get_crc`, `function adf_send_vf2pf_blkmsg_req`, `function adf_handle_pf2vf_msg`, `function adf_recv_and_handle_pf2vf_msg`, `function adf_enable_vf2pf_comms`.
- Atlas domain: Driver Families / drivers/crypto.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.