drivers/net/wireless/realtek/rtlwifi/cam.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/realtek/rtlwifi/cam.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/realtek/rtlwifi/cam.c- Extension
.c- Size
- 8871 bytes
- Lines
- 322
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
wifi.hcam.hlinux/export.h
Detected Declarations
function rtl_cam_reset_sec_infofunction rtl_cam_program_entryfunction rtl_cam_add_one_entryfunction rtl_cam_delete_one_entryfunction rtl_cam_reset_all_entryfunction rtl_cam_mark_invalidfunction rtl_cam_empty_entryfunction rtl_cam_get_free_entryfunction rtl_cam_del_entryexport rtl_cam_add_one_entryexport rtl_cam_delete_one_entryexport rtl_cam_reset_all_entryexport rtl_cam_mark_invalidexport rtl_cam_empty_entryexport rtl_cam_get_free_entryexport rtl_cam_del_entry
Annotated Snippet
if (entry_i == 0) {
target_content = (u32) (*(mac_addr + 0)) << 16 |
(u32) (*(mac_addr + 1)) << 24 | (u32) us_config;
rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[WCAMI],
target_content);
rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM],
target_command);
rtl_dbg(rtlpriv, COMP_SEC, DBG_LOUD,
"WRITE %x: %x\n",
rtlpriv->cfg->maps[WCAMI], target_content);
rtl_dbg(rtlpriv, COMP_SEC, DBG_LOUD,
"The Key ID is %d\n", entry_no);
rtl_dbg(rtlpriv, COMP_SEC, DBG_LOUD,
"WRITE %x: %x\n",
rtlpriv->cfg->maps[RWCAM], target_command);
} else if (entry_i == 1) {
target_content = (u32) (*(mac_addr + 5)) << 24 |
(u32) (*(mac_addr + 4)) << 16 |
(u32) (*(mac_addr + 3)) << 8 |
(u32) (*(mac_addr + 2));
rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[WCAMI],
target_content);
rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM],
target_command);
rtl_dbg(rtlpriv, COMP_SEC, DBG_LOUD,
"WRITE A4: %x\n", target_content);
rtl_dbg(rtlpriv, COMP_SEC, DBG_LOUD,
"WRITE A0: %x\n", target_command);
} else {
target_content =
(u32) (*(key_cont_128 + (entry_i * 4 - 8) + 3)) <<
24 | (u32) (*(key_cont_128 + (entry_i * 4 - 8) + 2))
<< 16 |
(u32) (*(key_cont_128 + (entry_i * 4 - 8) + 1)) << 8
| (u32) (*(key_cont_128 + (entry_i * 4 - 8) + 0));
rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[WCAMI],
target_content);
rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[RWCAM],
target_command);
rtl_dbg(rtlpriv, COMP_SEC, DBG_LOUD,
"WRITE A4: %x\n", target_content);
rtl_dbg(rtlpriv, COMP_SEC, DBG_LOUD,
"WRITE A0: %x\n", target_command);
}
}
rtl_dbg(rtlpriv, COMP_SEC, DBG_LOUD,
"after set key, usconfig:%x\n", us_config);
}
u8 rtl_cam_add_one_entry(struct ieee80211_hw *hw, const u8 *mac_addr,
u32 ul_key_id, u32 ul_entry_idx, u32 ul_enc_alg,
u32 ul_default_key, u8 *key_content)
{
u32 us_config;
struct rtl_priv *rtlpriv = rtl_priv(hw);
rtl_dbg(rtlpriv, COMP_SEC, DBG_DMESG,
"EntryNo:%x, ulKeyId=%x, ulEncAlg=%x, ulUseDK=%x MacAddr %pM\n",
ul_entry_idx, ul_key_id, ul_enc_alg,
ul_default_key, mac_addr);
if (ul_key_id == TOTAL_CAM_ENTRY) {
rtl_dbg(rtlpriv, COMP_ERR, DBG_WARNING,
"ulKeyId exceed!\n");
return 0;
}
if (ul_default_key == 1)
us_config = CFG_VALID | ((u16) (ul_enc_alg) << 2);
else
us_config = CFG_VALID | ((ul_enc_alg) << 2) | ul_key_id;
rtl_cam_program_entry(hw, ul_entry_idx, mac_addr,
(u8 *)key_content, us_config);
rtl_dbg(rtlpriv, COMP_SEC, DBG_DMESG, "end\n");
return 1;
Annotation
- Immediate include surface: `wifi.h`, `cam.h`, `linux/export.h`.
- Detected declarations: `function rtl_cam_reset_sec_info`, `function rtl_cam_program_entry`, `function rtl_cam_add_one_entry`, `function rtl_cam_delete_one_entry`, `function rtl_cam_reset_all_entry`, `function rtl_cam_mark_invalid`, `function rtl_cam_empty_entry`, `function rtl_cam_get_free_entry`, `function rtl_cam_del_entry`, `export rtl_cam_add_one_entry`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration 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.