drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cppcore.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cppcore.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cppcore.c- Extension
.c- Size
- 35182 bytes
- Lines
- 1500
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/unaligned.hlinux/delay.hlinux/device.hlinux/ioport.hlinux/kernel.hlinux/module.hlinux/mutex.hlinux/sched.hlinux/slab.hlinux/wait.hnfp_arm.hnfp_cpp.hnfp6000/nfp6000.h
Detected Declarations
struct nfp_cpp_resourcestruct nfp_cppstruct nfp_cpp_area_cachestruct nfp_cpp_areastruct nfp_cpp_explicitfunction __resource_addfunction list_for_eachfunction __resource_delfunction __release_cpp_areafunction nfp_cpp_area_putfunction nfp_cpp_freefunction nfp_cpp_modelfunction nfp_cpp_interfacefunction nfp_cpp_serialfunction nfp_cpp_set_mu_locality_lsbfunction nfp_cpp_mu_locality_lsbfunction nfp_cpp_area_alloc_with_namefunction nfp_cpp_area_allocfunction nfp_cpp_area_alloc_acquirefunction nfp_cpp_area_freefunction nfp_cpp_area_acquire_tryfunction __nfp_cpp_area_acquirefunction nfp_cpp_area_acquirefunction nfp_cpp_area_acquire_nonblockingfunction nfp_cpp_area_releasefunction nfp_cpp_area_release_freefunction nfp_cpp_area_readfunction nfp_cpp_area_writefunction nfp_cpp_area_sizefunction nfp_cpp_area_namefunction nfp_cpp_area_privfunction nfp_cpp_area_cppfunction nfp_cpp_area_resourcefunction nfp_cpp_area_physfunction nfp_cpp_area_iomemfunction nfp_cpp_area_readlfunction nfp_cpp_area_writelfunction nfp_cpp_area_readqfunction nfp_cpp_area_writeqfunction nfp_cpp_area_fillfunction nfp_cpp_area_cache_addfunction area_cache_getfunction round_downfunction area_cache_putfunction __nfp_cpp_readfunction nfp_cpp_readfunction __nfp_cpp_writefunction nfp_cpp_write
Annotated Snippet
struct nfp_cpp_resource {
struct list_head list;
const char *name;
u32 cpp_id;
u64 start;
u64 end;
};
/**
* struct nfp_cpp - main nfpcore device structure
* Following fields are read-only after probe() exits or netdevs are spawned.
* @dev: embedded device structure
* @op: low-level implementation ops
* @priv: private data of the low-level implementation
* @model: chip model
* @interface: chip interface id we are using to reach it
* @serial: chip serial number
* @imb_cat_table: CPP Mapping Table
* @mu_locality_lsb: MU access type bit offset
*
* Following fields use explicit locking:
* @resource_list: NFP CPP resource list
* @resource_lock: protects @resource_list
*
* @area_cache_list: cached areas for cpp/xpb read/write speed up
* @area_cache_mutex: protects @area_cache_list
*
* @waitq: area wait queue
*/
struct nfp_cpp {
struct device dev;
void *priv;
u32 model;
u16 interface;
u8 serial[NFP_SERIAL_LEN];
const struct nfp_cpp_operations *op;
struct list_head resource_list;
rwlock_t resource_lock;
wait_queue_head_t waitq;
u32 imb_cat_table[16];
unsigned int mu_locality_lsb;
struct mutex area_cache_mutex;
struct list_head area_cache_list;
};
/* Element of the area_cache_list */
struct nfp_cpp_area_cache {
struct list_head entry;
u32 id;
u64 addr;
u32 size;
struct nfp_cpp_area *area;
};
struct nfp_cpp_area {
struct nfp_cpp *cpp;
struct kref kref;
atomic_t refcount;
struct mutex mutex; /* Lock for the area's refcount */
unsigned long long offset;
unsigned long size;
struct nfp_cpp_resource resource;
void __iomem *iomem;
/* Here follows the 'priv' part of nfp_cpp_area. */
};
struct nfp_cpp_explicit {
struct nfp_cpp *cpp;
struct nfp_cpp_explicit_command cmd;
/* Here follows the 'priv' part of nfp_cpp_area. */
};
static void __resource_add(struct list_head *head, struct nfp_cpp_resource *res)
{
struct nfp_cpp_resource *tmp;
struct list_head *pos;
list_for_each(pos, head) {
tmp = container_of(pos, struct nfp_cpp_resource, list);
if (tmp->cpp_id > res->cpp_id)
break;
if (tmp->cpp_id == res->cpp_id && tmp->start > res->start)
break;
Annotation
- Immediate include surface: `linux/unaligned.h`, `linux/delay.h`, `linux/device.h`, `linux/ioport.h`, `linux/kernel.h`, `linux/module.h`, `linux/mutex.h`, `linux/sched.h`.
- Detected declarations: `struct nfp_cpp_resource`, `struct nfp_cpp`, `struct nfp_cpp_area_cache`, `struct nfp_cpp_area`, `struct nfp_cpp_explicit`, `function __resource_add`, `function list_for_each`, `function __resource_del`, `function __release_cpp_area`, `function nfp_cpp_area_put`.
- Atlas domain: Driver Families / drivers/net.
- 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.