drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c- Extension
.c- Size
- 56490 bytes
- Lines
- 2053
- 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/bitfield.hlinux/module.hlinux/pci.hlinux/firmware.hlinux/stddef.hlinux/debugfs.hrvu_struct.hrvu_reg.hrvu.hnpc.hcgx.hrvu_npc_fs.hrvu_npc_hash.h
Detected Declarations
function Copyrightfunction rvu_npc_lshift_keyfunction rvu_npc_toeplitz_hashfunction npc_field_hash_calcfunction npc_update_use_hashfunction npc_program_mkex_hash_rxfunction npc_program_mkex_hash_txfunction npc_config_secret_keyfunction npc_program_mkex_hashfunction npc_update_field_hashfunction rvu_mbox_handler_npc_get_field_hash_infofunction rvu_exact_prepare_mdatafunction rvu_exact_calculate_hashfunction rvu_npc_exact_alloc_mem_table_entryfunction rvu_npc_exact_free_idfunction rvu_npc_exact_alloc_idfunction rvu_npc_exact_alloc_cam_table_entryfunction rvu_exact_prepare_table_entryfunction rvu_exact_config_secret_keyfunction rvu_exact_config_search_keyfunction rvu_exact_config_result_ctrlfunction rvu_exact_config_table_maskfunction rvu_npc_exact_get_max_entriesfunction rvu_npc_exact_has_match_tablefunction __rvu_npc_exact_find_entry_by_seq_idfunction rvu_npc_exact_add_to_listfunction rvu_npc_exact_mem_table_writefunction rvu_npc_exact_cam_table_writefunction rvu_npc_exact_dealloc_table_entryfunction rvu_npc_exact_alloc_table_entryfunction rvu_npc_exact_save_drop_rule_chan_and_maskfunction rvu_npc_exact_calc_drop_rule_chan_and_maskfunction Debugfsfunction rvu_npc_exact_get_drop_rule_infofunction __rvu_npc_exact_cmd_rules_cnt_updatefunction rvu_npc_exact_del_table_entry_by_idfunction rvu_npc_exact_add_table_entryfunction rvu_npc_exact_update_table_entryfunction rvu_npc_exact_promisc_disablefunction rvu_npc_exact_promisc_enablefunction rvu_npc_exact_mac_addr_resetfunction rvu_npc_exact_mac_addr_updatefunction rvu_npc_exact_mac_addr_addfunction rvu_npc_exact_mac_addr_delfunction rvu_npc_exact_mac_addr_setfunction rvu_npc_exact_can_disable_featurefunction rvu_npc_exact_disable_featurefunction rvu_npc_exact_reset
Annotated Snippet
if (mkex_hash->lid_lt_ld_hash_en[intf][lid][lt][ld]) {
u64 cfg;
if (hash_cnt == NPC_MAX_HASH)
return;
cfg = npc_update_use_hash(rvu, blkaddr,
intf, lid, lt, ld);
/* Set updated KEX configuration */
SET_KEX_LD(intf, lid, lt, ld, cfg);
/* Set HASH configuration */
SET_KEX_LD_HASH(intf, ld,
mkex_hash->hash[intf][ld]);
SET_KEX_LD_HASH_MASK(intf, ld, 0,
mkex_hash->hash_mask[intf][ld][0]);
SET_KEX_LD_HASH_MASK(intf, ld, 1,
mkex_hash->hash_mask[intf][ld][1]);
SET_KEX_LD_HASH_CTRL(intf, ld,
mkex_hash->hash_ctrl[intf][ld]);
hash_cnt++;
}
}
}
}
}
static void npc_program_mkex_hash_tx(struct rvu *rvu, int blkaddr,
u8 intf)
{
struct npc_mcam_kex_hash *mkex_hash = rvu->kpu.mkex_hash;
int lid, lt, ld, hash_cnt = 0;
if (is_cn20k(rvu->pdev))
return;
if (is_npc_intf_rx(intf))
return;
/* Program HASH_CFG */
for (lid = 0; lid < NPC_MAX_LID; lid++) {
for (lt = 0; lt < NPC_MAX_LT; lt++) {
for (ld = 0; ld < NPC_MAX_LD; ld++)
if (mkex_hash->lid_lt_ld_hash_en[intf][lid][lt][ld]) {
u64 cfg;
if (hash_cnt == NPC_MAX_HASH)
return;
cfg = npc_update_use_hash(rvu, blkaddr,
intf, lid, lt, ld);
/* Set updated KEX configuration */
SET_KEX_LD(intf, lid, lt, ld, cfg);
/* Set HASH configuration */
SET_KEX_LD_HASH(intf, ld,
mkex_hash->hash[intf][ld]);
SET_KEX_LD_HASH_MASK(intf, ld, 0,
mkex_hash->hash_mask[intf][ld][0]);
SET_KEX_LD_HASH_MASK(intf, ld, 1,
mkex_hash->hash_mask[intf][ld][1]);
SET_KEX_LD_HASH_CTRL(intf, ld,
mkex_hash->hash_ctrl[intf][ld]);
hash_cnt++;
}
}
}
}
void npc_config_secret_key(struct rvu *rvu, int blkaddr)
{
struct hw_cap *hwcap = &rvu->hw->cap;
struct rvu_hwinfo *hw = rvu->hw;
u8 intf;
if (!hwcap->npc_hash_extract)
return;
for (intf = 0; intf < hw->npc_intfs; intf++) {
rvu_write64(rvu, blkaddr, NPC_AF_INTFX_SECRET_KEY0(intf),
RVU_NPC_HASH_SECRET_KEY0);
rvu_write64(rvu, blkaddr, NPC_AF_INTFX_SECRET_KEY1(intf),
RVU_NPC_HASH_SECRET_KEY1);
rvu_write64(rvu, blkaddr, NPC_AF_INTFX_SECRET_KEY2(intf),
RVU_NPC_HASH_SECRET_KEY2);
}
}
void npc_program_mkex_hash(struct rvu *rvu, int blkaddr)
{
struct npc_mcam_kex_hash *mh = rvu->kpu.mkex_hash;
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/module.h`, `linux/pci.h`, `linux/firmware.h`, `linux/stddef.h`, `linux/debugfs.h`, `rvu_struct.h`, `rvu_reg.h`.
- Detected declarations: `function Copyright`, `function rvu_npc_lshift_key`, `function rvu_npc_toeplitz_hash`, `function npc_field_hash_calc`, `function npc_update_use_hash`, `function npc_program_mkex_hash_rx`, `function npc_program_mkex_hash_tx`, `function npc_config_secret_key`, `function npc_program_mkex_hash`, `function npc_update_field_hash`.
- 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.