drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c- Extension
.c- Size
- 183778 bytes
- Lines
- 6688
- 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/module.hlinux/pci.hrvu_struct.hrvu_reg.hrvu.hnpc.hmcs.hcgx.hlmac_common.hrvu_npc_hash.hcn20k/npc.h
Detected Declarations
struct mceenum mc_tbl_szenum mc_buf_cntenum nix_makr_fmt_indexesfunction rvu_get_next_nix_blkaddrfunction is_nixlf_attachedfunction rvu_get_nixlf_countfunction nix_get_nixlffunction nix_get_struct_ptrsfunction nix_mce_list_initfunction nix_alloc_mce_listfunction nix_free_mce_listfunction nix_get_dwrr_mtu_regfunction convert_dwrr_mtu_to_bytesfunction convert_bytes_to_dwrr_mtufunction nix_rx_syncfunction is_valid_txschqfunction nix_interface_initfunction nix_interface_deinitfunction nix_setup_bpidsfunction rvu_nix_flr_free_bpidsfunction nix_get_channelfunction nix_bp_disablefunction rvu_mbox_handler_nix_bp_disablefunction rvu_mbox_handler_nix_cpt_bp_disablefunction rvu_nix_get_bpidfunction tofunction nix_bp_enablefunction rvu_mbox_handler_nix_bp_enablefunction rvu_mbox_handler_nix_cpt_bp_enablefunction nix_setup_lso_tso_l3function nix_setup_lso_tso_l4function nix_setup_lsofunction nix_ctx_freefunction nixlf_rss_ctx_initfunction nix_aq_enqueue_waitfunction nix_get_aq_req_smqfunction rvu_nix_blk_aq_enq_instfunction rvu_nix_verify_aq_ctxfunction rvu_nix_aq_enq_instfunction nix_lf_hwctx_disablefunction nix_lf_hwctx_lockdownfunction rvu_mbox_handler_nix_aq_enqfunction rvu_mbox_handler_nix_aq_enqfunction rvu_mbox_handler_nix_cn10k_aq_enqfunction rvu_mbox_handler_nix_hwctx_disablefunction rvu_mbox_handler_nix_lf_allocfunction rvu_mbox_handler_nix_lf_free
Annotated Snippet
struct mce {
struct hlist_node node;
u32 rq_rss_index;
u16 pcifunc;
u16 channel;
u8 dest_type;
u8 is_active;
u8 reserved[2];
};
int rvu_get_next_nix_blkaddr(struct rvu *rvu, int blkaddr)
{
int i = 0;
/*If blkaddr is 0, return the first nix block address*/
if (blkaddr == 0)
return rvu->nix_blkaddr[blkaddr];
while (i + 1 < MAX_NIX_BLKS) {
if (rvu->nix_blkaddr[i] == blkaddr)
return rvu->nix_blkaddr[i + 1];
i++;
}
return 0;
}
bool is_nixlf_attached(struct rvu *rvu, u16 pcifunc)
{
struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc);
int blkaddr;
blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc);
if (!pfvf->nixlf || blkaddr < 0)
return false;
return true;
}
int rvu_get_nixlf_count(struct rvu *rvu)
{
int blkaddr = 0, max = 0;
struct rvu_block *block;
blkaddr = rvu_get_next_nix_blkaddr(rvu, blkaddr);
while (blkaddr) {
block = &rvu->hw->block[blkaddr];
max += block->lf.max;
blkaddr = rvu_get_next_nix_blkaddr(rvu, blkaddr);
}
return max;
}
int nix_get_nixlf(struct rvu *rvu, u16 pcifunc, int *nixlf, int *nix_blkaddr)
{
struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc);
struct rvu_hwinfo *hw = rvu->hw;
int blkaddr;
blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc);
if (!pfvf->nixlf || blkaddr < 0)
return NIX_AF_ERR_AF_LF_INVALID;
*nixlf = rvu_get_lf(rvu, &hw->block[blkaddr], pcifunc, 0);
if (*nixlf < 0)
return NIX_AF_ERR_AF_LF_INVALID;
if (nix_blkaddr)
*nix_blkaddr = blkaddr;
return 0;
}
int nix_get_struct_ptrs(struct rvu *rvu, u16 pcifunc,
struct nix_hw **nix_hw, int *blkaddr)
{
struct rvu_pfvf *pfvf;
pfvf = rvu_get_pfvf(rvu, pcifunc);
*blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc);
if (!pfvf->nixlf || *blkaddr < 0)
return NIX_AF_ERR_AF_LF_INVALID;
*nix_hw = get_nix_hw(rvu->hw, *blkaddr);
if (!*nix_hw)
return NIX_AF_ERR_INVALID_NIXBLK;
return 0;
}
static void nix_mce_list_init(struct nix_mce_list *list, int max)
{
Annotation
- Immediate include surface: `linux/module.h`, `linux/pci.h`, `rvu_struct.h`, `rvu_reg.h`, `rvu.h`, `npc.h`, `mcs.h`, `cgx.h`.
- Detected declarations: `struct mce`, `enum mc_tbl_sz`, `enum mc_buf_cnt`, `enum nix_makr_fmt_indexes`, `function rvu_get_next_nix_blkaddr`, `function is_nixlf_attached`, `function rvu_get_nixlf_count`, `function nix_get_nixlf`, `function nix_get_struct_ptrs`, `function nix_mce_list_init`.
- 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.