drivers/net/ethernet/netronome/nfp/nfp_net_ctrl.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/netronome/nfp/nfp_net_ctrl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/netronome/nfp/nfp_net_ctrl.c- Extension
.c- Size
- 4312 bytes
- Lines
- 171
- 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
linux/bitfield.hlinux/device.hlinux/kernel.hlinux/types.hnfp_net_ctrl.hnfp_net.h
Detected Declarations
function nfp_net_tlv_caps_resetfunction nfp_net_tls_parse_crypto_opsfunction nfp_net_tlv_caps_parse
Annotated Snippet
if (length % NFP_NET_CFG_TLV_LENGTH_INC) {
dev_err(dev, "TLV size not multiple of %u offset:%u len:%u\n",
NFP_NET_CFG_TLV_LENGTH_INC, offset, length);
return -EINVAL;
}
if (data + length > end) {
dev_err(dev, "oversized TLV offset:%u len:%u\n",
offset, length);
return -EINVAL;
}
switch (FIELD_GET(NFP_NET_CFG_TLV_HEADER_TYPE, hdr)) {
case NFP_NET_CFG_TLV_TYPE_UNKNOWN:
dev_err(dev, "NULL TLV at offset:%u\n", offset);
return -EINVAL;
case NFP_NET_CFG_TLV_TYPE_RESERVED:
break;
case NFP_NET_CFG_TLV_TYPE_END:
if (!length)
return 0;
dev_err(dev, "END TLV should be empty, has offset:%u len:%d\n",
offset, length);
return -EINVAL;
case NFP_NET_CFG_TLV_TYPE_ME_FREQ:
if (length != 4) {
dev_err(dev,
"ME FREQ TLV should be 4B, is %dB offset:%u\n",
length, offset);
return -EINVAL;
}
caps->me_freq_mhz = readl(data);
break;
case NFP_NET_CFG_TLV_TYPE_MBOX:
if (!length) {
caps->mbox_off = 0;
caps->mbox_len = 0;
} else {
caps->mbox_off = data - ctrl_mem;
caps->mbox_len = length;
}
break;
case NFP_NET_CFG_TLV_TYPE_EXPERIMENTAL0:
case NFP_NET_CFG_TLV_TYPE_EXPERIMENTAL1:
dev_warn(dev,
"experimental TLV type:%u offset:%u len:%u\n",
FIELD_GET(NFP_NET_CFG_TLV_HEADER_TYPE, hdr),
offset, length);
break;
case NFP_NET_CFG_TLV_TYPE_REPR_CAP:
if (length < 4) {
dev_err(dev, "REPR CAP TLV short %dB < 4B offset:%u\n",
length, offset);
return -EINVAL;
}
caps->repr_cap = readl(data);
break;
case NFP_NET_CFG_TLV_TYPE_MBOX_CMSG_TYPES:
if (length >= 4)
caps->mbox_cmsg_types = readl(data);
break;
case NFP_NET_CFG_TLV_TYPE_CRYPTO_OPS:
if (!nfp_net_tls_parse_crypto_ops(dev, caps, ctrl_mem,
data, length, offset,
false))
return -EINVAL;
break;
case NFP_NET_CFG_TLV_TYPE_VNIC_STATS:
if ((data - ctrl_mem) % 8) {
dev_warn(dev, "VNIC STATS TLV misaligned, ignoring offset:%u len:%u\n",
offset, length);
break;
}
caps->vnic_stats_off = data - ctrl_mem;
caps->vnic_stats_cnt = length / 10;
break;
case NFP_NET_CFG_TLV_TYPE_CRYPTO_OPS_RX_SCAN:
if (!nfp_net_tls_parse_crypto_ops(dev, caps, ctrl_mem,
data, length, offset,
true))
return -EINVAL;
break;
default:
if (!FIELD_GET(NFP_NET_CFG_TLV_HEADER_REQUIRED, hdr))
break;
dev_err(dev, "unknown TLV type:%u offset:%u len:%u\n",
FIELD_GET(NFP_NET_CFG_TLV_HEADER_TYPE, hdr),
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/device.h`, `linux/kernel.h`, `linux/types.h`, `nfp_net_ctrl.h`, `nfp_net.h`.
- Detected declarations: `function nfp_net_tlv_caps_reset`, `function nfp_net_tls_parse_crypto_ops`, `function nfp_net_tlv_caps_parse`.
- 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.