drivers/crypto/intel/qat/qat_common/qat_algs_send.c
Source file repositories/reference/linux-study-clean/drivers/crypto/intel/qat/qat_common/qat_algs_send.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/intel/qat/qat_common/qat_algs_send.c- Extension
.c- Size
- 2088 bytes
- Lines
- 92
- 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.
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
crypto/algapi.hadf_transport.hqat_algs_send.hqat_crypto.h
Detected Declarations
function qat_alg_send_message_retryfunction qat_alg_send_backlogfunction qat_alg_try_enqueuefunction qat_alg_send_message_maybacklogfunction qat_alg_send_message
Annotated Snippet
if (adf_send_message(req->tx_ring, req->fw_req)) {
/* The HW ring is full. Do nothing.
* qat_alg_send_backlog() will be invoked again by
* another callback.
*/
break;
}
list_del(&req->list);
crypto_request_complete(req->base, -EINPROGRESS);
}
spin_unlock_bh(&backlog->lock);
}
static bool qat_alg_try_enqueue(struct qat_alg_req *req)
{
struct qat_instance_backlog *backlog = req->backlog;
struct adf_etr_ring_data *tx_ring = req->tx_ring;
u32 *fw_req = req->fw_req;
/* Check if any request is already backlogged */
if (!list_empty(&backlog->list))
return false;
/* Check if ring is nearly full */
if (adf_ring_nearly_full(tx_ring))
return false;
/* Try to enqueue to HW ring */
if (adf_send_message(tx_ring, fw_req))
return false;
return true;
}
static int qat_alg_send_message_maybacklog(struct qat_alg_req *req)
{
struct qat_instance_backlog *backlog = req->backlog;
int ret = -EINPROGRESS;
if (qat_alg_try_enqueue(req))
return ret;
spin_lock_bh(&backlog->lock);
if (!qat_alg_try_enqueue(req)) {
list_add_tail(&req->list, &backlog->list);
ret = -EBUSY;
}
spin_unlock_bh(&backlog->lock);
return ret;
}
int qat_alg_send_message(struct qat_alg_req *req)
{
u32 flags = req->base->flags;
if (flags & CRYPTO_TFM_REQ_MAY_BACKLOG)
return qat_alg_send_message_maybacklog(req);
else
return qat_alg_send_message_retry(req);
}
Annotation
- Immediate include surface: `crypto/algapi.h`, `adf_transport.h`, `qat_algs_send.h`, `qat_crypto.h`.
- Detected declarations: `function qat_alg_send_message_retry`, `function qat_alg_send_backlog`, `function qat_alg_try_enqueue`, `function qat_alg_send_message_maybacklog`, `function qat_alg_send_message`.
- Atlas domain: Driver Families / drivers/crypto.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.