drivers/net/ethernet/netronome/nfp/devlink_param.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/netronome/nfp/devlink_param.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/netronome/nfp/devlink_param.c- Extension
.c- Size
- 6701 bytes
- Lines
- 253
- Domain
- Driver Families
- Bucket
- drivers/net
- 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
net/devlink.hnfpcore/nfp.hnfpcore/nfp_nsp.hnfp_main.h
Detected Declarations
struct nfp_devlink_param_u8_argfunction nfp_devlink_param_u8_getfunction nfp_devlink_param_u8_setfunction nfp_devlink_param_u8_validatefunction nfp_devlink_supports_paramsfunction nfp_devlink_params_registerfunction nfp_devlink_params_unregister
Annotated Snippet
struct nfp_devlink_param_u8_arg {
const char *hwinfo_name;
const char *default_hi_val;
int invalid_dl_val;
u8 hi_to_dl[4];
u8 dl_to_hi[4];
u8 max_dl_val;
u8 max_hi_val;
};
static const struct nfp_devlink_param_u8_arg nfp_devlink_u8_args[] = {
[DEVLINK_PARAM_GENERIC_ID_FW_LOAD_POLICY] = {
.hwinfo_name = "app_fw_from_flash",
.default_hi_val = NFP_NSP_APP_FW_LOAD_DEFAULT,
.invalid_dl_val =
DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_UNKNOWN,
.hi_to_dl = {
[NFP_NSP_APP_FW_LOAD_DISK] =
DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_DISK,
[NFP_NSP_APP_FW_LOAD_FLASH] =
DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_FLASH,
[NFP_NSP_APP_FW_LOAD_PREF] =
DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_DRIVER,
},
.dl_to_hi = {
[DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_DRIVER] =
NFP_NSP_APP_FW_LOAD_PREF,
[DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_FLASH] =
NFP_NSP_APP_FW_LOAD_FLASH,
[DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_DISK] =
NFP_NSP_APP_FW_LOAD_DISK,
},
.max_dl_val = DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_DISK,
.max_hi_val = NFP_NSP_APP_FW_LOAD_PREF,
},
[DEVLINK_PARAM_GENERIC_ID_RESET_DEV_ON_DRV_PROBE] = {
.hwinfo_name = "abi_drv_reset",
.default_hi_val = NFP_NSP_DRV_RESET_DEFAULT,
.invalid_dl_val =
DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_UNKNOWN,
.hi_to_dl = {
[NFP_NSP_DRV_RESET_ALWAYS] =
DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_ALWAYS,
[NFP_NSP_DRV_RESET_NEVER] =
DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_NEVER,
[NFP_NSP_DRV_RESET_DISK] =
DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_DISK,
},
.dl_to_hi = {
[DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_ALWAYS] =
NFP_NSP_DRV_RESET_ALWAYS,
[DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_NEVER] =
NFP_NSP_DRV_RESET_NEVER,
[DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_DISK] =
NFP_NSP_DRV_RESET_DISK,
},
.max_dl_val = DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_DISK,
.max_hi_val = NFP_NSP_DRV_RESET_NEVER,
}
};
static int
nfp_devlink_param_u8_get(struct devlink *devlink, u32 id,
struct devlink_param_gset_ctx *ctx,
struct netlink_ext_ack *extack)
{
const struct nfp_devlink_param_u8_arg *arg;
struct nfp_pf *pf = devlink_priv(devlink);
struct nfp_nsp *nsp;
char hwinfo[32];
long value;
int err;
if (id >= ARRAY_SIZE(nfp_devlink_u8_args))
return -EOPNOTSUPP;
arg = &nfp_devlink_u8_args[id];
nsp = nfp_nsp_open(pf->cpp);
if (IS_ERR(nsp)) {
err = PTR_ERR(nsp);
nfp_warn(pf->cpp, "can't access NSP: %d\n", err);
return err;
}
snprintf(hwinfo, sizeof(hwinfo), arg->hwinfo_name);
err = nfp_nsp_hwinfo_lookup_optional(nsp, hwinfo, sizeof(hwinfo),
arg->default_hi_val);
if (err) {
nfp_warn(pf->cpp, "HWinfo lookup failed: %d\n", err);
Annotation
- Immediate include surface: `net/devlink.h`, `nfpcore/nfp.h`, `nfpcore/nfp_nsp.h`, `nfp_main.h`.
- Detected declarations: `struct nfp_devlink_param_u8_arg`, `function nfp_devlink_param_u8_get`, `function nfp_devlink_param_u8_set`, `function nfp_devlink_param_u8_validate`, `function nfp_devlink_supports_params`, `function nfp_devlink_params_register`, `function nfp_devlink_params_unregister`.
- Atlas domain: Driver Families / drivers/net.
- 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.