drivers/net/ethernet/netronome/nfp/nfpcore/nfp_rtsym.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_rtsym.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_rtsym.c- Extension
.c- Size
- 13252 bytes
- Lines
- 557
- 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.
- 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/kernel.hlinux/module.hlinux/slab.hlinux/io-64-nonatomic-hi-lo.hnfp.hnfp_cpp.hnfp_nffw.hnfp6000/nfp6000.h
Detected Declarations
struct nfp_rtsym_entrystruct nfp_rtsym_tablefunction nfp_meidfunction nfp_rtsym_sw_entry_initfunction __nfp_rtsym_table_readfunction nfp_rtsym_countfunction nfp_rtsym_getfunction nfp_rtsym_lookupfunction nfp_rtsym_sizefunction nfp_rtsym_to_destfunction __nfp_rtsym_readfunction nfp_rtsym_readfunction __nfp_rtsym_readlfunction nfp_rtsym_readlfunction __nfp_rtsym_readqfunction nfp_rtsym_readqfunction __nfp_rtsym_writefunction nfp_rtsym_writefunction __nfp_rtsym_writelfunction nfp_rtsym_writelfunction __nfp_rtsym_writeqfunction nfp_rtsym_writeqfunction nfp_rtsym_read_lefunction nfp_rtsym_write_lefunction nfp_rtsym_map
Annotated Snippet
struct nfp_rtsym_entry {
u8 type;
u8 target;
u8 island;
u8 addr_hi;
__le32 addr_lo;
__le16 name;
u8 menum;
u8 size_hi;
__le32 size_lo;
};
struct nfp_rtsym_table {
struct nfp_cpp *cpp;
int num;
char *strtab;
struct nfp_rtsym symtab[];
};
static int nfp_meid(u8 island_id, u8 menum)
{
return (island_id & 0x3F) == island_id && menum < 12 ?
(island_id << 4) | (menum + 4) : -1;
}
static void
nfp_rtsym_sw_entry_init(struct nfp_rtsym_table *cache, u32 strtab_size,
struct nfp_rtsym *sw, struct nfp_rtsym_entry *fw)
{
sw->type = fw->type;
sw->name = cache->strtab + le16_to_cpu(fw->name) % strtab_size;
sw->addr = ((u64)fw->addr_hi << 32) | le32_to_cpu(fw->addr_lo);
sw->size = ((u64)fw->size_hi << 32) | le32_to_cpu(fw->size_lo);
switch (fw->target) {
case SYM_TGT_LMEM:
sw->target = NFP_RTSYM_TARGET_LMEM;
break;
case SYM_TGT_EMU_CACHE:
sw->target = NFP_RTSYM_TARGET_EMU_CACHE;
break;
default:
sw->target = fw->target;
break;
}
if (fw->menum != 0xff)
sw->domain = nfp_meid(fw->island, fw->menum);
else if (fw->island != 0xff)
sw->domain = fw->island;
else
sw->domain = -1;
}
struct nfp_rtsym_table *nfp_rtsym_table_read(struct nfp_cpp *cpp)
{
struct nfp_rtsym_table *rtbl;
const struct nfp_mip *mip;
mip = nfp_mip_open(cpp);
rtbl = __nfp_rtsym_table_read(cpp, mip);
nfp_mip_close(mip);
return rtbl;
}
struct nfp_rtsym_table *
__nfp_rtsym_table_read(struct nfp_cpp *cpp, const struct nfp_mip *mip)
{
const u32 dram = NFP_CPP_ID(NFP_CPP_TARGET_MU, NFP_CPP_ACTION_RW, 0) |
NFP_ISL_EMEM0;
u32 strtab_addr, symtab_addr, strtab_size, symtab_size;
struct nfp_rtsym_entry *rtsymtab;
struct nfp_rtsym_table *cache;
int err, n, size;
if (!mip)
return NULL;
nfp_mip_strtab(mip, &strtab_addr, &strtab_size);
nfp_mip_symtab(mip, &symtab_addr, &symtab_size);
if (!symtab_size || !strtab_size || symtab_size % sizeof(*rtsymtab))
return NULL;
/* Align to 64 bits */
symtab_size = round_up(symtab_size, 8);
strtab_size = round_up(strtab_size, 8);
rtsymtab = kmalloc(symtab_size, GFP_KERNEL);
Annotation
- Immediate include surface: `linux/unaligned.h`, `linux/kernel.h`, `linux/module.h`, `linux/slab.h`, `linux/io-64-nonatomic-hi-lo.h`, `nfp.h`, `nfp_cpp.h`, `nfp_nffw.h`.
- Detected declarations: `struct nfp_rtsym_entry`, `struct nfp_rtsym_table`, `function nfp_meid`, `function nfp_rtsym_sw_entry_init`, `function __nfp_rtsym_table_read`, `function nfp_rtsym_count`, `function nfp_rtsym_get`, `function nfp_rtsym_lookup`, `function nfp_rtsym_size`, `function nfp_rtsym_to_dest`.
- 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.