drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c- Extension
.c- Size
- 17372 bytes
- Lines
- 585
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/pci.hrvu.hcgx.hrvu_reg.h
Detected Declarations
function Copyrightfunction rvu_get_lmtst_tbl_indexfunction rvu_get_lmtaddrfunction rvu_update_lmtaddrfunction rvu_mbox_handler_lmtst_tbl_setupfunction pcifuncfunction rvu_reset_lmt_map_tblfunction rvu_set_channels_basefunction __rvu_lbk_set_chansfunction rvu_lbk_set_channelsfunction __rvu_nix_set_channelsfunction rvu_nix_set_channelsfunction __rvu_rpm_set_channelsfunction rvu_rpm_set_channelsfunction rvu_program_channelsfunction rvu_nix_block_cn10k_initfunction rvu_apr_block_cn10k_init
Annotated Snippet
if (err) {
dev_err(rvu->dev,
"Failed to read LMT map table: index 0x%x err %d\n",
pri_tbl_idx, err);
goto error;
}
/* Update the base lmt addr of secondary with primary's base
* lmt addr.
*/
err = rvu_update_lmtaddr(rvu, req->hdr.pcifunc, val);
if (err)
return err;
}
/* This mailbox can also be used to update word1 of APR_LMT_MAP_ENTRY_S
* like enabling scheduled LMTST, disable LMTLINE prefetch, disable
* early completion for ordered LMTST.
*/
if (req->sch_ena || req->dis_sched_early_comp || req->dis_line_pref) {
tbl_idx = rvu_get_lmtst_tbl_index(rvu, req->hdr.pcifunc);
err = lmtst_map_table_ops(rvu, tbl_idx + LMT_MAP_TBL_W1_OFF,
&val, LMT_TBL_OP_READ);
if (err) {
dev_err(rvu->dev,
"Failed to read LMT map table: index 0x%x err %d\n",
tbl_idx + LMT_MAP_TBL_W1_OFF, err);
goto error;
}
/* Storing lmt map table entry word1 default value as this needs
* to be reverted in FLR. Also making sure this default value
* doesn't get overwritten on multiple calls to this mailbox.
*/
if (!pfvf->lmt_map_ent_w1)
pfvf->lmt_map_ent_w1 = val;
/* Disable early completion for Ordered LMTSTs. */
if (req->dis_sched_early_comp)
val |= (req->dis_sched_early_comp <<
APR_LMT_MAP_ENT_DIS_SCH_CMP_SHIFT);
/* Enable scheduled LMTST */
if (req->sch_ena)
val |= (req->sch_ena << APR_LMT_MAP_ENT_SCH_ENA_SHIFT) |
req->ssow_pf_func;
/* Disables LMTLINE prefetch before receiving store data. */
if (req->dis_line_pref)
val |= (req->dis_line_pref <<
APR_LMT_MAP_ENT_DIS_LINE_PREF_SHIFT);
err = lmtst_map_table_ops(rvu, tbl_idx + LMT_MAP_TBL_W1_OFF,
&val, LMT_TBL_OP_WRITE);
if (err) {
dev_err(rvu->dev,
"Failed to update LMT map table: index 0x%x err %d\n",
tbl_idx + LMT_MAP_TBL_W1_OFF, err);
goto error;
}
}
error:
return err;
}
/* Resetting the lmtst map table to original base addresses */
void rvu_reset_lmt_map_tbl(struct rvu *rvu, u16 pcifunc)
{
struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc);
u32 tbl_idx;
int err;
if (is_rvu_otx2(rvu))
return;
if (pfvf->lmt_base_addr || pfvf->lmt_map_ent_w1) {
/* This corresponds to lmt map table index */
tbl_idx = rvu_get_lmtst_tbl_index(rvu, pcifunc);
/* Reverting back original lmt base addr for respective
* pcifunc.
*/
if (pfvf->lmt_base_addr) {
err = lmtst_map_table_ops(rvu, tbl_idx,
&pfvf->lmt_base_addr,
LMT_TBL_OP_WRITE);
if (err)
dev_err(rvu->dev,
"Failed to update LMT map table: index 0x%x err %d\n",
tbl_idx, err);
pfvf->lmt_base_addr = 0;
}
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/pci.h`, `rvu.h`, `cgx.h`, `rvu_reg.h`.
- Detected declarations: `function Copyright`, `function rvu_get_lmtst_tbl_index`, `function rvu_get_lmtaddr`, `function rvu_update_lmtaddr`, `function rvu_mbox_handler_lmtst_tbl_setup`, `function pcifunc`, `function rvu_reset_lmt_map_tbl`, `function rvu_set_channels_base`, `function __rvu_lbk_set_chans`, `function rvu_lbk_set_channels`.
- 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.