drivers/crypto/cavium/cpt/cptvf_algs.c
Source file repositories/reference/linux-study-clean/drivers/crypto/cavium/cpt/cptvf_algs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/cavium/cpt/cptvf_algs.c- Extension
.c- Size
- 11973 bytes
- Lines
- 463
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
crypto/aes.hcrypto/algapi.hcrypto/authenc.hcrypto/internal/des.hcrypto/xts.hlinux/crypto.hlinux/err.hlinux/list.hlinux/scatterlist.hcptvf.hcptvf_algs.h
Detected Declarations
struct cpt_device_handlefunction cvm_callbackfunction update_input_ivfunction update_output_ivfunction update_input_datafunction update_output_datafunction create_ctx_hdrfunction create_input_listfunction store_cb_infofunction create_output_listfunction cvm_enc_decfunction cvm_encryptfunction cvm_decryptfunction cvm_xts_setkeyfunction cvm_validate_keylenfunction cvm_setkeyfunction cvm_cbc_aes_setkeyfunction cvm_ecb_aes_setkeyfunction cvm_cbc_des3_setkeyfunction cvm_ecb_des3_setkeyfunction cvm_enc_dec_initfunction cav_register_algsfunction cav_unregister_algsfunction cvm_crypto_initfunction cvm_crypto_exit
Annotated Snippet
struct cpt_device_handle {
void *cdev[MAX_DEVICES];
u32 dev_count;
};
static struct cpt_device_handle dev_handle;
static void cvm_callback(u32 status, void *arg)
{
struct crypto_async_request *req = (struct crypto_async_request *)arg;
crypto_request_complete(req, !status);
}
static inline void update_input_iv(struct cpt_request_info *req_info,
u8 *iv, u32 enc_iv_len,
u32 *argcnt)
{
/* Setting the iv information */
req_info->in[*argcnt].vptr = (void *)iv;
req_info->in[*argcnt].size = enc_iv_len;
req_info->req.dlen += enc_iv_len;
++(*argcnt);
}
static inline void update_output_iv(struct cpt_request_info *req_info,
u8 *iv, u32 enc_iv_len,
u32 *argcnt)
{
/* Setting the iv information */
req_info->out[*argcnt].vptr = (void *)iv;
req_info->out[*argcnt].size = enc_iv_len;
req_info->rlen += enc_iv_len;
++(*argcnt);
}
static inline void update_input_data(struct cpt_request_info *req_info,
struct scatterlist *inp_sg,
u32 nbytes, u32 *argcnt)
{
req_info->req.dlen += nbytes;
while (nbytes) {
u32 len = min(nbytes, inp_sg->length);
u8 *ptr = sg_virt(inp_sg);
req_info->in[*argcnt].vptr = (void *)ptr;
req_info->in[*argcnt].size = len;
nbytes -= len;
++(*argcnt);
++inp_sg;
}
}
static inline void update_output_data(struct cpt_request_info *req_info,
struct scatterlist *outp_sg,
u32 nbytes, u32 *argcnt)
{
req_info->rlen += nbytes;
while (nbytes) {
u32 len = min(nbytes, outp_sg->length);
u8 *ptr = sg_virt(outp_sg);
req_info->out[*argcnt].vptr = (void *)ptr;
req_info->out[*argcnt].size = len;
nbytes -= len;
++(*argcnt);
++outp_sg;
}
}
static inline u32 create_ctx_hdr(struct skcipher_request *req, u32 enc,
u32 *argcnt)
{
struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
struct cvm_enc_ctx *ctx = crypto_skcipher_ctx(tfm);
struct cvm_req_ctx *rctx = skcipher_request_ctx_dma(req);
struct fc_context *fctx = &rctx->fctx;
u32 enc_iv_len = crypto_skcipher_ivsize(tfm);
struct cpt_request_info *req_info = &rctx->cpt_req;
__be64 *ctrl_flags = NULL;
__be64 *offset_control;
req_info->ctrl.s.grp = 0;
req_info->ctrl.s.dma_mode = DMA_GATHER_SCATTER;
req_info->ctrl.s.se_req = SE_CORE_REQ;
Annotation
- Immediate include surface: `crypto/aes.h`, `crypto/algapi.h`, `crypto/authenc.h`, `crypto/internal/des.h`, `crypto/xts.h`, `linux/crypto.h`, `linux/err.h`, `linux/list.h`.
- Detected declarations: `struct cpt_device_handle`, `function cvm_callback`, `function update_input_iv`, `function update_output_iv`, `function update_input_data`, `function update_output_data`, `function create_ctx_hdr`, `function create_input_list`, `function store_cb_info`, `function create_output_list`.
- Atlas domain: Driver Families / drivers/crypto.
- Implementation status: source 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.