drivers/crypto/marvell/octeontx2/otx2_cpt_devlink.c
Source file repositories/reference/linux-study-clean/drivers/crypto/marvell/octeontx2/otx2_cpt_devlink.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/marvell/octeontx2/otx2_cpt_devlink.c- Extension
.c- Size
- 5100 bytes
- Lines
- 186
- 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
otx2_cpt_devlink.h
Detected Declarations
enum otx2_cpt_dl_param_idfunction otx2_cpt_dl_egrp_createfunction otx2_cpt_dl_egrp_deletefunction otx2_cpt_dl_uc_infofunction otx2_cpt_dl_t106_mode_getfunction otx2_cpt_dl_t106_mode_setfunction otx2_cpt_dl_info_firmware_version_putfunction otx2_cpt_devlink_info_getfunction otx2_cpt_register_dlfunction otx2_cpt_unregister_dl
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (C) 2021 Marvell. */
#include "otx2_cpt_devlink.h"
static int otx2_cpt_dl_egrp_create(struct devlink *dl, u32 id,
struct devlink_param_gset_ctx *ctx,
struct netlink_ext_ack *extack)
{
struct otx2_cpt_devlink *cpt_dl = devlink_priv(dl);
struct otx2_cptpf_dev *cptpf = cpt_dl->cptpf;
return otx2_cpt_dl_custom_egrp_create(cptpf, ctx);
}
static int otx2_cpt_dl_egrp_delete(struct devlink *dl, u32 id,
struct devlink_param_gset_ctx *ctx,
struct netlink_ext_ack *extack)
{
struct otx2_cpt_devlink *cpt_dl = devlink_priv(dl);
struct otx2_cptpf_dev *cptpf = cpt_dl->cptpf;
return otx2_cpt_dl_custom_egrp_delete(cptpf, ctx);
}
static int otx2_cpt_dl_uc_info(struct devlink *dl, u32 id,
struct devlink_param_gset_ctx *ctx,
struct netlink_ext_ack *extack)
{
ctx->val.vstr[0] = '\0';
return 0;
}
static int otx2_cpt_dl_t106_mode_get(struct devlink *dl, u32 id,
struct devlink_param_gset_ctx *ctx,
struct netlink_ext_ack *extack)
{
struct otx2_cpt_devlink *cpt_dl = devlink_priv(dl);
struct otx2_cptpf_dev *cptpf = cpt_dl->cptpf;
struct pci_dev *pdev = cptpf->pdev;
u64 reg_val = 0;
otx2_cpt_read_af_reg(&cptpf->afpf_mbox, pdev, CPT_AF_CTL, ®_val,
BLKADDR_CPT0);
ctx->val.vu8 = (reg_val >> 18) & 0x1;
return 0;
}
static int otx2_cpt_dl_t106_mode_set(struct devlink *dl, u32 id,
struct devlink_param_gset_ctx *ctx,
struct netlink_ext_ack *extack)
{
struct otx2_cpt_devlink *cpt_dl = devlink_priv(dl);
struct otx2_cptpf_dev *cptpf = cpt_dl->cptpf;
struct pci_dev *pdev = cptpf->pdev;
u64 reg_val = 0;
if (cptpf->enabled_vfs != 0 || cptpf->eng_grps.is_grps_created)
return -EPERM;
if (cpt_feature_sgv2(pdev)) {
otx2_cpt_read_af_reg(&cptpf->afpf_mbox, pdev, CPT_AF_CTL,
®_val, BLKADDR_CPT0);
reg_val &= ~(0x1ULL << 18);
reg_val |= ((u64)ctx->val.vu8 & 0x1) << 18;
return otx2_cpt_write_af_reg(&cptpf->afpf_mbox, pdev,
CPT_AF_CTL, reg_val, BLKADDR_CPT0);
}
return 0;
}
enum otx2_cpt_dl_param_id {
OTX2_CPT_DEVLINK_PARAM_ID_BASE = DEVLINK_PARAM_GENERIC_ID_MAX,
OTX2_CPT_DEVLINK_PARAM_ID_EGRP_CREATE,
OTX2_CPT_DEVLINK_PARAM_ID_EGRP_DELETE,
OTX2_CPT_DEVLINK_PARAM_ID_T106_MODE,
};
static const struct devlink_param otx2_cpt_dl_params[] = {
DEVLINK_PARAM_DRIVER(OTX2_CPT_DEVLINK_PARAM_ID_EGRP_CREATE,
"egrp_create", DEVLINK_PARAM_TYPE_STRING,
BIT(DEVLINK_PARAM_CMODE_RUNTIME),
otx2_cpt_dl_uc_info, otx2_cpt_dl_egrp_create,
NULL),
DEVLINK_PARAM_DRIVER(OTX2_CPT_DEVLINK_PARAM_ID_EGRP_DELETE,
"egrp_delete", DEVLINK_PARAM_TYPE_STRING,
BIT(DEVLINK_PARAM_CMODE_RUNTIME),
Annotation
- Immediate include surface: `otx2_cpt_devlink.h`.
- Detected declarations: `enum otx2_cpt_dl_param_id`, `function otx2_cpt_dl_egrp_create`, `function otx2_cpt_dl_egrp_delete`, `function otx2_cpt_dl_uc_info`, `function otx2_cpt_dl_t106_mode_get`, `function otx2_cpt_dl_t106_mode_set`, `function otx2_cpt_dl_info_firmware_version_put`, `function otx2_cpt_devlink_info_get`, `function otx2_cpt_register_dl`, `function otx2_cpt_unregister_dl`.
- 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.